diff options
author | Dave Airlie <airlied@redhat.com> | 2012-08-17 09:49:24 +1000 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2017-10-08 21:07:25 +0200 |
commit | 0cbd96f8bc6824b31b2a2c45672ff7e5475e924f (patch) | |
tree | fbbbcc1bef99b21ed73f14cd4bd37e7f3e83a1ec /hw/xfree86/common/xf86Init.c | |
parent | c2f2b25ab55c67f9f3ad07c02fa746eae7c61196 (diff) |
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>
Reviewed-by: Eric Anholt <eric@anholt.net>
---
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
Diffstat (limited to 'hw/xfree86/common/xf86Init.c')
-rw-r--r-- | hw/xfree86/common/xf86Init.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 994b63b43..326bfc191 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) { /* @@ -827,6 +841,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(); @@ -1339,6 +1355,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); |