-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In addition to my recent commit to Mesa CVS, try this patch.  I have
verified that everything builds and that glxgears works on a system with
current X.org CVS installed.

The problem with display lists was really, really stupid.  The changes
to dispatch.h existed when I tested everything.  However, I had added
them by hand.  Shortly before committing, I regenerated the file.  Since
the script did not contain the changes, they were lost when the file was
regenerated.  D'oh!

I'm really, really confused as to why this bug doesn't hit X.org CVS
builds.  The only way that it would not hit is if IN_DRI_DRIVER isn't
set.  If that's the case, it's also a bug.  I'm not sure if we should
just apply this patch (should just need the changes to dispatch.h) to
X.org CVS or re-import Mesa with the patch applied.  Fortunately for me,
it's not my call to make. :)

As for the s/XTHREADS/USE_XTHREADS/ change, I'm not terribly happy about
it.  The problem is that XlibConf.h contains '#define XTHREADS' to make
it easier to build X extensions in the modular build.  This used to be
set on the command line by imake.  My *personal* opinion is that it
should be set on the command line by configure.

7ddbfb1ad2cbd6b3c3e61e7128f906b6  Mesa-200508011040.patch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD4DBQFC7mEQX1gOwKyEAw8RAlMdAKCZe3qcw61nVEw9mLfS4TCMxjGeRACY1aen
2yT61/LyAUhN7ivtLfhdjQ==
=x6eQ
-----END PGP SIGNATURE-----
Index: src/glx/x11/glxclient.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/glx/x11/glxclient.h,v
retrieving revision 1.12
diff -u -d -r1.12 glxclient.h
--- src/glx/x11/glxclient.h	1 Aug 2005 16:30:24 -0000	1.12
+++ src/glx/x11/glxclient.h	1 Aug 2005 17:39:35 -0000
@@ -60,7 +60,7 @@
 #include "GL/internal/glcore.h"
 #include "glapitable.h"
 #include "glxextensions.h"
-#if defined( XTHREADS )
+#if defined( USE_XTHREADS )
 # include <X11/Xthreads.h>
 #elif defined( PTHREADS )
 # include <pthread.h>
@@ -547,7 +547,7 @@
 extern int __glXDebug;
 
 /* This is per-thread storage in an MT environment */
-#if defined( XTHREADS ) || defined( PTHREADS )
+#if defined( USE_XTHREADS ) || defined( PTHREADS )
 
 extern void __glXSetCurrentContext(__GLXcontext *c);
 
@@ -570,14 +570,14 @@
 #define __glXGetCurrentContext()	__glXcurrentContext
 #define __glXSetCurrentContext(gc)	__glXcurrentContext = gc
 
-#endif /* defined( XTHREADS ) || defined( PTHREADS ) */
+#endif /* defined( USE_XTHREADS ) || defined( PTHREADS ) */
 
 
 /*
 ** Global lock for all threads in this address space using the GLX
 ** extension
 */
-#if defined( XTHREADS )
+#if defined( USE_XTHREADS )
 extern xmutex_rec __glXmutex;
 #define __glXLock()    xmutex_lock(&__glXmutex)
 #define __glXUnlock()  xmutex_unlock(&__glXmutex)
Index: src/glx/x11/glxext.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/glx/x11/glxext.c,v
retrieving revision 1.15
diff -u -d -r1.15 glxext.c
--- src/glx/x11/glxext.c	1 Aug 2005 16:30:24 -0000	1.15
+++ src/glx/x11/glxext.c	1 Aug 2005 17:39:35 -0000
@@ -145,7 +145,7 @@
  * Current context management and locking
  */
 
-#if defined( XTHREADS )
+#if defined( USE_XTHREADS )
 
 /* thread safe */
 static GLboolean TSDinitialized = GL_FALSE;
@@ -1106,7 +1106,7 @@
     XEDataObject dataObj;
     int major, minor;
 
