Merging aiglx

David Reveman davidr at novell.com
Wed Mar 8 17:10:26 PST 2006


On Mon, 2006-03-06 at 14:32 -0500, Kristian Høgsberg wrote:
> Hello,
> 
> It's been a couple of weeks since I posted my aiglx patch and there 
> hasn't been a lot of feedback, so I'm going to go ahead and assume 
> everybody is happy with the approach.  In the meantime, we've fixed a 
> number of crashers, added better logging and added hooks to allow the 
> GLXprovider to implement the GLX_EXT_tfp extension.
> 
> Unless there are any objections to this, I'll merge the aiglx branch to 
> head this friday (yay, one less branch to keep in sync with mesa).


OK, I updated the xgl branch earlier today. Seams to be working alright but I
haven't done much testing yet.

I had to change a few things to make it work with Xgl. I've attached the
current diff between the xgl and aiglx branches and you can find a few
short comments to this diff below.



--- ../../../aiglx/xserver/xorg/GL/glx/Makefile.am	2006-03-06 23:56:22.000000000 +0100
+++ ./glx/Makefile.am	2006-03-08 18:16:35.000000000 +0100
@@ -1,4 +1,8 @@
-noinst_LTLIBRARIES = libglx.la libglxdri.la
+if DRI
+GLXDRI_LIBRARY=libglxdri.la
+endif
+
+noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
 
 AM_CFLAGS = \
 	-I at MESA_SOURCE@/include \
@@ -12,7 +16,8 @@
 	@SERVER_DEFINES@ \
 	@MODULE_DEFINES@ \
 	@LOADER_DEFINES@ \
-	-DNO_LIBCWRAPPER
+	-DNO_LIBCWRAPPER \
+	-DUSE_MGL_NAMESPACE
 # none yet
 #sdk_HEADERS =


Made it possible to not build glxdri.c. Eventually, this shouldn't be
necessary.


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxcmds.c ./glx/glxcmds.c
--- ../../../aiglx/xserver/xorg/GL/glx/glxcmds.c	2006-03-06 23:56:23.000000000 +0100
+++ ./glx/glxcmds.c	2006-03-08 18:16:40.000000000 +0100
@@ -58,8 +58,22 @@
 #include "glthread.h"
 #include "dispatch.h"
 
+#ifndef GLX_TEXTURE_TARGET_EXT
+#define GLX_TEXTURE_TARGET_EXT              0x6001
+#define GLX_TEXTURE_2D_EXT                  0x6002
+#define GLX_TEXTURE_RECTANGLE_EXT           0x6003
+#define GLX_NO_TEXTURE_EXT                  0x6004
+#define GLX_Y_INVERTED_EXT                  0x6006
+#endif
+
 /************************************************************************/
 
+void
+GlxSetRenderTables (struct _glapi_table *table)
+{
+    _glapi_set_dispatch (table);
+}
+
 static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
 static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
 static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);


GlxSetRenderTables is just a wrapper around _glapi_set_dispatch that Xgl
is using to set dispatch table.


@@ -1357,6 +1371,7 @@
 	if (!glxc) {
 	    return __glXBadContextTag;
 	}
+#if 0 //XGL
 	/*
 	** The calling thread is swapping its current drawable.  In this case,
 	** glxSwapBuffers is in both GL and X streams, in terms of
@@ -1372,6 +1387,7 @@
 	} else {
 	    return error;
 	}
+#endif
     }
 
     if (pDraw) {


Xgl doesn't need this extra context switch before swapping buffers and
it's a significant performance improvement to avoid it. We need to make
this optional somehow.


@@ -1517,14 +1533,6 @@
 						       pGlxPixmap);
 }
 
-#ifndef GLX_TEXTURE_TARGET_EXT
-#define GLX_TEXTURE_TARGET_EXT              0x6001
-#define GLX_TEXTURE_2D_EXT                  0x6002
-#define GLX_TEXTURE_RECTANGLE_EXT           0x6003
-#define GLX_NO_TEXTURE_EXT                  0x6004
-#define GLX_Y_INVERTED_EXT                  0x6006
-#endif
-
 /*
 ** Get drawable attributes
 */
@@ -1533,8 +1541,9 @@
 {
     ClientPtr client = cl->client;
     __GLXpixmap *glxPixmap;
+    __GLXscreen *glxScreen;
     xGLXGetDrawableAttributesReply reply;
-    CARD32 attributes[2];
+    CARD32 attributes[4];
     int numAttribs;
 
     glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
@@ -1550,10 +1559,16 @@
     reply.numAttribs = numAttribs;
 
     attributes[0] = GLX_TEXTURE_TARGET_EXT;
-    attributes[1] = GLX_TEXTURE_RECTANGLE_EXT;
+    attributes[1] = GLX_NO_TEXTURE_EXT;
     attributes[2] = GLX_Y_INVERTED_EXT;
     attributes[3] = GL_FALSE;
 
+    glxScreen = glxPixmap->pGlxScreen;
+    if (glxScreen->textureFromPixmap)
+	attributes[1] =
+	    (*glxScreen->textureFromPixmap->getTexTarget) (glxScreen,
+							   glxPixmap);
+
     if (client->swapped) {
 	__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
     } else {


Texture target is not always GLX_TEXTURE_RECTANGLE_EXT and obvious fix
to size of attributes.


@@ -1578,8 +1593,189 @@
     return DoGetDrawableAttributes(cl, drawable);
 }
 
+
 /************************************************************************/
 
+static int
+__glXRenderBeginEnd (__GLXclientState *cl,
+		     int	      *commandsDone,
+		     GLbyte	      **ppc,
+		     int	      *pleft)
+{
+    ClientPtr	        client = cl->client;
+    int		        left, cmdlen;
+    CARD16	        opcode;
+    __GLXrenderHeader   *hdr;
+    GLbyte	        *pc;
+    __GLXrenderSizeData *entry;
+    int			extra;
+    void		(*proc) (GLbyte *);
+
+    pc = *ppc;
+    left = *pleft;
+    opcode = 0;
+
+    while (left > 0 && opcode != X_GLrop_End)
+    {
+	/*
+	** Verify that the header length and the overall length agree.
+	** Also, each command must be word aligned.
+	*/
+	hdr = (__GLXrenderHeader *) pc;
+	cmdlen = hdr->length;
+	opcode = hdr->opcode;
+
+	/*
+	** Check for core opcodes and grab entry data.
+	*/
+	if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+	     (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+	    entry = &__glXRenderSizeTable[opcode];
+	    proc = __glXRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+	} else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+		    (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+	    entry =
+		&__glXRenderSizeTable_EXT[opcode -
+					  __GLX_MIN_RENDER_OPCODE_EXT];
+	    proc = __glXRenderTable_EXT[opcode -
+					__GLX_MIN_RENDER_OPCODE_EXT];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+	} else {
+	    client->errorValue = *commandsDone;
+	    cl->beBufLen = 0;
+	    return __glXBadRenderRequest;
+	}
+
+	if (!entry->bytes) {
+	    /* unused opcode */
+	    client->errorValue = *commandsDone;
+	    cl->beBufLen = 0;
+	    return __glXBadRenderRequest;
+	}
+	if (entry->varsize) {
+	    /* variable size command */
+	    extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False);
+	    if (extra < 0) {
+		extra = 0;
+	    }
+	    if (cmdlen != __GLX_PAD(entry->bytes + extra)) {
+		cl->beBufLen = 0;
+		return BadLength;
+	    }
+	} else {
+	    /* constant size command */
+	    if (cmdlen != __GLX_PAD(entry->bytes)) {
+		cl->beBufLen = 0;
+		return BadLength;
+	    }
+	}
+	if (left < cmdlen) {
+	    cl->beBufLen = 0;
+	    return BadLength;
+	}
+
+	(*commandsDone)++;
+
+	pc += cmdlen;
+	left -= cmdlen;
+    }
+
+    if (opcode == X_GLrop_End)
+    {
+	pc = cl->beBuf;
+	left = cl->beBufLen;
+	opcode = 0;
+
+	while (left > 0 && opcode != X_GLrop_End)
+	{
+	    hdr = (__GLXrenderHeader *) pc;
+	    cmdlen = hdr->length;
+	    opcode = hdr->opcode;
+
+	    if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+		(opcode <= __GLX_MAX_RENDER_OPCODE))
+	    {
+		entry = &__glXRenderSizeTable[opcode];
+		proc = __glXRenderTable[opcode];
+	    }
+
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+	    else
+	    {
+		int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+
+		entry = &__glXRenderSizeTable_EXT[index];
+		proc = __glXRenderTable_EXT[index];
+	    }
+#endif
+
+	    (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+
+	    pc += cmdlen;
+	    left -= cmdlen;
+	}
+
+	cl->beBufLen = 0;
+
+	pc = *ppc;
+	left = *pleft;
+	opcode = 0;
+
+	while (opcode != X_GLrop_End)
+	{
+	    hdr = (__GLXrenderHeader *) pc;
+	    cmdlen = hdr->length;
+	    opcode = hdr->opcode;
+
+	    if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+		(opcode <= __GLX_MAX_RENDER_OPCODE))
+	    {
+		entry = &__glXRenderSizeTable[opcode];
+		proc = __glXRenderTable[opcode];
+	    }
+
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+	    else
+	    {
+		int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+		entry = &__glXRenderSizeTable_EXT[index];
+		proc = __glXRenderTable_EXT[index];
+	    }
+#endif
+
+	    (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+
+	    pc += cmdlen;
+	    left -= cmdlen;
+	}
+    }
+    else
+    {
+	int size;
+
+	size = pc - *ppc;
+	if (cl->beBufSize < cl->beBufLen + size)
+	{
+	    cl->beBuf = (GLbyte *) Xrealloc (cl->beBuf, cl->beBufLen + size);
+	    if (!cl->beBuf)
+		cl->beBufLen = size = 0;
+
+	    cl->beBufSize = cl->beBufLen + size;
+	}
+
+	if (size)
+	    memcpy (cl->beBuf + cl->beBufLen, *ppc, size);
+
+	cl->beBufLen += size;
+    }
+
+    *ppc = pc;
+    *pleft = left;
+
+    return Success;
+}
+
 /*
 ** Render and Renderlarge are not in the GLX API.  They are used by the GLX
 ** client library to send batches of GL rendering commands.
@@ -1671,17 +1867,26 @@
 	    return BadLength;
 	}
 
-	/*
-	** Skip over the header and execute the command.  We allow the
-	** caller to trash the command memory.  This is useful especially
-	** for things that require double alignment - they can just shift
-	** the data towards lower memory (trashing the header) by 4 bytes
-	** and achieve the required alignment.
-	*/
-	(*proc)(pc + __GLX_RENDER_HDR_SIZE);
-	pc += cmdlen;
-	left -= cmdlen;
-	commandsDone++;
+	if (opcode == X_GLrop_Begin || cl->beBufLen > 0)
+	{
+	    error = __glXRenderBeginEnd (cl, &commandsDone, &pc, &left);
+	    if (error != Success)
+		return error;
+	}
+	else
+	{
+	    /*
+	    ** Skip over the header and execute the command.  We allow the
+	    ** caller to trash the command memory.  This is useful especially
+	    ** for things that require double alignment - they can just shift
+	    ** the data towards lower memory (trashing the header) by 4 bytes
+	    ** and achieve the required alignment.
+	    */
+	    (*proc)(pc + __GLX_RENDER_HDR_SIZE);
+	    pc += cmdlen;
+	    left -= cmdlen;
+	    commandsDone++;
+	}
     }
     __GLX_NOTE_UNFLUSHED_CMDS(glxc);
     return Success;


Big chunk of code to deal with context switches not happening between
glBegin and glEnd (as I mentioned at xdevconf). 


@@ -2202,6 +2407,20 @@
 	return __glXCreateGLXPixmapWithConfigSGIX(cl, pc);
       case X_GLXvop_GetDrawableAttributesSGIX:
 	return __glXGetDrawableAttributesSGIX(cl, pc);
+      case X_GLvop_IsRenderbufferEXT:
+	return __glXDisp_IsRenderbufferEXT(cl, pc);
+      case X_GLvop_GenRenderbuffersEXT:
+	return __glXDisp_GenRenderbuffersEXT(cl, pc);
+      case X_GLvop_GetRenderbufferParameterivEXT:
+	return __glXDisp_GetRenderbufferParameterivEXT(cl, pc);
+      case X_GLvop_IsFramebufferEXT:
+	return __glXDisp_IsFramebufferEXT(cl, pc);
+      case X_GLvop_GenFramebuffersEXT:
+	return __glXDisp_GenFramebuffersEXT(cl, pc);
+      case X_GLvop_CheckFramebufferStatusEXT:
+	return __glXDisp_CheckFramebufferStatusEXT(cl, pc);
+      case X_GLvop_GetFramebufferAttachmentParameterivEXT:
+	return __glXDisp_GetFramebufferAttachmentParameterivEXT(cl, pc);
       default:
 	break;
     }


