xserver/GL/mesa/X xf86glx.c,1.7,1.8 xf86glxint.h,1.4,1.5

Dave Airlie xserver-commit at pdx.freedesktop.org
Tue Jan 3 01:43:42 PST 2006


Committed by: airlied

Update of /cvs/xserver/xserver/GL/mesa/X
In directory gabe:/tmp/cvs-serv14502/GL/mesa/X

Modified Files:
	xf86glx.c xf86glxint.h 
Log Message:
GL changes from Xgl codedrop


Index: xf86glx.c
===================================================================
RCS file: /cvs/xserver/xserver/GL/mesa/X/xf86glx.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xf86glx.c	23 Dec 2005 02:07:57 -0000	1.7
+++ xf86glx.c	3 Jan 2006 09:43:40 -0000	1.8
@@ -33,6 +33,7 @@
  *
  */
 
+#include <config.h>
 #define GL_GLEXT_PROTOTYPES
 #include <regionstr.h>
 #include <resource.h>
@@ -40,7 +41,6 @@
 #include <GL/glxint.h>
 #include <GL/glxtokens.h>
 #include <scrnintstr.h>
-#include <config.h>
 #include <glxserver.h>
 #include <glxscreens.h>
 #include <glxdrawable.h>
@@ -809,6 +809,15 @@
 		glXVisualPtr[j].greenMask  = pVisual[i].greenMask;
 		glXVisualPtr[j].blueMask   = pVisual[i].blueMask;
 		glXVisualPtr[j].alphaMask  = glXVisualPtr[j].alphaMask;
+#ifdef COMPOSITE
+		if (pVisual[i].nplanes == 32 && glXVisualPtr[j].alphaSize == 0)
+		{
+		    glXVisualPtr[j].alphaSize  = 8;
+		    glXVisualPtr[j].alphaMask  = ~(pVisual[i].redMask   |
+						   pVisual[i].greenMask |
+						   pVisual[i].blueMask);
+		}
+#endif
 		if (is_rgb) {
 		    glXVisualPtr[j].bufferSize = glXVisualPtr[j].redSize +
 		                                 glXVisualPtr[j].greenSize +
@@ -1072,15 +1081,9 @@
     __MESA_buffer buf;
 
     buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec));
-
-    /* Create Mesa's buffers */
-    if (glxPriv->type == DRAWABLE_WINDOW) {
-	buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis,
-						      (WindowPtr)pDraw);
-    } else {
-	buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis,
-						      (PixmapPtr)pDraw, 0);
-    }
+    buf->xm_buf = 0;
+    buf->pDraw = pDraw;
+    buf->xm_vis = xm_vis;
 
     /* Wrap the front buffer's resize routine */
     buf->fbresize = glPriv->frontBuffer.resize;
@@ -1104,6 +1107,26 @@
     glPriv->freePrivate = __MESA_destroyBuffer;
 }
 
+static void __MESA_allocateBuffer (__GLdrawablePrivate *glPriv)
+{
+    __MESA_buffer buf = glPriv->private;
+
+    if (!buf->xm_buf)
+    {
+	/* Create Mesa's buffers */
+	if (buf->pDraw->type == DRAWABLE_WINDOW)
+	{
+	    buf->xm_buf = (void *)
+		XMesaCreateWindowBuffer (buf->xm_vis, (WindowPtr) buf->pDraw);
+	}
+	else
+	{
+	    buf->xm_buf = (void *)
+		XMesaCreatePixmapBuffer (buf->xm_vis, (PixmapPtr) buf->pDraw, 0);
+	}
+    }
+}
+
 GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer,
 			       GLint x, GLint y,
 			       GLuint width, GLuint height, 
@@ -1222,6 +1245,12 @@
     __MESA_buffer readBuf = (__MESA_buffer)readPriv->private;
     XMesaContext xmesa = (XMesaContext) gc->DriverCtx;
 
+    if (!drawBuf->xm_buf)
+	__MESA_allocateBuffer (drawPriv);
+
+    if (!readBuf->xm_buf)
+	__MESA_allocateBuffer (readPriv);
+
     MESA_CC = gc;
     return XMesaMakeCurrent2(xmesa, drawBuf->xm_buf, readBuf->xm_buf);
 }

Index: xf86glxint.h
===================================================================
RCS file: /cvs/xserver/xserver/GL/mesa/X/xf86glxint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xf86glxint.h	23 Dec 2005 02:07:57 -0000	1.4
+++ xf86glxint.h	3 Jan 2006 09:43:40 -0000	1.5
@@ -55,8 +55,10 @@
 typedef struct __MESA_bufferRec *__MESA_buffer;
 struct __MESA_bufferRec {
     XMesaBuffer xm_buf;
+    DrawablePtr pDraw;
+    XMesaVisual xm_vis;
     GLboolean (*fbresize)(__GLdrawableBuffer *buf,
-			  GLint x, GLint y, GLuint width, GLuint height, 
+			  GLint x, GLint y, GLuint width, GLuint height,
 			  __GLdrawablePrivate *glPriv, GLuint bufferMask);
     GLboolean (*fbswap)(__GLXdrawablePrivate *glxPriv);
     int (*fbbind)(__GLXdrawablePrivate *glxPriv, int buffer);



More information about the xserver-commit mailing list