From: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
To: Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
Subject: [PATCH 1/1] linux-user: Add drm ioctls for graphics drivers
Date: Thu, 28 Sep 2023 01:52:59 +0800 [thread overview]
Message-ID: <20230927175408.495872-2-tanxiongchuan@isrc.iscas.ac.cn> (raw)
In-Reply-To: <20230927175408.495872-1-tanxiongchuan@isrc.iscas.ac.cn>
This patch adds more drm-related ioctls to support userland OpenGL and
Vulkan drivers.
Signed-off-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
---
linux-user/ioctls.h | 26 +++++++++++++++
linux-user/syscall_defs.h | 15 ++++++++-
linux-user/syscall_types.h | 68 ++++++++++++++++++++++++++++++++++++++
3 files changed, 108 insertions(+), 1 deletion(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 071f7ca253..e6b946ed26 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -685,6 +685,32 @@
#ifdef HAVE_DRM_H
IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm,
MK_PTR(MK_STRUCT(STRUCT_drm_version)))
+ IOCTL(DRM_IOCTL_GET_MAGIC, IOC_R,
+ MK_PTR(MK_STRUCT(STRUCT_drm_auth)))
+ IOCTL(DRM_IOCTL_GET_CLIENT, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_client)))
+ IOCTL(DRM_IOCTL_GEM_CLOSE, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_drm_gem_close)))
+ IOCTL(DRM_IOCTL_GET_CAP, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_get_cap)))
+ IOCTL(DRM_IOCTL_PRIME_HANDLE_TO_FD, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_prime_handle)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_CREATE, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_create)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_DESTROY, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_destroy)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_handle)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_handle)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_WAIT, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_wait)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_RESET, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_array)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_timeline_wait)))
+ IOCTL(DRM_IOCTL_SYNCOBJ_TRANSFER, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_drm_syncobj_transfer)))
IOCTL_SPECIAL(DRM_IOCTL_I915_GETPARAM, IOC_RW, do_ioctl_drm_i915,
MK_PTR(MK_STRUCT(STRUCT_drm_i915_getparam)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 77ba343c85..be92b5fa6f 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1201,7 +1201,20 @@ struct target_rtc_pll_info {
#define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
/* drm ioctls */
-#define TARGET_DRM_IOCTL_VERSION TARGET_IOWRU('d', 0x00)
+#define TARGET_DRM_IOCTL_VERSION TARGET_IOWRU('d', 0x00)
+#define TARGET_DRM_IOCTL_GET_MAGIC TARGET_IORU('d', 0x02)
+#define TARGET_DRM_IOCTL_GET_CLIENT TARGET_IOWRU('d', 0x05)
+#define TARGET_DRM_IOCTL_GEM_CLOSE TARGET_IOWU('d', 0x09)
+#define TARGET_DRM_IOCTL_GET_CAP TARGET_IOWRU('d', 0x0c)
+#define TARGET_DRM_IOCTL_PRIME_HANDLE_TO_FD TARGET_IOWRU('d', 0x2d)
+#define TARGET_DRM_IOCTL_SYNCOBJ_CREATE TARGET_IOWRU('d', 0xbf)
+#define TARGET_DRM_IOCTL_SYNCOBJ_DESTROY TARGET_IOWRU('d', 0xc0)
+#define TARGET_DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD TARGET_IOWRU('d', 0xc1)
+#define TARGET_DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE TARGET_IOWRU('d', 0xc2)
+#define TARGET_DRM_IOCTL_SYNCOBJ_WAIT TARGET_IOWRU('d', 0xc3)
+#define TARGET_DRM_IOCTL_SYNCOBJ_RESET TARGET_IOWRU('d', 0xc4)
+#define TARGET_DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT TARGET_IOWRU('d', 0xca)
+#define TARGET_DRM_IOCTL_SYNCOBJ_TRANSFER TARGET_IOWRU('d', 0xcc)
/* drm i915 ioctls */
#define TARGET_DRM_IOCTL_I915_GETPARAM TARGET_IOWRU('d', 0x46)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index c3b43f8022..dcc1f14e11 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -331,6 +331,74 @@ STRUCT(drm_version,
TYPE_ULONG, /* desc_len */
TYPE_PTRVOID) /* desc */
+STRUCT(drm_auth,
+ TYPE_INT) /* magic */
+
+STRUCT(drm_client,
+ TYPE_INT, /* idx */
+ TYPE_INT, /* auth */
+ TYPE_ULONG, /* pid */
+ TYPE_ULONG, /* uid */
+ TYPE_ULONG, /* magic */
+ TYPE_ULONG) /* iocs */
+
+STRUCT(drm_gem_close,
+ TYPE_INT, /* handle */
+ TYPE_INT) /* pad */
+
+STRUCT(drm_get_cap,
+ TYPE_ULONGLONG, /* capability */
+ TYPE_ULONGLONG) /* value */
+
+STRUCT(drm_prime_handle,
+ TYPE_INT, /* handle */
+ TYPE_INT, /* flags */
+ TYPE_INT) /* fd */
+
+STRUCT(drm_syncobj_create,
+ TYPE_INT, /* handle */
+ TYPE_INT) /* flags */
+
+STRUCT(drm_syncobj_destroy,
+ TYPE_INT, /* handle */
+ TYPE_INT) /* pad */
+
+STRUCT(drm_syncobj_handle,
+ TYPE_INT, /* handle */
+ TYPE_INT, /* flags */
+ TYPE_INT, /* fd */
+ TYPE_INT) /* pad */
+
+STRUCT(drm_syncobj_transfer,
+ TYPE_INT, /* src_handle */
+ TYPE_INT, /* dst_handle */
+ TYPE_ULONGLONG, /* src_point */
+ TYPE_ULONGLONG, /* dst_point */
+ TYPE_INT, /* flags */
+ TYPE_INT) /* pad */
+
+STRUCT(drm_syncobj_wait,
+ TYPE_ULONGLONG, /* handles */
+ TYPE_LONGLONG, /* timeout_nsec */
+ TYPE_INT, /* count_handles */
+ TYPE_INT, /* flags */
+ TYPE_INT, /* first_signaled */
+ TYPE_INT) /* pad */
+
+STRUCT(drm_syncobj_timeline_wait,
+ TYPE_ULONGLONG, /* handles */
+ TYPE_ULONGLONG, /* points */
+ TYPE_LONGLONG, /* timeout_nsec */
+ TYPE_INT, /* count_handles */
+ TYPE_INT, /* flags */
+ TYPE_INT, /* first_signaled */
+ TYPE_INT) /* pad */
+
+STRUCT(drm_syncobj_array,
+ TYPE_ULONGLONG, /* handles */
+ TYPE_INT, /* count_handles */
+ TYPE_INT) /* pad */
+
STRUCT(drm_i915_getparam,
TYPE_INT, /* param */
TYPE_PTRVOID) /* value */
--
2.42.0
prev parent reply other threads:[~2023-09-27 17:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 17:52 [PATCH 0/1] linux-user: Add drm ioctls for userland graphics drivers Xiongchuan Tan
2023-09-27 17:52 ` Xiongchuan Tan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230927175408.495872-2-tanxiongchuan@isrc.iscas.ac.cn \
--to=tanxiongchuan@isrc.iscas.ac.cn \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).