FBO support.


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxcmdsswap.c ./glx/glxcmdsswap.c
--- ../../../aiglx/xserver/xorg/GL/glx/glxcmdsswap.c	2006-03-06 23:56:23.000000000 +0100
+++ ./glx/glxcmdsswap.c	2006-03-08 18:29:30.000000000 +0100
@@ -531,13 +531,191 @@
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->numAttribs);
-    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
+    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply);
     __GLX_SWAP_INT_ARRAY((int *)buf, length);
     WriteToClient(client, length << 2, (char *)buf);
 }


Fix typo. 

 
 /************************************************************************/
 
+static int
+__glXSwapRenderBeginEnd (__GLXclientState *cl,
+			 int		  *commandsDone,
+			 GLbyte		  **ppc,
+			 int		  *pleft)
+{
+    ClientPtr	        client = cl->client;
+    int		        left, cmdlen;
+    CARD16	        opcode;
+    __GLXrenderHeader   *hdr;
+    GLbyte	        *pc;
+    __GLXrenderSizeData *entry;
+    int			extra;
+    void		(*proc) (GLbyte *);
+
+   __GLX_DECLARE_SWAP_VARIABLES;
+
+    pc = *ppc;
+    left = *pleft;
+    opcode = 0;
+
+    while (left > 0 && opcode != X_GLrop_End)
+    {
+	/*
+	** Verify that the header length and the overall length agree.
+	** Also, each command must be word aligned.
+	*/
+	hdr = (__GLXrenderHeader *) pc;
+	__GLX_SWAP_SHORT(&hdr->length);
+	__GLX_SWAP_SHORT(&hdr->opcode);
+	cmdlen = hdr->length;
+	opcode = hdr->opcode;
+
+	if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+	     (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+	    entry = &__glXRenderSizeTable[opcode];
+	    proc = __glXSwapRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+	} else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+		    (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+	    int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+	    entry = &__glXRenderSizeTable_EXT[index];
+	    proc = __glXSwapRenderTable_EXT[index];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+	} else {
+	    client->errorValue = *commandsDone;
+	    cl->beBufLen = 0;
+	    return __glXBadRenderRequest;
+	}
+
+	if (!entry->bytes) {
+	    /* unused opcode */
+	    client->errorValue = *commandsDone;
+	    cl->beBufLen = 0;
+	    return __glXBadRenderRequest;
+	}
+	if (entry->varsize) {
+	    /* variable size command */
+	    extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True);
+	    if (extra < 0) {
+		extra = 0;
+	    }
+	    if (cmdlen != __GLX_PAD(entry->bytes + extra)) {
+		cl->beBufLen = 0;
+		return BadLength;
+	    }
+	} else {
+	    /* constant size command */
+	    if (cmdlen != __GLX_PAD(entry->bytes)) {
+		cl->beBufLen = 0;
+		return BadLength;
+	    }
+	}
+	if (left < cmdlen) {
+	    cl->beBufLen = 0;
+	    return BadLength;
+	}
+
+	(*commandsDone)++;
+
+	pc += cmdlen;
+	left -= cmdlen;
+    }
+
+    if (opcode == X_GLrop_End)
+    {
+	pc = cl->beBuf;
+	left = cl->beBufLen;
+	opcode = 0;
+
+	while (left > 0 && opcode != X_GLrop_End)
+	{
+	    hdr = (__GLXrenderHeader *) pc;
+	    cmdlen = hdr->length;
+	    opcode = hdr->opcode;
+
+	    if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+		(opcode <= __GLX_MAX_RENDER_OPCODE))
+	    {
+		entry = &__glXRenderSizeTable[opcode];
+		proc = __glXSwapRenderTable[opcode];
+	    }
+
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+	    else
+	    {
+		int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+
+		entry = &__glXRenderSizeTable_EXT[index];
+		proc = __glXSwapRenderTable_EXT[index];
+	    }
+#endif
+
+	    (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+
+	    pc += cmdlen;
+	    left -= cmdlen;
+	}
+
+	cl->beBufLen = 0;
+
+	pc = *ppc;
+	left = *pleft;
+	opcode = 0;
+
+	while (opcode != X_GLrop_End)
+	{
+	    hdr = (__GLXrenderHeader *) pc;
+	    cmdlen = hdr->length;
+	    opcode = hdr->opcode;
+
+	    if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+		(opcode <= __GLX_MAX_RENDER_OPCODE))
+	    {
+		entry = &__glXRenderSizeTable[opcode];
+		proc = __glXRenderTable[opcode];
+	    }
+
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+	    else
+	    {
+		int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+
+		entry = &__glXRenderSizeTable_EXT[index];
+		proc = __glXRenderTable_EXT[index];
+	    }
+#endif
+
+	    (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+
+	    pc += cmdlen;
+	    left -= cmdlen;
+	}
+    }
+    else
+    {
+	int size;
+
+	size = pc - *ppc;
+	if (cl->beBufSize < cl->beBufLen + size)
+	{
+	    cl->beBuf = (GLbyte *) Xrealloc (cl->beBuf, cl->beBufLen + size);
+	    if (!cl->beBuf)
+		cl->beBufLen = size = 0;
+
+	    cl->beBufSize = cl->beBufLen + size;
+	}
+
+	if (size)
+	    memcpy (cl->beBuf + cl->beBufLen, *ppc, size);
+    }
+
+    *ppc = pc;
+    *pleft = left;
+
+    return Success;
+}
+
 /*
 ** Render and Renderlarge are not in the GLX API.  They are used by the GLX
 ** client library to send batches of GL rendering commands.
@@ -626,17 +804,26 @@
 	    return BadLength;
 	}
 
-	/*
-	** Skip over the header and execute the command.  We allow the
-	** caller to trash the command memory.  This is useful especially
-	** for things that require double alignment - they can just shift
-	** the data towards lower memory (trashing the header) by 4 bytes
-	** and achieve the required alignment.
-	*/
-	(*proc)(pc + __GLX_RENDER_HDR_SIZE);
-	pc += cmdlen;
-	left -= cmdlen;
-	commandsDone++;
+	if (opcode == X_GLrop_Begin || cl->beBufLen > 0)
+	{
+	    error = __glXSwapRenderBeginEnd (cl, &commandsDone, &pc, &left);
+	    if (error != Success)
+		return error;
+	}
+	else
+	{
+	    /*
+	    ** Skip over the header and execute the command.  We allow the
+	    ** caller to trash the command memory.  This is useful especially
+	    ** for things that require double alignment - they can just shift
+	    ** the data towards lower memory (trashing the header) by 4 bytes
+	    ** and achieve the required alignment.
+	    */
+	    (*proc)(pc + __GLX_RENDER_HDR_SIZE);
+	    pc += cmdlen;
+	    left -= cmdlen;
+	    commandsDone++;
+	}
     }
     __GLX_NOTE_UNFLUSHED_CMDS(cx);
     return Success;