-#if defined(XTHREADS)
+#if defined(USE_XTHREADS)
     {
         static int firstCall = 1;
         if (firstCall) {
Index: src/mesa/glapi/dispatch.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/dispatch.h,v
retrieving revision 1.2
diff -u -d -r1.2 dispatch.h
--- src/mesa/glapi/dispatch.h	28 Jul 2005 00:29:53 -0000	1.2
+++ src/mesa/glapi/dispatch.h	1 Aug 2005 17:39:36 -0000
@@ -40,11 +40,20 @@
  */
 
 #define CALL_by_offset(disp, cast, offset, parameters) \
-    (*(cast (((_glapi_proc *)(disp))[offset]))) parameters
+    (*(cast (GET_by_offset(disp, offset))) parameters
 #define GET_by_offset(disp, offset) \
-    (((_glapi_proc *)(disp))[offset])
+    (offset != 0) ? (((_glapi_proc *)(disp))[offset]) : NULL
 #define SET_by_offset(disp, offset, fn) \
-    ((((_glapi_proc *)(disp))[offset]) = (_glapi_proc) fn)
+    do { \
+        if ( (offset) == 0 ) { \
+            fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", \
+                     __func__, __LINE__, disp, offset, # fn); \
+            abort(); \
+        } \
+        else { \
+            ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \
+        } \
+    } while(0)
 
 #define CALL_NewList(disp, parameters) (*((disp)->NewList)) parameters
 #define GET_NewList(disp) ((disp)->NewList)
Index: src/mesa/glapi/gl_table.py
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/gl_table.py,v
retrieving revision 1.8
diff -u -d -r1.8 gl_table.py
--- src/mesa/glapi/gl_table.py	28 Jul 2005 00:29:53 -0000	1.8
+++ src/mesa/glapi/gl_table.py	1 Aug 2005 17:39:36 -0000
@@ -91,11 +91,20 @@
 
 	def printBody(self, api):
 		print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
-		print '    (*(cast (((_glapi_proc *)(disp))[offset]))) parameters'
+		print '    (*(cast (GET_by_offset(disp, offset))) parameters'
 		print '#define GET_by_offset(disp, offset) \\'
-		print '    (((_glapi_proc *)(disp))[offset])'
+		print '    (offset != 0) ? (((_glapi_proc *)(disp))[offset]) : NULL'
 		print '#define SET_by_offset(disp, offset, fn) \\'
-		print '    ((((_glapi_proc *)(disp))[offset]) = (_glapi_proc) fn)'
+		print '    do { \\'
+		print '        if ( (offset) == 0 ) { \\'
+		print '            fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", \\'
+		print '                     __func__, __LINE__, disp, offset, # fn); \\'
+		print '            abort(); \\'
+		print '        } \\'
+		print '        else { \\'
+		print '            ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\'
+		print '        } \\'
+		print '    } while(0)'
 		print ''
 
 		abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
Index: src/mesa/glapi/gl_x86-64_asm.py
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/gl_x86-64_asm.py,v
retrieving revision 1.1
diff -u -d -r1.1 gl_x86-64_asm.py
--- src/mesa/glapi/gl_x86-64_asm.py	2 Jul 2005 08:29:58 -0000	1.1
+++ src/mesa/glapi/gl_x86-64_asm.py	1 Aug 2005 17:39:36 -0000
@@ -127,7 +127,7 @@
 		print '#  define HIDDEN(x)'
 		print '#endif'
 		print ''
-		print '#if defined(PTHREADS) || defined(XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+		print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
 		print '#  define THREADS'
 		print '#endif'
 		print ''
Index: src/mesa/glapi/gl_x86_asm.py
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/gl_x86_asm.py,v
retrieving revision 1.13
diff -u -d -r1.13 gl_x86_asm.py
--- src/mesa/glapi/gl_x86_asm.py	21 Jun 2005 23:42:44 -0000	1.13
+++ src/mesa/glapi/gl_x86_asm.py	1 Aug 2005 17:39:36 -0000
@@ -86,7 +86,7 @@
 		print '#define GLOBL_FN(x) GLOBL x'
 		print '#endif'
 		print ''
-		print '#if defined(PTHREADS) || defined(XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+		print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
 		print '#  define THREADS'
 		print '#endif'
 		print ''
Index: src/mesa/glapi/glthread.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/glthread.c,v
retrieving revision 1.11
diff -u -d -r1.11 glthread.c
--- src/mesa/glapi/glthread.c	5 Jun 2003 00:50:40 -0000	1.11
+++ src/mesa/glapi/glthread.c	1 Aug 2005 17:39:36 -0000
@@ -242,7 +242,7 @@
  * XFree86 has its own thread wrapper, Xthreads.h
  * We wrap it again for GL.
  */
-#ifdef XTHREADS
+#ifdef USE_XTHREADS
 
 unsigned long
 _glthread_GetID(void)
Index: src/mesa/glapi/glthread.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/glthread.h,v
retrieving revision 1.20
diff -u -d -r1.20 glthread.h
--- src/mesa/glapi/glthread.h	18 Jul 2005 12:31:26 -0000	1.20
+++ src/mesa/glapi/glthread.h	1 Aug 2005 17:39:36 -0000
@@ -65,7 +65,7 @@
 
 
 #if (defined(PTHREADS) || defined(SOLARIS_THREADS) ||\
-     defined(WIN32_THREADS) || defined(XTHREADS) || defined(BEOS_THREADS)) \
+     defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \
     && !defined(THREADS)
 # define THREADS
 #endif
@@ -193,7 +193,7 @@
  * XFree86 has its own thread wrapper, Xthreads.h
  * We wrap it again for GL.
  */
-#ifdef XTHREADS
+#ifdef USE_XTHREADS
 #include <X11/Xthreads.h>
 
 typedef struct {
@@ -225,7 +225,7 @@
 #define _glthread_UNLOCK_MUTEX(name) \
    (void) xmutex_unlock(&(name))
 
-#endif /* XTHREADS */
+#endif /* USE_XTHREADS */
 
 
 
Index: src/mesa/x86/glapi_x86.S
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/x86/glapi_x86.S,v
retrieving revision 1.54
diff -u -d -r1.54 glapi_x86.S
--- src/mesa/x86/glapi_x86.S	21 Jun 2005 23:42:44 -0000	1.54
+++ src/mesa/x86/glapi_x86.S	1 Aug 2005 17:39:37 -0000
@@ -63,7 +63,7 @@
 #define GLOBL_FN(x) GLOBL x
 #endif
 
-#if defined(PTHREADS) || defined(XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
 #  define THREADS
 #endif
 
Index: src/mesa/x86-64/glapi_x86-64.S
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/x86-64/glapi_x86-64.S,v
retrieving revision 1.1
diff -u -d -r1.1 glapi_x86-64.S
--- src/mesa/x86-64/glapi_x86-64.S	2 Jul 2005 08:29:58 -0000	1.1
+++ src/mesa/x86-64/glapi_x86-64.S	1 Aug 2005 17:39:37 -0000
@@ -35,7 +35,7 @@
 #  define HIDDEN(x)
 #endif
 
-#if defined(PTHREADS) || defined(XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
 #  define THREADS
 #endif
 

Reply via email to