From 4e6a4d9b69cf5cb1a78ba679a6852578a6644008 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 2 Oct 2024 13:43:43 -0700 Subject: [PATCH 1/6] Linux: Update drm-headers to v6.11 --- External/drm-headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/drm-headers b/External/drm-headers index 34a20394f7..8efb6dc03f 160000 --- a/External/drm-headers +++ b/External/drm-headers @@ -1 +1 @@ -Subproject commit 34a20394f712bfa8eaacafa01b27759e246ee1d7 +Subproject commit 8efb6dc03fef5dacec1aab989f067ce6f82f0710 From 6dd72a09e5a150d16cd72c310047e2dcb8150c7c Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 2 Oct 2024 14:25:59 -0700 Subject: [PATCH 2/6] Scripts: Fixes newer clang-python It provided this in the newer clang-python --- Scripts/StructPackVerifier.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Scripts/StructPackVerifier.py b/Scripts/StructPackVerifier.py index 4716e79763..c8c534b29a 100755 --- a/Scripts/StructPackVerifier.py +++ b/Scripts/StructPackVerifier.py @@ -23,8 +23,11 @@ # C++2a std::bit_cast expression. CursorKind.BUILTINBITCASTEXPR = CursorKind(280) -# a concept declaration. -CursorKind.CONCEPTDECL = CursorKind(604), +try: + # a concept declaration. + CursorKind.CONCEPTDECL = CursorKind(604), +except: + pass @dataclass class TypeDefinition: From 2c7896bce4d7428ec4669167e0f3688ce5c91c87 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 2 Oct 2024 14:26:30 -0700 Subject: [PATCH 3/6] IoctlEmulation: Update v3d_drm --- Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/v3d_drm.inl | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/v3d_drm.inl b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/v3d_drm.inl index fbbf19f7e6..193cc1ed2e 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/v3d_drm.inl +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/v3d_drm.inl @@ -10,3 +10,4 @@ _BASIC_META(DRM_IOCTL_V3D_PERFMON_CREATE) _BASIC_META(DRM_IOCTL_V3D_PERFMON_DESTROY) _BASIC_META(DRM_IOCTL_V3D_PERFMON_GET_VALUES) _BASIC_META(DRM_IOCTL_V3D_SUBMIT_CPU) +_BASIC_META(DRM_IOCTL_V3D_PERFMON_GET_COUNTER) From 5aff16f72bf38231158a1229966ac237bba6c273 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 2 Oct 2024 14:26:38 -0700 Subject: [PATCH 4/6] IoctlEmulation: Update xe_drm --- Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/xe_drm.inl | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/xe_drm.inl b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/xe_drm.inl index 5fb38c217f..6d48cbfc61 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/xe_drm.inl +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/xe_drm.inl @@ -9,3 +9,4 @@ _BASIC_META(DRM_IOCTL_XE_EXEC_QUEUE_DESTROY) _BASIC_META(DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY) _BASIC_META(DRM_IOCTL_XE_EXEC) _BASIC_META(DRM_IOCTL_XE_WAIT_USER_FENCE) +_BASIC_META(DRM_IOCTL_XE_OBSERVATION) From 0cd6371c1b3f1273b4c7cd79da673f3f6e67f28d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 2 Oct 2024 14:27:24 -0700 Subject: [PATCH 5/6] IoctlEmulation: Add panthor_drm --- .../LinuxEmulation/LinuxSyscalls/x32/Ioctl/drm.h | 2 ++ .../LinuxSyscalls/x32/Ioctl/panthor_drm.inl | 13 +++++++++++++ .../LinuxSyscalls/x32/IoctlEmulation.cpp | 1 + 3 files changed, 16 insertions(+) create mode 100644 Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/panthor_drm.inl diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/drm.h b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/drm.h index 521179b6f5..478b27fdd0 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/drm.h +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/drm.h @@ -21,6 +21,7 @@ extern "C" { #include "fex-drm/radeon_drm.h" #include "fex-drm/vc4_drm.h" #include "fex-drm/v3d_drm.h" +#include "fex-drm/panthor_drm.h" #include "fex-drm/pvr_drm.h" #include "fex-drm/virtgpu_drm.h" #include "fex-drm/xe_drm.h" @@ -1278,6 +1279,7 @@ namespace V3D { #include "LinuxSyscalls/x32/Ioctl/radeon_drm.inl" #include "LinuxSyscalls/x32/Ioctl/vc4_drm.inl" #include "LinuxSyscalls/x32/Ioctl/v3d_drm.inl" +#include "LinuxSyscalls/x32/Ioctl/panthor_drm.inl" #include "LinuxSyscalls/x32/Ioctl/pvr_drm.inl" #include "LinuxSyscalls/x32/Ioctl/xe_drm.inl" } // namespace FEX::HLE::x32 diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/panthor_drm.inl b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/panthor_drm.inl new file mode 100644 index 0000000000..8953ffdf09 --- /dev/null +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Ioctl/panthor_drm.inl @@ -0,0 +1,13 @@ +_BASIC_META(DRM_IOCTL_PANTHOR_DEV_QUERY) +_BASIC_META(DRM_IOCTL_PANTHOR_VM_CREATE) +_BASIC_META(DRM_IOCTL_PANTHOR_VM_DESTROY) +_BASIC_META(DRM_IOCTL_PANTHOR_VM_BIND) +_BASIC_META(DRM_IOCTL_PANTHOR_VM_GET_STATE) +_BASIC_META(DRM_IOCTL_PANTHOR_BO_CREATE) +_BASIC_META(DRM_IOCTL_PANTHOR_BO_MMAP_OFFSET) +_BASIC_META(DRM_IOCTL_PANTHOR_GROUP_CREATE) +_BASIC_META(DRM_IOCTL_PANTHOR_GROUP_DESTROY) +_BASIC_META(DRM_IOCTL_PANTHOR_GROUP_SUBMIT) +_BASIC_META(DRM_IOCTL_PANTHOR_GROUP_GET_STATE) +_BASIC_META(DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE) +_BASIC_META(DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY) diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp index 7c89605f00..d29d8c1064 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp @@ -730,6 +730,7 @@ std::array Handlers = []() consteval { #include "LinuxSyscalls/x32/Ioctl/vc4_drm.inl" #include "LinuxSyscalls/x32/Ioctl/v3d_drm.inl" #include "LinuxSyscalls/x32/Ioctl/virtio_drm.inl" +#include "LinuxSyscalls/x32/Ioctl/panthor_drm.inl" #include "LinuxSyscalls/x32/Ioctl/pvr_drm.inl" #include "LinuxSyscalls/x32/Ioctl/xe_drm.inl" From 0c8cfa7bb203404463c9d24da9c57c1352355600 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 2 Oct 2024 14:28:23 -0700 Subject: [PATCH 6/6] IoctlEmulation: Update AssignDeviceTypeToFD Adds known good drivers to remove a log. --- .../LinuxSyscalls/x32/IoctlEmulation.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp index d29d8c1064..a05d65d026 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/x32/IoctlEmulation.cpp @@ -577,28 +577,32 @@ namespace DRM { void AssignDeviceTypeToFD(int fd, const drm_version& Version) { if (Version.name) { - if (strncmp(Version.name, "amdgpu", Version.name_len) == 0) { + const std::string_view Name(Version.name, Version.name_len); + if (Name == "amdgpu") { FDToHandler.SetFDHandler(fd, AMDGPU_Handler); - } else if (strncmp(Version.name, "radeon", Version.name_len) == 0) { + } else if (Name == "radeon") { FDToHandler.SetFDHandler(fd, RADEON_Handler); - } else if (strncmp(Version.name, "msm", Version.name_len) == 0) { + } else if (Name == "msm") { FDToHandler.SetFDHandler(fd, MSM_Handler); - } else if (strncmp(Version.name, "nouveau", Version.name_len) == 0) { + } else if (Name == "nouveau") { FDToHandler.SetFDHandler(fd, Nouveau_Handler); - } else if (strncmp(Version.name, "i915", Version.name_len) == 0) { + } else if (Name == "i915") { FDToHandler.SetFDHandler(fd, I915_Handler); - } else if (strncmp(Version.name, "panfrost", Version.name_len) == 0) { + } else if (Name == "panfrost") { FDToHandler.SetFDHandler(fd, Panfrost_Handler); - } else if (strncmp(Version.name, "lima", Version.name_len) == 0) { + } else if (Name == "lima") { FDToHandler.SetFDHandler(fd, Lima_Handler); - } else if (strncmp(Version.name, "vc4", Version.name_len) == 0) { + } else if (Name == "vc4") { FDToHandler.SetFDHandler(fd, VC4_Handler); - } else if (strncmp(Version.name, "v3d", Version.name_len) == 0) { + } else if (Name == "v3d") { FDToHandler.SetFDHandler(fd, V3D_Handler); - } else if (strncmp(Version.name, "virtio_gpu", Version.name_len) == 0) { + } else if (Name == "virtio_gpu") { FDToHandler.SetFDHandler(fd, Virtio_Handler); } else { - LogMan::Msg::IFmt("Unknown DRM device: '{}'. Using default passthrough", Version.name); + // Known safe drm drivers. + if (!(Name == "asahi" || Name == "panthor" || Name == "xe")) { + LogMan::Msg::IFmt("Unknown DRM device: '{}'. Using default passthrough", Version.name); + } FDToHandler.SetFDHandler(fd, Default_Handler); } }