~ubuntu-branches/ubuntu/trusty/xorg-server-lts-xenial/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/228_autobind_gpu.patch

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2016-05-03 14:02:21 UTC
  • Revision ID: package-import@ubuntu.com-20160503140221-p5jty1kzz5nzj107
Tags: 2:1.18.3-1ubuntu2.2~trusty1
* Backport for lts-xenial stack.
  - revert configurable maxclients, avoid depending on newer coreproto
  - rules: work around ftbfs on ppc64el

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 37d51acb3b6a38af1717bfaa7925043c35bfb447 Mon Sep 17 00:00:00 2001
 
2
From: Dave Airlie <airlied@redhat.com>
 
3
Date: Fri, 17 Aug 2012 09:49:24 +1000
 
4
Subject: [PATCH] autobind GPUs to the screen, (v3)
 
5
 
 
6
this is racy and really not what we want for hotplug going forward,
 
7
but until DE support is in GNOME its probably for the best.
 
8
 
 
9
v2: fix if config or slave config is NULL
 
10
v3: fix multi useful slaves
 
11
DO NOT UPSTREAM.
 
12
---
 
13
 hw/xfree86/common/xf86Init.c        | 12 ++++++++++++
 
14
 hw/xfree86/common/xf86platformBus.c |  3 +++
 
15
 hw/xfree86/modes/xf86Crtc.c         | 32 ++++++++++++++++++++++++++++++++
 
16
 3 files changed, 47 insertions(+), 0 deletions(-)
 
17
 
 
18
--- a/hw/xfree86/common/xf86Init.c
 
19
+++ b/hw/xfree86/common/xf86Init.c
 
20
@@ -340,6 +340,16 @@ xf86CreateRootWindow(WindowPtr pWin)
 
21
     return ret;
 
22
 }
 
23
 
 
24
+extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master);                              
 
25
+static void
 
26
+xf86AutoConfigOutputDevices(void)
 
27
+{
 
28
+    int i;
 
29
+
 
30
+    for (i = 0; i < xf86NumGPUScreens; i++)
 
31
+        xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);
 
32
+}
 
33
+
 
34
 static void
 
35
 InstallSignalHandlers(void)
 
36
 {
 
37
@@ -950,6 +960,8 @@ InitOutput(ScreenInfo * pScreenInfo, int
 
38
     for (i = 0; i < xf86NumGPUScreens; i++)
 
39
         AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
 
40
 
 
41
+    xf86AutoConfigOutputDevices();
 
42
+
 
43
     xf86VGAarbiterWrapFunctions();
 
44
     if (sigio_blocked)
 
45
         OsReleaseSIGIO();
 
46
--- a/hw/xfree86/common/xf86platformBus.c
 
47
+++ b/hw/xfree86/common/xf86platformBus.c
 
48
@@ -466,9 +466,12 @@ xf86platformProbeDev(DriverPtr drvp)
 
49
         }
 
50
     }
 
51
 
 
52
+    free(devList);
 
53
     return foundScreen;
 
54
 }
 
55
 
 
56
+extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master);
 
57
+
 
58
 int
 
59
 xf86platformAddDevice(int index)
 
60
 {
 
61
@@ -540,6 +543,7 @@ xf86platformAddDevice(int index)
 
62
    }
 
63
    /* attach unbound to 0 protocol screen */
 
64
    AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
 
65
+   xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);
 
66
 
 
67
    RRResourcesChanged(xf86Screens[0]->pScreen);
 
68
    RRTellChanged(xf86Screens[0]->pScreen);
 
69
--- a/hw/xfree86/modes/xf86Crtc.c
 
70
+++ b/hw/xfree86/modes/xf86Crtc.c
 
71
@@ -3562,3 +3562,35 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn)
 
72
             crtc->x = crtc->y = 0;
 
73
         }
 
74
 }
 
75
+
 
76
+
 
77
+void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master)
 
78
+{
 
79
+    RRProviderPtr master_provider;
 
80
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(master);
 
81
+    xf86CrtcConfigPtr slave_config = XF86_CRTC_CONFIG_PTR(pScrn);
 
82
+    Bool unbound = FALSE;
 
83
+
 
84
+    if (!config || !slave_config)
 
85
+        return;
 
86
+
 
87
+    master_provider = config->randr_provider;
 
88
+
 
89
+    if ((master->capabilities & RR_Capability_SinkOffload) &&
 
90
+        pScrn->capabilities & RR_Capability_SourceOffload) {
 
91
+            /* source offload */
 
92
+            
 
93
+        DetachUnboundGPU(pScrn->pScreen);
 
94
+        unbound = TRUE;
 
95
+        AttachOffloadGPU(master->pScreen, pScrn->pScreen);
 
96
+        slave_config->randr_provider->offload_sink = master_provider;
 
97
+    }
 
98
+    if ((master->capabilities & RR_Capability_SourceOutput) &&
 
99
+               pScrn->capabilities & RR_Capability_SinkOutput) {
 
100
+        /* sink offload */
 
101
+        if (!unbound)
 
102
+            DetachUnboundGPU(pScrn->pScreen);
 
103
+        AttachOutputGPU(master->pScreen, pScrn->pScreen);
 
104
+        slave_config->randr_provider->output_source = master_provider;
 
105
+    }
 
106
+}