Lines Matching refs:buffer
265 static void drm_client_buffer_delete(struct drm_client_buffer *buffer) in drm_client_buffer_delete() argument
267 if (buffer->gem) { in drm_client_buffer_delete()
268 drm_gem_vunmap_unlocked(buffer->gem, &buffer->map); in drm_client_buffer_delete()
269 drm_gem_object_put(buffer->gem); in drm_client_buffer_delete()
272 kfree(buffer); in drm_client_buffer_delete()
282 struct drm_client_buffer *buffer; in drm_client_buffer_create() local
286 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); in drm_client_buffer_create()
287 if (!buffer) in drm_client_buffer_create()
290 buffer->client = client; in drm_client_buffer_create()
305 buffer->pitch = dumb_args.pitch; in drm_client_buffer_create()
306 buffer->gem = obj; in drm_client_buffer_create()
309 return buffer; in drm_client_buffer_create()
312 drm_client_buffer_delete(buffer); in drm_client_buffer_create()
338 drm_client_buffer_vmap(struct drm_client_buffer *buffer, in drm_client_buffer_vmap() argument
341 struct iosys_map *map = &buffer->map; in drm_client_buffer_vmap()
352 ret = drm_gem_vmap_unlocked(buffer->gem, map); in drm_client_buffer_vmap()
370 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer) in drm_client_buffer_vunmap() argument
372 struct iosys_map *map = &buffer->map; in drm_client_buffer_vunmap()
374 drm_gem_vunmap_unlocked(buffer->gem, map); in drm_client_buffer_vunmap()
378 static void drm_client_buffer_rmfb(struct drm_client_buffer *buffer) in drm_client_buffer_rmfb() argument
382 if (!buffer->fb) in drm_client_buffer_rmfb()
385 ret = drm_mode_rmfb(buffer->client->dev, buffer->fb->base.id, buffer->client->file); in drm_client_buffer_rmfb()
387 drm_err(buffer->client->dev, in drm_client_buffer_rmfb()
388 "Error removing FB:%u (%d)\n", buffer->fb->base.id, ret); in drm_client_buffer_rmfb()
390 buffer->fb = NULL; in drm_client_buffer_rmfb()
393 static int drm_client_buffer_addfb(struct drm_client_buffer *buffer, in drm_client_buffer_addfb() argument
397 struct drm_client_dev *client = buffer->client; in drm_client_buffer_addfb()
408 fb_req.pitch = buffer->pitch; in drm_client_buffer_addfb()
414 buffer->fb = drm_framebuffer_lookup(client->dev, buffer->client->file, fb_req.fb_id); in drm_client_buffer_addfb()
415 if (WARN_ON(!buffer->fb)) in drm_client_buffer_addfb()
419 drm_framebuffer_put(buffer->fb); in drm_client_buffer_addfb()
421 strscpy(buffer->fb->comm, client->name, TASK_COMM_LEN); in drm_client_buffer_addfb()
443 struct drm_client_buffer *buffer; in drm_client_framebuffer_create() local
447 buffer = drm_client_buffer_create(client, width, height, format, in drm_client_framebuffer_create()
449 if (IS_ERR(buffer)) in drm_client_framebuffer_create()
450 return buffer; in drm_client_framebuffer_create()
452 ret = drm_client_buffer_addfb(buffer, width, height, format, handle); in drm_client_framebuffer_create()
463 drm_client_buffer_delete(buffer); in drm_client_framebuffer_create()
467 return buffer; in drm_client_framebuffer_create()
475 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer) in drm_client_framebuffer_delete() argument
477 if (!buffer) in drm_client_framebuffer_delete()
480 drm_client_buffer_rmfb(buffer); in drm_client_framebuffer_delete()
481 drm_client_buffer_delete(buffer); in drm_client_framebuffer_delete()
496 int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect) in drm_client_framebuffer_flush() argument
498 if (!buffer || !buffer->fb || !buffer->fb->funcs->dirty) in drm_client_framebuffer_flush()
509 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()
513 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()