I'm running this stuff for some weeks.

-Dieter
Index: xf86glx.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v
retrieving revision 1.20
diff -u -r1.20 xf86glx.c
--- xf86glx.c	7 May 2003 17:47:59 -0000	1.20
+++ xf86glx.c	7 May 2003 22:27:30 -0000
@@ -135,10 +135,9 @@
 
 /*
  * In the case the driver defines no GLX visuals we'll use these.
- * One thing is funny here: the bufferSize field doesn't always include
- * the alpha bits.  That is, bufferSize may be 24 when we have 8 bits
- * of red, green, blue and alpha.  If set set bufferSize to 32 we may
- * foul-up the visual matching code below (search for bufferSize).
+ * Note that for TrueColor and DirectColor visuals, bufferSize is the 
+ * sum of redSize, greenSize, blueSize and alphaSize, which may be larger 
+ * than the nplanes/rootDepth of the server's X11 visuals
  */
 #define NUM_FALLBACK_CONFIGS 5
 static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = {
@@ -405,7 +404,14 @@
 		glXVisualPtr[j].greenMask  = pVisual[i].greenMask;
 		glXVisualPtr[j].blueMask   = pVisual[i].blueMask;
 		glXVisualPtr[j].alphaMask  = glXVisualPtr[j].alphaMask;
-		glXVisualPtr[j].bufferSize = rootDepth;
+		if (is_rgb) {
+		    glXVisualPtr[j].bufferSize = glXVisualPtr[j].redSize +
+		                                 glXVisualPtr[j].greenSize +
+		                                 glXVisualPtr[j].blueSize +
+		                                 glXVisualPtr[j].alphaSize;
+		} else {
+		    glXVisualPtr[j].bufferSize = rootDepth;
+		}
 	    }
 
 	    /* Save the device-dependent private for this visual */
@@ -505,7 +511,7 @@
 	/* Find a visual that matches the GLX visual's class and size */
 	for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
 	    if (pVis->class == pGLXVis->class &&
-		pVis->nplanes == pGLXVis->bufferSize) {
+		pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize)) {
 
 		/* Fixup the masks */
 		pGLXVis->redMask   = pVis->redMask;
@@ -545,7 +551,7 @@
 	for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
 
 	    if (pVis->class == pGLXVis->class &&
-		pVis->nplanes == pGLXVis->bufferSize &&
+		pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize) &&
 		!used[j]) {
 
 		if (pVis->redMask   == pGLXVis->redMask &&

Reply via email to