summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD19
-rw-r--r--bug99358.patch162
-rw-r--r--xserver-autobind-hotplug.patch302
4 files changed, 326 insertions, 185 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e300aa3546ad..d6bdd9e63b1b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = xorg-server-dev
- pkgver = 1.19.2
+ pkgver = 1.19.3
pkgrel = 1
url = https://xorg.freedesktop.org
arch = i686
@@ -55,16 +55,16 @@ pkgbase = xorg-server-dev
makedepends = libunwind
makedepends = systemd
makedepends = wayland-protocols
- source = https://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.19.2.tar.bz2
- source = https://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.19.2.tar.bz2.sig
- source = bug99358.patch
+ source = https://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.19.3.tar.bz2
+ source = https://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.19.3.tar.bz2.sig
source = nvidia-add-modulepath-support.patch
+ source = xserver-autobind-hotplug.patch
source = xvfb-run
source = xvfb-run.1
- sha256sums = 191d91d02c059c66747635e145c30bc1004e703fe3b74439e26c0d05d5c4d28b
+ sha256sums = 677a8166e03474719238dfe396ce673c4234735464d6dadf2959b600d20e5a98
sha256sums = SKIP
- sha256sums = f46a9d1a5ac43c5359fbd8c57b6e64b0bd313116b5cb638527bfe3701e6c3904
sha256sums = 914a8d775b708f836ae3f0eeca553da3872727a2e4262190f4d5c01241cb14e8
+ sha256sums = fcaf536e4fc307958923b58f2baf3d3102ad694efc28506f6f95a9e64483fa57
sha256sums = ff0156309470fc1d378fd2e104338020a884295e285972cc88e250e031cc35b9
sha256sums = 2460adccd3362fefd4cdc5f1c70f332d7b578091fb9167bf88b5f91265bbd776
@@ -82,7 +82,7 @@ pkgname = xorg-server-dev
depends = libpciaccess
depends = libdrm
depends = libxshmfence
- provides = xorg-server=1.19.2
+ provides = xorg-server=1.19.3
provides = X-ABI-VIDEODRV_VERSION=23
provides = X-ABI-XINPUT_VERSION=24.1
provides = X-ABI-EXTENSION_VERSION=10.0
@@ -108,7 +108,7 @@ pkgname = xorg-server-xephyr-dev
depends = xcb-util-renderutil
depends = xcb-util-wm
depends = xcb-util-keysyms
- provides = xorg-server-xephyr=1.19.2
+ provides = xorg-server-xephyr=1.19.3
conflicts = xorg-server-xephyr
pkgname = xorg-server-xdmx-dev
@@ -122,7 +122,7 @@ pkgname = xorg-server-xdmx-dev
depends = libunwind
depends = pixman
depends = xorg-server-common-dev
- provides = xorg-server-xdmx=1.19.2
+ provides = xorg-server-xdmx=1.19.3
conflicts = xorg-server-xdmx
pkgname = xorg-server-xvfb-dev
@@ -134,7 +134,7 @@ pkgname = xorg-server-xvfb-dev
depends = xorg-server-common-dev
depends = xorg-xauth
depends = libgl
- provides = xorg-server-xvfb=1.19.2
+ provides = xorg-server-xvfb=1.19.3
conflicts = xorg-server-xvfb
pkgname = xorg-server-xnest-dev
@@ -145,7 +145,7 @@ pkgname = xorg-server-xnest-dev
depends = pixman
depends = xorg-server-common-dev
depends = libsystemd
- provides = xorg-server-xnest=1.19.2
+ provides = xorg-server-xnest=1.19.3
conflicts = xorg-server-xnest
pkgname = xorg-server-xwayland-dev
@@ -155,7 +155,7 @@ pkgname = xorg-server-xwayland-dev
depends = libgl
depends = pixman
depends = xorg-server-common-dev
- provides = xorg-server-xwayland=1.19.2
+ provides = xorg-server-xwayland=1.19.3
conflicts = xorg-server-xwayland
pkgname = xorg-server-common-dev
@@ -164,7 +164,7 @@ pkgname = xorg-server-common-dev
depends = xorg-xkbcomp
depends = xorg-setxkbmap
depends = xorg-fonts-misc
- provides = xorg-server-common=1.19.2-1
+ provides = xorg-server-common=1.19.3-1
conflicts = xorg-server-common
pkgname = xorg-server-devel-dev
@@ -189,6 +189,6 @@ pkgname = xorg-server-devel-dev
depends = scrnsaverproto
depends = presentproto
depends = xorg-util-macros
- provides = xorg-server-devel=1.19.2
+ provides = xorg-server-devel=1.19.3
conflicts = xorg-server-devel
diff --git a/PKGBUILD b/PKGBUILD
index 8f6a8323134c..22780e44b651 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,8 +3,8 @@
_pkgbase=xorg-server
pkgname=('xorg-server-dev' 'xorg-server-xephyr-dev' 'xorg-server-xdmx-dev' 'xorg-server-xvfb-dev' 'xorg-server-xnest-dev' 'xorg-server-xwayland-dev' 'xorg-server-common-dev' 'xorg-server-devel-dev')
-pkgver=1.19.2 # http://lists.x.org/archives/xorg/2017-March/058628.html
-pkgrel=1
+pkgver=1.19.3 # https://lists.x.org/archives/xorg/2017-March/058662.html
+pkgrel=1 # https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/xorg-server&id=8a67e151837c8ef7d6e1419828410e1b8944d169
arch=('i686' 'x86_64')
license=('custom')
groups=('xorg')
@@ -17,17 +17,17 @@ makedepends=('pixman' 'libx11' 'mesa' 'libgl' 'xf86driproto' 'xcmiscproto' 'xtra
'xcb-util' 'xcb-util-image' 'xcb-util-renderutil' 'xcb-util-wm' 'xcb-util-keysyms' 'dri3proto'
'libxshmfence' 'libunwind' 'systemd' 'wayland-protocols')
source=(${url}/releases/individual/xserver/${_pkgbase}-${pkgver}.tar.bz2{,.sig}
- bug99358.patch
nvidia-add-modulepath-support.patch
+ xserver-autobind-hotplug.patch
xvfb-run
xvfb-run.1)
validpgpkeys=('7B27A3F1A6E18CD9588B4AE8310180050905E40C'
'C383B778255613DFDB409D91DB221A6900000011'
'DD38563A8A8224537D1F90E45B8A2D50A0ECD0D3')
-sha256sums=('191d91d02c059c66747635e145c30bc1004e703fe3b74439e26c0d05d5c4d28b'
+sha256sums=('677a8166e03474719238dfe396ce673c4234735464d6dadf2959b600d20e5a98'
'SKIP'
- 'f46a9d1a5ac43c5359fbd8c57b6e64b0bd313116b5cb638527bfe3701e6c3904'
'914a8d775b708f836ae3f0eeca553da3872727a2e4262190f4d5c01241cb14e8'
+ 'fcaf536e4fc307958923b58f2baf3d3102ad694efc28506f6f95a9e64483fa57'
'ff0156309470fc1d378fd2e104338020a884295e285972cc88e250e031cc35b9'
'2460adccd3362fefd4cdc5f1c70f332d7b578091fb9167bf88b5f91265bbd776')
@@ -37,10 +37,11 @@ prepare() {
msg2 "merged upstream in trunk"
patch -Np1 -i ../nvidia-add-modulepath-support.patch
- msg2 "Fix: Bug 99358 - Xorg crashes with SIGSEGV in sna_set_cursor_position()"
- msg2 "https://bugs.freedesktop.org/show_bug.cgi?id=99358"
- msg2 "https://bugs.archlinux.org/task/52808"
- patch -Np1 -i ../bug99358.patch
+ msg2 "patch from Fedora, not yet merged"
+ patch -Np1 -i ../xserver-autobind-hotplug.patch
+
+ msg2 "Starting autoreconf..."
+ autoreconf -vfi
}
build() {
diff --git a/bug99358.patch b/bug99358.patch
deleted file mode 100644
index 7feb762ba1bd..000000000000
--- a/bug99358.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From 7198a6d4e74f684cb383b3e0f70dd2bae405e6e7 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Mon, 16 Jan 2017 22:17:36 +0000
-Subject: xfree86: Take the input lock for xf86RecolorCursor
-
-xf86RecolorCursor() may be called directly from XRecolorCursor as well
-as from xf86ScreenSetCursor(). In the latter case, the input lock is
-already held, but not for the former and so we need to add a wrapper
-function that acquires the input lock before performing
-xf86RecolorCursor()
-
-References: https://bugs.freedesktop.org/show_bug.cgi?id=99358
-
-diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
-index 4481320..55d5861 100644
---- a/hw/xfree86/ramdac/xf86HWCurs.c
-+++ b/hw/xfree86/ramdac/xf86HWCurs.c
-@@ -22,6 +22,9 @@
-
- #include "servermd.h"
-
-+static void
-+xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs);
-+
- static CARD32
- xf86ReverseBitOrder(CARD32 v)
- {
-@@ -204,7 +207,7 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
- if (!xf86DriverLoadCursorImage (infoPtr, bits))
- return FALSE;
-
-- xf86RecolorCursor(pScreen, pCurs, 1);
-+ xf86RecolorCursor_locked (ScreenPriv, pCurs);
-
- (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
-
-@@ -312,12 +315,9 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
- input_unlock();
- }
-
--void
--xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
-+static void
-+xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs)
- {
-- xf86CursorScreenPtr ScreenPriv =
-- (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
-- xf86CursorScreenKey);
- xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
-
- /* recoloring isn't applicable to ARGB cursors and drivers
-@@ -357,6 +357,18 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
- }
- }
-
-+void
-+xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
-+{
-+ xf86CursorScreenPtr ScreenPriv =
-+ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
-+ xf86CursorScreenKey);
-+
-+ input_lock();
-+ xf86RecolorCursor_locked (ScreenPriv, pCurs);
-+ input_unlock();
-+}
-+
- /* These functions assume that MaxWidth is a multiple of 32 */
- static unsigned char *
- RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
---
-cgit v0.10.2
-
-From cfddd919cce4178baba07959e5e862d02e166522 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Mon, 16 Jan 2017 22:36:34 +0000
-Subject: xfree86: Take input lock for xf86TransparentCursor
-
-
-diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
-index 55d5861..26dc7e5 100644
---- a/hw/xfree86/ramdac/xf86HWCurs.c
-+++ b/hw/xfree86/ramdac/xf86HWCurs.c
-@@ -261,6 +261,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
- xf86CursorScreenKey);
- xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
-
-+ input_lock();
-+
- if (!ScreenPriv->transparentData)
- ScreenPriv->transparentData =
- (*infoPtr->RealizeCursor) (infoPtr, NullCursor);
-@@ -273,6 +275,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
- ScreenPriv->transparentData);
-
- (*infoPtr->ShowCursor) (infoPtr->pScrn);
-+
-+ input_unlock();
- }
-
- static void
---
-cgit v0.10.2
-
-From 3eb964e25243056dd998f52d3b00171b71c89189 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Fri, 20 Jan 2017 09:49:19 +0000
-Subject: xfree86: Take input_lock() for xf86ScreenCheckHWCursor
-
-
-diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
-index 26dc7e5..7043a9c 100644
---- a/hw/xfree86/ramdac/xf86HWCurs.c
-+++ b/hw/xfree86/ramdac/xf86HWCurs.c
-@@ -139,9 +139,14 @@ Bool
- xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr)
- {
- ScreenPtr pSlave;
-+ Bool use_hw_cursor = TRUE;
-
-- if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr))
-- return FALSE;
-+ input_lock();
-+
-+ if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr)) {
-+ use_hw_cursor = FALSE;
-+ goto unlock;
-+ }
-
- /* ask each driver consuming a pixmap if it can support HW cursor */
- xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) {
-@@ -151,14 +156,22 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr
- continue;
-
- sPriv = dixLookupPrivate(&pSlave->devPrivates, xf86CursorScreenKey);
-- if (!sPriv) /* NULL if Option "SWCursor", possibly other conditions */
-- return FALSE;
-+ if (!sPriv) { /* NULL if Option "SWCursor", possibly other conditions */
-+ use_hw_cursor = FALSE;
-+ break;
-+ }
-
- /* FALSE if HWCursor not supported by slave */
-- if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr))
-- return FALSE;
-+ if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) {
-+ use_hw_cursor = FALSE;
-+ break;
-+ }
- }
-- return TRUE;
-+
-+unlock:
-+ input_unlock();
-+
-+ return use_hw_cursor;
- }
-
- static Bool
---
-cgit v0.10.2
-
diff --git a/xserver-autobind-hotplug.patch b/xserver-autobind-hotplug.patch
new file mode 100644
index 000000000000..8025cbd87be9
--- /dev/null
+++ b/xserver-autobind-hotplug.patch
@@ -0,0 +1,302 @@
+From 4471df41ea6e94834a2b10643ca7fcd69682d276 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Fri, 17 Aug 2012 09:49:24 +1000
+Subject: [PATCH xserver v3] 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 <airlied@gmail.com>
+[hdegoede@redhat.com: Make configurable, fix with nvidia, submit upstream]
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+---
+Changes in v2:
+-Make the default enabled instead of installing a xorg.conf
+ snippet which enables it unconditionally
+Changes in v3:
+-Handle GPUScreen autoconfig in randr/rrprovider.c, looking at
+ rrScrPriv->provider, rather then in hw/xfree86/modes/xf86Crtc.c
+ looking at xf86CrtcConfig->provider. This fixes the autoconfig not
+ working with the nvidia binary driver
+---
+ 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 21daf1a..df3ca50 100644
+--- a/hw/xfree86/common/xf86Config.c
++++ b/hw/xfree86/common/xf86Config.c
+@@ -719,6 +719,7 @@ typedef enum {
+ FLAG_DRI2,
+ FLAG_USE_SIGIO,
+ FLAG_AUTO_ADD_GPU,
++ FLAG_AUTO_BIND_GPU,
+ FLAG_MAX_CLIENTS,
+ FLAG_IGLX,
+ } FlagValues;
+@@ -778,6 +779,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,
+@@ -857,6 +860,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 e962b75..0d1e31b 100644
+--- a/hw/xfree86/common/xf86Globals.c
++++ b/hw/xfree86/common/xf86Globals.c
+@@ -136,6 +136,7 @@ xf86InfoRec xf86Info = {
+ #else
+ .autoAddGPU = FALSE,
+ #endif
++ .autoBindGPU = TRUE,
+ };
+
+ const char *xf86ConfigFile = NULL;
+@@ -197,6 +198,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 a544b65..b0cba3d 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 "xf86Bus.h"
+@@ -298,6 +299,19 @@ xf86PrivsElevated(void)
+ }
+
+ 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
+ InstallSignalHandlers(void)
+ {
+ /*
+@@ -871,6 +885,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();
+@@ -1389,6 +1405,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 c1f8a18..9a3d0df 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 c29b3cc..4c5f54b 100644
+--- a/hw/xfree86/common/xf86Privstr.h
++++ b/hw/xfree86/common/xf86Privstr.h
+@@ -102,6 +102,7 @@ typedef struct {
+ MessageType dri2From;
+
+ Bool autoAddGPU;
++ Bool autoBindGPU;
+ } xf86InfoRec, *xf86InfoPtr;
+
+ #ifdef DPMSExtension
+diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
+index 063e81c..42789ca 100644
+--- a/hw/xfree86/common/xf86platformBus.c
++++ b/hw/xfree86/common/xf86platformBus.c
+@@ -48,6 +48,7 @@
+ #include "Pci.h"
+ #include "xf86platformBus.h"
+ #include "xf86Config.h"
++#include "xf86Crtc.h"
+
+ #include "randrstr.h"
+ int platformSlotClaimed;
+@@ -579,6 +580,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 def9bfc..8df6b7d 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 7d0c524..3e596e4 100644
+--- a/hw/xfree86/man/xorg.conf.man
++++ b/hw/xfree86/man/xorg.conf.man
+@@ -673,6 +673,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 706e9a7..66999d5 100644
+--- a/randr/randrstr.h
++++ b/randr/randrstr.h
+@@ -976,6 +976,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 f9df67e..abc5685 100644
+--- a/randr/rrprovider.c
++++ b/randr/rrprovider.c
+@@ -482,3 +482,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.9.3
+