summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-08-17 09:49:24 +1000
committerHans de Goede <hdegoede@redhat.com>2016-08-29 13:46:06 +0200
commit688fa6c4e68f9b447cf9ae9eb7711c113271bd31 (patch)
tree1a0e0c800b79a28503c502f1bbd3c8691fca4137
parentde013fd30e83a810c81988df7f6f1294f84640e9 (diff)
autobind GPUs to the screen, (v3)server-1.18-branch
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 <airlied@gmail.com>
-rw-r--r--hw/xfree86/common/xf86Init.c12
-rw-r--r--hw/xfree86/common/xf86platformBus.c3
-rw-r--r--hw/xfree86/modes/xf86Crtc.c32
3 files changed, 47 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 9bade905d..6b97d24ec 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -341,6 +341,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)
{
@@ -930,6 +940,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 96895a6e1..8b3a8623d 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -469,6 +469,8 @@ xf86platformProbeDev(DriverPtr drvp)
return foundScreen;
}
+extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master);
+
int
xf86platformAddDevice(int index)
{
@@ -540,6 +542,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 4a13c1329..e7a2f1d93 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -3575,3 +3575,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;
+ }
+}