Lines Matching full:buffer

32  * GEM drivers which provide a GEM based dumb buffer with a virtual address are supported.
144 * is fbdev which cannot free the buffer if userspace has open file descriptors.
234 static void drm_client_buffer_delete(struct drm_client_buffer *buffer) in drm_client_buffer_delete() argument
236 struct drm_device *dev = buffer->client->dev; in drm_client_buffer_delete()
238 drm_gem_vunmap(buffer->gem, &buffer->map); in drm_client_buffer_delete()
240 if (buffer->gem) in drm_client_buffer_delete()
241 drm_gem_object_put(buffer->gem); in drm_client_buffer_delete()
243 if (buffer->handle) in drm_client_buffer_delete()
244 drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file); in drm_client_buffer_delete()
246 kfree(buffer); in drm_client_buffer_delete()
255 struct drm_client_buffer *buffer; in drm_client_buffer_create() local
259 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); in drm_client_buffer_create()
260 if (!buffer) in drm_client_buffer_create()
263 buffer->client = client; in drm_client_buffer_create()
272 buffer->handle = dumb_args.handle; in drm_client_buffer_create()
273 buffer->pitch = dumb_args.pitch; in drm_client_buffer_create()
281 buffer->gem = obj; in drm_client_buffer_create()
283 return buffer; in drm_client_buffer_create()
286 drm_client_buffer_delete(buffer); in drm_client_buffer_create()
292 * drm_client_buffer_vmap - Map DRM client buffer into address space
293 * @buffer: DRM client buffer
296 * This function maps a client buffer into kernel address space. If the
297 * buffer is already mapped, it returns the existing mapping's address.
299 * Client buffer mappings are not ref'counted. Each call to
301 * drm_client_buffer_vunmap(); or the client buffer should be mapped
312 drm_client_buffer_vmap(struct drm_client_buffer *buffer, in drm_client_buffer_vmap() argument
315 struct iosys_map *map = &buffer->map; in drm_client_buffer_vmap()
326 ret = drm_gem_vmap(buffer->gem, map); in drm_client_buffer_vmap()
337 * drm_client_buffer_vunmap - Unmap DRM client buffer
338 * @buffer: DRM client buffer
340 * This function removes a client buffer's memory mapping. Calling this
341 * function is only required by clients that manage their buffer mappings
344 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer) in drm_client_buffer_vunmap() argument
346 struct iosys_map *map = &buffer->map; in drm_client_buffer_vunmap()
348 drm_gem_vunmap(buffer->gem, map); in drm_client_buffer_vunmap()
352 static void drm_client_buffer_rmfb(struct drm_client_buffer *buffer) in drm_client_buffer_rmfb() argument
356 if (!buffer->fb) in drm_client_buffer_rmfb()
359 ret = drm_mode_rmfb(buffer->client->dev, buffer->fb->base.id, buffer->client->file); in drm_client_buffer_rmfb()
361 drm_err(buffer->client->dev, in drm_client_buffer_rmfb()
362 "Error removing FB:%u (%d)\n", buffer->fb->base.id, ret); in drm_client_buffer_rmfb()
364 buffer->fb = NULL; in drm_client_buffer_rmfb()
367 static int drm_client_buffer_addfb(struct drm_client_buffer *buffer, in drm_client_buffer_addfb() argument
370 struct drm_client_dev *client = buffer->client; in drm_client_buffer_addfb()
380 fb_req.handle = buffer->handle; in drm_client_buffer_addfb()
381 fb_req.pitch = buffer->pitch; in drm_client_buffer_addfb()
387 buffer->fb = drm_framebuffer_lookup(client->dev, buffer->client->file, fb_req.fb_id); in drm_client_buffer_addfb()
388 if (WARN_ON(!buffer->fb)) in drm_client_buffer_addfb()
392 drm_framebuffer_put(buffer->fb); in drm_client_buffer_addfb()
394 strscpy(buffer->fb->comm, client->name, TASK_COMM_LEN); in drm_client_buffer_addfb()
404 * @format: Buffer format
407 * &drm_framebuffer backed by a dumb buffer.
408 * Call drm_client_framebuffer_delete() to free the buffer.
411 * Pointer to a client buffer or an error pointer on failure.
416 struct drm_client_buffer *buffer; in drm_client_framebuffer_create() local
419 buffer = drm_client_buffer_create(client, width, height, format); in drm_client_framebuffer_create()
420 if (IS_ERR(buffer)) in drm_client_framebuffer_create()
421 return buffer; in drm_client_framebuffer_create()
423 ret = drm_client_buffer_addfb(buffer, width, height, format); in drm_client_framebuffer_create()
425 drm_client_buffer_delete(buffer); in drm_client_framebuffer_create()
429 return buffer; in drm_client_framebuffer_create()
435 * @buffer: DRM client buffer (can be NULL)
437 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer) in drm_client_framebuffer_delete() argument
439 if (!buffer) in drm_client_framebuffer_delete()
442 drm_client_buffer_rmfb(buffer); in drm_client_framebuffer_delete()
443 drm_client_buffer_delete(buffer); in drm_client_framebuffer_delete()
449 * @buffer: DRM client buffer (can be NULL)
452 * This calls &drm_framebuffer_funcs->dirty (if present) to flush buffer changes
458 int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect) in drm_client_framebuffer_flush() argument
460 if (!buffer || !buffer->fb || !buffer->fb->funcs->dirty) in drm_client_framebuffer_flush()
471 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()
475 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()