diff --git a/0001-Always-install-vbe-and-int10-sdk-headers.patch b/0001-Always-install-vbe-and-int10-sdk-headers.patch new file mode 100644 index 0000000..c613eb8 --- /dev/null +++ b/0001-Always-install-vbe-and-int10-sdk-headers.patch @@ -0,0 +1,37 @@ +From e96a83d9b1b5a52a41213c7a4840dc96b4f5b06f Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 15 Aug 2012 12:35:21 -0400 +Subject: [PATCH] Always install vbe and int10 sdk headers + +Signed-off-by: Adam Jackson +--- + hw/xfree86/Makefile.am | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am +index b876b79..a170b58 100644 +--- a/hw/xfree86/Makefile.am ++++ b/hw/xfree86/Makefile.am +@@ -26,17 +26,9 @@ if VGAHW + VGAHW_SUBDIR = vgahw + endif + +-if VBE +-VBE_SUBDIR = vbe +-endif +- +-if INT10MODULE +-INT10_SUBDIR = int10 +-endif +- +-SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ ++SUBDIRS = common ddc x86emu int10 os-support parser \ + ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ +- $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods xkb \ ++ $(DRI2_SUBDIR) . vbe i2c dixmods xkb \ + fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ + $(GLAMOR_EGL_SUBDIR) drivers + +-- +2.13.6 + diff --git a/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch b/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch new file mode 100644 index 0000000..9355ad2 --- /dev/null +++ b/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch @@ -0,0 +1,41 @@ +From 38ae53c94a88c7bd5877c72a12582b60865e07ff Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 17 Apr 2014 15:50:44 +0200 +Subject: [PATCH] Fedora hack: Make the suid-root wrapper start the server with + root rights + +Do NOT upstream. + +Since most display managers are not ready yet to start Xorg in way which will +keep it working without root-rights, see: +https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights + +Just keep starting X as root for now, but do it through the wrapper, by +overriding the needs_root_rights = -1 (auto) default and setting it to 1. + +We set a special environment variable when starting X in a way where root +rights are not needed (from gdm and startx) and keep the upstream +needs_root_rights = -1 (auto) default in that case. + +Signed-off-by: Hans de Goede +--- + hw/xfree86/xorg-wrapper.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c +index 4c37cfc..ae5d27f 100644 +--- a/hw/xfree86/xorg-wrapper.c ++++ b/hw/xfree86/xorg-wrapper.c +@@ -198,6 +198,9 @@ int main(int argc, char *argv[]) + int needs_root_rights = -1; + char *const empty_envp[1] = { NULL, }; + ++ if (getenv("XORG_RUN_AS_USER_OK") == NULL) ++ needs_root_rights = 1; ++ + progname = argv[0]; + + parse_config(&allowed, &needs_root_rights); +-- +2.4.3 + diff --git a/0001-autobind-GPUs-to-the-screen.patch b/0001-autobind-GPUs-to-the-screen.patch new file mode 100644 index 0000000..86b96a2 --- /dev/null +++ b/0001-autobind-GPUs-to-the-screen.patch @@ -0,0 +1,293 @@ +From 471289fa1dc359555ceed6302f7d9605ab6be3ea Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Mon, 2 Apr 2018 16:49:02 -0400 +Subject: [PATCH] autobind GPUs to the screen + +This is a modified version of a patch we've been carry-ing in Fedora and +RHEL for years now. This patch automatically adds secondary GPUs to the +master as output sink / offload source making e.g. the use of +slave-outputs just work, with requiring the user to manually run +"xrandr --setprovideroutputsource" before he can hookup an external +monitor to his hybrid graphics laptop. + +There is one problem with this patch, which is why it was not upstreamed +before. What to do when a secondary GPU gets detected really is a policy +decission (e.g. one may want to autobind PCI GPUs but not USB ones) and +as such should be under control of the Desktop Environment. + +Unconditionally adding autobinding support to the xserver will result +in races between the DE dealing with the hotplug of a secondary GPU +and the server itself dealing with it. + +However we've waited for years for any Desktop Environments to actually +start doing some sort of autoconfiguration of secondary GPUs and there +is still not a single DE dealing with this, so I believe that it is +time to upstream this now. + +To avoid potential future problems if any DEs get support for doing +secondary GPU configuration themselves, the new autobind functionality +is made optional. Since no DEs currently support doing this themselves it +is enabled by default. When DEs grow support for doing this themselves +they can disable the servers autobinding through the servers cmdline or a +xorg.conf snippet. + +Signed-off-by: Dave Airlie +[hdegoede@redhat.com: Make configurable, fix with nvidia, submit upstream] +Signed-off-by: Hans de Goede +--- + hw/xfree86/common/xf86Config.c | 19 +++++++++++++++++++ + hw/xfree86/common/xf86Globals.c | 2 ++ + hw/xfree86/common/xf86Init.c | 20 ++++++++++++++++++++ + hw/xfree86/common/xf86Priv.h | 1 + + hw/xfree86/common/xf86Privstr.h | 1 + + hw/xfree86/common/xf86platformBus.c | 4 ++++ + hw/xfree86/man/Xorg.man | 7 +++++++ + hw/xfree86/man/xorg.conf.man | 6 ++++++ + randr/randrstr.h | 3 +++ + randr/rrprovider.c | 22 ++++++++++++++++++++++ + 10 files changed, 85 insertions(+) + +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index 2c1d335..d7d7c2e 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -643,6 +643,7 @@ typedef enum { + FLAG_DRI2, + FLAG_USE_SIGIO, + FLAG_AUTO_ADD_GPU, ++ FLAG_AUTO_BIND_GPU, + FLAG_MAX_CLIENTS, + FLAG_IGLX, + FLAG_DEBUG, +@@ -699,6 +700,8 @@ static OptionInfoRec FlagOptions[] = { + {0}, FALSE}, + {FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN, + {0}, FALSE}, ++ {FLAG_AUTO_BIND_GPU, "AutoBindGPU", OPTV_BOOLEAN, ++ {0}, FALSE}, + {FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER, + {0}, FALSE }, + {FLAG_IGLX, "IndirectGLX", OPTV_BOOLEAN, +@@ -779,6 +782,22 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) + } + xf86Msg(from, "%sutomatically adding GPU devices\n", + xf86Info.autoAddGPU ? "A" : "Not a"); ++ ++ if (xf86AutoBindGPUDisabled) { ++ xf86Info.autoBindGPU = FALSE; ++ from = X_CMDLINE; ++ } ++ else if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_BIND_GPU)) { ++ xf86GetOptValBool(FlagOptions, FLAG_AUTO_BIND_GPU, ++ &xf86Info.autoBindGPU); ++ from = X_CONFIG; ++ } ++ else { ++ from = X_DEFAULT; ++ } ++ xf86Msg(from, "%sutomatically binding GPU devices\n", ++ xf86Info.autoBindGPU ? "A" : "Not a"); ++ + /* + * Set things up based on the config file information. Some of these + * settings may be overridden later when the command line options are +diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c +index e890f05..7b27b4c 100644 +--- a/hw/xfree86/common/xf86Globals.c ++++ b/hw/xfree86/common/xf86Globals.c +@@ -131,6 +131,7 @@ xf86InfoRec xf86Info = { + #else + .autoAddGPU = FALSE, + #endif ++ .autoBindGPU = TRUE, + }; + + const char *xf86ConfigFile = NULL; +@@ -191,6 +192,7 @@ Bool xf86FlipPixels = FALSE; + Gamma xf86Gamma = { 0.0, 0.0, 0.0 }; + + Bool xf86AllowMouseOpenFail = FALSE; ++Bool xf86AutoBindGPUDisabled = FALSE; + + #ifdef XF86VIDMODE + Bool xf86VidModeDisabled = FALSE; +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index ea42ec9..ec255b6 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -76,6 +76,7 @@ + #include "xf86DDC.h" + #include "xf86Xinput.h" + #include "xf86InPriv.h" ++#include "xf86Crtc.h" + #include "picturestr.h" + #include "randrstr.h" + #include "glxvndabi.h" +@@ -237,6 +238,19 @@ xf86PrivsElevated(void) + return PrivsElevated(); + } + ++static void ++xf86AutoConfigOutputDevices(void) ++{ ++ int i; ++ ++ if (!xf86Info.autoBindGPU) ++ return; ++ ++ for (i = 0; i < xf86NumGPUScreens; i++) ++ RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]), ++ xf86ScrnToScreen(xf86Screens[0])); ++} ++ + static void + TrapSignals(void) + { +@@ -770,6 +784,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) + for (i = 0; i < xf86NumGPUScreens; i++) + AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); + ++ xf86AutoConfigOutputDevices(); ++ + xf86VGAarbiterWrapFunctions(); + if (sigio_blocked) + input_unlock(); +@@ -1278,6 +1294,10 @@ ddxProcessArgument(int argc, char **argv, int i) + xf86Info.iglxFrom = X_CMDLINE; + return 0; + } ++ if (!strcmp(argv[i], "-noautoBindGPU")) { ++ xf86AutoBindGPUDisabled = TRUE; ++ return 1; ++ } + + /* OS-specific processing */ + return xf86ProcessArgument(argc, argv, i); +diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h +index 4fe2b5f..6566622 100644 +--- a/hw/xfree86/common/xf86Priv.h ++++ b/hw/xfree86/common/xf86Priv.h +@@ -46,6 +46,7 @@ + extern _X_EXPORT const char *xf86ConfigFile; + extern _X_EXPORT const char *xf86ConfigDir; + extern _X_EXPORT Bool xf86AllowMouseOpenFail; ++extern _X_EXPORT Bool xf86AutoBindGPUDisabled; + + #ifdef XF86VIDMODE + extern _X_EXPORT Bool xf86VidModeDisabled; +diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h +index 21c2e1f..6c71863 100644 +--- a/hw/xfree86/common/xf86Privstr.h ++++ b/hw/xfree86/common/xf86Privstr.h +@@ -98,6 +98,7 @@ typedef struct { + + Bool autoAddGPU; + const char *debug; ++ Bool autoBindGPU; + } xf86InfoRec, *xf86InfoPtr; + + /* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */ +diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c +index cef47da..913a324 100644 +--- a/hw/xfree86/common/xf86platformBus.c ++++ b/hw/xfree86/common/xf86platformBus.c +@@ -49,6 +49,7 @@ + #include "Pci.h" + #include "xf86platformBus.h" + #include "xf86Config.h" ++#include "xf86Crtc.h" + + #include "randrstr.h" + int platformSlotClaimed; +@@ -665,6 +666,9 @@ xf86platformAddDevice(int index) + } + /* attach unbound to 0 protocol screen */ + AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); ++ if (xf86Info.autoBindGPU) ++ RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]), ++ xf86ScrnToScreen(xf86Screens[0])); + + RRResourcesChanged(xf86Screens[0]->pScreen); + RRTellChanged(xf86Screens[0]->pScreen); +diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man +index 13a9dc3..745f986 100644 +--- a/hw/xfree86/man/Xorg.man ++++ b/hw/xfree86/man/Xorg.man +@@ -283,6 +283,13 @@ is a comma separated list of directories to search for + server modules. This option is only available when the server is run + as root (i.e, with real-uid 0). + .TP 8 ++.B \-noautoBindGPU ++Disable automatically setting secondary GPUs up as output sinks and offload ++sources. This is equivalent to setting the ++.B AutoBindGPU ++xorg.conf(__filemansuffix__) file option. To ++.B false. ++.TP 8 + .B \-nosilk + Disable Silken Mouse support. + .TP 8 +diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man +index 9589262..8d51e06 100644 +--- a/hw/xfree86/man/xorg.conf.man ++++ b/hw/xfree86/man/xorg.conf.man +@@ -672,6 +672,12 @@ Enabled by default. + If this option is disabled, then no GPU devices will be added from the udev + backend. Enabled by default. (May need to be disabled to setup Xinerama). + .TP 7 ++.BI "Option \*qAutoBindGPU\*q \*q" boolean \*q ++If enabled then secondary GPUs will be automatically set up as output-sinks and ++offload-sources. Making e.g. laptop outputs connected only to the secondary ++GPU directly available for use without needing to run ++"xrandr --setprovideroutputsource". Enabled by default. ++.TP 7 + .BI "Option \*qLog\*q \*q" string \*q + This option controls whether the log is flushed and/or synced to disk after + each message. +diff --git a/randr/randrstr.h b/randr/randrstr.h +index f94174b..092d726 100644 +--- a/randr/randrstr.h ++++ b/randr/randrstr.h +@@ -1039,6 +1039,9 @@ RRProviderLookup(XID id, RRProviderPtr *provider_p); + extern _X_EXPORT void + RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider); + ++extern _X_EXPORT void ++RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr masterScreen); ++ + /* rrproviderproperty.c */ + + extern _X_EXPORT void +diff --git a/randr/rrprovider.c b/randr/rrprovider.c +index e4bc2bf..e04c18f 100644 +--- a/randr/rrprovider.c ++++ b/randr/rrprovider.c +@@ -485,3 +485,25 @@ RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider) + + WriteEventsToClient(client, 1, (xEvent *) &pe); + } ++ ++void ++RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr masterScreen) ++{ ++ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); ++ rrScrPrivPtr masterPriv = rrGetScrPriv(masterScreen); ++ RRProviderPtr provider = pScrPriv->provider; ++ RRProviderPtr master_provider = masterPriv->provider; ++ ++ if (!provider || !master_provider) ++ return; ++ ++ if ((provider->capabilities & RR_Capability_SinkOutput) && ++ (master_provider->capabilities & RR_Capability_SourceOutput)) { ++ pScrPriv->rrProviderSetOutputSource(pScreen, provider, master_provider); ++ RRInitPrimeSyncProps(pScreen); ++ } ++ ++ if ((provider->capabilities & RR_Capability_SourceOffload) && ++ (master_provider->capabilities & RR_Capability_SinkOffload)) ++ pScrPriv->rrProviderSetOffloadSink(pScreen, provider, master_provider); ++} +-- +2.16.2 + diff --git a/0001-glx-check-for-indirect-context-in-CreateContextAttri.patch b/0001-glx-check-for-indirect-context-in-CreateContextAttri.patch new file mode 100644 index 0000000..7c51440 --- /dev/null +++ b/0001-glx-check-for-indirect-context-in-CreateContextAttri.patch @@ -0,0 +1,60 @@ +From 2881ce563661043ef0ee1163c63c120f3622e6d1 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Wed, 5 Sep 2018 15:06:55 +0200 +Subject: [PATCH xserver] glx: check for indirect context in + CreateContextAttribsARB() + +Commit 99f0365b "Add a command line argument for disabling indirect GLX" +added a test to check if indirect context are enabled in +`DoCreateContext()` but `__glXDisp_CreateContextAttribsARB()` doesn't +use `DoCreateContext()` and doesn't check if indirect context is +enabled. + +As a result, clients can still manage to create indirect contexts using +`glXCreateContextAttribsARB()` even if indirect contexts are disabled, +which can possibly crash Xservers such as Xwayland or Xephyr when the +context is destroyed. + +To avoid the issue, check for `enableIndirectGLX` in +`__glXDisp_CreateContextAttribsARB()` as well. + +Fixes: 99f0365b "Add a command line argument for disabling indirect GLX" +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107508 +Signed-off-by: Olivier Fourdan +--- + glx/createcontext.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/glx/createcontext.c b/glx/createcontext.c +index 7d09c3a1c..24b02ddfb 100644 +--- a/glx/createcontext.c ++++ b/glx/createcontext.c +@@ -28,6 +28,7 @@ + #include "glxserver.h" + #include "glxext.h" + #include "indirect_dispatch.h" ++#include "opaque.h" + + #define ALL_VALID_FLAGS \ + (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB \ +@@ -320,6 +321,17 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) + err = BadAlloc; + } + else { ++ /* Only allow creating indirect GLX contexts if allowed by ++ * server command line. Indirect GLX is of limited use (since ++ * it's only GL 1.4), it's slower than direct contexts, and ++ * it's a massive attack surface for buffer overflow type ++ * errors. ++ */ ++ if (!enableIndirectGLX) { ++ client->errorValue = req->isDirect; ++ return BadValue; ++ } ++ + ctx = glxScreen->createContext(glxScreen, config, shareCtx, + req->numAttribs, (uint32_t *) attribs, + &err); +-- +2.19.0.rc1 + diff --git a/0001-present-fix-freed-pointer-access.patch b/0001-present-fix-freed-pointer-access.patch new file mode 100644 index 0000000..8c28ee8 --- /dev/null +++ b/0001-present-fix-freed-pointer-access.patch @@ -0,0 +1,80 @@ +From 259f838af4aae2c240d0ea9c05073a86718990d7 Mon Sep 17 00:00:00 2001 +From: Lionel Landwerlin +Date: Mon, 27 Aug 2018 01:04:45 +0100 +Subject: [PATCH xserver] present: fix freed pointer access + +When a vblank has been marked as aborted, it's going to be free in the +flip_notify function when stopped. We can't notify it after it's +stopped because the pointer is invalid. + +Valgrind backtrace: + +==5331== Invalid read of size 8 +==5331== at 0x212B4D: present_vblank_notify (present_vblank.c:34) +==5331== by 0x21439B: present_wnmd_flip_notify (present_wnmd.c:194) +==5331== by 0x21439B: present_wnmd_event_notify (present_wnmd.c:228) +==5331== by 0x156216: xwl_present_sync_callback (xwayland-present.c:282) +==5331== by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x14BCCA: xwl_read_events (xwayland.c:814) +==5331== by 0x2AC0D0: ospoll_wait (ospoll.c:651) +==5331== by 0x2A5322: WaitForSomething (WaitFor.c:208) +==5331== by 0x27574B: Dispatch (dispatch.c:421) +==5331== Address 0x1b44dc98 is 40 bytes inside a block of size 184 free'd +==5331== at 0x48369EB: free (vg_replace_malloc.c:530) +==5331== by 0x213B0A: present_wnmd_free_idle_vblanks (present_wnmd.c:118) +==5331== by 0x213B0A: present_wnmd_flips_stop (present_wnmd.c:161) +==5331== by 0x2143EF: present_wnmd_flip_notify (present_wnmd.c:192) +==5331== by 0x2143EF: present_wnmd_event_notify (present_wnmd.c:228) +==5331== by 0x156216: xwl_present_sync_callback (xwayland-present.c:282) +==5331== by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x14BCCA: xwl_read_events (xwayland.c:814) +==5331== by 0x2AC0D0: ospoll_wait (ospoll.c:651) +==5331== by 0x2A5322: WaitForSomething (WaitFor.c:208) +==5331== Block was alloc'd at +==5331== at 0x48377D5: calloc (vg_replace_malloc.c:711) +==5331== by 0x212D9F: present_vblank_create (present_vblank.c:69) +==5331== by 0x214014: present_wnmd_pixmap (present_wnmd.c:610) +==5331== by 0x21576C: proc_present_pixmap (present_request.c:150) +==5331== by 0x27599D: Dispatch (dispatch.c:479) +==5331== by 0x279945: dix_main (main.c:276) +==5331== by 0x633AB16: (below main) (libc-start.c:310) + +v2: Still notify aborted flips (Roman) + +Signed-off-by: Lionel Landwerlin +Reviewed-by: Daniel Stone +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107314 +Reviewed-by: Roman Gilg +Tested-by: Roman Gilg +--- + present/present_wnmd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/present/present_wnmd.c b/present/present_wnmd.c +index 035ae8ffe..8f3836440 100644 +--- a/present/present_wnmd.c ++++ b/present/present_wnmd.c +@@ -188,10 +188,11 @@ present_wnmd_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_ + window_priv->flip_active = vblank; + window_priv->flip_pending = NULL; + ++ present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc); ++ + if (vblank->abort_flip) + present_wnmd_flips_stop(window); + +- present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc); + present_wnmd_flip_try_ready(window); + } + +-- +2.19.0.rc1 + diff --git a/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch b/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch new file mode 100644 index 0000000..cce0348 --- /dev/null +++ b/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch @@ -0,0 +1,152 @@ +From acf5a0100c98a040e5e07a79ecf4a83627da770e Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 23 Mar 2017 12:54:07 +0100 +Subject: [PATCH xserver] xf86: dri2: Use va_gl as vdpau_driver for Intel i965 + GPUs + +The modesetting driver (which now often is used with Intel GPUs), +relies on dri2_probe_driver_name() to get the dri and vdpau driver +names, before this commit it would always assign the same name to +the 2 names. But the vdpau driver for i965 GPUs should be va_gl +(i915 does not support vdpau at all). + +This commit modifies the used lookup table and dri2_probe_driver_name() +to set the vdpau_driver to va_gl for i965 GPUs, it leaves the 2 +names the same for all other GPUs. + +Note this commit adds a FIXME comment for a memory leak in +dri2_probe_driver_name(), that leak was already present and fixing +it falls outside of the scope of this commit. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1413733 +Cc: kwizart@gmail.com +Signed-off-by: Hans de Goede +--- + hw/xfree86/dri2/dri2.c | 31 +++++++++++++-------- + hw/xfree86/dri2/pci_ids/pci_id_driver_map.h | 21 +++++++------- + 2 files changed, 31 insertions(+), 21 deletions(-) + +diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c +index 6619e3aa7..1f8ad14bc 100644 +--- a/hw/xfree86/dri2/dri2.c ++++ b/hw/xfree86/dri2/dri2.c +@@ -1437,14 +1437,18 @@ get_prime_id(void) + + #include "pci_ids/pci_id_driver_map.h" + +-static char * +-dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) ++static void ++dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info, ++ const char **dri_driver_ret, ++ const char **vdpau_driver_ret) + { + #ifdef WITH_LIBDRM + int i, j; +- char *driver = NULL; + drmDevicePtr dev; + ++ *dri_driver_ret = NULL; ++ *vdpau_driver_ret = NULL; ++ + /* For non-PCI devices and drmGetDevice fail, just assume that + * the 3D driver is named the same as the kernel driver. This is + * currently true for vc4 and msm (freedreno). +@@ -1456,12 +1460,14 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[DRI2] Couldn't drmGetVersion() on non-PCI device, " + "no driver name found.\n"); +- return NULL; ++ return; + } + +- driver = strndup(version->name, version->name_len); ++ /* FIXME this gets leaked */ ++ *dri_driver_ret = strndup(version->name, version->name_len); ++ *vdpau_driver_ret = *dri_driver_ret; + drmFreeVersion(version); +- return driver; ++ return; + } + + for (i = 0; driver_map[i].driver; i++) { +@@ -1469,13 +1475,15 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) + continue; + + if (driver_map[i].num_chips_ids == -1) { +- driver = strdup(driver_map[i].driver); ++ *dri_driver_ret = driver_map[i].driver; ++ *vdpau_driver_ret = driver_map[i].vdpau_driver; + goto out; + } + + for (j = 0; j < driver_map[i].num_chips_ids; j++) { + if (driver_map[i].chip_ids[j] == dev->deviceinfo.pci->device_id) { +- driver = strdup(driver_map[i].driver); ++ *dri_driver_ret = driver_map[i].driver; ++ *vdpau_driver_ret = driver_map[i].vdpau_driver; + goto out; + } + } +@@ -1487,9 +1495,9 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) + dev->deviceinfo.pci->vendor_id, dev->deviceinfo.pci->device_id); + out: + drmFreeDevice(&dev); +- return driver; + #else +- return NULL; ++ *dri_driver_ret = NULL; ++ *vdpau_driver_ret = NULL; + #endif + } + +@@ -1610,7 +1618,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) + if (info->driverName) { + ds->driverNames[0] = info->driverName; + } else { +- ds->driverNames[0] = ds->driverNames[1] = dri2_probe_driver_name(pScreen, info); ++ dri2_probe_driver_name(pScreen, info, ++ &ds->driverNames[0], &ds->driverNames[1]); + if (!ds->driverNames[0]) + return FALSE; + } +diff --git a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h +index da7ea1c1e..7036d1003 100644 +--- a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h ++++ b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h +@@ -66,21 +66,22 @@ static const int vmwgfx_chip_ids[] = { + static const struct { + int vendor_id; + const char *driver; ++ const char *vdpau_driver; + const int *chip_ids; + int num_chips_ids; + } driver_map[] = { +- { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) }, +- { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) }, ++ { 0x8086, "i915", "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) }, ++ { 0x8086, "i965", "va_gl", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) }, + #ifndef DRIVER_MAP_GALLIUM_ONLY +- { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) }, +- { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) }, ++ { 0x1002, "radeon", "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) }, ++ { 0x1002, "r200", "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) }, + #endif +- { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) }, +- { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) }, +- { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) }, +- { 0x10de, "nouveau", NULL, -1 }, +- { 0x1af4, "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) }, +- { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) }, ++ { 0x1002, "r300", "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) }, ++ { 0x1002, "r600","r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) }, ++ { 0x1002, "radeonsi", "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) }, ++ { 0x10de, "nouveau", "nouveau", NULL, -1 }, ++ { 0x1af4, "virtio_gpu", "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) }, ++ { 0x15ad, "vmwgfx", "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) }, + { 0x0000, NULL, NULL, 0 }, + }; + +-- +2.19.0 + diff --git a/0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch b/0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch new file mode 100644 index 0000000..1b1306e --- /dev/null +++ b/0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch @@ -0,0 +1,52 @@ +From aa2f34d80ef3118eae0cce73b610c36cdcb978fe Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Sat, 22 Apr 2017 02:26:28 +1000 +Subject: [PATCH xserver] xfree86: use modesetting driver by default on GeForce + 8 and newer + +Signed-off-by: Ben Skeggs +--- + hw/xfree86/common/xf86pciBus.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c +index 8158c2b62..78d1c947d 100644 +--- a/hw/xfree86/common/xf86pciBus.c ++++ b/hw/xfree86/common/xf86pciBus.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include "os.h" + #include "Pci.h" + #include "xf86.h" +@@ -1190,6 +1191,25 @@ xf86VideoPtrToDriverList(struct pci_device *dev, + int idx = 0; + + #ifdef __linux__ ++ char busid[32]; ++ int fd; ++ ++ snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d", ++ dev->domain, dev->bus, dev->dev, dev->func); ++ ++ /* 'modesetting' is preferred for GeForce 8 and newer GPUs */ ++ fd = drmOpenWithType("nouveau", busid, DRM_NODE_RENDER); ++ if (fd >= 0) { ++ uint64_t args[] = { 11 /* NOUVEAU_GETPARAM_CHIPSET_ID */, 0 }; ++ int ret = drmCommandWriteRead(fd, 0 /* DRM_NOUVEAU_GETPARAM */, ++ &args, sizeof(args)); ++ drmClose(fd); ++ if (ret == 0) { ++ if (args[1] == 0x050 || args[1] >= 0x80) ++ break; ++ } ++ } ++ + driverList[idx++] = "nouveau"; + #endif + driverList[idx++] = "nv"; +-- +2.12.2 + diff --git a/0001-xwayland-Remove-xwl_present_window-from-privates-on-.patch b/0001-xwayland-Remove-xwl_present_window-from-privates-on-.patch new file mode 100644 index 0000000..1575cb0 --- /dev/null +++ b/0001-xwayland-Remove-xwl_present_window-from-privates-on-.patch @@ -0,0 +1,81 @@ +From 90ac51f3e44d8d433741dc0f0495e79cc6e5fd51 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Wed, 5 Sep 2018 09:34:12 +0200 +Subject: [PATCH xserver] xwayland: Remove xwl_present_window from privates on + cleanup + +Xwayland's `xwl_destroy_window()` invokes `xwl_present_cleanup()` +before the common `DestroyWindow()`. + +But then `DestroyWindow()` calls `present_destroy_window()` which will +possibly end up in `xwl_present_abort_vblank()` which will try to access +data that was previously freed by `xwl_present_cleanup()`: + + Invalid read of size 8 + at 0x434184: xwl_present_abort_vblank (xwayland-present.c:378) + by 0x53785B: present_wnmd_abort_vblank (present_wnmd.c:651) + by 0x53695A: present_free_window_vblank (present_screen.c:87) + by 0x53695A: present_destroy_window (present_screen.c:152) + by 0x42A90D: xwl_destroy_window (xwayland.c:653) + by 0x584298: compDestroyWindow (compwindow.c:613) + by 0x53CEE3: damageDestroyWindow (damage.c:1570) + by 0x4F1BB8: DbeDestroyWindow (dbe.c:1326) + by 0x46F7F6: FreeWindowResources (window.c:1031) + by 0x472847: DeleteWindow (window.c:1099) + by 0x46B54C: doFreeResource (resource.c:880) + by 0x46C706: FreeClientResources (resource.c:1146) + by 0x446ADE: CloseDownClient (dispatch.c:3473) + Address 0x182abde0 is 80 bytes inside a block of size 112 free'd + at 0x4C2FDAC: free (vg_replace_malloc.c:530) + by 0x42A937: xwl_destroy_window (xwayland.c:647) + by 0x584298: compDestroyWindow (compwindow.c:613) + by 0x53CEE3: damageDestroyWindow (damage.c:1570) + by 0x4F1BB8: DbeDestroyWindow (dbe.c:1326) + by 0x46F7F6: FreeWindowResources (window.c:1031) + by 0x472847: DeleteWindow (window.c:1099) + by 0x46B54C: doFreeResource (resource.c:880) + by 0x46C706: FreeClientResources (resource.c:1146) + by 0x446ADE: CloseDownClient (dispatch.c:3473) + by 0x446DA5: ProcKillClient (dispatch.c:3279) + by 0x4476AF: Dispatch (dispatch.c:479) + Block was alloc'd at + at 0x4C30B06: calloc (vg_replace_malloc.c:711) + by 0x433F46: xwl_present_window_get_priv (xwayland-present.c:54) + by 0x434228: xwl_present_get_crtc (xwayland-present.c:302) + by 0x539728: proc_present_query_capabilities (present_request.c:227) + by 0x4476AF: Dispatch (dispatch.c:479) + by 0x44B5B5: dix_main (main.c:276) + by 0x75F611A: (below main) (libc-start.c:308) + +This is because `xwl_present_cleanup()` frees the memory but does not +remove it from the window's privates, and `xwl_present_abort_vblank()` +will still find it and hence try to access that freed memory... + +Remove `xwl_present_window` from window's privates on cleanup so that no +other function can find and reuse that data once it's freed. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1616269 +Signed-off-by: Olivier Fourdan +--- + hw/xwayland/xwayland-present.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c +index 81e0eb9ce..316e04443 100644 +--- a/hw/xwayland/xwayland-present.c ++++ b/hw/xwayland/xwayland-present.c +@@ -147,6 +147,11 @@ xwl_present_cleanup(WindowPtr window) + /* Clear timer */ + xwl_present_free_timer(xwl_present_window); + ++ /* Remove from privates so we don't try to access it later */ ++ dixSetPrivate(&window->devPrivates, ++ &xwl_present_window_private_key, ++ NULL); ++ + free(xwl_present_window); + } + +-- +2.19.0.rc1 + diff --git a/0001-xwayland-fix-access-to-invalid-pointer.patch b/0001-xwayland-fix-access-to-invalid-pointer.patch new file mode 100644 index 0000000..a6026ba --- /dev/null +++ b/0001-xwayland-fix-access-to-invalid-pointer.patch @@ -0,0 +1,78 @@ +From b3f6dc6892ca554ecb57f4289182a3e29915a2c6 Mon Sep 17 00:00:00 2001 +From: Lionel Landwerlin +Date: Tue, 28 Aug 2018 21:30:05 +0100 +Subject: [PATCH xserver] xwayland: fix access to invalid pointer + +xwl_output->randr_crtc is used in the update_screen_size() function : + +==5331== Invalid read of size 4 +==5331== at 0x15263D: update_screen_size (xwayland-output.c:190) +==5331== by 0x152C48: xwl_output_remove (xwayland-output.c:413) +==5331== by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x14BCCA: xwl_read_events (xwayland.c:814) +==5331== by 0x2AC0D0: ospoll_wait (ospoll.c:651) +==5331== by 0x2A5322: WaitForSomething (WaitFor.c:208) +==5331== by 0x27574B: Dispatch (dispatch.c:421) +==5331== by 0x279945: dix_main (main.c:276) +==5331== Address 0x1aacb5f4 is 36 bytes inside a block of size 154 free'd +==5331== at 0x48369EB: free (vg_replace_malloc.c:530) +==5331== by 0x1F8AE8: RROutputDestroyResource (rroutput.c:421) +==5331== by 0x29A2AC: doFreeResource (resource.c:880) +==5331== by 0x29AE5B: FreeResource (resource.c:910) +==5331== by 0x152BE0: xwl_output_remove (xwayland-output.c:408) +==5331== by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x14BCCA: xwl_read_events (xwayland.c:814) +==5331== by 0x2AC0D0: ospoll_wait (ospoll.c:651) +==5331== Block was alloc'd at +==5331== at 0x48357BF: malloc (vg_replace_malloc.c:299) +==5331== by 0x1F93E0: RROutputCreate (rroutput.c:83) +==5331== by 0x152A75: xwl_output_create (xwayland-output.c:361) +==5331== by 0x14BE59: registry_global (xwayland.c:764) +==5331== by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4) +==5331== by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0) +==5331== by 0x14BCCA: xwl_read_events (xwayland.c:814) +==5331== by 0x2AC0D0: ospoll_wait (ospoll.c:651) +==5331== by 0x2A5322: WaitForSomething (WaitFor.c:208) + +Signed-off-by: Lionel Landwerlin +Reviewed-by: Daniel Stone +--- + hw/xwayland/xwayland-output.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c +index 0d2ec7890..cc68f0340 100644 +--- a/hw/xwayland/xwayland-output.c ++++ b/hw/xwayland/xwayland-output.c +@@ -404,14 +404,15 @@ xwl_output_remove(struct xwl_output *xwl_output) + int width = 0, height = 0; + Bool need_rotate = (xwl_output->xdg_output == NULL); + +- RRCrtcDestroy(xwl_output->randr_crtc); +- RROutputDestroy(xwl_output->randr_output); + xorg_list_del(&xwl_output->link); + + xorg_list_for_each_entry(it, &xwl_screen->output_list, link) + output_get_new_size(it, need_rotate, &height, &width); + update_screen_size(xwl_output, width, height); + ++ RRCrtcDestroy(xwl_output->randr_crtc); ++ RROutputDestroy(xwl_output->randr_output); ++ + xwl_output_destroy(xwl_output); + } + +-- +2.19.0.rc1 + diff --git a/0026-glamor_egl-Don-t-initialize-on-llvmpipe.patch b/0026-glamor_egl-Don-t-initialize-on-llvmpipe.patch new file mode 100644 index 0000000..0c2bb41 --- /dev/null +++ b/0026-glamor_egl-Don-t-initialize-on-llvmpipe.patch @@ -0,0 +1,92 @@ +From 1e3c5d614ee33d9eac1d2cf6366feeb8341fc0f4 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Fri, 14 Sep 2018 11:33:43 -0400 +Subject: [PATCH 26/29] glamor_egl: Don't initialize on llvmpipe + +Mesa started supporting GL_OES_EGL_image on llvmpipe in 17.3, after this +commit: + + commit bbdeddd5fd0b797e1e281f058338b3da4d98029d + Author: Gurchetan Singh + Date: Tue Aug 1 14:49:33 2017 -0700 + + st/dri: add drisw image extension + +That's pretty cool, but it means glamor now thinks it can initialize on +llvmpipe. This is almost certainly not what anyone wants, as glamor on +llvmpipe is pretty much uniformly slower than fb. + +This fixes both Xorg and Xwayland to refuse glamor in such a setup. +Xephyr is left alone, both because glamor is not the default there and +because Xephyr+glamor+llvmpipe is one of the easier ways to get xts to +exercise glamor. + +The (very small) downside of this change is that you lose DRI3 support. +This wouldn't have helped you very much (since an lp glamor blit is +slower than a pixman blit), but it would eliminate the PutImage overhead +for llvmpipe's glXSwapBuffers. A future change should add DRI3 support +for the fb-only case. + +Reviewed-by: Eric Anholt +Signed-off-by: Adam Jackson +(cherry picked from commit 0a9415cf793babed1f28c61f8047d51de04f1528) +--- + glamor/glamor_egl.c | 11 ++++++++++- + hw/xwayland/xwayland-glamor-gbm.c | 5 +++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c +index 0edfa11..31b1faf 100644 +--- a/glamor/glamor_egl.c ++++ b/glamor/glamor_egl.c +@@ -892,6 +892,7 @@ Bool + glamor_egl_init(ScrnInfoPtr scrn, int fd) + { + struct glamor_egl_screen_private *glamor_egl; ++ const GLubyte *renderer; + + glamor_egl = calloc(sizeof(*glamor_egl), 1); + if (glamor_egl == NULL) +@@ -986,6 +987,14 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) + "Failed to make EGL context current\n"); + goto error; + } ++ ++ renderer = glGetString(GL_RENDERER); ++ if (strstr((const char *)renderer, "llvmpipe")) { ++ xf86DrvMsg(scrn->scrnIndex, X_INFO, ++ "Refusing to try glamor on llvmpipe\n"); ++ goto error; ++ } ++ + /* + * Force the next glamor_make_current call to set the right context + * (in case of multiple GPUs using glamor) +@@ -999,7 +1008,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) + } + + xf86DrvMsg(scrn->scrnIndex, X_INFO, "glamor X acceleration enabled on %s\n", +- glGetString(GL_RENDERER)); ++ renderer); + + #ifdef GBM_BO_WITH_MODIFIERS + if (epoxy_has_egl_extension(glamor_egl->display, +diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c +index 06fcf52..25a354b 100644 +--- a/hw/xwayland/xwayland-glamor-gbm.c ++++ b/hw/xwayland/xwayland-glamor-gbm.c +@@ -843,6 +843,11 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen) + goto error; + } + ++ if (strstr((const char *)glGetString(GL_RENDERER), "llvmpipe")) { ++ ErrorF("Refusing to try glamor on llvmpipe\n"); ++ goto error; ++ } ++ + if (!epoxy_has_gl_extension("GL_OES_EGL_image")) { + ErrorF("GL_OES_EGL_image not available\n"); + goto error; +-- +2.7.4.huawei.3 + diff --git a/0027-glamor-egl-Avoid-crashing-on-broken-configurations.patch b/0027-glamor-egl-Avoid-crashing-on-broken-configurations.patch new file mode 100644 index 0000000..ca0c21a --- /dev/null +++ b/0027-glamor-egl-Avoid-crashing-on-broken-configurations.patch @@ -0,0 +1,63 @@ +From 4795c069a503144ea31f01de0c039f32d9880292 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Fri, 5 Oct 2018 14:50:20 -0400 +Subject: [PATCH 27/29] glamor/egl: Avoid crashing on broken configurations + +0a9415cf apparently can tickle bugs in the GL stack where glGetString +returns NULL, presumably because the eglMakeCurrent() didn't manage to +actually install a dispatch table and you're hitting a stub function. +That's clearly not our bug, but if it happens we should at least not +crash. Notice this case and fail gently. + +Signed-off-by: Adam Jackson +(cherry picked from commit af151895f3cb1755a7a5631f2398a3d3b219cbef) +--- + glamor/glamor_egl.c | 5 +++++ + hw/xwayland/xwayland-glamor-gbm.c | 8 +++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c +index 31b1faf..d3c678d 100644 +--- a/glamor/glamor_egl.c ++++ b/glamor/glamor_egl.c +@@ -989,6 +989,11 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) + } + + renderer = glGetString(GL_RENDERER); ++ if (!renderer) { ++ xf86DrvMsg(scrn->scrnIndex, X_ERROR, ++ "glGetString() returned NULL, your GL is broken\n"); ++ goto error; ++ } + if (strstr((const char *)renderer, "llvmpipe")) { + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Refusing to try glamor on llvmpipe\n"); +diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c +index 25a354b..6aa1e46 100644 +--- a/hw/xwayland/xwayland-glamor-gbm.c ++++ b/hw/xwayland/xwayland-glamor-gbm.c +@@ -797,6 +797,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen) + GLAMOR_GL_CORE_VER_MINOR, + EGL_NONE + }; ++ const GLubyte *renderer; + + if (!xwl_gbm->fd_render_node && !xwl_gbm->drm_authenticated) { + ErrorF("Failed to get wl_drm, disabling Glamor and DRI3\n"); +@@ -843,7 +844,12 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen) + goto error; + } + +- if (strstr((const char *)glGetString(GL_RENDERER), "llvmpipe")) { ++ renderer = glGetString(GL_RENDERER); ++ if (!renderer) { ++ ErrorF("glGetString() returned NULL, your GL is broken\n"); ++ goto error; ++ } ++ if (strstr((const char *)renderer, "llvmpipe")) { + ErrorF("Refusing to try glamor on llvmpipe\n"); + goto error; + } +-- +2.7.4.huawei.3 + diff --git a/06_use-intel-only-on-pre-gen4.diff b/06_use-intel-only-on-pre-gen4.diff new file mode 100644 index 0000000..4994492 --- /dev/null +++ b/06_use-intel-only-on-pre-gen4.diff @@ -0,0 +1,30 @@ +Description: Use intel ddx only on pre-gen4 hw, newer ones will fall back to modesetting +Author: Timo Aaltonen + +--- a/hw/xfree86/common/xf86pciBus.c ++++ b/hw/xfree86/common/xf86pciBus.c +@@ -1173,7 +1173,23 @@ xf86VideoPtrToDriverList(struct pci_devi + case 0x0bef: + /* Use fbdev/vesa driver on Oaktrail, Medfield, CDV */ + break; +- default: ++ /* Default to intel only on pre-gen4 chips */ ++ case 0x3577: ++ case 0x2562: ++ case 0x3582: ++ case 0x358e: ++ case 0x2572: ++ case 0x2582: ++ case 0x258a: ++ case 0x2592: ++ case 0x2772: ++ case 0x27a2: ++ case 0x27ae: ++ case 0x29b2: ++ case 0x29c2: ++ case 0x29d2: ++ case 0xa001: ++ case 0xa011: + driverList[0] = "intel"; + break; + } diff --git a/10-quirks.conf b/10-quirks.conf new file mode 100644 index 0000000..47907d8 --- /dev/null +++ b/10-quirks.conf @@ -0,0 +1,38 @@ +# Collection of quirks and blacklist/whitelists for specific devices. + + +# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable +# http://bugs.freedesktop.org/show_bug.cgi?id=22442 +Section "InputClass" + Identifier "ThinkPad HDAPS accelerometer blacklist" + MatchProduct "ThinkPad HDAPS accelerometer data" + Option "Ignore" "on" +EndSection + +# https://bugzilla.redhat.com/show_bug.cgi?id=523914 +# Mouse does not move in PV Xen guest +# Explicitly tell evdev to not ignore the absolute axes. +Section "InputClass" + Identifier "Xen Virtual Pointer axis blacklist" + MatchProduct "Xen Virtual Pointer" + Option "IgnoreAbsoluteAxes" "off" + Option "IgnoreRelativeAxes" "off" +EndSection + +# https://bugs.freedesktop.org/show_bug.cgi?id=55867 +# Bug 55867 - Doesn't know how to tag XI_TRACKBALL +Section "InputClass" + Identifier "Tag trackballs as XI_TRACKBALL" + MatchProduct "trackball" + MatchDriver "evdev" + Option "TypeName" "TRACKBALL" +EndSection + +# https://bugs.freedesktop.org/show_bug.cgi?id=62831 +# Bug 62831 - Mionix Naos 5000 mouse detected incorrectly +Section "InputClass" + Identifier "Tag Mionix Naos 5000 mouse XI_MOUSE" + MatchProduct "La-VIEW Technology Naos 5000 Mouse" + MatchDriver "evdev" + Option "TypeName" "MOUSE" +EndSection diff --git a/gitignore b/gitignore new file mode 100644 index 0000000..524cfc6 --- /dev/null +++ b/gitignore @@ -0,0 +1,306 @@ +Makefile +Makefile.in +.deps +.libs +.msg +*.lo +*.la +*.a +*.o +*~ +.*sw? +*.pbxuser +*.mode1v3 +obj* +build* +local +aclocal.m4 +autom4te.cache +compile +config.guess +config.log +config.status +config.sub +configure +configure.lineno +depcomp +install-sh +libtool +ltmain.sh +missing +TAGS +tags +ylwrap +xorg-server.pc +stamp-h? +do-not-use-config.h +do-not-use-config.h.in +afb/afbbltC.c +afb/afbbltCI.c +afb/afbbltG.c +afb/afbbltO.c +afb/afbbltX.c +afb/afbseg.c +afb/afbtileC.c +afb/afbtileG.c +cfb/cfb8lineCO.c +cfb/cfb8lineCP.c +cfb/cfb8lineG.c +cfb/cfb8lineX.c +cfb/cfb8segC.c +cfb/cfb8segCS.c +cfb/cfb8segX.c +cfb/cfb8setG.c +cfb/cfbbltC.c +cfb/cfbbltG.c +cfb/cfbbltO.c +cfb/cfbbltX.c +cfb/cfbfillarcC.c +cfb/cfbfillarcG.c +cfb/cfbglrop8.c +cfb/cfbply1rctC.c +cfb/cfbply1rctG.c +cfb/cfbseg.c +cfb/cfbsolidC.c +cfb/cfbsolidG.c +cfb/cfbsolidX.c +cfb/cfbtile32C.c +cfb/cfbtile32G.c +cfb/cfbtileoddC.c +cfb/cfbtileoddG.c +cfb/cfbzerarcC.c +cfb/cfbzerarcG.c +cfb/cfbzerarcX.c +cfb32/cfb8lineCO.c +cfb32/cfb8lineCP.c +cfb32/cfb8lineG.c +cfb32/cfb8lineX.c +cfb32/cfb8segC.c +cfb32/cfb8segCS.c +cfb32/cfb8segX.c +cfb32/cfb8setG.c +cfb32/cfbbltC.c +cfb32/cfbbltG.c +cfb32/cfbbltO.c +cfb32/cfbbltX.c +cfb32/cfbfillarcC.c +cfb32/cfbfillarcG.c +cfb32/cfbply1rctC.c +cfb32/cfbply1rctG.c +cfb32/cfbseg.c +cfb32/cfbsolidC.c +cfb32/cfbsolidG.c +cfb32/cfbsolidX.c +cfb32/cfbtile32C.c +cfb32/cfbtile32G.c +cfb32/cfbtileoddC.c +cfb32/cfbtileoddG.c +cfb32/cfbzerarcC.c +cfb32/cfbzerarcG.c +cfb32/cfbzerarcX.c +doc/Xserver.1x +doc/Xserver.man +hw/dmx/Xdmx +hw/dmx/Xdmx.1x +hw/dmx/config/dmxtodmx +hw/dmx/config/dmxtodmx.1x +hw/dmx/config/parser.c +hw/dmx/config/parser.h +hw/dmx/config/scanner.c +hw/dmx/config/vdltodmx +hw/dmx/config/vdltodmx.1x +hw/dmx/config/xdmxconfig +hw/dmx/config/xdmxconfig.1x +hw/dmx/examples/dmxaddinput +hw/dmx/examples/dmxaddscreen +hw/dmx/examples/dmxreconfig +hw/dmx/examples/dmxresize +hw/dmx/examples/dmxrminput +hw/dmx/examples/dmxrmscreen +hw/dmx/examples/dmxwininfo +hw/dmx/examples/ev +hw/dmx/examples/evi +hw/dmx/examples/res +hw/dmx/examples/xbell +hw/dmx/examples/xdmx +hw/dmx/examples/xinput +hw/dmx/examples/xled +hw/dmx/examples/xtest +hw/kdrive/ati/Xati +hw/kdrive/chips/Xchips +hw/kdrive/ephyr/Xephyr +hw/kdrive/epson/Xepson +hw/kdrive/fake/Xfake +hw/kdrive/fbdev/Xfbdev +hw/kdrive/i810/Xi810 +hw/kdrive/mach64/Xmach64 +hw/kdrive/mga/Xmga +hw/kdrive/neomagic/Xneomagic +hw/kdrive/nvidia/Xnvidia +hw/kdrive/pm2/Xpm2 +hw/kdrive/r128/Xr128 +hw/kdrive/sdl/Xsdl +hw/kdrive/sis300/Xsis +hw/kdrive/smi/Xsmi +hw/kdrive/vesa/Xvesa +hw/kdrive/via/Xvia +hw/vfb/Xvfb +hw/vfb/Xvfb.1x +hw/vfb/Xvfb.man +hw/xfree86/Xorg +hw/xfree86/common/xf86Build.h +hw/xfree86/common/xf86DefModeSet.c +hw/xfree86/doc/man/Xorg.1x +hw/xfree86/doc/man/Xorg.man +hw/xfree86/doc/man/xorg.conf.5x +hw/xfree86/doc/man/xorg.conf.man +hw/xfree86/exa/exa.4 +hw/xfree86/exa/exa.4x +hw/xfree86/exa/exa.man +hw/xfree86/fbdevhw/fbdevhw.4x +hw/xfree86/fbdevhw/fbdevhw.man +hw/xfree86/getconfig/cfg.man +hw/xfree86/getconfig/getconfig.1x +hw/xfree86/getconfig/getconfig.5x +hw/xfree86/getconfig/getconfig.man +hw/xfree86/os-support/xorgos.c +hw/xfree86/osandcommon.c +hw/xfree86/ramdac/xf86BitOrder.c +hw/xfree86/scanpci/xf86PciData.c +hw/xfree86/scanpci/xf86PciIds.h +hw/xfree86/utils/cvt/cvt +hw/xfree86/utils/cvt/cvt.man +hw/xfree86/utils/gtf/gtf +hw/xfree86/utils/gtf/gtf.1x +hw/xfree86/utils/gtf/gtf.man +hw/xfree86/utils/ioport/inb +hw/xfree86/utils/ioport/inl +hw/xfree86/utils/ioport/inw +hw/xfree86/utils/ioport/ioport +hw/xfree86/utils/ioport/outb +hw/xfree86/utils/ioport/outl +hw/xfree86/utils/ioport/outw +hw/xfree86/utils/pcitweak/pcitweak +hw/xfree86/utils/pcitweak/pcitweak.1x +hw/xfree86/utils/pcitweak/pcitweak.man +hw/xfree86/utils/scanpci/scanpci +hw/xfree86/utils/scanpci/scanpci.1x +hw/xfree86/utils/scanpci/scanpci.man +hw/xfree86/utils/xorgcfg/XOrgCfg +hw/xfree86/utils/xorgcfg/xorgcfg +hw/xfree86/utils/xorgcfg/xorgcfg.1x +hw/xfree86/utils/xorgcfg/xorgcfg.man +hw/xfree86/utils/xorgconfig/xorgconfig +hw/xfree86/utils/xorgconfig/xorgconfig.1x +hw/xfree86/utils/xorgconfig/xorgconfig.man +hw/xfree86/xaa/l-xaaBitmap.c +hw/xfree86/xaa/l-xaaStipple.c +hw/xfree86/xaa/l-xaaTEGlyph.c +hw/xfree86/xaa/l3-xaaBitmap.c +hw/xfree86/xaa/l3-xaaStipple.c +hw/xfree86/xaa/lf-xaaBitmap.c +hw/xfree86/xaa/lf-xaaStipple.c +hw/xfree86/xaa/lf-xaaTEGlyph.c +hw/xfree86/xaa/lf3-xaaBitmap.c +hw/xfree86/xaa/lf3-xaaStipple.c +hw/xfree86/xaa/m-xaaBitmap.c +hw/xfree86/xaa/m-xaaStipple.c +hw/xfree86/xaa/m-xaaTEGlyph.c +hw/xfree86/xaa/m3-xaaBitmap.c +hw/xfree86/xaa/m3-xaaStipple.c +hw/xfree86/xaa/mf-xaaBitmap.c +hw/xfree86/xaa/mf-xaaStipple.c +hw/xfree86/xaa/mf-xaaTEGlyph.c +hw/xfree86/xaa/mf3-xaaBitmap.c +hw/xfree86/xaa/mf3-xaaStipple.c +hw/xfree86/xaa/s-xaaDashLine.c +hw/xfree86/xaa/s-xaaLine.c +hw/xfree86/xf1bpp/maskbits.c +hw/xfree86/xf1bpp/mfbbitblt.c +hw/xfree86/xf1bpp/mfbbltC.c +hw/xfree86/xf1bpp/mfbbltCI.c +hw/xfree86/xf1bpp/mfbbltG.c +hw/xfree86/xf1bpp/mfbbltO.c +hw/xfree86/xf1bpp/mfbbltX.c +hw/xfree86/xf1bpp/mfbbres.c +hw/xfree86/xf1bpp/mfbbresd.c +hw/xfree86/xf1bpp/mfbclip.c +hw/xfree86/xf1bpp/mfbcmap.c +hw/xfree86/xf1bpp/mfbfillarc.c +hw/xfree86/xf1bpp/mfbfillrct.c +hw/xfree86/xf1bpp/mfbfillsp.c +hw/xfree86/xf1bpp/mfbfont.c +hw/xfree86/xf1bpp/mfbgc.c +hw/xfree86/xf1bpp/mfbgetsp.c +hw/xfree86/xf1bpp/mfbigbblak.c +hw/xfree86/xf1bpp/mfbigbwht.c +hw/xfree86/xf1bpp/mfbhrzvert.c +hw/xfree86/xf1bpp/mfbimage.c +hw/xfree86/xf1bpp/mfbline.c +hw/xfree86/xf1bpp/mfbmisc.c +hw/xfree86/xf1bpp/mfbpablack.c +hw/xfree86/xf1bpp/mfbpainv.c +hw/xfree86/xf1bpp/mfbpawhite.c +hw/xfree86/xf1bpp/mfbpgbblak.c +hw/xfree86/xf1bpp/mfbpgbinv.c +hw/xfree86/xf1bpp/mfbpgbwht.c +hw/xfree86/xf1bpp/mfbpixmap.c +hw/xfree86/xf1bpp/mfbplyblack.c +hw/xfree86/xf1bpp/mfbplyinv.c +hw/xfree86/xf1bpp/mfbplywhite.c +hw/xfree86/xf1bpp/mfbpntwin.c +hw/xfree86/xf1bpp/mfbpolypnt.c +hw/xfree86/xf1bpp/mfbpushpxl.c +hw/xfree86/xf1bpp/mfbscrclse.c +hw/xfree86/xf1bpp/mfbscrinit.c +hw/xfree86/xf1bpp/mfbseg.c +hw/xfree86/xf1bpp/mfbsetsp.c +hw/xfree86/xf1bpp/mfbteblack.c +hw/xfree86/xf1bpp/mfbtewhite.c +hw/xfree86/xf1bpp/mfbtileC.c +hw/xfree86/xf1bpp/mfbtileG.c +hw/xfree86/xf1bpp/mfbwindow.c +hw/xfree86/xf1bpp/mfbzerarc.c +hw/xfree86/xf4bpp/mfbseg.c +hw/xfree86/xf8_32bpp/cfbgc32.c +hw/xfree86/xf8_32bpp/cfbgc8.c +hw/xfree86/xorg.c +hw/xfree86/xorg.conf.example +hw/xfree86/xorg.conf.example.pre +hw/xnest/Xnest +hw/xnest/Xnest.1x +hw/xnest/Xnest.man +hw/xprint/Xprt +hw/xprint/config/C/print/Xprinters.ghostscript +hw/xprint/doc/Xprt.1x +hw/xprint/doc/Xprt.man +hw/xprint/dpmsstubs-wrapper.c +hw/xprint/miinitext-wrapper.c +include/dix-config.h +include/kdrive-config.h +include/xgl-config.h +include/xkb-config.h +include/xorg-config.h +include/xorg-server.h +include/xwin-config.h +mfb/mfbbltC.c +mfb/mfbbltCI.c +mfb/mfbbltG.c +mfb/mfbbltO.c +mfb/mfbbltX.c +mfb/mfbigbblak.c +mfb/mfbigbwht.c +mfb/mfbpablack.c +mfb/mfbpainv.c +mfb/mfbpawhite.c +mfb/mfbpgbblak.c +mfb/mfbpgbinv.c +mfb/mfbpgbwht.c +mfb/mfbplyblack.c +mfb/mfbplyinv.c +mfb/mfbplywhite.c +mfb/mfbseg.c +mfb/mfbteblack.c +mfb/mfbtewhite.c +mfb/mfbtileC.c +mfb/mfbtileG.c diff --git a/xorg-server-1.20.1.tar.bz2 b/xorg-server-1.20.1.tar.bz2 new file mode 100644 index 0000000..a6b209e Binary files /dev/null and b/xorg-server-1.20.1.tar.bz2 differ diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec new file mode 100644 index 0000000..4c99a85 --- /dev/null +++ b/xorg-x11-server.spec @@ -0,0 +1,319 @@ +%undefine _hardened_build +%undefine _strict_symbol_defs_build + +#global gitdate 20161026 +%global stable_abi 1 + +%global ansic_major 0 +%global ansic_minor 4 +%global videodrv_major 24 +%global videodrv_minor 0 +%global xinput_major 24 +%global xinput_minor 1 +%global extension_major 10 +%global extension_minor 0 +%global pkgname xorg-server + +Name: xorg-x11-server +Version: 1.20.1 +Release: 10 +Summary: X.Org X11 X server +License: MIT and GPLv2 +URL: https://www.x.org +Source0: https://www.x.org/pub/individual/xserver/xorg-server-%{version}.tar.bz2 +Source1: gitignore +Source4: 10-quirks.conf +Source10: xserver.pamd + +# "useful" xvfb-run script +Source20: http://svn.exactcode.de/t2/trunk/package/xorg/xorg-server/xvfb-run.sh + +# for requires generation in drivers +Source30: xserver-sdk-abi-requires.release +Source31: xserver-sdk-abi-requires.git + +# From Debian use intel ddx driver only for gen4 and older chipsets +Patch1: 06_use-intel-only-on-pre-gen4.diff +# Default to xf86-video-modesetting on GeForce 8 and newer +Patch2: 0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch + +# Default to va_gl on intel i965 as we use the modesetting drv there +# va_gl should probably just be the default everywhere ? +Patch3: 0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch + +Patch4: 0001-Always-install-vbe-and-int10-sdk-headers.patch + +# Submitted upstream, but not going anywhere +Patch5: 0001-autobind-GPUs-to-the-screen.patch + +# because the display-managers are not ready yet, do not upstream +Patch6: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch + +# Submitted upstream +Patch7: 0001-xwayland-Remove-xwl_present_window-from-privates-on-.patch +Patch8: 0001-xwayland-fix-access-to-invalid-pointer.patch +Patch9: 0001-present-fix-freed-pointer-access.patch +Patch10: 0001-glx-check-for-indirect-context-in-CreateContextAttri.patch + +Patch6000: 0026-glamor_egl-Don-t-initialize-on-llvmpipe.patch +Patch6001: 0027-glamor-egl-Avoid-crashing-on-broken-configurations.patch + +BuildRequires: audit-libs-devel autoconf automake bison dbus-devel flex flex-devel git +BuildRequires: systemtap-sdt-devel libtool pkgconfig xorg-x11-util-macros xorg-x11-proto-devel +BuildRequires: xorg-x11-font-utils libepoxy-devel systemd-devel xorg-x11-xtrans-devel +BuildRequires: libXfont2-devel libXau-devel libxkbfile-devel libXres-devel +BuildRequires: libfontenc-devel libXtst-devel libXdmcp-devel libX11-devel libXext-devel +BuildRequires: libXinerama-devel libXi-devel libXt-devel libdmx-devel libXmu-devel libXrender-devel +BuildRequires: libXi-devel libXpm-devel libXaw-devel libXfixes-devel libepoxy-devel +BuildRequires: wayland-devel wayland-protocols-devel egl-wayland-devel libxshmfence-devel +BuildRequires: libXv-devel pixman-devel libpciaccess-devel openssl-devel kernel-headers +BuildRequires: mesa-libGL-devel mesa-libEGL-devel mesa-libgbm-devel libdrm-devel +BuildRequires: xcb-util-devel xcb-util-image-devel xcb-util-wm-devel libudev-devel +BuildRequires: xcb-util-keysyms-devel xcb-util-renderutil-devel libselinux-devel + +%ifarch aarch64 %{arm} x86_64 +BuildRequires: libunwind-devel +%endif + +Requires: pixman >= 0.30.0 xkeyboard-config xkbcomp +Requires: system-setup-keyboard xorg-x11-drv-libinput libEGL +Requires: xorg-x11-xauth + + +Obsoletes: %{name}-common %{name}-Xorg %{name}-Xorg%{?_isa} %{name}-Xnest %{name}-source %{name}-Xdmx %{name}-Xvfb %{name}-Xwayland +Provides: %{name}-common %{name}-Xorg %{name}-Xorg%{?_isa} %{name}-Xnest %{name}-source %{name}-Xdmx %{name}-Xvfb %{name}-Xwayland %{name}-Xwayland%{?_isa} + +Provides: Xorg = %{version}-%{release} +Provides: Xserver +Provides: xorg-x11-server-wrapper = %{version}-%{release} +Provides: xserver-abi(ansic-%{ansic_major}) = %{ansic_minor} +Provides: xserver-abi(videodrv-%{videodrv_major}) = %{videodrv_minor} +Provides: xserver-abi(xinput-%{xinput_major}) = %{xinput_minor} +Provides: xserver-abi(extension-%{extension_major}) = %{extension_minor} +Obsoletes: xorg-x11-glamor < %{version}-%{release} +Provides: xorg-x11-glamor = %{version}-%{release} +Obsoletes: xorg-x11-drv-modesetting < %{version}-%{release} +Provides: xorg-x11-drv-modesetting = %{version}-%{release} +Obsoletes: xorg-x11-drv-vmmouse < 13.1.0-4 +Provides: Xnest Xdmx Xvfb Xephyr + +%description +X.Org X11 X server + +%package Xephyr +Summary: A nested server +Requires: xorg-x11-server >= %{version}-%{release} +Provides: Xephyr + +%description Xephyr +Xephyr is an X server which has been implemented as an ordinary +X application. It runs in a window just like other X applications, +but it is an X server itself in which you can run other software. It +is a very useful tool for developers who wish to test their +applications without running them on their real X server. Unlike +Xnest, Xephyr renders to an X image rather than relaying the +X protocol, and therefore supports the newer X extensions like +Render and Composite. + +%package devel +Summary: SDK for X server driver module development +Requires: xorg-x11-util-macros xorg-x11-proto-devel libXfont2-devel +Requires: pkgconfig pixman-devel libpciaccess-devel +Provides: xorg-x11-server-static +Obsoletes: xorg-x11-glamor-devel < %{version}-%{release} +Provides: xorg-x11-glamor-devel = %{version}-%{release} + +%description devel +The SDK package provides the developmental files which are necessary for +developing X server driver modules, and for compiling driver modules +outside of the standard X11 source code tree. Developers writing video +drivers, input drivers, or other X modules should install this package. + +%package_help + +%prep +%autosetup -N -n xorg-server-%{version} +rm -rf .git +cp %{SOURCE1} .gitignore +%global __scm git +%{expand:%__scm_setup_git -q} +%autopatch + +getmajor() { + grep -i ^#define.ABI.$1_VERSION hw/xfree86/common/xf86Module.h | + tr '(),' ' ' | awk '{ print $4 }' +} + +getminor() { + grep -i ^#define.ABI.$1_VERSION hw/xfree86/common/xf86Module.h | + tr '(),' ' ' | awk '{ print $5 }' +} + +test `getmajor ansic` == %{ansic_major} +test `getminor ansic` == %{ansic_minor} +test `getmajor videodrv` == %{videodrv_major} +test `getminor videodrv` == %{videodrv_minor} +test `getmajor xinput` == %{xinput_major} +test `getminor xinput` == %{xinput_minor} +test `getmajor extension` == %{extension_major} +test `getminor extension` == %{extension_minor} + + +%build + +export LDFLAGS="$RPM_LD_FLAGS -specs=/usr/lib/rpm/%{_vendor}/%{_vendor}-hardened-ld" +export CXXFLAGS="$RPM_OPT_FLAGS -specs=/usr/lib/rpm/%{_vendor}/%{_vendor}-hardened-cc1" +export CFLAGS="$RPM_OPT_FLAGS -specs=/usr/lib/rpm/%{_vendor}/%{_vendor}-hardened-cc1" + +%ifnarch %{ix86} x86_64 +%global no_int10 --disable-vbe --disable-int10-module +%endif + +%global xservers --enable-xvfb --enable-xnest %{kdrive} --enable-xorg +%global default_font_path "catalogue:/etc/X11/fontpath.d,built-ins" +%global kdrive --enable-kdrive --enable-xephyr --disable-xfake --disable-xfbdev +%global bodhi_flags --with-vendor-name="openEuler Project" +%global dri_flags --enable-dri --enable-dri2 --enable-dri3 --enable-suid-wrapper --enable-glamor + +autoreconf -ivf || exit 1 + +%configure %{xservers} \ + --enable-dependency-tracking \ + --enable-xwayland-eglstream \ + --with-pic \ + %{?no_int10} --with-int10=x86emu \ + --with-default-font-path=%{default_font_path} \ + --with-module-dir=%{_libdir}/xorg/modules \ + --with-builderstring="Build ID: %{name} %{version}-%{release}" \ + --with-os-name="$(hostname -s) $(uname -r)" \ + --with-xkb-output=%{_localstatedir}/lib/xkb \ + --without-dtrace \ + --disable-linux-acpi --disable-linux-apm \ + --enable-xselinux --enable-record --enable-present \ + --enable-config-udev \ + --disable-unit-tests \ + --enable-dmx \ + --enable-xwayland \ + %{dri_flags} %{?bodhi_flags} \ + ${CONFIGURE} + +%make_build V=1 + +%install +%make_install + +install -d %{buildroot}/%{_libdir}/xorg/modules/{drivers,input} + +install -d %{buildroot}/%{_sysconfdir}/pam.d +install -m 644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/pam.d/xserver + +install -d %{buildroot}/%{_datadir}/X11/xorg.conf.d +install -m 644 %{SOURCE4} %{buildroot}/%{_datadir}/X11/xorg.conf.d + +install -d %{buildroot}/%{_sysconfdir}/X11/xorg.conf.d + +%if %{stable_abi} +install -m 755 %{SOURCE30} %{buildroot}/%{_bindir}/xserver-sdk-abi-requires +%else +sed -e s/@MAJOR@/%{gitdate}/g -e s/@MINOR@/%{minor_serial}/g %{SOURCE31} > \ + %{buildroot}/%{_bindir}/xserver-sdk-abi-requires +chmod 755 %{buildroot}/%{_bindir}/xserver-sdk-abi-requires +%endif + +install -m 0755 %{SOURCE20} %{buildroot}/%{_bindir}/xvfb-run + +%global xserver_source_dir %{_datadir}/xorg-x11-server-source +%global inst_srcdir %{buildroot}/%{xserver_source_dir} + +install -d %{inst_srcdir}/{Xext,xkb,GL,hw/{xquartz/bundle,xfree86/common}} +install -d %{inst_srcdir}/{hw/dmx/doc,man,doc,hw/dmx/doxygen} +cp {,%{inst_srcdir}/}hw/xquartz/bundle/cpprules.in +cp {,%{inst_srcdir}/}man/Xserver.man +cp {,%{inst_srcdir}/}doc/smartsched +cp {,%{inst_srcdir}/}hw/dmx/doxygen/doxygen.conf.in +cp {,%{inst_srcdir}/}xserver.ent.in +cp {,%{inst_srcdir}/}hw/xfree86/Xorg.sh.in +cp xkb/README.compiled %{inst_srcdir}/xkb +cp hw/xfree86/xorgconf.cpp %{inst_srcdir}/hw/xfree86 + +find . -type f | egrep '.*\.(c|h|am|ac|inc|m4|h.in|pc.in|man.pre|pl|txt)$' | +xargs tar cf - | (cd %{inst_srcdir} && tar xf -) +find %{inst_srcdir}/hw/xfree86 -name \*.c -delete + +{ +%delete_la +%ifnarch %{ix86} x86_64 + rm -f %{buildroot}/%{_libdir}/xorg/modules/lib{int10,vbe}.so +%endif +} + +%files +%defattr(-,root,root) +%doc COPYING +%config %attr(0644,root,root) %{_sysconfdir}/pam.d/xserver +%{_bindir}/* +%{_libexecdir}/Xorg +%attr(4755,root,root) %{_libexecdir}/Xorg.wrap +%{_libdir}/xorg/modules/drivers/modesetting_drv.so +%{_libdir}/xorg/modules/extensions/libglx.so +%dir %{_libdir}/xorg/modules/input +%{_libdir}/xorg/modules/libexa.so +%{_libdir}/xorg/modules/libfb*.so +%{_libdir}/xorg/modules/libglamoregl.so +%{_libdir}/xorg/modules/libs*.so +%{_libdir}/xorg/modules/libvgahw.so +%{_libdir}/xorg/modules/libwfb.so +%ifarch %{ix86} x86_64 +%{_libdir}/xorg/modules/libint10.so +%{_libdir}/xorg/modules/libvbe.so +%endif +%dir %{_sysconfdir}/X11/xorg.conf.d +%{_datadir}/X11/xorg.conf.d/10-quirks.conf +%{_datadir}/xorg-x11-server-source +%exclude %{_bindir}/Xephyr + +%files Xephyr +%defattr(-,root,root) +%{_bindir}/Xephyr + +%files devel +%defattr(-,root,root) +%{_bindir}/xserver-sdk-abi-requires +%{_libdir}/pkgconfig/xorg-server.pc +%{_includedir}/xorg/*.h +%{_datadir}/aclocal/xorg-server.m4 + +%files help +%defattr(-,root,root) +%doc ChangeLog README +%{_mandir}/man*/* +%{_localstatedir}/lib/xkb/README.compiled +%{_libdir}/xorg/protocol.txt + +%changelog +* Sun Dec 29 2019 openEuler Buildteam - 1.20.1-10 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:optimization the spec + +* Mon Dec 23 2019 openEuler Buildteam - 1.20.1-9 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:modify the standard for fonts + +* Thu Oct 31 2019 shenyangyang - 1.20.1-8 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:add provides of xorg-x11-server-Xwayland(aarch-64) + +* Wed Oct 23 2019 openEuler Buildteam - 1.20.1-7 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:change the path of the lib*.so files + +* Sat Oct 12 2019 openEuler Buildteam - 1.20.1-6 +- Package init diff --git a/xserver-sdk-abi-requires.git b/xserver-sdk-abi-requires.git new file mode 100644 index 0000000..c033061 --- /dev/null +++ b/xserver-sdk-abi-requires.git @@ -0,0 +1,14 @@ +#!/bin/sh +# +# The X server provides capabilities of the form: +# +# Provides: xserver-abi(ansic-0) = 4 +# +# for an ABI version of 0.4. The major number is encoded into the name so +# that major number changes force upgrades. If we didn't, then +# +# Requires: xserver-abi(ansic) >= 0.4 +# +# would also match 1.0, which is wrong since major numbers mean an ABI break. + +echo "xserver-abi($1-@MAJOR@) >= @MINOR@" diff --git a/xserver-sdk-abi-requires.release b/xserver-sdk-abi-requires.release new file mode 100644 index 0000000..30d77bf --- /dev/null +++ b/xserver-sdk-abi-requires.release @@ -0,0 +1,19 @@ +#!/bin/sh +# +# The X server provides capabilities of the form: +# +# Provides: xserver-abi(ansic-0) = 4 +# +# for an ABI version of 0.4. The major number is encoded into the name so +# that major number changes force upgrades. If we didn't, then +# +# Requires: xserver-abi(ansic) >= 0.4 +# +# would also match 1.0, which is wrong since major numbers mean an ABI break. + +ver=$(pkg-config --variable abi_$1 xorg-server) + +major=$(echo $ver | cut -f 1 -d .) +minor=$(echo $ver | cut -f 2 -d .) + +echo "xserver-abi($1-$major) >= $minor" diff --git a/xserver.pamd b/xserver.pamd new file mode 100644 index 0000000..bf79930 --- /dev/null +++ b/xserver.pamd @@ -0,0 +1,5 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_console.so +account required pam_permit.so +session optional pam_keyinit.so force revoke diff --git a/xvfb-run.sh b/xvfb-run.sh new file mode 100644 index 0000000..9d088c1 --- /dev/null +++ b/xvfb-run.sh @@ -0,0 +1,200 @@ +#!/bin/sh +# --- T2-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# T2 SDE: package/.../xorg-server/xvfb-run.sh +# Copyright (C) 2005 The T2 SDE Project +# Copyright (C) XXXX - 2005 Debian +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- T2-COPYRIGHT-NOTE-END --- + +# $Id$ +# from: http://necrotic.deadbeast.net/xsf/XFree86/trunk/debian/local/xvfb-run + +# This script starts an instance of Xvfb, the "fake" X server, runs a command +# with that server available, and kills the X server when done. The return +# value of the command becomes the return value of this script. +# +# If anyone is using this to build a Debian package, make sure the package +# Build-Depends on xvfb, xbase-clients, and xfonts-base. + +set -e + +PROGNAME=xvfb-run +SERVERNUM=99 +AUTHFILE= +ERRORFILE=/dev/null +STARTWAIT=3 +XVFBARGS="-screen 0 640x480x24" +LISTENTCP="-nolisten tcp" +XAUTHPROTO=. + +# Query the terminal to establish a default number of columns to use for +# displaying messages to the user. This is used only as a fallback in the event +# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the +# script is running, and this cannot, only being calculated once.) +DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true +if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then + DEFCOLUMNS=80 +fi + +# Display a message, wrapping lines at the terminal width. +message () { + echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} +} + +# Display an error message. +error () { + message "error: $*" >&2 +} + +# Display a usage message. +usage () { + if [ -n "$*" ]; then + message "usage error: $*" + fi + cat <&2 + exit 2 +fi + +if ! type xauth >/dev/null; then + error "xauth command not found" + exit 3 +fi + +# Set up the temp dir for the pid and X authorization file +XVFB_RUN_TMPDIR="$(mktemp --directory --tmpdir $PROGNAME.XXXXXX)" +# If the user did not specify an X authorization file to use, set up a temporary +# directory to house one. +if [ -z "$AUTHFILE" ]; then + AUTHFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" Xauthority.XXXXXX) +fi + +# Start Xvfb. +MCOOKIE=$(mcookie) + +if [ -z "$AUTO_DISPLAY" ]; then + # Old style using a pre-computed SERVERNUM + XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \ + 2>&1 & + XVFBPID=$! +else + # New style using Xvfb to provide a free display + PIDFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" pid.XXXXXX) + SERVERNUM=$(XAUTHORITY=$AUTHFILE Xvfb -displayfd 1 $XVFBARGS $LISTENTCP \ + 2>"$ERRORFILE" & echo $! > $PIDFILE) + XVFBPID=$(cat $PIDFILE) +fi +sleep "$STARTWAIT" + +XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1 +add :$SERVERNUM $XAUTHPROTO $MCOOKIE +EOF + +# Start the command and save its exit status. +set +e +DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1 +RETVAL=$? +set -e + +# Kill Xvfb now that the command has exited. +kill $XVFBPID + +# Clean up. +XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >"$ERRORFILE" 2>&1 +if [ -n "$XVFB_RUN_TMPDIR" ]; then + if ! rm -r "$XVFB_RUN_TMPDIR"; then + error "problem while cleaning up temporary directory" + exit 5 + fi +fi + +# Return the executed command's exit status. +exit $RETVAL + +# vim:set ai et sts=4 sw=4 tw=80: