2012-09-25 06:26:02 +00:00
|
|
|
From 536626891b60039c0f3f9b4cd96156e9fe810f39 Mon Sep 17 00:00:00 2001
|
2012-08-17 00:16:37 +00:00
|
|
|
From: Dave Airlie <airlied@redhat.com>
|
|
|
|
Date: Fri, 17 Aug 2012 09:49:24 +1000
|
2012-09-25 06:26:02 +00:00
|
|
|
Subject: [PATCH] autobind GPUs to the screen, (v2)
|
2012-08-17 00:16:37 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2012-09-25 06:26:02 +00:00
|
|
|
v2: fix if config or slave config is NULL
|
2012-08-17 00:16:37 +00:00
|
|
|
DO NOT UPSTREAM.
|
|
|
|
---
|
2012-08-24 03:37:10 +00:00
|
|
|
hw/xfree86/common/xf86Init.c | 12 ++++++++++++
|
|
|
|
hw/xfree86/common/xf86platformBus.c | 3 +++
|
2012-09-25 06:26:02 +00:00
|
|
|
hw/xfree86/modes/xf86Crtc.c | 28 ++++++++++++++++++++++++++++
|
|
|
|
3 files changed, 43 insertions(+)
|
2012-08-17 00:16:37 +00:00
|
|
|
|
|
|
|
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
|
2012-09-25 06:26:02 +00:00
|
|
|
index d231ced..89629c1 100644
|
2012-08-17 00:16:37 +00:00
|
|
|
--- a/hw/xfree86/common/xf86Init.c
|
|
|
|
+++ b/hw/xfree86/common/xf86Init.c
|
2012-08-24 03:37:10 +00:00
|
|
|
@@ -361,6 +361,16 @@ xf86CreateRootWindow(WindowPtr pWin)
|
|
|
|
return ret;
|
|
|
|
}
|
2012-08-17 00:16:37 +00:00
|
|
|
|
2012-08-24 03:37:10 +00:00
|
|
|
+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)
|
|
|
|
{
|
2012-09-25 06:26:02 +00:00
|
|
|
@@ -926,6 +936,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
2012-08-24 03:37:10 +00:00
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++)
|
|
|
|
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
|
2012-08-17 00:16:37 +00:00
|
|
|
|
2012-08-24 03:37:10 +00:00
|
|
|
+ xf86AutoConfigOutputDevices();
|
|
|
|
+
|
2012-08-17 00:16:37 +00:00
|
|
|
xf86VGAarbiterWrapFunctions();
|
|
|
|
if (sigio_blocked)
|
2012-08-24 03:37:10 +00:00
|
|
|
OsReleaseSIGIO();
|
2012-08-17 00:16:37 +00:00
|
|
|
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
|
2012-09-25 06:26:02 +00:00
|
|
|
index a73aea2..3810076 100644
|
2012-08-17 00:16:37 +00:00
|
|
|
--- a/hw/xfree86/common/xf86platformBus.c
|
|
|
|
+++ b/hw/xfree86/common/xf86platformBus.c
|
2012-09-25 06:26:02 +00:00
|
|
|
@@ -387,6 +387,8 @@ xf86platformProbeDev(DriverPtr drvp)
|
2012-08-24 03:37:10 +00:00
|
|
|
return foundScreen;
|
|
|
|
}
|
2012-08-17 00:16:37 +00:00
|
|
|
|
2012-08-24 03:37:10 +00:00
|
|
|
+extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master);
|
2012-08-17 00:16:37 +00:00
|
|
|
+
|
2012-08-24 03:37:10 +00:00
|
|
|
int
|
|
|
|
xf86platformAddDevice(int index)
|
|
|
|
{
|
2012-09-25 06:26:02 +00:00
|
|
|
@@ -446,6 +448,7 @@ xf86platformAddDevice(int index)
|
2012-08-24 03:37:10 +00:00
|
|
|
|
|
|
|
/* attach unbound to 0 protocol screen */
|
|
|
|
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
|
|
|
|
+ xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);
|
|
|
|
|
2012-08-17 00:16:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2012-08-24 03:37:10 +00:00
|
|
|
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
|
2012-09-25 06:26:02 +00:00
|
|
|
index 8f05c53..ba84e6b 100644
|
2012-08-24 03:37:10 +00:00
|
|
|
--- a/hw/xfree86/modes/xf86Crtc.c
|
|
|
|
+++ b/hw/xfree86/modes/xf86Crtc.c
|
2012-09-25 06:26:02 +00:00
|
|
|
@@ -3321,3 +3321,31 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn)
|
2012-08-24 03:37:10 +00:00
|
|
|
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);
|
|
|
|
+
|
2012-09-25 06:26:02 +00:00
|
|
|
+ if (!config || !slave_config)
|
|
|
|
+ return;
|
|
|
|
+
|
2012-08-24 03:37:10 +00:00
|
|
|
+ master_provider = config->randr_provider;
|
|
|
|
+
|
|
|
|
+ if ((master->capabilities & RR_Capability_SinkOffload) &&
|
|
|
|
+ pScrn->capabilities & RR_Capability_SourceOffload) {
|
|
|
|
+ /* source offload */
|
|
|
|
+
|
|
|
|
+ DetachUnboundGPU(pScrn->pScreen);
|
|
|
|
+ AttachOffloadGPU(master->pScreen, pScrn->pScreen);
|
|
|
|
+ slave_config->randr_provider->offload_sink = master_provider;
|
|
|
|
+ } else if ((master->capabilities & RR_Capability_SourceOutput) &&
|
|
|
|
+ pScrn->capabilities & RR_Capability_SinkOutput) {
|
|
|
|
+ /* sink offload */
|
|
|
|
+ DetachUnboundGPU(pScrn->pScreen);
|
|
|
|
+ AttachOutputGPU(master->pScreen, pScrn->pScreen);
|
|
|
|
+ slave_config->randr_provider->output_source = master_provider;
|
|
|
|
+ }
|
|
|
|
+}
|
2012-08-17 00:16:37 +00:00
|
|
|
--
|
2012-08-24 03:37:10 +00:00
|
|
|
1.7.10.2
|
2012-08-17 00:16:37 +00:00
|
|
|
|