From 9620f4c0492942068edf01671be5e4076e23cc91 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 12 Apr 2013 11:05:53 +1000 Subject: [PATCH] fix bug with GPU hotplugging while VT switched - reenable reverse optimus --- ...anges-when-we-disconnect-a-GPU-slave.patch | 26 +++++++--- xorg-x11-server.spec | 1 + xserver-autobind-hotplug.patch | 50 ++++++++++++++----- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/0001-randr-report-changes-when-we-disconnect-a-GPU-slave.patch b/0001-randr-report-changes-when-we-disconnect-a-GPU-slave.patch index 685108b..fd89c71 100644 --- a/0001-randr-report-changes-when-we-disconnect-a-GPU-slave.patch +++ b/0001-randr-report-changes-when-we-disconnect-a-GPU-slave.patch @@ -1,4 +1,4 @@ -From 388c8278cf81848635d8b4af75f0ccc189344acf Mon Sep 17 00:00:00 2001 +From 3adc5f9a82ea9aeb2fa5eb2337fb9dd0502082df Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 9 Jan 2013 14:32:50 +1000 Subject: [PATCH] randr: report changes when we disconnect a GPU slave @@ -15,8 +15,8 @@ Signed-off-by: Dave Airlie Signed-off-by: Fedora X Ninjas --- hw/xfree86/common/xf86platformBus.c | 3 ++- - hw/xfree86/modes/xf86RandR12.c | 2 ++ - 2 files changed, 4 insertions(+), 1 deletion(-) + hw/xfree86/modes/xf86RandR12.c | 9 +++++++-- + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 2b02e79..4ccb005 100644 @@ -40,22 +40,32 @@ index 2b02e79..4ccb005 100644 return; } diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c -index 01fc9c5..7f570cf 100644 +index 01fc9c5..f259730 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c -@@ -1895,10 +1895,12 @@ xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider) +@@ -1892,15 +1892,20 @@ xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider) + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + + if (config->randr_provider == provider) { ++ Bool detached = FALSE; if (config->randr_provider->offload_sink) { DetachOffloadGPU(screen); config->randr_provider->offload_sink = NULL; + RRSetChanged(screen); ++ detached = TRUE; } - else if (config->randr_provider->output_source) { +- else if (config->randr_provider->output_source) { ++ if (config->randr_provider->output_source) { DetachOutputGPU(screen); config->randr_provider->output_source = NULL; + RRSetChanged(screen); ++ detached = TRUE; } - else if (screen->current_master) +- else if (screen->current_master) ++ if (!detached && screen->current_master) DetachUnboundGPU(screen); + } + config->randr_provider = NULL; -- -1.8.1.4 +1.8.2 diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 0a24628..7b5b71a 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -595,6 +595,7 @@ rm -rf $RPM_BUILD_ROOT %changelog * Fri Apr 12 2013 Dave Airlie 1.14.0-4 - fix bug with GPU hotplugging while VT switched +- reenable reverse optimus * Fri Mar 22 2013 Dan HorĂ¡k 1.14.0-3 - libunwind exists only on selected arches diff --git a/xserver-autobind-hotplug.patch b/xserver-autobind-hotplug.patch index 7d05f27..c510791 100644 --- a/xserver-autobind-hotplug.patch +++ b/xserver-autobind-hotplug.patch @@ -1,19 +1,41 @@ -From 536626891b60039c0f3f9b4cd96156e9fe810f39 Mon Sep 17 00:00:00 2001 +From 37d51acb3b6a38af1717bfaa7925043c35bfb447 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, (v2) +Subject: [PATCH] autobind GPUs to the screen, (v3) 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. --- - hw/xfree86/common/xf86Init.c | 12 ++++++++++++ - hw/xfree86/common/xf86platformBus.c | 3 +++ - hw/xfree86/modes/xf86Crtc.c | 28 ++++++++++++++++++++++++++++ - 3 files changed, 43 insertions(+) + dix/dispatch.c | 2 -- + hw/xfree86/common/xf86Init.c | 12 ++++++++++++ + hw/xfree86/common/xf86platformBus.c | 3 +++ + hw/xfree86/modes/xf86Crtc.c | 32 ++++++++++++++++++++++++++++++++ + 4 files changed, 47 insertions(+), 2 deletions(-) +diff --git a/dix/dispatch.c b/dix/dispatch.c +index 0ce10c2..c2ab8f9 100644 +--- a/dix/dispatch.c ++++ b/dix/dispatch.c +@@ -3933,7 +3933,6 @@ void + AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new) + { + assert(new->isGPU); +- assert(!new->current_master); + xorg_list_add(&new->output_head, &pScreen->output_slave_list); + new->current_master = pScreen; + } +@@ -3950,7 +3949,6 @@ void + AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new) + { + assert(new->isGPU); +- assert(!new->current_master); + xorg_list_add(&new->offload_head, &pScreen->offload_slave_list); + new->current_master = pScreen; + } diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index d231ced..89629c1 100644 --- a/hw/xfree86/common/xf86Init.c @@ -45,7 +67,7 @@ index d231ced..89629c1 100644 if (sigio_blocked) OsReleaseSIGIO(); diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c -index a73aea2..3810076 100644 +index 0525e39..82fef32 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -387,6 +387,8 @@ xf86platformProbeDev(DriverPtr drvp) @@ -66,10 +88,10 @@ index a73aea2..3810076 100644 return 0; } diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c -index 8f05c53..ba84e6b 100644 +index 3011f13..34c1848 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c -@@ -3321,3 +3321,31 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn) +@@ -3323,3 +3323,35 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn) crtc->x = crtc->y = 0; } } @@ -80,6 +102,7 @@ index 8f05c53..ba84e6b 100644 + 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; @@ -91,16 +114,19 @@ index 8f05c53..ba84e6b 100644 + /* source offload */ + + DetachUnboundGPU(pScrn->pScreen); ++ unbound = TRUE; + AttachOffloadGPU(master->pScreen, pScrn->pScreen); + slave_config->randr_provider->offload_sink = master_provider; -+ } else if ((master->capabilities & RR_Capability_SourceOutput) && ++ } ++ if ((master->capabilities & RR_Capability_SourceOutput) && + pScrn->capabilities & RR_Capability_SinkOutput) { + /* sink offload */ -+ DetachUnboundGPU(pScrn->pScreen); ++ if (!unbound) ++ DetachUnboundGPU(pScrn->pScreen); + AttachOutputGPU(master->pScreen, pScrn->pScreen); + slave_config->randr_provider->output_source = master_provider; + } +} -- -1.7.10.2 +1.8.1