qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] linux-user: Add compile flag for amdgpu drm support


From: Xiongchuan Tan
Subject: [PATCH 1/3] linux-user: Add compile flag for amdgpu drm support
Date: Mon, 10 Apr 2023 18:11:16 +0800

Signed-off-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
---
 configure                 |  2 ++
 linux-user/ioctls.h       |  4 ++++
 linux-user/syscall.c      | 10 ++++++++++
 linux-user/syscall_defs.h |  5 +++++
 meson.build               |  1 +
 meson_options.txt         |  3 +++
 6 files changed, 25 insertions(+)

diff --git a/configure b/configure
index 800b5850f4..a93f5426ef 100755
--- a/configure
+++ b/configure
@@ -836,6 +836,8 @@ for opt do
   ;;
   --enable-linux-user) linux_user="yes"
   ;;
+  --enable-linux-user-drm-amdgpu) meson_option_add "-Ddrm_amdgpu=true"
+  ;;
   --disable-bsd-user) bsd_user="no"
   ;;
   --enable-bsd-user) bsd_user="yes"
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 071f7ca253..54b44a29a9 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -686,8 +686,12 @@
   IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm,
                 MK_PTR(MK_STRUCT(STRUCT_drm_version)))
 
+#ifdef CONFIG_DRM_AMDGPU
+#else
   IOCTL_SPECIAL(DRM_IOCTL_I915_GETPARAM, IOC_RW, do_ioctl_drm_i915,
                 MK_PTR(MK_STRUCT(STRUCT_drm_i915_getparam)))
+#endif /* CONFIG_DRM_AMDGPU */
+
 #endif
 
 #ifdef TARGET_TIOCSTART
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 69f740ff98..bb0db61990 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -123,8 +123,12 @@
 #endif
 #ifdef HAVE_DRM_H
 #include <libdrm/drm.h>
+#ifdef CONFIG_DRM_AMDGPU
+#include <libdrm/amdgpu_drm.h>
+#else
 #include <libdrm/i915_drm.h>
 #endif
+#endif
 #include "linux_loop.h"
 #include "uname.h"
 
@@ -5648,6 +5652,10 @@ static abi_long do_ioctl_drm(const IOCTLEntry *ie, 
uint8_t *buf_temp,
     return -TARGET_ENOSYS;
 }
 
+#ifdef CONFIG_DRM_AMDGPU
+
+#else
+
 static abi_long do_ioctl_drm_i915_getparam(const IOCTLEntry *ie,
                                            struct drm_i915_getparam *gparam,
                                            int fd, abi_long arg)
@@ -5682,6 +5690,8 @@ static abi_long do_ioctl_drm_i915(const IOCTLEntry *ie, 
uint8_t *buf_temp,
     }
 }
 
+#endif /* CONFIG_DRM_AMDGPU */
+
 #endif
 
 static abi_long do_ioctl_TUNSETTXFILTER(const IOCTLEntry *ie, uint8_t 
*buf_temp,
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index cc37054cb5..e435649693 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1227,9 +1227,14 @@ struct target_rtc_pll_info {
 /* drm ioctls */
 #define TARGET_DRM_IOCTL_VERSION      TARGET_IOWRU('d', 0x00)
 
+#ifdef CONFIG_DRM_AMDGPU
+
+#else
 /* drm i915 ioctls */
 #define TARGET_DRM_IOCTL_I915_GETPARAM              TARGET_IOWRU('d', 0x46)
 
+#endif /* CONFIG_DRM_AMDGPU */
+
 /* from asm/termbits.h */
 
 #define TARGET_NCC 8
diff --git a/meson.build b/meson.build
index c44d05a13f..841306f414 100644
--- a/meson.build
+++ b/meson.build
@@ -1962,6 +1962,7 @@ config_host_data.set('CONFIG_GPROF', get_option('gprof'))
 config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', 
get_option('live_block_migration').allowed())
 config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug'))
 config_host_data.set('CONFIG_REPLICATION', get_option('replication').allowed())
+config_host_data.set('CONFIG_DRM_AMDGPU', get_option('drm_amdgpu'))
 
 # has_header
 config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h'))
diff --git a/meson_options.txt b/meson_options.txt
index fc9447d267..f85f76f355 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -327,3 +327,6 @@ option('slirp_smbd', type : 'feature', value : 'auto',
 
 option('hexagon_idef_parser', type : 'boolean', value : true,
        description: 'use idef-parser to automatically generate TCG code for 
the Hexagon frontend')
+
+option('drm_amdgpu', type : 'boolean', value: false,
+       description: 'drm amdgpu ioctl support')
\ No newline at end of file
-- 
2.40.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]