summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_client.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-07-03 09:58:24 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2019-07-09 10:24:39 +0200
commitcf1ca9aeb930df074bb5bbcde55f935fec04e529 (patch)
tree485b01b1eebd4d49c0854ed2f8d365f5282f561e /drivers/gpu/drm/drm_client.c
parent15dd0fc833407a513da162451ac3459650beecb6 (diff)
downloadlwn-cf1ca9aeb930df074bb5bbcde55f935fec04e529.tar.gz
lwn-cf1ca9aeb930df074bb5bbcde55f935fec04e529.zip
drm/fb-helper: Map DRM client buffer only when required
This patch changes DRM clients to not map the buffer by default. The buffer, like any buffer object, should be mapped and unmapped when needed. An unmapped buffer object can be evicted to system memory and does not consume video ram until displayed. This allows to use generic fbdev emulation with drivers for low-memory devices, such as ast and mgag200. This change affects the generic framebuffer console. HW-based consoles map their console buffer once and keep it mapped. Userspace can mmap this buffer into its address space. The shadow-buffered framebuffer console only needs the buffer object to be mapped during updates. While not being updated from the shadow buffer, the buffer object can remain unmapped. Userspace will always mmap the shadow buffer. v2: * change DRM client to not map buffer by default * manually map client buffer for fbdev with HW framebuffer Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/315830/
Diffstat (limited to 'drivers/gpu/drm/drm_client.c')
-rw-r--r--drivers/gpu/drm/drm_client.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index fb107b24baae..e1dafb0cc5e2 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -254,7 +254,6 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
struct drm_device *dev = client->dev;
struct drm_client_buffer *buffer;
struct drm_gem_object *obj;
- void *vaddr;
int ret;
buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
@@ -281,12 +280,6 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
buffer->gem = obj;
- vaddr = drm_client_buffer_vmap(buffer);
- if (IS_ERR(vaddr)) {
- ret = PTR_ERR(vaddr);
- goto err_delete;
- }
-
return buffer;
err_delete:
@@ -305,7 +298,7 @@ err_delete:
* Client buffer mappings are not ref'counted. Each call to
* drm_client_buffer_vmap() should be followed by a call to
* drm_client_buffer_vunmap(); or the client buffer should be mapped
- * throughout its lifetime. The latter is the default.
+ * throughout its lifetime.
*
* Returns:
* The mapped memory's address
@@ -339,10 +332,9 @@ EXPORT_SYMBOL(drm_client_buffer_vmap);
* drm_client_buffer_vunmap - Unmap DRM client buffer
* @buffer: DRM client buffer
*
- * This function removes a client buffer's memory mapping. This
- * function is only required by clients that manage their buffers
- * by themselves. By default, DRM client buffers are mapped throughout
- * their entire lifetime.
+ * This function removes a client buffer's memory mapping. Calling this
+ * function is only required by clients that manage their buffer mappings
+ * by themselves.
*/
void drm_client_buffer_vunmap(struct drm_client_buffer *buffer)
{