glBegin and glEnd, again. 


@@ -939,6 +1126,20 @@
 	return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc);
       case X_GLXvop_GetDrawableAttributesSGIX:
 	return __glXSwapGetDrawableAttributesSGIX(cl, pc);
+      case X_GLvop_IsRenderbufferEXT:
+	return __glXDispSwap_IsRenderbufferEXT(cl, pc);
+      case X_GLvop_GenRenderbuffersEXT:
+	return __glXDispSwap_GenRenderbuffersEXT(cl, pc);
+      case X_GLvop_GetRenderbufferParameterivEXT:
+	return __glXDispSwap_GetRenderbufferParameterivEXT(cl, pc);
+      case X_GLvop_IsFramebufferEXT:
+	return __glXDispSwap_IsFramebufferEXT(cl, pc);
+      case X_GLvop_GenFramebuffersEXT:
+	return __glXDispSwap_GenFramebuffersEXT(cl, pc);
+      case X_GLvop_CheckFramebufferStatusEXT:
+	return __glXDispSwap_CheckFramebufferStatusEXT(cl, pc);
+      case X_GLvop_GetFramebufferAttachmentParameterivEXT:
+	return __glXDispSwap_GetFramebufferAttachmentParameterivEXT(cl, pc);
       default:
 	break;
     }

