Add patch that contain Mali fixes.
[deb_xorg-server.git] / debian / patches / fix-detach-gpu.patch
CommitLineData
7217e0ca
ML
1--- a/hw/xfree86/modes/xf86RandR12.c
2+++ b/hw/xfree86/modes/xf86RandR12.c
4db25562 3@@ -1800,7 +1800,8 @@ xf86RandR14ProviderSetOutputSource(Scree
7217e0ca
ML
4 ScreenPtr cmScreen = pScreen->current_master;
5
6 xf86DetachOutputGPU(pScreen);
7- AttachUnboundGPU(cmScreen, pScreen);
8+ if (!pScreen->current_master)
9+ AttachUnboundGPU(cmScreen, pScreen);
10 }
11 provider->output_source = NULL;
12 return TRUE;
4db25562 13@@ -1811,7 +1812,8 @@ xf86RandR14ProviderSetOutputSource(Scree
7217e0ca
ML
14
15 SetRootClip(source_provider->pScreen, FALSE);
16
17- DetachUnboundGPU(pScreen);
18+ if (!pScreen->current_master)
19+ DetachUnboundGPU(pScreen);
20 AttachOutputGPU(source_provider->pScreen, pScreen);
21
22 provider->output_source = source_provider;
4db25562 23@@ -1828,7 +1830,8 @@ xf86RandR14ProviderSetOffloadSink(Screen
7217e0ca
ML
24 if (provider->offload_sink) {
25 ScreenPtr cmScreen = pScreen->current_master;
26 xf86DetachOutputGPU(pScreen);
27- AttachUnboundGPU(cmScreen, pScreen);
28+ if (!pScreen->current_master)
29+ AttachUnboundGPU(cmScreen, pScreen);
30 }
31
32 provider->offload_sink = NULL;
4db25562 33@@ -1838,7 +1841,8 @@ xf86RandR14ProviderSetOffloadSink(Screen
7217e0ca
ML
34 if (provider->offload_sink == sink_provider)
35 return TRUE;
36
37- DetachUnboundGPU(pScreen);
38+ if (!pScreen->current_master)
39+ DetachUnboundGPU(pScreen);
40 AttachOffloadGPU(sink_provider->pScreen, pScreen);
41
42 provider->offload_sink = sink_provider;
4db25562 43@@ -1917,12 +1921,14 @@ xf86RandR14ProviderDestroy(ScreenPtr scr
7217e0ca
ML
44 config->randr_provider->offload_sink = NULL;
45 RRSetChanged(screen);
46 }
47- else if (config->randr_provider->output_source) {
48+
49+ if (config->randr_provider->output_source) {
50 xf86DetachOutputGPU(screen);
51 config->randr_provider->output_source = NULL;
52 RRSetChanged(screen);
53 }
54- else if (screen->current_master)
55+
56+ if (screen->current_master)
57 DetachUnboundGPU(screen);
58 }
59 config->randr_provider = NULL;
60--- a/dix/dispatch.c
61+++ b/dix/dispatch.c
4db25562 62@@ -3911,6 +3911,8 @@ AttachUnboundGPU(ScreenPtr pScreen, Scre
7217e0ca
ML
63 assert(new->isGPU);
64 assert(!new->current_master);
65 xorg_list_add(&new->unattached_head, &pScreen->unattached_list);
66+ xorg_list_init(&new->offload_head);
67+ xorg_list_init(&new->output_head);
68 new->current_master = pScreen;
69 }
70
4db25562 71@@ -3935,7 +3937,8 @@ DetachOutputGPU(ScreenPtr slave)
7217e0ca
ML
72 {
73 assert(slave->isGPU);
74 xorg_list_del(&slave->output_head);
75- slave->current_master = NULL;
76+ if (xorg_list_is_empty(&slave->offload_head))
77+ slave->current_master = NULL;
78 }
79
80 void
4db25562 81@@ -3951,6 +3954,7 @@ DetachOffloadGPU(ScreenPtr slave)
7217e0ca
ML
82 {
83 assert(slave->isGPU);
84 xorg_list_del(&slave->offload_head);
85- slave->current_master = NULL;
86+ if (xorg_list_is_empty(&slave->output_head))
87+ slave->current_master = NULL;
88 }
89