drm/client: Do not pin in drm_client_buffer_vmap()

Pin and vmap are two distict operations. Do not mix them.

The helper drm_client_buffer_vmap() maps the pages for fbdev-dma
and fbdev-shmem. In both cases, the vmap operation ensures that
the pages are available until the vunmap happens. And as the pages
in DMA or SHMEM areas cannot be moved, there is no reason to call
pin. Hence remove the pin call.

Update drm_client_buffer_vunmap() accordingly.

v2:
- call 'locked' variants of GEM helpers (Dmitry)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://lore.kernel.org/r/20250526132634.531789-2-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann
2025-05-26 15:25:17 +02:00
parent 2271e0a20e
commit 62e1e11a49

View File

@@ -303,34 +303,17 @@ EXPORT_SYMBOL(drm_client_buffer_vunmap_local);
* Returns:
* 0 on success, or a negative errno code otherwise.
*/
int
drm_client_buffer_vmap(struct drm_client_buffer *buffer,
struct iosys_map *map_copy)
int drm_client_buffer_vmap(struct drm_client_buffer *buffer,
struct iosys_map *map_copy)
{
struct drm_gem_object *gem = buffer->gem;
struct iosys_map *map = &buffer->map;
int ret;
drm_gem_lock(gem);
ret = drm_gem_pin_locked(gem);
ret = drm_gem_vmap(buffer->gem, &buffer->map);
if (ret)
goto err_drm_gem_pin_locked;
ret = drm_gem_vmap_locked(gem, map);
if (ret)
goto err_drm_gem_vmap;
drm_gem_unlock(gem);
*map_copy = *map;
return ret;
*map_copy = buffer->map;
return 0;
err_drm_gem_vmap:
drm_gem_unpin_locked(buffer->gem);
err_drm_gem_pin_locked:
drm_gem_unlock(gem);
return ret;
}
EXPORT_SYMBOL(drm_client_buffer_vmap);
@@ -344,13 +327,7 @@ EXPORT_SYMBOL(drm_client_buffer_vmap);
*/
void drm_client_buffer_vunmap(struct drm_client_buffer *buffer)
{
struct drm_gem_object *gem = buffer->gem;
struct iosys_map *map = &buffer->map;
drm_gem_lock(gem);
drm_gem_vunmap_locked(gem, map);
drm_gem_unpin_locked(gem);
drm_gem_unlock(gem);
drm_gem_vunmap(buffer->gem, &buffer->map);
}
EXPORT_SYMBOL(drm_client_buffer_vunmap);