FBO support.


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxcontext.h ./glx/glxcontext.h
--- ../../../aiglx/xserver/xorg/GL/glx/glxcontext.h	2006-02-25 03:02:07.000000000 +0100
+++ ./glx/glxcontext.h	2006-03-08 18:16:43.000000000 +0100
@@ -46,8 +46,8 @@
 
 #include "GL/internal/glcore.h"
 
-typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
-struct __GLXtextureFromPixmap {
+typedef struct __GLXtextureFromPixmapContext __GLXtextureFromPixmapContext;
+struct __GLXtextureFromPixmapContext {
     int (*bindTexImage)		(__GLXcontext *baseContext,
 				 int           buffer,
 				 __GLXpixmap  *pixmap);
@@ -70,7 +70,7 @@
 				     DrawablePtr pDraw,
 				     XID drawId);
 
-    __GLXtextureFromPixmap *textureFromPixmap;
+    __GLXtextureFromPixmapContext *textureFromPixmap;
 
     /*
     ** list of context structs


Appropriate renaming as I've added __GLXtextureFromPixmapScreen.


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxdri.c ./glx/glxdri.c
--- ../../../aiglx/xserver/xorg/GL/glx/glxdri.c	2006-03-06 23:56:24.000000000 +0100
+++ ./glx/glxdri.c	2006-03-08 18:16:40.000000000 +0100
@@ -330,6 +330,17 @@
  */
 
 static int
+__glXDRIgetTexTarget (__GLXscreen *screen,
+		      __GLXpixmap *pixmap)
+{
+    return GLX_TEXTURE_RECTANGLE_EXT;
+}
+
+static __GLXtextureFromPixmapScreen __glXDRItextureFromPixmapScreen = {
+    __glXDRIgetTexTarget,
+};
+
+static int
 __glXDRIbindTexImage(__GLXcontext *baseContext,
 		     int buffer,
 		     __GLXpixmap *glxPixmap)
@@ -378,7 +389,7 @@
     return Success;
 }
 
-static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
+static __GLXtextureFromPixmapContext __glXDRItextureFromPixmapContext = {
     __glXDRIbindTexImage,
     __glXDRIreleaseTexImage
 };
@@ -426,7 +437,7 @@
     context->base.forceCurrent      = __glXDRIcontextForceCurrent;
     context->base.createDrawable    = __glXDRIcontextCreateDrawable;
 
