Lines Matching refs:buffer
255 static void drm_client_buffer_delete(struct drm_client_buffer *buffer) in drm_client_buffer_delete() argument
257 struct drm_device *dev = buffer->client->dev; in drm_client_buffer_delete()
259 drm_gem_vunmap(buffer->gem, &buffer->map); in drm_client_buffer_delete()
261 if (buffer->gem) in drm_client_buffer_delete()
262 drm_gem_object_put(buffer->gem); in drm_client_buffer_delete()
264 if (buffer->handle) in drm_client_buffer_delete()
265 drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file); in drm_client_buffer_delete()
267 kfree(buffer); in drm_client_buffer_delete()
276 struct drm_client_buffer *buffer; in drm_client_buffer_create() local
280 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); in drm_client_buffer_create()
281 if (!buffer) in drm_client_buffer_create()
284 buffer->client = client; in drm_client_buffer_create()
293 buffer->handle = dumb_args.handle; in drm_client_buffer_create()
294 buffer->pitch = dumb_args.pitch; in drm_client_buffer_create()
302 buffer->gem = obj; in drm_client_buffer_create()
304 return buffer; in drm_client_buffer_create()
307 drm_client_buffer_delete(buffer); in drm_client_buffer_create()
333 drm_client_buffer_vmap(struct drm_client_buffer *buffer, in drm_client_buffer_vmap() argument
336 struct iosys_map *map = &buffer->map; in drm_client_buffer_vmap()
347 ret = drm_gem_vmap(buffer->gem, map); in drm_client_buffer_vmap()
365 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer) in drm_client_buffer_vunmap() argument
367 struct iosys_map *map = &buffer->map; in drm_client_buffer_vunmap()
369 drm_gem_vunmap(buffer->gem, map); in drm_client_buffer_vunmap()
373 static void drm_client_buffer_rmfb(struct drm_client_buffer *buffer) in drm_client_buffer_rmfb() argument
377 if (!buffer->fb) in drm_client_buffer_rmfb()
380 ret = drm_mode_rmfb(buffer->client->dev, buffer->fb->base.id, buffer->client->file); in drm_client_buffer_rmfb()
382 drm_err(buffer->client->dev, in drm_client_buffer_rmfb()
383 "Error removing FB:%u (%d)\n", buffer->fb->base.id, ret); in drm_client_buffer_rmfb()
385 buffer->fb = NULL; in drm_client_buffer_rmfb()
388 static int drm_client_buffer_addfb(struct drm_client_buffer *buffer, in drm_client_buffer_addfb() argument
391 struct drm_client_dev *client = buffer->client; in drm_client_buffer_addfb()
401 fb_req.handle = buffer->handle; in drm_client_buffer_addfb()
402 fb_req.pitch = buffer->pitch; in drm_client_buffer_addfb()
408 buffer->fb = drm_framebuffer_lookup(client->dev, buffer->client->file, fb_req.fb_id); in drm_client_buffer_addfb()
409 if (WARN_ON(!buffer->fb)) in drm_client_buffer_addfb()
413 drm_framebuffer_put(buffer->fb); in drm_client_buffer_addfb()
415 strscpy(buffer->fb->comm, client->name, TASK_COMM_LEN); in drm_client_buffer_addfb()
437 struct drm_client_buffer *buffer; in drm_client_framebuffer_create() local
440 buffer = drm_client_buffer_create(client, width, height, format); in drm_client_framebuffer_create()
441 if (IS_ERR(buffer)) in drm_client_framebuffer_create()
442 return buffer; in drm_client_framebuffer_create()
444 ret = drm_client_buffer_addfb(buffer, width, height, format); in drm_client_framebuffer_create()
446 drm_client_buffer_delete(buffer); in drm_client_framebuffer_create()
450 return buffer; in drm_client_framebuffer_create()
458 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer) in drm_client_framebuffer_delete() argument
460 if (!buffer) in drm_client_framebuffer_delete()
463 drm_client_buffer_rmfb(buffer); in drm_client_framebuffer_delete()
464 drm_client_buffer_delete(buffer); in drm_client_framebuffer_delete()
479 int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect) in drm_client_framebuffer_flush() argument
481 if (!buffer || !buffer->fb || !buffer->fb->funcs->dirty) in drm_client_framebuffer_flush()
492 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()
496 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()