/[gentoo-x86]/x11-base/xorg-server/files/06-aiglx-happy-vt-switch.patch
Gentoo

Contents of /x11-base/xorg-server/files/06-aiglx-happy-vt-switch.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Sep 9 10:34:45 2007 UTC (7 years, 3 months ago) by dberkholz
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Drop 1.1, everyone's stable on 1.2 or 1.3.
(Portage version: 2.1.3.8)

1 diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
2 index cfa9996..77fa4bf 100644
3 --- a/GL/glx/glxdri.c
4 +++ b/GL/glx/glxdri.c
5 @@ -63,27 +63,30 @@ #include "dispatch.h"
6 #define STRINGIFY(macro_or_string) STRINGIFY_ARG (macro_or_string)
7 #define STRINGIFY_ARG(contents) #contents
8
9 -typedef struct __GLXDRIscreen __GLXDRIscreen;
10 -typedef struct __GLXDRIcontext __GLXDRIcontext;
11 +typedef struct __GLXDRIscreen __GLXDRIscreen;
12 +typedef struct __GLXDRIcontext __GLXDRIcontext;
13 typedef struct __GLXDRIdrawable __GLXDRIdrawable;
14
15 struct __GLXDRIscreen {
16 - __GLXscreen base;
17 + __GLXscreen base;
18
19 - __DRIscreen driScreen;
20 - void *driver;
21 + xf86EnterVTProc *enterVT;
22 + xf86LeaveVTProc *leaveVT;
23 +
24 + __DRIscreen driScreen;
25 + void *driver;
26 };
27
28 struct __GLXDRIcontext {
29 - __GLXcontext base;
30 + __GLXcontext base;
31
32 - __DRIcontext driContext;
33 + __DRIcontext driContext;
34 };
35
36 struct __GLXDRIdrawable {
37 - __GLXdrawable base;
38 + __GLXdrawable base;
39
40 - __DRIdrawable *driDrawable;
41 + __DRIdrawable *driDrawable;
42 };
43
44 /* History:
45 @@ -594,8 +597,7 @@ static __DRIfuncPtr getProcAddress(const
46
47 static __DRIscreen *findScreen(__DRInativeDisplay *dpy, int scrn)
48 {
49 - __GLXDRIscreen *screen =
50 - (__GLXDRIscreen *) __glXgetActiveScreen(scrn);
51 + __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(scrn);
52
53 return &screen->driScreen;
54 }
55 @@ -789,6 +791,30 @@ static const __DRIinterfaceMethods inter
56
57 static const char dri_driver_path[] = DRI_DRIVER_PATH;
58
59 +static Bool
60 +glxDRIEnterVT (int index, int flags)
61 +{
62 + __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
63 +
64 + LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
65 +
66 + glxResumeClients();
67 +
68 + return (*screen->enterVT) (index, flags);
69 +}
70 +
71 +static void
72 +glxDRILeaveVT (int index, int flags)
73 +{
74 + __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
75 +
76 + LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
77 +
78 + glxSuspendClients();
79 +
80 + return (*screen->leaveVT) (index, flags);
81 +}
82 +
83 static __GLXscreen *
84 __glXDRIscreenProbe(ScreenPtr pScreen)
85 {
86 @@ -813,6 +839,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
87 void *dev_priv = NULL;
88 char filename[128];
89 Bool isCapable;
90 + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
91
92 if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable")) {
93 LogMessage(X_ERROR, "AIGLX: DRI module not loaded\n");
94 @@ -983,6 +1010,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
95
96 __glXsetEnterLeaveServerFuncs(__glXDRIenterServer, __glXDRIleaveServer);
97
98 + screen->enterVT = pScrn->EnterVT;
99 + pScrn->EnterVT = glxDRIEnterVT;
100 + screen->leaveVT = pScrn->LeaveVT;
101 + pScrn->LeaveVT = glxDRILeaveVT;
102 +
103 LogMessage(X_INFO,
104 "AIGLX: Loaded and initialized %s\n", filename);
105
106 diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c
107 index 8bbb83f..edc257c 100644
108 --- a/GL/glx/glxext.c
109 +++ b/GL/glx/glxext.c
110 @@ -234,13 +231,11 @@ GLboolean __glXFreeContext(__GLXcontext
111 * __glXDispatch() or as a callback from the resource manager. In
112 * the latter case we need to lift the DRI lock manually. */
113
114 - if (!inDispatch)
115 - __glXleaveServer();
116 + __glXleaveServer();
117
118 cx->destroy(cx);
119
120 - if (!inDispatch)
121 - __glXenterServer();
122 + __glXenterServer();
123
124 return GL_TRUE;
125 }
126 @@ -336,7 +331,7 @@ void GlxExtensionInit(void)
127 /*
128 ** Initialize table of client state. There is never a client 0.
129 */
130 - for (i=1; i <= MAXCLIENTS; i++) {
131 + for (i = 1; i <= MAXCLIENTS; i++) {
132 __glXClients[i] = 0;
133 }
134
135 @@ -407,11 +402,36 @@ __GLXcontext *__glXForceCurrent(__GLXcli
136
137 /************************************************************************/
138
139 -/*
140 -** Top level dispatcher; all commands are executed from here down.
141 -*/
142 +static int glxServerLeaveCount;
143 +static int glxBlockClients;
144
145 -/* I cried when I wrote this. Damn you XAA! */
146 +void glxSuspendClients(void)
147 +{
148 + int i;
149 +
150 + for (i = 1; i <= MAXCLIENTS; i++) {
151 + if (__glXClients[i] == NULL || !__glXClients[i]->inUse)
152 + continue;
153 +
154 + IgnoreClient(__glXClients[i]->client);
155 + }
156 +
157 + glxBlockClients = TRUE;
158 +}
159 +
160 +void glxResumeClients(void)
161 +{
162 + int i;
163 +
164 + glxBlockClients = FALSE;
165 +
166 + for (i = 1; i <= MAXCLIENTS; i++) {
167 + if (__glXClients[i] == NULL || !__glXClients[i]->inUse)
168 + continue;
169 +
170 + AttendClient(__glXClients[i]->client);
171 + }
172 +}
173
174 static void
175 __glXnopEnterServer(void)
176 @@ -436,14 +456,19 @@ void __glXsetEnterLeaveServerFuncs(void
177
178 void __glXenterServer(void)
179 {
180 - (*__glXenterServerFunc)();
181 + glxServerLeaveCount--;
182 +
183 + if (glxServerLeaveCount == 0)
184 + (*__glXenterServerFunc)();
185 }
186
187 void __glXleaveServer(void)
188 {
189 - (*__glXleaveServerFunc)();
190 -}
191 + if (glxServerLeaveCount == 0)
192 + (*__glXleaveServerFunc)();
193
194 + glxServerLeaveCount++;
195 +}
196
197 /*
198 ** Top level dispatcher; all commands are executed from here down.
199 @@ -496,6 +521,15 @@ static int __glXDispatch(ClientPtr clien
200 return __glXError(GLXBadLargeRequest);
201 }
202
203 + /* If we're currently blocking GLX clients, just put this guy to
204 + * sleep, reset the request and return. */
205 + if (glxBlockClients) {
206 + ResetCurrentRequest(client);
207 + client->sequence--;
208 + IgnoreClient(client);
209 + return(client->noClientException);
210 + }
211 +
212 /*
213 ** Use the opcode to index into the procedure table.
214 */
215 @@ -506,12 +540,8 @@ static int __glXDispatch(ClientPtr clien
216
217 __glXleaveServer();
218
219 - inDispatch = True;
220 -
221 retval = proc(cl, (GLbyte *) stuff);
222
223 - inDispatch = False;
224 -
225 __glXenterServer();
226
227 return retval;
228 diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h
229 index 8ece1e2..9eed1bc 100644
230 --- a/GL/glx/glxserver.h
231 +++ b/GL/glx/glxserver.h
232 @@ -136,6 +136,9 @@ void __glXsetEnterLeaveServerFuncs(void
233 void __glXenterServer(void);
234 void __glXleaveServer(void);
235
236 +void glxSuspendClients(void);
237 +void glxResumeClients(void);
238 +
239 /*
240 ** State kept per client.
241 */

  ViewVC Help
Powered by ViewVC 1.1.20