Skip to content

Commit f8950b4

Browse files
committed
tools headers UAPI: Update tools's copy of drm.h to pick DRM_IOCTL_GEM_CHANGE_HANDLE
Picking the changes from: 0864197 ("drm: Move drm_gem ioctl kerneldoc to uapi file") 5309672 ("drm: Add DRM prime interface to reassign GEM handle") Addressing these perf build warnings: Warning: Kernel ABI header differences: Now 'perf trace' and other code that might use the tools/perf/trace/beauty autogenerated tables will be able to translate this new ioctl command into a string: $ tools/perf/trace/beauty/drm_ioctl.sh > before $ cp include/uapi/drm/drm.h tools/include/uapi/drm/drm.h $ tools/perf/trace/beauty/drm_ioctl.sh > after $ diff -u before after --- before 2025-11-03 09:57:34.832553174 -0300 +++ after 2025-11-03 09:57:47.969409428 -0300 @@ -111,6 +111,7 @@ [0xCF] = "SYNCOBJ_EVENTFD", [0xD0] = "MODE_CLOSEFB", [0xD1] = "SET_CLIENT_NAME", + [0xD2] = "GEM_CHANGE_HANDLE", [DRM_COMMAND_BASE + 0x00] = "I915_INIT", [DRM_COMMAND_BASE + 0x01] = "I915_FLUSH", [DRM_COMMAND_BASE + 0x02] = "I915_FLIP", $ Please see tools/include/uapi/README for further details. Cc: Christian König <[email protected]> Cc: David Francis <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ccaba80 commit f8950b4

1 file changed

Lines changed: 51 additions & 12 deletions

File tree

  • tools/include/uapi/drm

tools/include/uapi/drm/drm.h

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -597,34 +597,65 @@ struct drm_set_version {
597597
int drm_dd_minor;
598598
};
599599

600-
/* DRM_IOCTL_GEM_CLOSE ioctl argument type */
600+
/**
601+
* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl.
602+
* @handle: Handle of the object to be closed.
603+
* @pad: Padding.
604+
*
605+
* Releases the handle to an mm object.
606+
*/
601607
struct drm_gem_close {
602-
/** Handle of the object to be closed. */
603608
__u32 handle;
604609
__u32 pad;
605610
};
606611

607-
/* DRM_IOCTL_GEM_FLINK ioctl argument type */
612+
/**
613+
* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl.
614+
* @handle: Handle for the object being named.
615+
* @name: Returned global name.
616+
*
617+
* Create a global name for an object, returning the name.
618+
*
619+
* Note that the name does not hold a reference; when the object
620+
* is freed, the name goes away.
621+
*/
608622
struct drm_gem_flink {
609-
/** Handle for the object being named */
610623
__u32 handle;
611-
612-
/** Returned global name */
613624
__u32 name;
614625
};
615626

616-
/* DRM_IOCTL_GEM_OPEN ioctl argument type */
627+
/**
628+
* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl.
629+
* @name: Name of object being opened.
630+
* @handle: Returned handle for the object.
631+
* @size: Returned size of the object
632+
*
633+
* Open an object using the global name, returning a handle and the size.
634+
*
635+
* This handle (of course) holds a reference to the object, so the object
636+
* will not go away until the handle is deleted.
637+
*/
617638
struct drm_gem_open {
618-
/** Name of object being opened */
619639
__u32 name;
620-
621-
/** Returned handle for the object */
622640
__u32 handle;
623-
624-
/** Returned size of the object */
625641
__u64 size;
626642
};
627643

644+
/**
645+
* struct drm_gem_change_handle - Argument for &DRM_IOCTL_GEM_CHANGE_HANDLE ioctl.
646+
* @handle: The handle of a gem object.
647+
* @new_handle: An available gem handle.
648+
*
649+
* This ioctl changes the handle of a GEM object to the specified one.
650+
* The new handle must be unused. On success the old handle is closed
651+
* and all further IOCTL should refer to the new handle only.
652+
* Calls to DRM_IOCTL_PRIME_FD_TO_HANDLE will return the new handle.
653+
*/
654+
struct drm_gem_change_handle {
655+
__u32 handle;
656+
__u32 new_handle;
657+
};
658+
628659
/**
629660
* DRM_CAP_DUMB_BUFFER
630661
*
@@ -1309,6 +1340,14 @@ extern "C" {
13091340
*/
13101341
#define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name)
13111342

1343+
/**
1344+
* DRM_IOCTL_GEM_CHANGE_HANDLE - Move an object to a different handle
1345+
*
1346+
* Some applications (notably CRIU) need objects to have specific gem handles.
1347+
* This ioctl changes the object at one gem handle to use a new gem handle.
1348+
*/
1349+
#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle)
1350+
13121351
/*
13131352
* Device specific ioctls should only be in their respective headers
13141353
* The device specific ioctl range is from 0x40 to 0x9f.

0 commit comments

Comments
 (0)