Add CHANGE_HANDLE ioctl for drm gem v2
Subsystems (2)
This patch adds a new ioctl GEM_CHANGE_HANDLE which is needed by amdgpu CRIU for dmabuf.
The ioctl allows a user to move a gem object to a new handle.
In this version, I have added kerneldoc comments for the new ioctl in drm.h and have moved over the other drm_gem.c ioctl docs to drm.h.
Accompanying changes:
kernel (for dmabuf CRIU support)
https://lore.kernel.org/dri-devel/[email protected]/
igt (for this ioctl)
https://gitlab.freedesktop.org/fdavid-amd/igt-gpu-tools
CRIU (for dmabuf CRIU support)
https://github.com/checkpoint-restore/criu/pull/2613
PATCH 1/2 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/[email protected]/
--- drivers/gpu/drm/drm_gem.c | 54 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_internal.h | 4 +++ drivers/gpu/drm/drm_ioctl.c | 1 + drivers/gpu/drm/drm_prime.c | 6 +--- include/uapi/drm/drm.h | 23 +++++++++++++++ 5 files changed, 83 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_gem.c +54 -0
@@ -282,7 +282,12 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)if (obj->funcs->close) obj->funcs->close (obj, file_priv); +mutex_lock (&file_priv->prime.lock); +drm_prime_remove_buf_handle (&file_priv->prime, id); + +mutex_unlock (&file_priv->prime.lock); +drm_vma_node_revoke (&obj->vma_node, file_priv);drm_gem_object_handle_put_unlocked (obj);
@@ -933,6 +938,55 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,return ret; } +int drm_gem_change_handle_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv) +{ +struct drm_gem_change_handle *args = data; +struct drm_gem_object *obj; +int ret; + +if (!drm_core_check_feature (dev,DRIVER_GEM )) +return -EOPNOTSUPP ; + + obj =drm_gem_object_lookup (file_priv, args->handle); +if (!obj) +return -ENOENT ; + +if (args->handle == args->new_handle) +return 0 ; + +mutex_lock (&file_priv->prime.lock); + +spin_lock (&file_priv->table_lock); + ret =idr_alloc (&file_priv->object_idr, obj, + args->new_handle, args->new_handle +1 ,GFP_NOWAIT ); +spin_unlock (&file_priv->table_lock); + +if (ret <0 ) + goto out_unlock; + +if (obj->dma_buf) { + ret =drm_prime_add_buf_handle (&file_priv->prime, obj->dma_buf, args->new_handle); +if (ret <0 ) { +spin_lock (&file_priv->table_lock); +idr_remove (&file_priv->object_idr, args->new_handle); +spin_unlock (&file_priv->table_lock); + goto out_unlock; + } + +drm_prime_remove_buf_handle (&file_priv->prime, args->handle); + } + +spin_lock (&file_priv->table_lock); +idr_remove (&file_priv->object_idr, args->handle); +spin_unlock (&file_priv->table_lock); + +out_unlock: +mutex_unlock (&file_priv->prime.lock); + +return ret; +} +/** * drm_gem_open - initializes GEM file-private structures at devnode open time * @dev: drm_device which is being opened by userspace
drivers/gpu/drm/drm_internal.h +4 -0
@@ -85,6 +85,8 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,void drm_prime_init_file_private (struct drm_prime_file_private *prime_fpriv);void drm_prime_destroy_file_private (struct drm_prime_file_private *prime_fpriv); +int drm_prime_add_buf_handle (struct drm_prime_file_private *prime_fpriv, +struct dma_buf *dma_buf,uint32_t handle);void drm_prime_remove_buf_handle (struct drm_prime_file_private *prime_fpriv,uint32_t handle);
@@ -168,6 +170,8 @@ int drm_gem_close_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); +int drm_gem_change_handle_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv);int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv);void drm_gem_open (struct drm_device *dev,struct drm_file *file_private);
drivers/gpu/drm/drm_ioctl.c +1 -0
@@ -653,6 +653,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {DRM_IOCTL_DEF (DRM_IOCTL_GEM_CLOSE , drm_gem_close_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_GEM_FLINK , drm_gem_flink_ioctl,DRM_AUTH ),DRM_IOCTL_DEF (DRM_IOCTL_GEM_OPEN , drm_gem_open_ioctl,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_GEM_CHANGE_HANDLE , drm_gem_change_handle_ioctl,DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, 0),
drivers/gpu/drm/drm_prime.c +1 -5
@@ -93,7 +93,7 @@ struct drm_prime_member {struct rb_node handle_rb; }; -static int drm_prime_add_buf_handle (struct drm_prime_file_private *prime_fpriv, +int drm_prime_add_buf_handle (struct drm_prime_file_private *prime_fpriv,struct dma_buf *dma_buf,uint32_t handle) {struct drm_prime_member *member;
@@ -190,8 +190,6 @@ void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, {struct rb_node *rb; -mutex_lock (&prime_fpriv->lock); - rb = prime_fpriv->handles.rb_node;while (rb) {struct drm_prime_member *member;
@@ -210,8 +208,6 @@ void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, rb = rb->rb_left; } } - -mutex_unlock (&prime_fpriv->lock); }void drm_prime_init_file_private (struct drm_prime_file_private *prime_fpriv)
include/uapi/drm/drm.h +23 -0
@@ -625,6 +625,21 @@ struct drm_gem_open {__u64 size; }; +/** +* struct drm_gem_change_handle - Argument for &DRM_IOCTL_GEM_CHANGE_HANDLE ioctl. +* @handle: The handle of a gem object. +* @new_handle: An available gem handle. +* +* This ioctl changes the handle of a GEM object to the specified one. +* The new handle must be unused. On success the old handle is closed +* and all further IOCTL should refer to the new handle only. +* Calls to DRM_IOCTL_PRIME_FD_TO_HANDLE will return the new handle. +*/ +struct drm_gem_change_handle { +__u32 handle; +__u32 new_handle; +}; +/** * DRM_CAP_DUMB_BUFFER *
@@ -1305,6 +1320,14 @@ extern "C" {*/ #define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name) +/** +* DRM_IOCTL_GEM_CHANGE_HANDLE - Move an object to a different handle +* +* Some applications (notably CRIU) need objects to have specific gem handles. +* This ioctl changes the object at one gem handle to use a new gem handle. +*/ +#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle) +/* * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 1 line
2.34.1
RE: [PATCH 1/2] drm: Add DRM prime interface to reassign GEM handle
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of David Francis
Sent: Friday, July 11, 2025 10:54 PM
To: [email protected]
Cc: [email protected]; Kuehling, Felix <[email protected]>; Yat Sin, David <[email protected]>; Freehill, Chris <[email protected]>; Koenig, Christian <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Francis, David <[email protected]>
Subject: [PATCH 1/2] 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/[email protected]/
--- drivers/gpu/drm/drm_gem.c | 54 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_internal.h | 4 +++ drivers/gpu/drm/drm_ioctl.c | 1 + drivers/gpu/drm/drm_prime.c | 6 +--- include/uapi/drm/drm.h | 23 +++++++++++++++ 5 files changed, 83 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_gem.c +44 -0
@@ -282,7 +282,12 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)if (obj->funcs->close) obj->funcs->close (obj, file_priv); +mutex_lock (&file_priv->prime.lock); +drm_prime_remove_buf_handle (&file_priv->prime, id); + +mutex_unlock (&file_priv->prime.lock); +drm_vma_node_revoke (&obj->vma_node, file_priv);drm_gem_object_handle_put_unlocked (obj);
@@ -933,6 +938,55 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,return ret; } +int drm_gem_change_handle_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv) +{ +struct drm_gem_change_handle *args = data; +struct drm_gem_object *obj; +int ret; + +if (!drm_core_check_feature (dev,DRIVER_GEM )) +return -EOPNOTSUPP ; + + obj =drm_gem_object_lookup (file_priv, args->handle); +if (!obj) +return -ENOENT ; + +if (args->handle == args->new_handle) +return 0 ; + +mutex_lock (&file_priv->prime.lock); + +spin_lock (&file_priv->table_lock); + ret =idr_alloc (&file_priv->object_idr, obj, + args->new_handle, args->new_handle +1 ,GFP_NOWAIT ); +spin_unlock (&file_priv->table_lock); + +if (ret <0 ) + goto out_unlock; + +if (obj->dma_buf) { + ret =drm_prime_add_buf_handle (&file_priv->prime, obj->dma_buf, args->new_handle); +if (ret <0 ) { +spin_lock (&file_priv->table_lock); +idr_remove (&file_priv->object_idr, args->new_handle); +spin_unlock (&file_priv->table_lock); + goto out_unlock; + } + +drm_prime_remove_buf_handle (&file_priv->prime, args->handle); + } + Added ret = 0 before out_unlock to ensure proper return value ret = 0;
Thanks
Jesse
+ spin_lock(&file_priv->table_lock); + idr_remove(&file_priv->object_idr, args->handle); + spin_unlock(&file_priv->table_lock);
+
+out_unlock:
+ mutex_unlock(&file_priv->prime.lock);
+
+ return ret;
+}
+
/**
* drm_gem_open - initializes GEM file-private structures at devnode open time
* @dev: drm_device which is being opened by userspace diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index b2b6a8e49dda..e9d5cdf7e033 100644
drivers/gpu/drm/drm_internal.h +4 -0
@@ -85,6 +85,8 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,void drm_prime_init_file_private (struct drm_prime_file_private *prime_fpriv);void drm_prime_destroy_file_private (struct drm_prime_file_private *prime_fpriv); +int drm_prime_add_buf_handle (struct drm_prime_file_private *prime_fpriv, +struct dma_buf *dma_buf,uint32_t handle);void drm_prime_remove_buf_handle (struct drm_prime_file_private *prime_fpriv,uint32_t handle);
@@ -168,6 +170,8 @@ int drm_gem_close_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); +int drm_gem_change_handle_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv);int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index f593dc569d31..d8a24875a7ba 100644
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -653,6 +653,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {DRM_IOCTL_DEF (DRM_IOCTL_GEM_CLOSE , drm_gem_close_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_GEM_FLINK , drm_gem_flink_ioctl,DRM_AUTH ),DRM_IOCTL_DEF (DRM_IOCTL_GEM_OPEN , drm_gem_open_ioctl,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_GEM_CHANGE_HANDLE , +drm_gem_change_handle_ioctl,DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, 0),
drivers/gpu/drm/drm_prime.c +2 -5
@@ -93,7 +93,7 @@ struct drm_prime_member {struct rb_node handle_rb; }; -static int drm_prime_add_buf_handle (struct drm_prime_file_private *prime_fpriv, +int drm_prime_add_buf_handle (struct drm_prime_file_private +*prime_fpriv,struct dma_buf *dma_buf,uint32_t handle) {struct drm_prime_member *member;
@@ -190,8 +190,6 @@ void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, {struct rb_node *rb; -mutex_lock (&prime_fpriv->lock); - rb = prime_fpriv->handles.rb_node;while (rb) {struct drm_prime_member *member;
@@ -210,8 +208,6 @@ void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, rb = rb->rb_left; } } - -mutex_unlock (&prime_fpriv->lock); } void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 7fba37b94401..e3940b657e16 100644
include/uapi/drm/drm.h +23 -0
@@ -625,6 +625,21 @@ struct drm_gem_open {__u64 size; }; +/** +* struct drm_gem_change_handle - Argument for &DRM_IOCTL_GEM_CHANGE_HANDLE ioctl. +* @handle: The handle of a gem object. +* @new_handle: An available gem handle. +* +* This ioctl changes the handle of a GEM object to the specified one. +* The new handle must be unused. On success the old handle is closed +* and all further IOCTL should refer to the new handle only. +* Calls to DRM_IOCTL_PRIME_FD_TO_HANDLE will return the new handle. +*/ +struct drm_gem_change_handle { +__u32 handle; +__u32 new_handle; +}; +/** * DRM_CAP_DUMB_BUFFER *
@@ -1305,6 +1320,14 @@ extern "C" {*/ #define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name) +/** +* DRM_IOCTL_GEM_CHANGE_HANDLE - Move an object to a different handle +* +* Some applications (notably CRIU) need objects to have specific gem handles. +* This ioctl changes the object at one gem handle to use a new gem handle. +*/ +#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle) +/* * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
--
2.34.1
PATCH 2/2 drm: Move drm_gem ioctl kerneldoc to uapi file
In reply to David FrancisThe drm_gem ioctls were documented in internal file drm_gem.c instead of uapi header drm.h. Move them there and change to appropriate kerneldoc formatting.
--- drivers/gpu/drm/drm_gem.c | 30 ----------------------------- include/uapi/drm/drm.h | 40 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 42 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -30
@@ -820,14 +820,6 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle, }EXPORT_SYMBOL (drm_gem_dma_resv_wait); -/** -* drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Releases the handle to an mm object. -*/ int drm_gem_close_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)
@@ -843,17 +835,6 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Create a global name for an object, returning the name. -* -* Note that the name does not hold a reference; when the object -* is freed, the name goes away. -*/ int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)
@@ -893,17 +874,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_open_ioctl - implementation of the GEM_OPEN ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Open an object using the global name, returning a handle and the size. -* -* This handle (of course) holds a reference to the object, so the object -* will not go away until the handle is deleted. -*/ int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)
include/uapi/drm/drm.h +28 -12
@@ -597,31 +597,47 @@ struct drm_set_version {int drm_dd_minor; }; -/* DRM_IOCTL_GEM_CLOSE ioctl argument type */ +/** +* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl. +* @handle: Handle of the object to be closed. +* @pad: Padding. +* +* Releases the handle to an mm object. +*/ struct drm_gem_close { -/** Handle of the object to be closed. */ __u32 handle;__u32 pad; }; -/* DRM_IOCTL_GEM_FLINK ioctl argument type */ +/** +* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl. +* @handle: Handle for the object being named. +* @name: Returned global name. +* +* Create a global name for an object, returning the name. +* +* Note that the name does not hold a reference; when the object +* is freed, the name goes away. +*/ struct drm_gem_flink { -/** Handle for the object being named */ __u32 handle; - -/** Returned global name */ __u32 name; }; -/* DRM_IOCTL_GEM_OPEN ioctl argument type */ +/** +* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl. +* @name: Name of object being opened. +* @handle: Returned handle for the object. +* @size: Returned size of the object +* +* Open an object using the global name, returning a handle and the size. +* +* This handle (of course) holds a reference to the object, so the object +* will not go away until the handle is deleted. +*/ struct drm_gem_open { -/** Name of object being opened */ __u32 name; - -/** Returned handle for the object */ __u32 handle; - -/** Returned size of the object */ __u64 size; };
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm: Move drm_gem ioctl kerneldoc to uapi file
Quoted 5 lines · David Francis
The
drm_gemioctls were documented in internal filedrm_gem.cinstead of uapi headerdrm.h. Move them there and change to appropriate kerneldoc formatting.Signed-off-by David Francis <[email protected]>
Thanks a lot for taking care of this!
I'll leave review for the first patch to folks who care about criu, but it looked good to me too.
-Sima
Quoted 127 lines
--- drivers/gpu/drm/drm_gem.c | 30 ----------------------------- include/uapi/drm/drm.h | 40 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 42 deletions(-)drivers/gpu/drm/drm_gem.c +0
-30@@ -820,14 +820,6 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle, }EXPORT_SYMBOL (drm_gem_dma_resv_wait); -/** -* drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Releases the handle to an mm object. -*/ int drm_gem_close_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -843,17 +835,6 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Create a global name for an object, returning the name. -* -* Note that the name does not hold a reference; when the object -* is freed, the name goes away. -*/ int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -893,17 +874,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_open_ioctl - implementation of the GEM_OPEN ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Open an object using the global name, returning a handle and the size. -* -* This handle (of course) holds a reference to the object, so the object -* will not go away until the handle is deleted. -*/ int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)include/uapi/drm/drm.h +28
-12@@ -597,31 +597,47 @@ struct drm_set_version {int drm_dd_minor; }; -/* DRM_IOCTL_GEM_CLOSE ioctl argument type */ +/** +* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl. +* @handle: Handle of the object to be closed. +* @pad: Padding. +* +* Releases the handle to an mm object. +*/ struct drm_gem_close { -/** Handle of the object to be closed. */ __u32 handle;__u32 pad; }; -/* DRM_IOCTL_GEM_FLINK ioctl argument type */ +/** +* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl. +* @handle: Handle for the object being named. +* @name: Returned global name. +* +* Create a global name for an object, returning the name. +* +* Note that the name does not hold a reference; when the object +* is freed, the name goes away. +*/ struct drm_gem_flink { -/** Handle for the object being named */ __u32 handle; - -/** Returned global name */ __u32 name; }; -/* DRM_IOCTL_GEM_OPEN ioctl argument type */ +/** +* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl. +* @name: Name of object being opened. +* @handle: Returned handle for the object. +* @size: Returned size of the object +* +* Open an object using the global name, returning a handle and the size. +* +* This handle (of course) holds a reference to the object, so the object +* will not go away until the handle is deleted. +*/ struct drm_gem_open { -/** Name of object being opened */ __u32 name; - -/** Returned handle for the object */ __u32 handle; - -/** Returned size of the object */ __u64 size; };Signature · 1 line
2.34.1
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH 2/2] drm: Move drm_gem ioctl kerneldoc to uapi file
Quoted 5 lines · Simona Vetter
Quoted 4 lines · David Francis
The
drm_gemioctls were documented in internal filedrm_gem.cinstead of uapi headerdrm.h. Move them there and change to appropriate kerneldoc formatting.
Quoted 8 lines
Quoted 1 line
Signed-off-by David Francis <[email protected]>Thanks a lot for taking care of this!
Reviewed-by Simona Vetter <[email protected]>I'll leave review for the first patch to folks who care about criu, but it looked good to me too.
I will take that as an Acked-by.
Are you ok that we push this into drm-misc-next by the end of the week when we have the IGT test ready?
The patches for the CRIU code are ready and IIRC there will be a merge request made, but it will take quite a while until they are actually merged I think.
Christian.
Quoted 130 lines
-Sima
Quoted 127 lines
--- drivers/gpu/drm/drm_gem.c | 30 ----------------------------- include/uapi/drm/drm.h | 40 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 42 deletions(-)drivers/gpu/drm/drm_gem.c +0
-30@@ -820,14 +820,6 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle, }EXPORT_SYMBOL (drm_gem_dma_resv_wait); -/** -* drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Releases the handle to an mm object. -*/ int drm_gem_close_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -843,17 +835,6 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Create a global name for an object, returning the name. -* -* Note that the name does not hold a reference; when the object -* is freed, the name goes away. -*/ int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -893,17 +874,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_open_ioctl - implementation of the GEM_OPEN ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Open an object using the global name, returning a handle and the size. -* -* This handle (of course) holds a reference to the object, so the object -* will not go away until the handle is deleted. -*/ int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)include/uapi/drm/drm.h +28
-12@@ -597,31 +597,47 @@ struct drm_set_version {int drm_dd_minor; }; -/* DRM_IOCTL_GEM_CLOSE ioctl argument type */ +/** +* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl. +* @handle: Handle of the object to be closed. +* @pad: Padding. +* +* Releases the handle to an mm object. +*/ struct drm_gem_close { -/** Handle of the object to be closed. */ __u32 handle;__u32 pad; }; -/* DRM_IOCTL_GEM_FLINK ioctl argument type */ +/** +* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl. +* @handle: Handle for the object being named. +* @name: Returned global name. +* +* Create a global name for an object, returning the name. +* +* Note that the name does not hold a reference; when the object +* is freed, the name goes away. +*/ struct drm_gem_flink { -/** Handle for the object being named */ __u32 handle; - -/** Returned global name */ __u32 name; }; -/* DRM_IOCTL_GEM_OPEN ioctl argument type */ +/** +* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl. +* @name: Name of object being opened. +* @handle: Returned handle for the object. +* @size: Returned size of the object +* +* Open an object using the global name, returning a handle and the size. +* +* This handle (of course) holds a reference to the object, so the object +* will not go away until the handle is deleted. +*/ struct drm_gem_open { -/** Name of object being opened */ __u32 name; - -/** Returned handle for the object */ __u32 handle; - -/** Returned size of the object */ __u64 size; };Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm: Move drm_gem ioctl kerneldoc to uapi file
Quoted 10 lines · Christian König
Quoted 9 lines · Simona Vetter
Quoted 5 lines · David Francis
The
drm_gemioctls were documented in internal filedrm_gem.cinstead of uapi headerdrm.h. Move them there and change to appropriate kerneldoc formatting.Signed-off-by David Francis <[email protected]>Thanks a lot for taking care of this!
Quoted 8 lines
Quoted 4 lines
Reviewed-by Simona Vetter <[email protected]>I'll leave review for the first patch to folks who care about criu, but it looked good to me too.
I will take that as an Acked-by.
Are you ok that we push this into drm-misc-next by the end of the week when we have the IGT test ready?
Aye, sounds like a plan.
-Sima
Quoted 139 lines
The patches for the CRIU code are ready and IIRC there will be a merge request made, but it will take quite a while until they are actually merged I think.
Christian.
Quoted 130 lines
-Sima
Quoted 127 lines
--- drivers/gpu/drm/drm_gem.c | 30 ----------------------------- include/uapi/drm/drm.h | 40 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 42 deletions(-)drivers/gpu/drm/drm_gem.c +0
-30@@ -820,14 +820,6 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle, }EXPORT_SYMBOL (drm_gem_dma_resv_wait); -/** -* drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Releases the handle to an mm object. -*/ int drm_gem_close_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -843,17 +835,6 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Create a global name for an object, returning the name. -* -* Note that the name does not hold a reference; when the object -* is freed, the name goes away. -*/ int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -893,17 +874,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_open_ioctl - implementation of the GEM_OPEN ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Open an object using the global name, returning a handle and the size. -* -* This handle (of course) holds a reference to the object, so the object -* will not go away until the handle is deleted. -*/ int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)include/uapi/drm/drm.h +28
-12@@ -597,31 +597,47 @@ struct drm_set_version {int drm_dd_minor; }; -/* DRM_IOCTL_GEM_CLOSE ioctl argument type */ +/** +* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl. +* @handle: Handle of the object to be closed. +* @pad: Padding. +* +* Releases the handle to an mm object. +*/ struct drm_gem_close { -/** Handle of the object to be closed. */ __u32 handle;__u32 pad; }; -/* DRM_IOCTL_GEM_FLINK ioctl argument type */ +/** +* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl. +* @handle: Handle for the object being named. +* @name: Returned global name. +* +* Create a global name for an object, returning the name. +* +* Note that the name does not hold a reference; when the object +* is freed, the name goes away. +*/ struct drm_gem_flink { -/** Handle for the object being named */ __u32 handle; - -/** Returned global name */ __u32 name; }; -/* DRM_IOCTL_GEM_OPEN ioctl argument type */ +/** +* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl. +* @name: Name of object being opened. +* @handle: Returned handle for the object. +* @size: Returned size of the object +* +* Open an object using the global name, returning a handle and the size. +* +* This handle (of course) holds a reference to the object, so the object +* will not go away until the handle is deleted. +*/ struct drm_gem_open { -/** Name of object being opened */ __u32 name; - -/** Returned handle for the object */ __u32 handle; - -/** Returned size of the object */ __u64 size; };Signature · 1 line
2.34.1
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH 2/2] drm: Move drm_gem ioctl kerneldoc to uapi file
Quoted 13 lines · Simona Vetter
Quoted 12 lines · Christian König
Quoted 11 lines · Simona Vetter
Quoted 5 lines · David Francis
The
drm_gemioctls were documented in internal filedrm_gem.cinstead of uapi headerdrm.h. Move them there and change to appropriate kerneldoc formatting.Signed-off-by David Francis <[email protected]>Thanks a lot for taking care of this!
Reviewed-by Simona Vetter <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I'll leave review for the first patch to folks who care about criu, but it looked good to me too.
I will take that as an Acked-by.
Are you ok that we push this into drm-misc-next by the end of the week when we have the IGT test ready?
Aye, sounds like a plan.
Added the reviews, acks and links to the cover letter to the v2 from this morning and pushed the result to drm-misc-next.
We just haven't been quick enough with the IGT test (which BTW found another bug) to push it earlier.
Fingers crossed that there will be another misc-next pull request before 6.17-rc1.
Regards,
Christian.
Quoted 142 lines
-Sima
Quoted 139 lines
The patches for the CRIU code are ready and IIRC there will be a merge request made, but it will take quite a while until they are actually merged I think.
Christian.
Quoted 130 lines
-Sima
Quoted 127 lines
--- drivers/gpu/drm/drm_gem.c | 30 ----------------------------- include/uapi/drm/drm.h | 40 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 42 deletions(-)drivers/gpu/drm/drm_gem.c +0
-30@@ -820,14 +820,6 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle, }EXPORT_SYMBOL (drm_gem_dma_resv_wait); -/** -* drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Releases the handle to an mm object. -*/ int drm_gem_close_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -843,17 +835,6 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Create a global name for an object, returning the name. -* -* Note that the name does not hold a reference; when the object -* is freed, the name goes away. -*/ int drm_gem_flink_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)@@ -893,17 +874,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,return ret; } -/** -* drm_gem_open_ioctl - implementation of the GEM_OPEN ioctl -* @dev: drm_device -* @data: ioctl data -* @file_priv: drm file-private structure -* -* Open an object using the global name, returning a handle and the size. -* -* This handle (of course) holds a reference to the object, so the object -* will not go away until the handle is deleted. -*/ int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv)include/uapi/drm/drm.h +28
-12@@ -597,31 +597,47 @@ struct drm_set_version {int drm_dd_minor; }; -/* DRM_IOCTL_GEM_CLOSE ioctl argument type */ +/** +* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl. +* @handle: Handle of the object to be closed. +* @pad: Padding. +* +* Releases the handle to an mm object. +*/ struct drm_gem_close { -/** Handle of the object to be closed. */ __u32 handle;__u32 pad; }; -/* DRM_IOCTL_GEM_FLINK ioctl argument type */ +/** +* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl. +* @handle: Handle for the object being named. +* @name: Returned global name. +* +* Create a global name for an object, returning the name. +* +* Note that the name does not hold a reference; when the object +* is freed, the name goes away. +*/ struct drm_gem_flink { -/** Handle for the object being named */ __u32 handle; - -/** Returned global name */ __u32 name; }; -/* DRM_IOCTL_GEM_OPEN ioctl argument type */ +/** +* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl. +* @name: Name of object being opened. +* @handle: Returned handle for the object. +* @size: Returned size of the object +* +* Open an object using the global name, returning a handle and the size. +* +* This handle (of course) holds a reference to the object, so the object +* will not go away until the handle is deleted. +*/ struct drm_gem_open { -/** Name of object being opened */ __u32 name; - -/** Returned handle for the object */ __u32 handle; - -/** Returned size of the object */ __u64 size; };Signature · 1 line
2.34.1