From fc485147fbf7cc4a885ff509e2be43ce2e9f13e2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Aug 2012 13:37:10 +1000 Subject: [PATCH] reintroduce auto config but working this time - fix two recycle/exit crashes --- 0001-xf86-crtc-don-t-free-config-name.patch | 33 +++++ ...ault-colormap-before-screen-deletion.patch | 34 +++++ sources | 1 - xorg-x11-server.spec | 12 +- xserver-autobind-hotplug.patch | 132 +++++++++++------- 5 files changed, 162 insertions(+), 50 deletions(-) create mode 100644 0001-xf86-crtc-don-t-free-config-name.patch create mode 100644 0002-dix-free-default-colormap-before-screen-deletion.patch diff --git a/0001-xf86-crtc-don-t-free-config-name.patch b/0001-xf86-crtc-don-t-free-config-name.patch new file mode 100644 index 0000000..e78e78c --- /dev/null +++ b/0001-xf86-crtc-don-t-free-config-name.patch @@ -0,0 +1,33 @@ +From 3a95c993a8d310122d0a3e91a0fe01c318bd7ecf Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 24 Aug 2012 12:56:18 +1000 +Subject: [PATCH 1/2] xf86/crtc: don't free config->name + +This is set by pre_init not screen init, so if we free it here +and then recycle the server, we lose all the providers. + +I think we need to wrap FreeScreen here to do this properly, +will investigate for 1.14 most likely, safer to just leak this +on server exit for now. + +Signed-off-by: Dave Airlie +--- + hw/xfree86/modes/xf86Crtc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 153c795..a1d7dca 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -728,8 +728,6 @@ xf86CrtcCloseScreen(ScreenPtr screen) + + xf86RandR12CloseScreen(screen); + +- free(config->name); +- + screen->CloseScreen(screen); + + for (o = 0; o < config->num_output; o++) { +-- +1.7.11.2 + diff --git a/0002-dix-free-default-colormap-before-screen-deletion.patch b/0002-dix-free-default-colormap-before-screen-deletion.patch new file mode 100644 index 0000000..6f1d081 --- /dev/null +++ b/0002-dix-free-default-colormap-before-screen-deletion.patch @@ -0,0 +1,34 @@ +From a8cb70389bdcd82ed952449de307ecb2a633ebe7 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 24 Aug 2012 13:23:01 +1000 +Subject: [PATCH 2/2] dix: free default colormap before screen deletion + +If we don't free this here, it gets freed later in the resource +cleanups, however it then looks up up pmap->pScreen, which we +freed already in this function. So free the default colormap +when we should. + +This fixes a bug after a couple of hotplug cycles when you try +to exit the X server and it crashes. + +Signed-off-by: Dave Airlie +--- + dix/dispatch.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dix/dispatch.c b/dix/dispatch.c +index 3c6a591..e002574 100644 +--- a/dix/dispatch.c ++++ b/dix/dispatch.c +@@ -3904,6 +3904,8 @@ RemoveGPUScreen(ScreenPtr pScreen) + } + screenInfo.numGPUScreens--; + ++ if (pScreen->defColormap) ++ FreeResource(pScreen->defColormap, RT_COLORMAP); + free(pScreen); + + } +-- +1.7.11.2 + diff --git a/sources b/sources index 4971589..5645c7f 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -c6b0c5843a14b4d1ee967050a665ef64 xorg-server-20120808.tar.xz ff68cba6b6e5aba97a0a1b1e196dff47 xorg-server-20120822.tar.xz diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index ec0d6c7..6dec01e 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -43,7 +43,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.12.99.905 -Release: 1%{?gitdate:.%{gitdate}}%{dist} +Release: 2%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -101,7 +101,11 @@ Patch7024: 0003-xfree86-Change-the-semantics-of-driverFunc-GET_REQUI.patch Patch7025: 0001-Always-install-vbe-and-int10-sdk-headers.patch # do not upstream - do not even use here yet -# Patch7027: xserver-autobind-hotplug.patch +Patch7027: xserver-autobind-hotplug.patch + +# backport fixes from list +Patch7030: 0001-xf86-crtc-don-t-free-config-name.patch +Patch7031: 0002-dix-free-default-colormap-before-screen-deletion.patch %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri @@ -575,6 +579,10 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Fri Aug 24 2012 Dave Airlie 1.12.99.905-2 +- reintroduce auto config but working this time +- fix two recycle/exit crashes + * Wed Aug 22 2012 Dave Airlie 1.12.99.905-1 - rebase to 1.12.99.905 snapshot diff --git a/xserver-autobind-hotplug.patch b/xserver-autobind-hotplug.patch index 7e7566a..904ac33 100644 --- a/xserver-autobind-hotplug.patch +++ b/xserver-autobind-hotplug.patch @@ -1,4 +1,4 @@ -From 1bedef99881a63f5e8215ba259e9b222abeb1fe7 Mon Sep 17 00:00:00 2001 +From d1acbfaea440fde47c5bd2b731b38c5ee722cded 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, @@ -8,57 +8,95 @@ but until DE support is in GNOME its probably for the best. DO NOT UPSTREAM. --- - hw/xfree86/common/xf86Init.c | 12 ++++++++++-- - hw/xfree86/common/xf86platformBus.c | 13 ++++++++++--- - 2 files changed, 20 insertions(+), 5 deletions(-) + hw/xfree86/common/xf86Init.c | 12 ++++++++++++ + hw/xfree86/common/xf86platformBus.c | 3 +++ + hw/xfree86/modes/xf86Crtc.c | 25 +++++++++++++++++++++++++ + 3 files changed, 40 insertions(+) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c -index e4a6b86..f41423d 100644 +index e4a6b86..a79aeb5 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c -@@ -924,8 +924,16 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) - #endif - } - -- for (i = 0; i < xf86NumGPUScreens; i++) -- AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ for (i = 0; i < xf86NumGPUScreens; i++) { -+ if ((xf86Screens[0]->capabilities & RR_Capability_SinkOffload) && -+ xf86GPUScreens[i]->capabilities & RR_Capability_SourceOffload) -+ AttachOffloadGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ else if ((xf86Screens[0]->capabilities & RR_Capability_SourceOutput) && -+ xf86GPUScreens[i]->capabilities & RR_Capability_SinkOutput) -+ AttachOutputGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ else -+ AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ } - - xf86VGAarbiterWrapFunctions(); - if (sigio_blocked) -diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c -index 24b9473..6e397eb 100644 ---- a/hw/xfree86/common/xf86platformBus.c -+++ b/hw/xfree86/common/xf86platformBus.c -@@ -440,9 +440,16 @@ xf86platformAddDevice(int index) - - CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen); - -- /* attach unbound to 0 protocol screen */ -- AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -- -+ if ((xf86Screens[0]->capabilities & RR_Capability_SinkOffload) && -+ xf86GPUScreens[i]->capabilities & RR_Capability_SourceOffload) -+ AttachOffloadGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ else if ((xf86Screens[0]->capabilities & RR_Capability_SourceOutput) && -+ xf86GPUScreens[i]->capabilities & RR_Capability_SinkOutput) -+ AttachOutputGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ else -+ /* attach unbound to 0 protocol screen */ -+ AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ - return 0; +@@ -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) + { +@@ -927,6 +937,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 24b9473..502d3c4 100644 +--- a/hw/xfree86/common/xf86platformBus.c ++++ b/hw/xfree86/common/xf86platformBus.c +@@ -383,6 +383,8 @@ xf86platformProbeDev(DriverPtr drvp) + return foundScreen; + } + ++extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master); ++ + int + xf86platformAddDevice(int index) + { +@@ -442,6 +444,7 @@ xf86platformAddDevice(int index) + + /* attach unbound to 0 protocol screen */ + AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); ++ xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]); + + return 0; + } +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 1947c5b..153c795 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -3260,3 +3260,28 @@ 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); ++ ++ 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; ++ } ++} -- -1.7.11.2 +1.7.10.2