Commit e6232180 authored by Yanteng Si's avatar Yanteng Si Committed by Arnaldo Carvalho de Melo
Browse files

tools headers UAPI: Sync the drm/drm.h with the kernel sources



Picking the changes from:

  60687716 ("drm: document DRM_IOCTL_PRIME_HANDLE_TO_FD and PRIME_FD_TO_HANDLE")
  61a55f8b ("drm: document expectations for GETFB2 handles")
  158350aa ("drm: document DRM_IOCTL_GEM_CLOSE")

Silencing these perf build warnings:

  Warning: Kernel ABI header at 'tools/include/uapi/drm/drm.h' differs from latest version at 'include/uapi/drm/drm.h'
  diff -u tools/include/uapi/drm/drm.h include/uapi/drm/drm.h

No changes in tooling as these are just C comment documentation changes.

Signed-off-by: default avatarYanteng Si <siyanteng@loongson.cn>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: loongson-kernel@lists.loongnix.cn
Link: https://lore.kernel.org/r/7552c61660bf079f2979fdcbcef8e921255f877a.1683712945.git.siyanteng@loongson.cn


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5d1ac59f
Loading
Loading
Loading
Loading
+55 −2
Original line number Diff line number Diff line
@@ -972,6 +972,19 @@ extern "C" {
#define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, struct drm_stats)
#define DRM_IOCTL_SET_VERSION		DRM_IOWR(0x07, struct drm_set_version)
#define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08, struct drm_modeset_ctl)
/**
 * DRM_IOCTL_GEM_CLOSE - Close a GEM handle.
 *
 * GEM handles are not reference-counted by the kernel. User-space is
 * responsible for managing their lifetime. For example, if user-space imports
 * the same memory object twice on the same DRM file description, the same GEM
 * handle is returned by both imports, and user-space needs to ensure
 * &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen
 * when a memory object is allocated, then exported and imported again on the
 * same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception
 * and always returns fresh new GEM handles even if an existing GEM handle
 * already refers to the same memory object before the IOCTL is performed.
 */
#define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
#define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
#define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
@@ -1012,7 +1025,37 @@ extern "C" {
#define DRM_IOCTL_UNLOCK		DRM_IOW( 0x2b, struct drm_lock)
#define DRM_IOCTL_FINISH		DRM_IOW( 0x2c, struct drm_lock)

/**
 * DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD.
 *
 * User-space sets &drm_prime_handle.handle with the GEM handle to export and
 * &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in
 * &drm_prime_handle.fd.
 *
 * The export can fail for any driver-specific reason, e.g. because export is
 * not supported for this specific GEM handle (but might be for others).
 *
 * Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT.
 */
#define DRM_IOCTL_PRIME_HANDLE_TO_FD    DRM_IOWR(0x2d, struct drm_prime_handle)
/**
 * DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle.
 *
 * User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to
 * import, and gets back a GEM handle in &drm_prime_handle.handle.
 * &drm_prime_handle.flags is unused.
 *
 * If an existing GEM handle refers to the memory object backing the DMA-BUF,
 * that GEM handle is returned. Therefore user-space which needs to handle
 * arbitrary DMA-BUFs must have a user-space lookup data structure to manually
 * reference-count duplicated GEM handles. For more information see
 * &DRM_IOCTL_GEM_CLOSE.
 *
 * The import can fail for any driver-specific reason, e.g. because import is
 * only supported for DMA-BUFs allocated on this DRM device.
 *
 * Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT.
 */
#define DRM_IOCTL_PRIME_FD_TO_HANDLE    DRM_IOWR(0x2e, struct drm_prime_handle)

#define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
@@ -1104,8 +1147,13 @@ extern "C" {
 * struct as the output.
 *
 * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
 * will be filled with GEM buffer handles. Planes are valid until one has a
 * zero handle -- this can be used to compute the number of planes.
 * will be filled with GEM buffer handles. Fresh new GEM handles are always
 * returned, even if another GEM handle referring to the same memory object
 * already exists on the DRM file description. The caller is responsible for
 * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same
 * new handle will be returned for multiple planes in case they use the same
 * memory object. Planes are valid until one has a zero handle -- this can be
 * used to compute the number of planes.
 *
 * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
 * until one has a zero &drm_mode_fb_cmd2.pitches.
@@ -1113,6 +1161,11 @@ extern "C" {
 * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set
 * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the
 * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.
 *
 * To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space
 * can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately
 * close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not
 * double-close handles which are specified multiple times in the array.
 */
#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)