summaryrefslogtreecommitdiff
path: root/user/xf86-video-sis/glx.patch
blob: f3cad9fad5ef970d1a3fcbaa1a8d1b41334cd482 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
From a50b2b3412dd8e7f3916acb142c942e85ffcb3e5 Mon Sep 17 00:00:00 2001
From: Emil Velikov <emil.velikov@collabora.com>
Date: Mon, 17 Jul 2017 12:01:57 +0100
Subject: [PATCH 2/2] xf86-video-sis: remove the GlxSetVisualConfigs stub and
 friends

The function was an empty since 2008 at least. Remove it alongside the
unused GLX visuals code.

With this all the GL/GLX dependencies in the driver are gone.

Cc: Connor Behan <connor.behan@gmail.com>
Cc: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
 src/sis.h        |   4 --
 src/sis_dri.c    | 161 +------------------------------------------------------
 src/sis_dri.h    |   5 --
 src/sis_driver.c |  10 +---
 4 files changed, 3 insertions(+), 177 deletions(-)

diff --git a/src/sis.h b/src/sis.h
index 385b784..2b764cb 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -197,7 +197,6 @@
 #include "sarea.h"
 #define _XF86DRI_SERVER_
 #include "dri.h"
-#include "GL/glxint.h"
 #include "sis_dri.h"
 #endif /* SISDRI */
 
@@ -1198,9 +1197,6 @@ typedef struct {
     Bool		directRenderingEnabled;
     DRIInfoPtr 		pDRIInfo;
     int			drmSubFD;
-    int			numVisualConfigs;
-    __GLXvisualConfig*	pVisualConfigs;
-    SISConfigPrivPtr	pVisualConfigsPriv;
     SISRegRec		DRContextRegs;
 #endif
 
diff --git a/src/sis_dri.c b/src/sis_dri.c
index 9a045a2..5778c51 100644
--- a/src/sis_dri.c
+++ b/src/sis_dri.c
@@ -44,7 +44,6 @@
 #include "sis_regs.h"
 
 #include "fb.h"
-#include "GL/glxtokens.h"
 
 #ifndef SISHAVEDRMWRITE
 # if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
@@ -96,12 +95,6 @@ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
   while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
   }
 
-extern void GlxSetVisualConfigs(
-    int nconfigs,
-    __GLXvisualConfig *configs,
-    void **configprivs
-);
-
 /* The kernel's "sis" DRM module handles all chipsets */
 static char SISKernelDriverName[] = "sis";
 
@@ -110,7 +103,6 @@ static char SISClientDriverNameSiS300[] = "sis";	/* 300, 540, 630, 730 */
 static char SISClientDriverNameSiS315[] = "sis315";	/* All of 315/330 series */
 static char SISClientDriverNameXGI[]    = "xgi";	/* XGI V3, V5, V8 */
 
-static Bool SISInitVisualConfigs(ScreenPtr pScreen);
 static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
                    drm_context_t hwContext, void *pVisualConfigPriv,
                    DRIContextType contextStore);
@@ -125,141 +117,6 @@ static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
 static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
                    RegionPtr prgnSrc, CARD32 index);
 
