drm_client.c (eceb995e04b74204c73f9dd0ccb19061d5082063) drm_client.c (24c478ead0bf50a758e9dbecc7356e9eebf20271)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2018 Noralf Trønnes
4 */
5
6#include <linux/list.h>
7#include <linux/module.h>
8#include <linux/mutex.h>

--- 229 unchanged lines hidden (view full) ---

238 drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
239
240 kfree(buffer);
241}
242
243static struct drm_client_buffer *
244drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format)
245{
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2018 Noralf Trønnes
4 */
5
6#include <linux/list.h>
7#include <linux/module.h>
8#include <linux/mutex.h>

--- 229 unchanged lines hidden (view full) ---

238 drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
239
240 kfree(buffer);
241}
242
243static struct drm_client_buffer *
244drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format)
245{
246 const struct drm_format_info *info = drm_format_info(format);
246 struct drm_mode_create_dumb dumb_args = { };
247 struct drm_device *dev = client->dev;
248 struct drm_client_buffer *buffer;
249 struct drm_gem_object *obj;
250 void *vaddr;
251 int ret;
252
253 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
254 if (!buffer)
255 return ERR_PTR(-ENOMEM);
256
257 buffer->client = client;
258
259 dumb_args.width = width;
260 dumb_args.height = height;
247 struct drm_mode_create_dumb dumb_args = { };
248 struct drm_device *dev = client->dev;
249 struct drm_client_buffer *buffer;
250 struct drm_gem_object *obj;
251 void *vaddr;
252 int ret;
253
254 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
255 if (!buffer)
256 return ERR_PTR(-ENOMEM);
257
258 buffer->client = client;
259
260 dumb_args.width = width;
261 dumb_args.height = height;
261 dumb_args.bpp = drm_format_plane_cpp(format, 0) * 8;
262 dumb_args.bpp = drm_format_info_plane_cpp(info, 0) * 8;
262 ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
263 if (ret)
264 goto err_delete;
265
266 buffer->handle = dumb_args.handle;
267 buffer->pitch = dumb_args.pitch;
268
269 obj = drm_gem_object_lookup(client->file, dumb_args.handle);

--- 153 unchanged lines hidden ---
263 ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
264 if (ret)
265 goto err_delete;
266
267 buffer->handle = dumb_args.handle;
268 buffer->pitch = dumb_args.pitch;
269
270 obj = drm_gem_object_lookup(client->file, dumb_args.handle);

--- 153 unchanged lines hidden ---