-    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+    context->base.textureFromPixmap = &__glXDRItextureFromPixmapContext;
 
     context->driContext.private =
 	screen->driScreen.createNewContext(NULL, modes,
@@ -731,6 +742,8 @@
     screen->base.createContext = __glXDRIscreenCreateContext;
     screen->base.pScreen       = pScreen;
 
+    screen->base.textureFromPixmap = __glXDRItextureFromPixmapScreen;
+
     /* DRI protocol version. */
     dri_version.major = XF86DRI_MAJOR_VERSION;
     dri_version.minor = XF86DRI_MINOR_VERSION;


Track changes needed by Xgl.


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxscreens.c ./glx/glxscreens.c
--- ../../../aiglx/xserver/xorg/GL/glx/glxscreens.c	2006-03-06 23:56:25.000000000 +0100
+++ ./glx/glxscreens.c	2006-03-08 18:16:40.000000000 +0100
@@ -64,6 +64,7 @@
 			"GL_ARB_texture_mirrored_repeat "
 			"GL_ARB_transpose_matrix "
 			"GL_ARB_window_pos "
+			"GL_ARB_texture_non_power_of_two "
 			"GL_EXT_abgr "
 			"GL_EXT_bgra "
  			"GL_EXT_blend_color "
@@ -96,6 +97,7 @@
 			"GL_EXT_texture_object "
 			"GL_EXT_texture_rectangle "
 			"GL_EXT_vertex_array "
+			"GL_EXT_framebuffer_object "
 			"GL_APPLE_packed_pixels "
 			"GL_ATI_texture_mirror_once "
 			"GL_ATI_texture_env_combine3 "
@@ -107,6 +109,7 @@
 			"GL_NV_point_sprite "
 			"GL_NV_texgen_reflection "
 			"GL_NV_texture_rectangle "
+			"GL_NV_texture_env_combine4 "
 			"GL_SGIS_generate_mipmap "
 			"GL_SGIS_texture_border_clamp "
 			"GL_SGIS_texture_edge_clamp "


Some extensions...


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxscreens.h ./glx/glxscreens.h
--- ../../../aiglx/xserver/xorg/GL/glx/glxscreens.h	2006-02-24 06:49:33.000000000 +0100
+++ ./glx/glxscreens.h	2006-03-08 18:16:43.000000000 +0100
@@ -51,7 +51,17 @@
 ** and DDX layers of the GLX server extension.  The methods provide an
 ** interface for context management on a screen.
 */
+
 typedef struct __GLXscreen __GLXscreen;
+typedef struct __GLXtextureFromPixmapScreen __GLXtextureFromPixmapScreen;
+
+#include "glxdrawable.h"
+
+struct __GLXtextureFromPixmapScreen {
+    int (*getTexTarget) (__GLXscreen *screen,
+			 __GLXpixmap *pixmap);
+};
+
 struct __GLXscreen {
     void          (*destroy)(__GLXscreen *screen);
 
@@ -81,6 +91,7 @@
     */
     Bool (*WrappedPositionWindow)(WindowPtr pWin, int x, int y);
 
+    __GLXtextureFromPixmapScreen *textureFromPixmap;
 };
 

Added __GLXtextureFromPixmapScreen, which is used for getting pixmap
texture target. 


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxserver.h ./glx/glxserver.h
--- ../../../aiglx/xserver/xorg/GL/glx/glxserver.h	2006-03-01 23:16:54.000000000 +0100
+++ ./glx/glxserver.h	2006-03-08 18:16:43.000000000 +0100
@@ -150,6 +150,13 @@
     GLint returnBufSize;
 
     /*
+    ** Begin/End buffer.
+    */
+    GLbyte *beBuf;
+    GLint beBufLen;
+    GLint beBufSize;
+
+    /*
     ** Keep track of large rendering commands, which span multiple requests.
     */
     GLint largeCmdBytesSoFar;		/* bytes received so far	*/


GLX client buffer used for fixing glBegin/glEnd context switch issue.


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxutil.c ./glx/glxutil.c
--- ../../../aiglx/xserver/xorg/GL/glx/glxutil.c	2006-02-24 06:49:33.000000000 +0100
+++ ./glx/glxutil.c	2006-03-08 18:16:40.000000000 +0100
@@ -225,11 +225,6 @@
     drawable->pGlxPixmap = (__GLXpixmap *) 
 	LookupIDByType(drawId, __glXPixmapRes);
 
-    /* since we are creating the drawablePrivate, drawId should be new */
-    if (!AddResource(drawId, __glXDrawableRes, drawable)) {
-	return GL_FALSE;
-    }
-
     return GL_TRUE;
 }
 
@@ -251,7 +246,16 @@
     glxPriv = __glXFindDrawable(drawId);
 
     if (glxPriv == NULL)
+    {
 	glxPriv = ctx->createDrawable(ctx, pDraw, drawId);
 
+	/* since we are creating the drawablePrivate, drawId should be new */
+	if (!AddResource(drawId, __glXDrawableRes, glxPriv))
+	{
+	    glxPriv->destroy (glxPriv);
+	    return NULL;
+	}
+    }
+
     return glxPriv;
 }


