Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/client: Depend on GEM object kmap ref-counting

DRM client's vmap/vunmap functions don't allow for multiple vmap
operations. Calling drm_client_buffer_vmap() twice returns the same
mapping, then calling drm_client_buffer_vunmap() twice already unmaps
on the first call. This leads to unbalanced vmap refcounts. Fix this
by calling drm_gem_vmap() unconditionally in drm_client_buffer_vmap().

All drivers that support DRM clients have to implement correct ref-
counting for their vmap operations, or not vunmap at all. This is the
case for drivers that use CMA, SHMEM and VRAM helpers, and QXL. Other
drivers are not affected.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-4-tzimmermann@suse.de

-4
-4
drivers/gpu/drm/drm_client.c
··· 314 314 struct dma_buf_map *map = &buffer->map; 315 315 int ret; 316 316 317 - if (dma_buf_map_is_set(map)) 318 - goto out; 319 - 320 317 /* 321 318 * FIXME: The dependency on GEM here isn't required, we could 322 319 * convert the driver handle to a dma-buf instead and use the ··· 326 329 if (ret) 327 330 return ret; 328 331 329 - out: 330 332 *map_copy = *map; 331 333 332 334 return 0;