From 7b5feca9a24e7d96f9b3f98ae980d511ac888c0c676b9628fb709e371ef88ace Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Mon, 19 May 2014 11:01:26 +0000 Subject: [PATCH 1/3] - Added n_xserver-optimus-autoconfig-hack.patch for FATE#316410. This is a little hack to make the X server autoconfigure the output sinks for Optimus laptops. This lets them automatically use outputs that are only wired to a certain GPU. To be removed once our desktop tools can configure this easily. OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=517 --- n_xserver-optimus-autoconfig-hack.patch | 113 ++++++++++++++++++++++++ xorg-x11-server.changes | 9 ++ xorg-x11-server.spec | 3 + 3 files changed, 125 insertions(+) create mode 100644 n_xserver-optimus-autoconfig-hack.patch diff --git a/n_xserver-optimus-autoconfig-hack.patch b/n_xserver-optimus-autoconfig-hack.patch new file mode 100644 index 0000000..0918de2 --- /dev/null +++ b/n_xserver-optimus-autoconfig-hack.patch @@ -0,0 +1,113 @@ +From 3216e0c618cc330f053ed36a749c8d8cfeb87a2f Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 17 Aug 2012 09:49:24 +1000 +Subject: [PATCH] autobind GPUs to the screen, (v3) + +this is racy and really not what we want for hotplug going forward, +but until DE support is in GNOME its probably for the best. + +v2: fix if config or slave config is NULL +v3: fix multi useful slaves +DO NOT UPSTREAM. + +Signed-off-by: Dave Airlie +--- + hw/xfree86/common/xf86Init.c | 12 ++++++++++++ + hw/xfree86/common/xf86platformBus.c | 3 +++ + hw/xfree86/modes/xf86Crtc.c | 32 ++++++++++++++++++++++++++++++++ + 3 files changed, 47 insertions(+) + +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 1e95061..c58fd2b 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -361,6 +361,16 @@ xf86CreateRootWindow(WindowPtr pWin) + return ret; + } + ++extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master); ++static void ++xf86AutoConfigOutputDevices(void) ++{ ++ int i; ++ ++ for (i = 0; i < xf86NumGPUScreens; i++) ++ xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]); ++} ++ + static void + InstallSignalHandlers(void) + { +@@ -931,6 +941,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) + OsReleaseSIGIO(); +diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c +index 33b2b7d..be3bdd9 100644 +--- a/hw/xfree86/common/xf86platformBus.c ++++ b/hw/xfree86/common/xf86platformBus.c +@@ -393,6 +393,8 @@ xf86platformProbeDev(DriverPtr drvp) + return foundScreen; + } + ++extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master); ++ + int + xf86platformAddDevice(int index) + { +@@ -465,6 +467,7 @@ xf86platformAddDevice(int index) + } + /* attach unbound to 0 protocol screen */ + AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); ++ xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]); + + RRResourcesChanged(xf86Screens[0]->pScreen); + RRTellChanged(xf86Screens[0]->pScreen); +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index a441fd1..c1a56a5 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -3383,3 +3383,35 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn) + crtc->x = crtc->y = 0; + } + } ++ ++ ++void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master) ++{ ++ RRProviderPtr master_provider; ++ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(master); ++ xf86CrtcConfigPtr slave_config = XF86_CRTC_CONFIG_PTR(pScrn); ++ Bool unbound = FALSE; ++ ++ if (!config || !slave_config) ++ return; ++ ++ master_provider = config->randr_provider; ++ ++ if ((master->capabilities & RR_Capability_SinkOffload) && ++ pScrn->capabilities & RR_Capability_SourceOffload) { ++ /* source offload */ ++ ++ DetachUnboundGPU(pScrn->pScreen); ++ unbound = TRUE; ++ AttachOffloadGPU(master->pScreen, pScrn->pScreen); ++ slave_config->randr_provider->offload_sink = master_provider; ++ } ++ if ((master->capabilities & RR_Capability_SourceOutput) && ++ pScrn->capabilities & RR_Capability_SinkOutput) { ++ /* sink offload */ ++ if (!unbound) ++ DetachUnboundGPU(pScrn->pScreen); ++ AttachOutputGPU(master->pScreen, pScrn->pScreen); ++ slave_config->randr_provider->output_source = master_provider; ++ } ++} +-- +1.8.4.5 + diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index 380c771..6f241f0 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon May 19 10:52:32 UTC 2014 - sndirsch@suse.com + +- Added n_xserver-optimus-autoconfig-hack.patch for FATE#316410. This + is a little hack to make the X server autoconfigure the output sinks + for Optimus laptops. This lets them automatically use outputs that + are only wired to a certain GPU. To be removed once our desktop + tools can configure this easily. + ------------------------------------------------------------------- Tue May 13 13:19:30 UTC 2014 - tobias.johannes.klausmann@mni.thm.de diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 514fc21..c0c08ae 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -154,6 +154,7 @@ Patch107: u_arch-Fix-image-and-bitmap-byte-order-for-ppc64le.patch Patch162: b_cache-xkbcomp-output-for-fast-start-up.patch Patch211: b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch Patch222: b_sync-fix.patch +Patch223: n_xserver-optimus-autoconfig-hack.patch %description This package contains the X.Org Server. @@ -232,6 +233,8 @@ cp %{SOURCE90} . ### patch222 might not be applicable anymore #%patch222 -p1 +%patch223 -p1 + %build autoreconf -fi %configure CFLAGS="%{optflags} -fno-strict-aliasing" \ From ebc18c564778d0121f23ec3c02ad5867d0d3b9366954be86a6426de85191d0e9 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Sat, 24 May 2014 10:37:00 +0000 Subject: [PATCH 2/3] - Fix crash in abnormal condition (bnc#879666, bnc#879489): * u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch Fix a crash when CloseWellKnownConnections() gets called twice. This can happen if FatalError() is called in the shutdown procedure. * u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch Don't call FatalError() on errors in console ioctls when in shutdown. OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=518 --- ...report-FatalError-when-shutting-down.patch | 81 +++++++++++++++++++ ...llKnownConnections-gets-called-twice.patch | 33 ++++++++ xorg-x11-server.changes | 10 +++ xorg-x11-server.spec | 4 + 4 files changed, 128 insertions(+) create mode 100644 u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch create mode 100644 u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch diff --git a/u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch b/u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch new file mode 100644 index 0000000..90b3722 --- /dev/null +++ b/u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch @@ -0,0 +1,81 @@ +From: Egbert Eich +Date: Sat May 24 02:02:32 2014 +0200 +Subject: [PATCH]CloseConsole: Don't report FatalError() when shutting down +Patch-mainline: to be upstreamed +Git-commit: 4edf1fd15b9d2746f1f83165ab45efbe35af8de8 +Git-repo: +References: bnc#879666, bnc#879489 +Signed-off-by: Egbert Eich + +When encountering a problem while closing the console, don't report this +as a FatalError(). FatalError() will terminate the Xserver - no use calling +it when terminating anyway. Since FatalError() will call CloseConsole() +we would only come here again. + +Signed-off-by: Egbert Eich +--- + hw/xfree86/os-support/linux/lnx_init.c | 25 ++++++++++++++++--------- + 1 file changed, 16 insertions(+), 9 deletions(-) + +diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c +index bcb039f..c46bca9 100644 +--- a/hw/xfree86/os-support/linux/lnx_init.c ++++ b/hw/xfree86/os-support/linux/lnx_init.c +@@ -63,17 +63,24 @@ drain_console(int fd, void *closure) + } + + static void +-switch_to(int vt, const char *from) ++switch_to(int vt, const char *from, Bool fatal) + { + int ret; + + SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt)); +- if (ret < 0) +- FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); +- ++ if (ret < 0) { ++ if (fatal) ++ FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); ++ else ++ xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); ++ } + SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt)); +- if (ret < 0) +- FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); ++ if (ret < 0) { ++ if (fatal) ++ FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); ++ else ++ xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); ++ } + } + + void +@@ -194,7 +201,7 @@ xf86OpenConsole(void) + /* + * now get the VT. This _must_ succeed, or else fail completely. + */ +- switch_to(xf86Info.vtno, "xf86OpenConsole"); ++ switch_to(xf86Info.vtno, "xf86OpenConsole", TRUE); + + SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT)); + if (ret < 0) +@@ -255,7 +262,7 @@ xf86OpenConsole(void) + else { /* serverGeneration != 1 */ + if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) { + /* now get the VT */ +- switch_to(xf86Info.vtno, "xf86OpenConsole"); ++ switch_to(xf86Info.vtno, "xf86OpenConsole", TRUE); + } + } + } +@@ -305,7 +312,7 @@ xf86CloseConsole(void) + * Perform a switch back to the active VT when we were started + */ + if (activeVT >= 0) { +- switch_to(activeVT, "xf86CloseConsole"); ++ switch_to(activeVT, "xf86CloseConsole", FALSE); + activeVT = -1; + } + } diff --git a/u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch b/u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch new file mode 100644 index 0000000..f761d28 --- /dev/null +++ b/u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch @@ -0,0 +1,33 @@ +From: Egbert Eich +Date: Fri May 23 20:08:29 2014 +0200 +Subject: [PATCH]connection: avoid crash when CloseWellKnownConnections() gets called twice +Patch-mainline: to be upstreamed +Git-commit: 74472c4e8e4c873014554f321ec2086066126297 +Git-repo: +References: bnc#879666, bnc#879489 +Signed-off-by: Egbert Eich + +CloseWellKnownConnections() closes all connections and deallocates +their data. Thus all entries in ListenTransConns are invalid. +To avoid access to those entries set ListenTransCount to 0. +This avoids crashes when CloseWellKnownConnections() is called twice +for instance when FatalError() is called on Xserver shutdown. + +Signed-off-by: Egbert Eich +--- + os/connection.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/os/connection.c b/os/connection.c +index 162e1d9..3c0b62a 100644 +--- a/os/connection.c ++++ b/os/connection.c +@@ -513,6 +513,8 @@ CloseWellKnownConnections(void) + + for (i = 0; i < ListenTransCount; i++) + _XSERVTransClose(ListenTransConns[i]); ++ ++ ListenTransCount = 0; + } + + static void diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index 6f241f0..0f7af54 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sat May 24 09:16:08 UTC 2014 - eich@suse.com + +- Fix crash in abnormal condition (bnc#879666, bnc#879489): + * u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch + Fix a crash when CloseWellKnownConnections() gets called twice. + This can happen if FatalError() is called in the shutdown procedure. + * u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch + Don't call FatalError() on errors in console ioctls when in shutdown. + ------------------------------------------------------------------- Mon May 19 10:52:32 UTC 2014 - sndirsch@suse.com diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index c0c08ae..81d6e04 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -150,6 +150,8 @@ Patch105: ux_xserver_xvfb-randr.patch Patch106: u_exa-only-draw-valid-trapezoids.patch # PATCH-FIX-UPSTREAM u_arch-Fix-image-and-bitmap-byte-order-for-ppc64le.patch -- sent to ML 2014-02-24 Patch107: u_arch-Fix-image-and-bitmap-byte-order-for-ppc64le.patch +Patch110: u_connection-avoid-crash-when-CloseWellKnownConnections-gets-called-twice.patch +Patch111: u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch Patch162: b_cache-xkbcomp-output-for-fast-start-up.patch Patch211: b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch @@ -225,6 +227,8 @@ cp %{SOURCE90} . %patch105 -p1 %patch106 -p1 %patch107 -p1 +%patch110 -p1 +%patch111 -p1 ### disabled for now #%patch162 -p1 From 5cd006c2113617c248c0fc5b6bcd8adcbd2a457fe1e4469e33da885d715bd568 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Wed, 28 May 2014 11:03:19 +0000 Subject: [PATCH 3/3] - %post: * move SaX2 generated xorg.conf file to xorg.conf.sle11 Only in very rare cases a static X configuration is still required on sle12. And, in some cases the migration from a static sle11 X configuration to a static sle12 X configuration is not possible at all, e.g. some video and input drivers are no longer available on sle12. In short, trying to migrate will result in more harm than benefit. (bnc#877315) * remove dangling link /etc/X11/XF86Config (bnc#879360, comment#15) * prevent %postun of NVIDIA/fglrx driver packages from restoring xorg.conf backup or running sax2 as fallback to create a new xorg.conf (bcn#877315) OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=519 --- xorg-x11-server.changes | 16 ++++++++++++++++ xorg-x11-server.spec | 36 ++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index 0f7af54..4096a02 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Wed May 28 11:00:49 UTC 2014 - sndirsch@suse.com + +- %post: + * move SaX2 generated xorg.conf file to xorg.conf.sle11 + Only in very rare cases a static X configuration is still + required on sle12. And, in some cases the migration from a + static sle11 X configuration to a static sle12 X configuration + is not possible at all, e.g. some video and input drivers + are no longer available on sle12. In short, trying to migrate + will result in more harm than benefit. (bnc#877315) + * remove dangling link /etc/X11/XF86Config (bnc#879360, comment#15) + * prevent %postun of NVIDIA/fglrx driver packages from + restoring xorg.conf backup or running sax2 as fallback + to create a new xorg.conf (bcn#877315) + ------------------------------------------------------------------- Sat May 24 09:16:08 UTC 2014 - eich@suse.com diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 81d6e04..0f78729 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -340,23 +340,27 @@ install -D xorg-x11-server.macros %{buildroot}%{_sysconfdir}/rpm/macros.xorg-ser %post %ifnarch s390 s390x %{fillup_only -an displaymanager} -if [ -f etc/X11/xorg.conf ]; then - # Document how to restore previous input driver behaviour in xorg.conf files created - # on openSUSE <= 11.1 - if ! grep -q "will be disabled unless 'Option \"AutoAddDevices\" \"off\"'" etc/X11/xorg.conf; then - if ! grep -q "\"AutoAddDevices\" \"off\"" etc/X11/xorg.conf; then - sed -i ' -/Section "ServerFlags"/{ -h -g -a\ - # Uncomment the following option to reenable kbd/mouse driver input sections. \ - # Otherwise evdev driver is used. \ - #Option "AutoAddDevices" "off" -} -' etc/X11/xorg.conf +# Move SaX2 generated xorg.conf file to xorg.conf.sle11 +# +# Only in very rare cases a static X configuration is still +# required on sle12. And, in some cases the migration from a +# static sle11 X configuration to a static sle12 X configuration +# is not possible at all, e.g. some video and input drivers +# are no longer available on sle12. In short, trying to migrate +# will result in more harm than benefit. +if [ -f etc/X11/xorg.conf -a ! -f etc/X11/xorg.conf.sle11 ]; then + echo "xorg.conf exists and xorg.conf.sle11 does not" + if grep -q "SaX generated X11 config file" etc/X11/xorg.conf; then + echo "move SaX generated xorg.conf to xorg.conf.sle11" + mv etc/X11/xorg.conf{,.sle11} + # remove dangling link (bnc#879360, comment#15) + rm -f etc/X11/XF86Config + # prevent %postun of NVIDIA/fglrx driver packages from restoring xorg.conf + # backup or running sax2 as fallback to create a new xorg.conf (bcn#877315) + rm -f etc/X11/xorg.conf.nvidia-post \ + etc/X11/xorg.conf.fglrx-post + chmod -x usr/sbin/sax2 fi - fi fi %endif exit 0