Moved AddResource out of drawable init function to allow sane wrapping
of createDrawable. 


diff -ur ../../../aiglx/xserver/xorg/GL/glx/glxvisuals.c ./glx/glxvisuals.c
--- ../../../aiglx/xserver/xorg/GL/glx/glxvisuals.c	2006-02-24 17:50:42.000000000 +0100
+++ ./glx/glxvisuals.c	2006-03-08 18:16:40.000000000 +0100
@@ -359,6 +359,12 @@
 		    ? (modes->redBits + modes->greenBits +
 		       modes->blueBits + modes->alphaBits)
 		    : rootDepth;
+
+#ifdef COMPOSITE
+		if (pVisual[i].nplanes == 32)
+		    modes->visualRating = GLX_NON_CONFORMANT_CONFIG;
+#endif
+
 	    }
 
 	    /* Save the device-dependent private for this visual */


ARGB32 GL visual support. 


@@ -432,11 +438,11 @@
 
 static miInitVisualsProcPtr saveInitVisualsProc;
 
-static Bool __glXInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
-			     int *nvisualp, int *ndepthp,
-			     int *rootDepthp, VisualID *defaultVisp,
-			     unsigned long sizes, int bitsPerRGB,
-			     int preferredVis)
+Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
+		    int *nvisualp, int *ndepthp,
+		    int *rootDepthp, VisualID *defaultVisp,
+		    unsigned long sizes, int bitsPerRGB,
+		    int preferredVis)
 {
     Bool ret;
 
@@ -466,7 +472,7 @@
 GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
 {
     saveInitVisualsProc = *initVisProc;
-    *initVisProc = __glXInitVisuals;
+    *initVisProc = GlxInitVisuals;
 }
 
 static void fixup_visuals(int screen)


Non-static GlxInitVisuals so that Xgl ddx can call this function. 


@@ -484,7 +490,13 @@
 	/* Find a visual that matches the GLX visual's class and size */
 	for (j = 0; j < pScreen->numVisuals; j++) {
 	    if (pVis[j].class == vis_class &&
-		pVis[j].nplanes == nplanes) {
+		(pVis[j].nplanes == nplanes
+
+#ifdef COMPOSITE
+		 || (pVis[j].nplanes == 32 && pVis[j].nplanes == modes->rgbBits)
+#endif
+
+		)) {
 
 		/* Fixup the masks */
 		modes->redMask   = pVis[j].redMask;


ARGB32 GL visual support.


diff -ur ../../../aiglx/xserver/xorg/GL/mesa/X/xf86glx.c ./mesa/X/xf86glx.c
--- ../../../aiglx/xserver/xorg/GL/mesa/X/xf86glx.c	2006-02-28 05:32:45.000000000 +0100
+++ ./mesa/X/xf86glx.c	2006-03-08 18:57:36.000000000 +0100
@@ -350,7 +350,13 @@
 
 	for (j = 0; j < pScreen->numVisuals; j++) {
 	    if (pVis[j].class     == vis_class &&
-		pVis[j].nplanes   == nplanes &&
+		(pVis[j].nplanes   == nplanes
+
+#ifdef COMPOSITE
+		 || (pVis[j].nplanes == 32 && pVis[j].nplanes == modes->rgbBits)
+#endif
+
+		    ) &&
 		pVis[j].redMask   == modes->redMask &&
 		pVis[j].greenMask == modes->greenMask &&
 		pVis[j].blueMask  == modes->blueMask &&
@@ -431,3 +437,9 @@
     "MESA",
     NULL
 };
+
+__GLXprovider *
+GlxGetMesaProvider (void)
+{
+    return &__glXMesaProvider;
+}


ARGB32 GL visual support and function that returns pointer to
__glXMesaProvider.

Added -DUSE_MGL_NAMESPACE to AM_CFLAGS in all Makefile.am files as Xgl
needs mangled namespace to avoid symbol conflict with dispatch table
names.

g_disptab_EXT.[ch] and rensizetab.c changes are just for FBO support. 


The new GLX code is much better, thanks Kristian!

-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aiglx.diff
Type: text/x-patch
Size: 45315 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20060309/98caca47/attachment.bin>


More information about the xorg mailing list