Lines Matching full:buffer

31  * GEM drivers which provide a GEM based dumb buffer with a virtual address are supported.
143 * is fbdev which cannot free the buffer if userspace has open file descriptors.
233 static void drm_client_buffer_delete(struct drm_client_buffer *buffer) in drm_client_buffer_delete() argument
235 struct drm_device *dev = buffer->client->dev; in drm_client_buffer_delete()
237 drm_gem_vunmap(buffer->gem, buffer->vaddr); in drm_client_buffer_delete()
239 if (buffer->gem) in drm_client_buffer_delete()
240 drm_gem_object_put(buffer->gem); in drm_client_buffer_delete()
242 if (buffer->handle) in drm_client_buffer_delete()
243 drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file); in drm_client_buffer_delete()
245 kfree(buffer); in drm_client_buffer_delete()
254 struct drm_client_buffer *buffer; in drm_client_buffer_create() local
258 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); in drm_client_buffer_create()
259 if (!buffer) in drm_client_buffer_create()
262 buffer->client = client; in drm_client_buffer_create()
271 buffer->handle = dumb_args.handle; in drm_client_buffer_create()
272 buffer->pitch = dumb_args.pitch; in drm_client_buffer_create()
280 buffer->gem = obj; in drm_client_buffer_create()
282 return buffer; in drm_client_buffer_create()
285 drm_client_buffer_delete(buffer); in drm_client_buffer_create()
291 * drm_client_buffer_vmap - Map DRM client buffer into address space
292 * @buffer: DRM client buffer
294 * This function maps a client buffer into kernel address space. If the
295 * buffer is already mapped, it returns the mapping's address.
297 * Client buffer mappings are not ref'counted. Each call to
299 * drm_client_buffer_vunmap(); or the client buffer should be mapped
305 void *drm_client_buffer_vmap(struct drm_client_buffer *buffer) in drm_client_buffer_vmap() argument
309 if (buffer->vaddr) in drm_client_buffer_vmap()
310 return buffer->vaddr; in drm_client_buffer_vmap()
320 vaddr = drm_gem_vmap(buffer->gem); in drm_client_buffer_vmap()
324 buffer->vaddr = vaddr; in drm_client_buffer_vmap()
331 * drm_client_buffer_vunmap - Unmap DRM client buffer
332 * @buffer: DRM client buffer
334 * This function removes a client buffer's memory mapping. Calling this
335 * function is only required by clients that manage their buffer mappings
338 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer) in drm_client_buffer_vunmap() argument
340 drm_gem_vunmap(buffer->gem, buffer->vaddr); in drm_client_buffer_vunmap()
341 buffer->vaddr = NULL; in drm_client_buffer_vunmap()
345 static void drm_client_buffer_rmfb(struct drm_client_buffer *buffer) in drm_client_buffer_rmfb() argument
349 if (!buffer->fb) in drm_client_buffer_rmfb()
352 ret = drm_mode_rmfb(buffer->client->dev, buffer->fb->base.id, buffer->client->file); in drm_client_buffer_rmfb()
354 drm_err(buffer->client->dev, in drm_client_buffer_rmfb()
355 "Error removing FB:%u (%d)\n", buffer->fb->base.id, ret); in drm_client_buffer_rmfb()
357 buffer->fb = NULL; in drm_client_buffer_rmfb()
360 static int drm_client_buffer_addfb(struct drm_client_buffer *buffer, in drm_client_buffer_addfb() argument
363 struct drm_client_dev *client = buffer->client; in drm_client_buffer_addfb()
373 fb_req.handle = buffer->handle; in drm_client_buffer_addfb()
374 fb_req.pitch = buffer->pitch; in drm_client_buffer_addfb()
380 buffer->fb = drm_framebuffer_lookup(client->dev, buffer->client->file, fb_req.fb_id); in drm_client_buffer_addfb()
381 if (WARN_ON(!buffer->fb)) in drm_client_buffer_addfb()
385 drm_framebuffer_put(buffer->fb); in drm_client_buffer_addfb()
387 strscpy(buffer->fb->comm, client->name, TASK_COMM_LEN); in drm_client_buffer_addfb()
397 * @format: Buffer format
400 * &drm_framebuffer backed by a dumb buffer.
401 * Call drm_client_framebuffer_delete() to free the buffer.
404 * Pointer to a client buffer or an error pointer on failure.
409 struct drm_client_buffer *buffer; in drm_client_framebuffer_create() local
412 buffer = drm_client_buffer_create(client, width, height, format); in drm_client_framebuffer_create()
413 if (IS_ERR(buffer)) in drm_client_framebuffer_create()
414 return buffer; in drm_client_framebuffer_create()
416 ret = drm_client_buffer_addfb(buffer, width, height, format); in drm_client_framebuffer_create()
418 drm_client_buffer_delete(buffer); in drm_client_framebuffer_create()
422 return buffer; in drm_client_framebuffer_create()
428 * @buffer: DRM client buffer (can be NULL)
430 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer) in drm_client_framebuffer_delete() argument
432 if (!buffer) in drm_client_framebuffer_delete()
435 drm_client_buffer_rmfb(buffer); in drm_client_framebuffer_delete()
436 drm_client_buffer_delete(buffer); in drm_client_framebuffer_delete()
442 * @buffer: DRM client buffer (can be NULL)
445 * This calls &drm_framebuffer_funcs->dirty (if present) to flush buffer changes
451 int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect) in drm_client_framebuffer_flush() argument
453 if (!buffer || !buffer->fb || !buffer->fb->funcs->dirty) in drm_client_framebuffer_flush()
464 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()
468 return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, in drm_client_framebuffer_flush()