From dc39eda42be103adbe901c6aecd98e6c899c8ebe Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Thu, 1 Jan 2026 13:42:08 +0200 Subject: [PATCH] treewide: Move the dri2 extension to Xext and use it for all X servers This is needed to get proton working in Xfbdev, but is probably useful in other places too. Xephyr has some unrelated issues regaring Xinput, so steam doesn't work there. Signed-off-by: stefan11111 --- {hw/xfree86 => Xext}/dri2/dri2.c | 16 ++++++++++++---- {hw/xfree86 => Xext}/dri2/dri2.h | 0 {hw/xfree86 => Xext}/dri2/dri2_priv.h | 0 {hw/xfree86 => Xext}/dri2/dri2ext.c | 10 ++++------ {hw/xfree86 => Xext}/dri2/dri2int.h | 0 Xext/dri2/meson.build | 18 ++++++++++++++++++ .../dri2/pci_ids/i810_pci_ids.h | 0 .../dri2/pci_ids/i915_pci_ids.h | 0 .../dri2/pci_ids/i965_pci_ids.h | 0 .../dri2/pci_ids/pci_id_driver_map.h | 0 .../dri2/pci_ids/r200_pci_ids.h | 0 .../dri2/pci_ids/r300_pci_ids.h | 0 .../dri2/pci_ids/r600_pci_ids.h | 0 .../dri2/pci_ids/radeon_pci_ids.h | 0 .../dri2/pci_ids/radeonsi_pci_ids.h | 0 .../dri2/pci_ids/virtio_gpu_pci_ids.h | 0 .../dri2/pci_ids/vmwgfx_pci_ids.h | 0 Xext/meson.build | 1 + hw/kdrive/fbdev/fbinit.c | 15 +-------------- hw/xfree86/common/xf86Extensions.c | 8 -------- hw/xfree86/common/xf86Extensions.h | 6 ------ hw/xfree86/dri2/meson.build | 16 ---------------- hw/xfree86/meson.build | 7 ------- meson.build | 2 ++ mi/miinitext.c | 3 +++ miext/extinit_priv.h | 6 ++++++ 26 files changed, 47 insertions(+), 61 deletions(-) rename {hw/xfree86 => Xext}/dri2/dri2.c (99%) rename {hw/xfree86 => Xext}/dri2/dri2.h (100%) rename {hw/xfree86 => Xext}/dri2/dri2_priv.h (100%) rename {hw/xfree86 => Xext}/dri2/dri2ext.c (99%) rename {hw/xfree86 => Xext}/dri2/dri2int.h (100%) create mode 100644 Xext/dri2/meson.build rename {hw/xfree86 => Xext}/dri2/pci_ids/i810_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/i915_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/i965_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/pci_id_driver_map.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/r200_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/r300_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/r600_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/radeon_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/radeonsi_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/virtio_gpu_pci_ids.h (100%) rename {hw/xfree86 => Xext}/dri2/pci_ids/vmwgfx_pci_ids.h (100%) delete mode 100644 hw/xfree86/dri2/meson.build diff --git a/hw/xfree86/dri2/dri2.c b/Xext/dri2/dri2.c similarity index 99% rename from hw/xfree86/dri2/dri2.c rename to Xext/dri2/dri2.c index f55659b53..e1f6e3ed9 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/Xext/dri2/dri2.c @@ -30,9 +30,7 @@ * Kristian Høgsberg (krh@redhat.com) */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif +#include #include @@ -49,7 +47,17 @@ #include "dri2_priv.h" #include "dri2int.h" #include "damage.h" -#include "xf86.h" + +/* needs xf86.h otherwise */ +/* format is treated as part of the varargs to swallow the comma */ +#define xf86DrvMsg(scrnIndex, type, /* format, */ ...) \ + do { \ + (void)scrnIndex; \ + if (type == X_ERROR) { \ + printf(__VA_ARGS__); \ + } \ + } while (0); + CARD8 dri2_major; /* version of DRI2 supported by DDX */ CARD8 dri2_minor; diff --git a/hw/xfree86/dri2/dri2.h b/Xext/dri2/dri2.h similarity index 100% rename from hw/xfree86/dri2/dri2.h rename to Xext/dri2/dri2.h diff --git a/hw/xfree86/dri2/dri2_priv.h b/Xext/dri2/dri2_priv.h similarity index 100% rename from hw/xfree86/dri2/dri2_priv.h rename to Xext/dri2/dri2_priv.h diff --git a/hw/xfree86/dri2/dri2ext.c b/Xext/dri2/dri2ext.c similarity index 99% rename from hw/xfree86/dri2/dri2ext.c rename to Xext/dri2/dri2ext.c index d19211be9..3ec3ecaae 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/Xext/dri2/dri2ext.c @@ -30,9 +30,7 @@ * Kristian Høgsberg (krh@redhat.com) */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif +#include #include #include @@ -52,9 +50,9 @@ #include "dri2int.h" #include "protocol-versions.h" -/* The only xf86 includes */ -#include "xf86Module.h" -#include "xf86Extensions.h" +/* For the static extension loader */ +Bool noDRI2Extension = FALSE; +void DRI2ExtensionInit(void); static int DRI2EventBase; diff --git a/hw/xfree86/dri2/dri2int.h b/Xext/dri2/dri2int.h similarity index 100% rename from hw/xfree86/dri2/dri2int.h rename to Xext/dri2/dri2int.h diff --git a/Xext/dri2/meson.build b/Xext/dri2/meson.build new file mode 100644 index 000000000..164997f36 --- /dev/null +++ b/Xext/dri2/meson.build @@ -0,0 +1,18 @@ +srcs_dri2 = [ + 'dri2.c', + 'dri2ext.c', +] + + +libxserver_dri2 = [] +if build_dri2 +libxserver_dri2 = static_library('xserver_dri2', + srcs_dri2, + include_directories: inc, + dependencies: [ common_dep, libdrm_dep ], +) +endif + +if build_xorg +install_data('dri2.h', install_dir: xorgsdkdir) +endif diff --git a/hw/xfree86/dri2/pci_ids/i810_pci_ids.h b/Xext/dri2/pci_ids/i810_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/i810_pci_ids.h rename to Xext/dri2/pci_ids/i810_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/i915_pci_ids.h b/Xext/dri2/pci_ids/i915_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/i915_pci_ids.h rename to Xext/dri2/pci_ids/i915_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/i965_pci_ids.h b/Xext/dri2/pci_ids/i965_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/i965_pci_ids.h rename to Xext/dri2/pci_ids/i965_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h b/Xext/dri2/pci_ids/pci_id_driver_map.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/pci_id_driver_map.h rename to Xext/dri2/pci_ids/pci_id_driver_map.h diff --git a/hw/xfree86/dri2/pci_ids/r200_pci_ids.h b/Xext/dri2/pci_ids/r200_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/r200_pci_ids.h rename to Xext/dri2/pci_ids/r200_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/r300_pci_ids.h b/Xext/dri2/pci_ids/r300_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/r300_pci_ids.h rename to Xext/dri2/pci_ids/r300_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/r600_pci_ids.h b/Xext/dri2/pci_ids/r600_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/r600_pci_ids.h rename to Xext/dri2/pci_ids/r600_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/radeon_pci_ids.h b/Xext/dri2/pci_ids/radeon_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/radeon_pci_ids.h rename to Xext/dri2/pci_ids/radeon_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h b/Xext/dri2/pci_ids/radeonsi_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h rename to Xext/dri2/pci_ids/radeonsi_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/virtio_gpu_pci_ids.h b/Xext/dri2/pci_ids/virtio_gpu_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/virtio_gpu_pci_ids.h rename to Xext/dri2/pci_ids/virtio_gpu_pci_ids.h diff --git a/hw/xfree86/dri2/pci_ids/vmwgfx_pci_ids.h b/Xext/dri2/pci_ids/vmwgfx_pci_ids.h similarity index 100% rename from hw/xfree86/dri2/pci_ids/vmwgfx_pci_ids.h rename to Xext/dri2/pci_ids/vmwgfx_pci_ids.h diff --git a/Xext/meson.build b/Xext/meson.build index 0eeacf87b..7fec3ab2b 100644 --- a/Xext/meson.build +++ b/Xext/meson.build @@ -66,3 +66,4 @@ if build_xorg endif subdir('damage') +subdir('dri2') diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c index fc13087ad..d539fb733 100644 --- a/hw/kdrive/fbdev/fbinit.c +++ b/hw/kdrive/fbdev/fbinit.c @@ -22,7 +22,7 @@ #include #include "fbdev.h" -#include "miext/extinit_priv.h" + #include "os/cmdline.h" #include "os/ddx_priv.h" @@ -32,18 +32,6 @@ InitCard(char *name) KdCardInfoAdd(&fbdevFuncs, 0); } -static const ExtensionModule ephyrExtensions[] = { -#ifdef GLXEXT - { GlxExtensionInit, "GLX", &noGlxExtension }, -#endif -}; - -static -void ephyrExtensionInit(void) -{ - LoadExtensionList(ephyrExtensions, ARRAY_SIZE(ephyrExtensions), TRUE); -} - #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ @@ -56,7 +44,6 @@ ddxInputThreadInit(void) void InitOutput(int argc, char **argv) { - ephyrExtensionInit(); KdInitOutput(argc, argv); } diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c index 2e898fd80..cfd2f242b 100644 --- a/hw/xfree86/common/xf86Extensions.c +++ b/hw/xfree86/common/xf86Extensions.c @@ -53,7 +53,6 @@ Bool noXFree86VidModeExtension = FALSE; Bool noXFree86DGAExtension = FALSE; Bool noXFree86DRIExtension = FALSE; -Bool noDRI2Extension = FALSE; /* * DDX-specific extensions. @@ -80,13 +79,6 @@ static const ExtensionModule extensionModules[] = { &noXFree86DRIExtension }, #endif -#ifdef DRI2 - { - DRI2ExtensionInit, - DRI2_NAME, - &noDRI2Extension - } -#endif }; static void diff --git a/hw/xfree86/common/xf86Extensions.h b/hw/xfree86/common/xf86Extensions.h index 6b5024c01..28d0819be 100644 --- a/hw/xfree86/common/xf86Extensions.h +++ b/hw/xfree86/common/xf86Extensions.h @@ -33,12 +33,6 @@ extern Bool noXFree86DRIExtension; void XFree86DRIExtensionInit(void); #endif -#ifdef DRI2 -#include -extern Bool noDRI2Extension; -void DRI2ExtensionInit(void); -#endif - #ifdef XF86VIDMODE #include extern Bool noXFree86VidModeExtension; diff --git a/hw/xfree86/dri2/meson.build b/hw/xfree86/dri2/meson.build deleted file mode 100644 index 087a21131..000000000 --- a/hw/xfree86/dri2/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -srcs_xorg_dri2 = [ - 'dri2.c', - 'dri2ext.c', -] - -xorg_dri2 = static_library('xorg_dri2', - srcs_xorg_dri2, - include_directories: [inc, xorg_inc], - dependencies: [ - common_dep, - libdrm_dep, - ], - c_args: xorg_c_args, -) - -install_data('dri2.h', install_dir: xorgsdkdir) diff --git a/hw/xfree86/meson.build b/hw/xfree86/meson.build index 4bf1dddaf..f83a53546 100644 --- a/hw/xfree86/meson.build +++ b/hw/xfree86/meson.build @@ -4,7 +4,6 @@ module_abi_dir = join_paths(module_dir, module_abi_tag) xorg_inc = include_directories( 'common', 'ddc', - 'dri2', 'i2c', 'int10', 'loader', @@ -33,9 +32,6 @@ subdir('ddc') if build_dri1 subdir('dri') endif -if build_dri2 - subdir('dri2') -endif subdir('i2c') subdir('loader') subdir('modes') @@ -76,9 +72,6 @@ xorg_link = [ if build_dri1 xorg_link += xorg_dri endif -if build_dri2 - xorg_link += xorg_dri2 -endif if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' linker_export_flags = '-Wl,--export-all-symbols' diff --git a/meson.build b/meson.build index 6244aef7a..541cd1165 100644 --- a/meson.build +++ b/meson.build @@ -649,6 +649,7 @@ common_dep = [ inc = include_directories( '.', 'Xext', + 'Xext/dri2', 'Xi', 'composite', 'exa', @@ -810,6 +811,7 @@ libxserver = [ libxserver_os, ] +libxserver += libxserver_dri2 libxserver += libxserver_dri3 if build_namespace diff --git a/mi/miinitext.c b/mi/miinitext.c index da6df88e4..e7cc80707 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -152,6 +152,9 @@ static const ExtensionModule staticExtensions[] = { #ifdef PRESENT {present_extension_init, "Present", NULL}, #endif +#ifdef DRI2 + {DRI2ExtensionInit, DRI2_NAME, &noDRI2Extension}, +#endif #ifdef DRI3 {dri3_extension_init, "DRI3", NULL}, #endif diff --git a/miext/extinit_priv.h b/miext/extinit_priv.h index 34d6a59fb..2f3eaeca3 100644 --- a/miext/extinit_priv.h +++ b/miext/extinit_priv.h @@ -8,6 +8,12 @@ #include "extinit.h" +#ifdef DRI2 +#include +extern Bool noDRI2Extension; +void DRI2ExtensionInit(void); +#endif + /* required by: the 470 and 390 nvidia DDX drivers */ extern _X_EXPORT Bool noDamageExtension;