-static Bool
-SISInitVisualConfigs(ScreenPtr pScreen)
-{
-  ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-  SISPtr pSIS = SISPTR(pScrn);
-  int numConfigs = 0;
-  __GLXvisualConfig *pConfigs = 0;
-  SISConfigPrivPtr pSISConfigs = 0;
-  SISConfigPrivPtr *pSISConfigPtrs = 0;
-  int i, db, z_stencil, accum;
-  Bool useZ16 = FALSE;
-
-  if(getenv("SIS_FORCE_Z16")) {
-     useZ16 = TRUE;
-  }
-
-  switch (pScrn->bitsPerPixel) {
-  case 8:
-  case 24:
-    break;
-  case 16:
-  case 32:
-    numConfigs = (useZ16) ? 8 : 16;
-
-    if(!(pConfigs = (__GLXvisualConfig*)calloc(sizeof(__GLXvisualConfig),
-						   numConfigs))) {
-       return FALSE;
-    }
-    if(!(pSISConfigs = (SISConfigPrivPtr)calloc(sizeof(SISConfigPrivRec),
-						    numConfigs))) {
-       free(pConfigs);
-       return FALSE;
-    }
-    if(!(pSISConfigPtrs = (SISConfigPrivPtr*)calloc(sizeof(SISConfigPrivPtr),
-							  numConfigs))) {
-       free(pConfigs);
-       free(pSISConfigs);
-       return FALSE;
-    }
-    for(i=0; i<numConfigs; i++) pSISConfigPtrs[i] = &pSISConfigs[i];
-
-    i = 0;
-    for(accum = 0; accum <= 1; accum++) {
-       for(z_stencil = 0; z_stencil < (useZ16 ? 2 : 4); z_stencil++) {
-	  for(db = 0; db <= 1; db++) {
-	     pConfigs[i].vid = -1;
-	     pConfigs[i].class = -1;
-	     pConfigs[i].rgba = TRUE;
-	     if(pScrn->bitsPerPixel == 16) {
-	        pConfigs[i].redSize   = 5;
-	        pConfigs[i].greenSize = 6;
-	        pConfigs[i].blueSize  = 5;
-	        pConfigs[i].alphaSize = 0;
-	        pConfigs[i].redMask   = 0x0000F800;
-	        pConfigs[i].greenMask = 0x000007E0;
-	        pConfigs[i].blueMask  = 0x0000001F;
-	        pConfigs[i].alphaMask = 0x00000000;
-	     } else {
-	        pConfigs[i].redSize   = 8;
-	        pConfigs[i].greenSize = 8;
-	        pConfigs[i].blueSize  = 8;
-	        pConfigs[i].alphaSize = 8;
-	        pConfigs[i].redMask   = 0x00FF0000;
-	        pConfigs[i].greenMask = 0x0000FF00;
-	        pConfigs[i].blueMask  = 0x000000FF;
-	        pConfigs[i].alphaMask = 0xFF000000;
-	     }
-	     if(accum) {
-	        pConfigs[i].accumRedSize   = 16;
-	        pConfigs[i].accumGreenSize = 16;
-	        pConfigs[i].accumBlueSize  = 16;
-	        if(pConfigs[i].alphaMask == 0)
-	           pConfigs[i].accumAlphaSize = 0;
-	        else
-	           pConfigs[i].accumAlphaSize = 16;
-	     } else {
-	        pConfigs[i].accumRedSize   = 0;
-	        pConfigs[i].accumGreenSize = 0;
-	        pConfigs[i].accumBlueSize  = 0;
-	        pConfigs[i].accumAlphaSize = 0;
-	     }
-	     if(db) pConfigs[i].doubleBuffer = TRUE;
-	     else   pConfigs[i].doubleBuffer = FALSE;
-	     pConfigs[i].stereo = FALSE;
-	     pConfigs[i].bufferSize = -1;
-	     switch(z_stencil) {
-	     case 0:
-	        pConfigs[i].depthSize = 0;
-	        pConfigs[i].stencilSize = 0;
-	        break;
-	     case 1:
-	        pConfigs[i].depthSize = 16;
-	        pConfigs[i].stencilSize = 0;
-	        break;
-	     case 2:
-	       pConfigs[i].depthSize = 32;
-	       pConfigs[i].stencilSize = 0;
-	       break;
-	     case 3:
-	       pConfigs[i].depthSize = 24;
-	       pConfigs[i].stencilSize = 8;
-	       break;
-             }
-	     pConfigs[i].auxBuffers = 0;
-	     pConfigs[i].level = 0;
-	     if(pConfigs[i].accumRedSize != 0)
-	        pConfigs[i].visualRating = GLX_SLOW_CONFIG;
-	     else
-	        pConfigs[i].visualRating = GLX_NONE_EXT;
-	     pConfigs[i].transparentPixel = GLX_NONE;
-	     pConfigs[i].transparentRed   = 0;
-	     pConfigs[i].transparentGreen = 0;
-	     pConfigs[i].transparentBlue  = 0;
-	     pConfigs[i].transparentAlpha = 0;
-	     pConfigs[i].transparentIndex = 0;
-	     i++;
-	  }
-       }
-    }
-    if(i != numConfigs) {
-       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		"[dri] Incorrect initialization of visuals. Disabling the DRI.\n");
-       return FALSE;
-    }
-    break;
-  }
-
-  pSIS->numVisualConfigs = numConfigs;
-  pSIS->pVisualConfigs = pConfigs;
-  pSIS->pVisualConfigsPriv = pSISConfigs;
-  GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pSISConfigPtrs);
-
-  return TRUE;
-}
-
 Bool
 SISDRIScreenInit(ScreenPtr pScreen)
 {
@@ -276,10 +133,9 @@ SISDRIScreenInit(ScreenPtr pScreen)
    pSIS->cmdQ_SharedWritePortBackup = NULL;
 #endif
 
-  /* Check that the GLX, DRI, and DRM modules have been loaded by testing
+  /* Check that the DRI, and DRM modules have been loaded by testing
    * for canonical symbols in each module.
    */
-  if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
   if(!xf86LoaderCheckSymbol("drmAvailable"))        return FALSE;
   if(!xf86LoaderCheckSymbol("DRIQueryVersion")) {
      xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -651,11 +507,6 @@ SISDRIScreenInit(ScreenPtr pScreen)
 
   pSISDRI->irqEnabled = pSIS->irqEnabled;
 
-  if(!(SISInitVisualConfigs(pScreen))) {
-     SISDRICloseScreen(pScreen);
-     return FALSE;
-  }
-
   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n" );
 
   return TRUE;
@@ -801,16 +652,6 @@ SISDRICloseScreen(ScreenPtr pScreen)
      pSIS->pDRIInfo = NULL;
   }
 
-  if(pSIS->pVisualConfigs) {
-     free(pSIS->pVisualConfigs);
-     pSIS->pVisualConfigs = NULL;
-  }
-
-  if(pSIS->pVisualConfigsPriv) {
-     free(pSIS->pVisualConfigsPriv);
-     pSIS->pVisualConfigsPriv = NULL;
-  }
-
 }
 
 /* TODO: xserver receives driver's swapping event and do something
diff --git a/src/sis_dri.h b/src/sis_dri.h
index 399d757..ce9039c 100644
--- a/src/sis_dri.h
+++ b/src/sis_dri.h
@@ -103,11 +103,6 @@ typedef struct {
 #define AGPVtxBufOffset AGPCmdBufOffset
 #define AGPVtxBufSize AGPCmdBufSize
 
-typedef struct {
-  /* Nothing here yet */
-  int dummy;
-} SISConfigPrivRec, *SISConfigPrivPtr;
-
 typedef struct {
   /* Nothing here yet */
   int dummy;
diff --git a/src/sis_driver.c b/src/sis_driver.c
index 513f68b..4e51e2e 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -6901,17 +6901,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
        }
     }
 
-    /* Load the dri and glx modules if requested. */
+    /* Load the dri modules if requested. */
 #ifdef SISDRI
     if(pSiS->loadDRI) {
        if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
-	  if(xf86LoadSubModule(pScrn, "dri")) {
-	     if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
-	        if(!xf86LoadSubModule(pScrn, "glx")) {
-		   SISErrorLog(pScrn, "Failed to load glx module\n");
-		}
-	     }
-	  } else {
+	  if(!xf86LoadSubModule(pScrn, "dri")) {
 	     SISErrorLog(pScrn, "Failed to load dri module\n");
 	  }
        }
-- 
2.16.2