]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm: Add DRM prime interface to reassign GEM handle
authorDavid Francis <David.Francis@amd.com>
Thu, 17 Jul 2025 14:35:55 +0000 (10:35 -0400)
committerChristian König <christian.koenig@amd.com>
Fri, 18 Jul 2025 06:59:24 +0000 (08:59 +0200)
commit53096728b8910c6916ecc6c46a5abc5c678b58d9
tree4b64a70ad3874d8da30000aee8370e899a69159d
parentb9a572f471993d3e8bf874fcb57f331d66650440
drm: Add DRM prime interface to reassign GEM handle

CRIU restore of drm buffer objects requires the ability to create
or import a buffer object with a specific gem handle.

Add new drm ioctl DRM_IOCTL_GEM_CHANGE_HANDLE, which takes
the gem handle of an object and moves that object to a
specified new gem handle.

This ioctl needs to call drm_prime_remove_buf_handle,
but that function acquires the prime lock, which the ioctl
needs to hold for other purposes.

Make drm_prime_remove_buf_handle not acquire the prime lock,
and change its other caller to reflect this.

The rest of the kernel patches required to enable CRIU can be
found at
https://lore.kernel.org/dri-devel/20250617194536.538681-1-David.Francis@amd.com/

v2 - Move documentation to UAPI headers
v3 - Always return 0 on success

Signed-off-by: David Francis <David.Francis@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20250717143556.857893-2-David.Francis@amd.com
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_internal.h
drivers/gpu/drm/drm_ioctl.c
drivers/gpu/drm/drm_prime.c
include/uapi/drm/drm.h