Filewatcher File Search
FTP Search
  
Directory (beta)
  
Content Search (beta)
   
pkg://Mesa-3.4.2-10.src.rpm:3170378/Mesa-XF86DRI-4.0.3.patch  info  downloads

diff -urN Mesa-3.4~/configure.in Mesa-3.4/configure.in
--- Mesa-3.4~/configure.in	Fri Aug 25 05:50:59 2000
+++ Mesa-3.4/configure.in	Sat Jan  6 01:49:28 2001
@@ -516,6 +516,7 @@
 src/OSmesa/Makefile
 src/SVGA/Makefile
 src/X/Makefile
+src/DRI/Makefile
 src/X86/Makefile
 src-glu/Makefile
 src-glut/Makefile
diff -urN Mesa-3.4~/src/DRI/Makefile.am Mesa-3.4/src/DRI/Makefile.am
--- Mesa-3.4~/src/DRI/Makefile.am	Wed Dec 31 19:00:00 1969
+++ Mesa-3.4/src/DRI/Makefile.am	Sat Jan  6 01:49:27 2001
@@ -0,0 +1,46 @@
+## Process this file with automake to produce Makefile.in
+
+#AUTOMAKE_OPTIONS = no-dependencies
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src $(X_CFLAGS) $(FX_CFLAGS) \
+	-DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING -DGLX_USE_DLOPEN -DGLX_USE_MESA \
+	-DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API
+
+if HAVE_X11
+# Build a libtool convenience library.
+noinst_LTLIBRARIES = libMesaDRI.la
+endif
+
+libMesaDRI_la_SOURCES = \
+	XF86dri.c \
+	clientattrib.c \
+	compsize.c \
+	dri_glx.c \
+	dri_glx.h \
+	eval.c \
+	g_render.c \
+	g_single.c \
+	g_vendpriv.c \
+	glxclient.h \
+	glxcmds.c \
+	glxext.c \
+	indirect.h \
+	indirect_init.c \
+	indirect_init.h \
+	indirect_wrap.h \
+	packrender.h \
+	packsingle.h \
+	packvendpriv.h \
+	pixel.c \
+	pixelstore.c \
+	render2.c \
+	renderpix.c \
+	single2.c \
+	singlepix.c \
+	size.h \
+	vertarr.c \
+	xf86dri.h \
+	xf86dristr.h \
+	xfont.c
+
+libMesaDRI_la_LIBADD = $(X_LIBS) $(X_PRE_LIBS) $(X_LIBADD) -lpthread -ldl
diff -urN Mesa-3.4~/src/DRI/XF86dri.c Mesa-3.4/src/DRI/XF86dri.c
--- Mesa-3.4~/src/DRI/XF86dri.c	Thu Dec  7 15:26:02 2000
+++ Mesa-3.4/src/DRI/XF86dri.c	Sat Jan  6 01:50:33 2001
@@ -38,9 +38,9 @@
 /* THIS IS NOT AN X CONSORTIUM STANDARD */
 
 #define NEED_REPLIES
-#include "Xlibint.h"
+#include <X11/Xlibint.h>
 #include "xf86dristr.h"
-#include "Xext.h"
+#include <X11/extensions/Xext.h>
 #include "extutil.h"
 
 static XExtensionInfo _xf86dri_info_data;
diff -urN Mesa-3.4~/src/DRI/dri_glx.c Mesa-3.4/src/DRI/dri_glx.c
--- Mesa-3.4~/src/DRI/dri_glx.c	Tue Sep 26 11:56:45 2000
+++ Mesa-3.4/src/DRI/dri_glx.c	Sat Jan  6 01:54:10 2001
@@ -36,8 +36,8 @@
 #ifdef GLX_DIRECT_RENDERING
 
 #include <unistd.h>
-#include <Xlibint.h>
-#include <Xext.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
 #include <extutil.h>
 #include "glxclient.h"
 #include "xf86dri.h"
diff -urN Mesa-3.4~/src/DRI/glxclient.h Mesa-3.4/src/DRI/glxclient.h
--- Mesa-3.4~/src/DRI/glxclient.h	Thu Dec  7 15:26:03 2000
+++ Mesa-3.4/src/DRI/glxclient.h	Sat Jan  6 01:52:35 2001
@@ -45,8 +45,10 @@
 #include "indirect.h"
 #endif
 #ifdef XTHREADS
-#include "Xthreads.h"
+#include <X11/Xthreads.h>
 #endif
+
+#define GLXContext __GLXcontext *
 
 
 #define GLX_MAJOR_VERSION	1	/* current version numbers */
diff -urN Mesa-3.4~/src/DRI/glxcmds.c Mesa-3.4/src/DRI/glxcmds.c
--- Mesa-3.4~/src/DRI/glxcmds.c	Mon Nov 13 18:31:23 2000
+++ Mesa-3.4/src/DRI/glxcmds.c	Sat Jan  6 02:28:35 2001
@@ -31,12 +31,27 @@
 #include "packsingle.h"
 #include "glxclient.h"
 #include <extutil.h>
-#include <Xext.h>
+#include <X11/extensions/Xext.h>
 #include <string.h>
 #include "glapi.h"
+#include "../X/glxapi.h"
 #ifdef GLX_DIRECT_RENDERING
 #include "indirect_init.h"
 #endif
+#include <assert.h>
+
+#define GLXContext __GLXcontext *
+
+Bool xf86DRIMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc);
+GLXContext xf86DRIGetCurrentContext(void);
+GLXDrawable xf86DRIGetCurrentDrawable(void);
+
+/*
+** Names for attributes to glXQueryContextInfoEXT.
+*/
+#define GLX_SHARE_CONTEXT_EXT   0x800A  /* id of share context */
+#define GLX_VISUAL_ID_EXT       0x800B  /* id of context's visual */
+#define GLX_SCREEN_EXT          0x800C  /* screen number */
 
 static const char GL_ClientExtensions[] = 
                   "GL_EXT_abgr "
@@ -181,7 +196,7 @@
     return gc;
 }
 
-GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
+static GLXContext xf86DRICreateContext(Display *dpy, XVisualInfo *vis,
 			    GLXContext shareList, Bool allowDirect)
 {
     return CreateContext(dpy, vis, shareList, allowDirect, None);
@@ -254,7 +269,7 @@
 	SyncHandle();
     }
 }
-void glXDestroyContext(Display *dpy, GLXContext gc)
+static void xf86DRIDestroyContext(Display *dpy, GLXContext gc)
 {
     DestroyContext(dpy, gc);
 }
@@ -262,7 +277,7 @@
 /*
 ** Return the major and minor version #s for the GLX extension
 */
-Bool glXQueryVersion(Display *dpy, int *major, int *minor)
+static Bool xf86DRIQueryVersion(Display *dpy, int *major, int *minor)
 {
     __GLXdisplayPrivate *priv;
 
@@ -278,7 +293,7 @@
 /*
 ** Query the existance of the GLX extension
 */
-Bool glXQueryExtension(Display *dpy, int *errorBase, int *eventBase)
+static Bool xf86DRIQueryExtension(Display *dpy, int *errorBase, int *eventBase)
 {
     int major_op, erb, evb;
     Bool rv;
@@ -295,7 +310,7 @@
 ** Put a barrier in the token stream that forces the GL to finish its
 ** work before X can proceed.
 */
-void glXWaitGL(void)
+static void xf86DRIWaitGL(void)
 {
     xGLXWaitGLReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -331,7 +346,7 @@
 ** Put a barrier in the token stream that forces X to finish its
 ** work before GL can proceed.
 */
-void glXWaitX(void)
+static void xf86DRIWaitX(void)
 {
     xGLXWaitXReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -361,7 +376,7 @@
     SyncHandle();
 }
 
-void glXUseXFont(Font font, int first, int count, int listBase)
+static void xf86DRIUseXFont(Font font, int first, int count, int listBase)
 {
     xGLXUseXFontReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -399,7 +414,7 @@
 ** Copy the source context to the destination context using the
 ** attribute "mask".
 */
-void glXCopyContext(Display *dpy, GLXContext source, GLXContext dest,
+static void xf86DRICopyContext(Display *dpy, GLXContext source, GLXContext dest,
 		    unsigned long mask)
 {
     xGLXCopyContextReq *req;
@@ -469,7 +484,7 @@
     return reply.isDirect;
 }
 
-Bool glXIsDirect(Display *dpy, GLXContext gc)
+static Bool xf86DRIIsDirect(Display *dpy, GLXContext gc)
 {
     if (!gc) {
 	return GL_FALSE;
@@ -481,7 +496,7 @@
     return __glXIsDirect(dpy, gc->xid);
 }
 
-GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, Pixmap pixmap)
+static GLXPixmap xf86DRICreateGLXPixmap(Display *dpy, XVisualInfo *vis, Pixmap pixmap)
 {
     xGLXCreateGLXPixmapReq *req;
     GLXPixmap xid;
@@ -509,7 +524,7 @@
 /*
 ** Destroy the named pixmap
 */
-void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap)
+static void xf86DRIDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap)
 {
     xGLXDestroyGLXPixmapReq *req;
     CARD8 opcode;
@@ -529,7 +544,7 @@
     SyncHandle();
 }
 
-void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
+static void xf86DRISwapBuffers(Display *dpy, GLXDrawable drawable)
 {
     xGLXSwapBuffersReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -601,7 +616,7 @@
 ** Return configuration information for the given display, screen and
 ** visual combination.
 */
-int glXGetConfig(Display *dpy, XVisualInfo *vis, int attribute,
+static int xf86DRIGetConfig(Display *dpy, XVisualInfo *vis, int attribute,
 		 int *value_return)
 {
     __GLXvisualConfig *pConfig;
@@ -813,7 +828,7 @@
 
 /* Fetch a configuration value */
 #define __GLX_GCONF(attrib)				    \
-    if (glXGetConfig(dpy, thisVis, attrib, &val)) { 	    \
+    if (xf86DRIGetConfig(dpy, thisVis, attrib, &val)) { 	    \
 	XFree((char *)visualList);			    \
 	return NULL;					    \
     }
@@ -823,7 +838,7 @@
 ** Return the visual that best matches the template.  Return None if no
 ** visual matches the template.
 */
-XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList)
+static XVisualInfo *xf86DRIChooseVisual(Display *dpy, int screen, int *attribList)
 {
     XVisualInfo visualTemplate;
     XVisualInfo *visualList;
@@ -1244,7 +1259,7 @@
    return combo_string;
 }
 
-const char *glXQueryExtensionsString( Display *dpy, int screen )
+static const char *xf86DRIQueryExtensionsString( Display *dpy, int screen )
 {
     __GLXvisualConfig *pConfig;
     __GLXscreenConfigs *psc;
@@ -1282,7 +1297,7 @@
     return psc->effectiveGLXexts;
 }
 
-const char *glXGetClientString( Display *dpy, int name )
+static const char *xf86DRIGetClientString( Display *dpy, int name )
 {
     switch(name) {
 	case GLX_VENDOR:
@@ -1296,7 +1311,7 @@
     }
 }
 
-const char *glXQueryServerString( Display *dpy, int screen, int name )
+static const char *xf86DRIQueryServerString( Display *dpy, int screen, int name )
 {
     __GLXvisualConfig *pConfig;
     __GLXscreenConfigs *psc;
@@ -1378,7 +1393,7 @@
 */
 /************************************************************************/
 
-Display *glXGetCurrentDisplay(void)
+static Display *xf86DRIGetCurrentDisplay(void)
 {
     GLXContext gc = __glXGetCurrentContext();
     if (NULL == gc) return NULL;
@@ -1452,7 +1467,7 @@
     return Success;
 }
 
-int glXQueryContextInfoEXT(Display *dpy, GLXContext ctx, 
+static int xf86DRIQueryContextInfoEXT(Display *dpy, GLXContext ctx, 
 				int attribute, int *value)
 {
     int retVal;
@@ -1478,12 +1493,12 @@
     return Success;
 }
 
-GLXContextID glXGetContextIDEXT(const GLXContext ctx)
+static GLXContextID xf86DRIGetContextIDEXT(const GLXContext ctx)
 {
     return ctx->xid;
 }
 
-GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID)
+static GLXContext xf86DRIImportContextEXT(Display *dpy, GLXContextID contextID)
 {
     GLXContext ctx;
 
@@ -1503,7 +1518,7 @@
     return ctx;
 }
 
-void glXFreeContextEXT(Display *dpy, GLXContext ctx)
+static void xf86DRIFreeContextEXT(Display *dpy, GLXContext ctx)
 {
     DestroyContext(dpy, ctx);
 }
@@ -1514,7 +1529,7 @@
  * GLX 1.3 functions - these are just stubs for now!
  */
 
-GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
+static GLXFBConfig *xf86DRIChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
 {
     (void) dpy;
     (void) screen;
@@ -1524,7 +1539,7 @@
 }
 
 
-GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
+static GLXContext xf86DRICreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
 {
     (void) dpy;
     (void) config;
@@ -1535,7 +1550,7 @@
 }
 
 
-GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
+static GLXPbuffer xf86DRICreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
 {
     (void) dpy;
     (void) config;
@@ -1544,7 +1559,7 @@
 }
 
 
-GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
+static GLXPixmap xf86DRICreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
 {
     (void) dpy;
     (void) config;
@@ -1554,7 +1569,7 @@
 }
 
 
-GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
+static GLXWindow xf86DRICreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
 {
     (void) dpy;
     (void) config;
@@ -1564,34 +1579,34 @@
 }
 
 
-void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
+static void xf86DRIDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
 {
     (void) dpy;
     (void) pbuf;
 }
 
 
-void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
+static void xf86DRIDestroyPixmap(Display *dpy, GLXPixmap pixmap)
 {
     (void) dpy;
     (void) pixmap;
 }
 
 
-void glXDestroyWindow(Display *dpy, GLXWindow window)
+static void xf86DRIDestroyWindow(Display *dpy, GLXWindow window)
 {
     (void) dpy;
     (void) window;
 }
 
 
-GLXDrawable glXGetCurrentReadDrawable(void)
+static GLXDrawable xf86DRIGetCurrentReadDrawable(void)
 {
     return 0;
 }
 
 
-GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements)
+static GLXFBConfig *xf86DRIGetFBConfigs(Display *dpy, int screen, int *nelements)
 {
    (void) dpy;
    (void) screen;
@@ -1600,7 +1615,7 @@
 }
 
 
-int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
+static int xf86DRIGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
 {
     (void) dpy;
     (void) config;
@@ -1610,7 +1625,7 @@
 }
 
 
-void glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
+static void xf86DRIGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
 {
     (void) dpy;
     (void) drawable;
@@ -1618,7 +1633,7 @@
 }
 
 
-XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
+static XVisualInfo *xf86DRIGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
 {
     (void) dpy;
     (void) config;
@@ -1626,7 +1641,7 @@
 }
 
 
-Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
+static Bool xf86DRIMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
 {
     (void) dpy;
     (void) draw;
@@ -1636,7 +1651,7 @@
 }
 
 
-int glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
+static int xf86DRIQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
 {
     (void) dpy;
     (void) ctx;
@@ -1646,7 +1661,7 @@
 }
 
 
-void glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
+static void xf86DRIQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
 {
     (void) dpy;
     (void) draw;
@@ -1655,7 +1670,7 @@
 }
 
 
-void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
+static void xf86DRISelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
 {
     (void) dpy;
     (void) drawable;
@@ -1668,7 +1683,7 @@
 ** Mesa extension stubs.  These will help reduce portability problems.
 */
 
-void glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
+static void xf86DRIReleaseBuffersMESA( Display *dpy, GLXDrawable d )
 {
    (void) dpy;
    (void) d;
@@ -1676,7 +1691,7 @@
 }
 
 
-GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
+static GLXPixmap xf86DRICreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
                                   Pixmap pixmap, Colormap cmap )
 {
    (void) dpy;
@@ -1687,7 +1702,7 @@
 }
 
 
-void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
+static void xf86DRICopySubBufferMESA( Display *dpy, GLXDrawable drawable,
                            int x, int y, int width, int height )
 {
    (void) dpy;
@@ -1699,7 +1714,7 @@
 }
 
 
-GLboolean glXSet3DfxModeMESA( GLint mode )
+static GLboolean xf86DRISet3DfxModeMESA( GLint mode )
 {
    (void) mode;
    return GL_FALSE;
@@ -1707,101 +1722,105 @@
 
 
 /*
-** glXGetProcAddress support
+** GLX_SGI_video_sync
 */
 
-struct name_address_pair {
-   const char *Name;
-   GLvoid *Address;
-};
-
-static struct name_address_pair GLX_functions[] = {
-   { "glXChooseVisual", (GLvoid *) glXChooseVisual },
-   { "glXCopyContext", (GLvoid *) glXCopyContext },
-   { "glXCreateContext", (GLvoid *) glXCreateContext },
-   { "glXCreateGLXPixmap", (GLvoid *) glXCreateGLXPixmap },
-   { "glXDestroyContext", (GLvoid *) glXDestroyContext },
-   { "glXDestroyGLXPixmap", (GLvoid *) glXDestroyGLXPixmap },
-   { "glXGetConfig", (GLvoid *) glXGetConfig },
-   { "glXGetCurrentContext", (GLvoid *) glXGetCurrentContext },
-   { "glXGetCurrentDrawable", (GLvoid *) glXGetCurrentDrawable },
-   { "glXIsDirect", (GLvoid *) glXIsDirect },
-   { "glXMakeCurrent", (GLvoid *) glXMakeCurrent },
-   { "glXQueryExtension", (GLvoid *) glXQueryExtension },
-   { "glXQueryVersion", (GLvoid *) glXQueryVersion },
-   { "glXSwapBuffers", (GLvoid *) glXSwapBuffers },
-   { "glXUseXFont", (GLvoid *) glXUseXFont },
-   { "glXWaitGL", (GLvoid *) glXWaitGL },
-   { "glXWaitX", (GLvoid *) glXWaitX },
-
-   { "glXGetClientString", (GLvoid *) glXGetClientString },
-   { "glXQueryExtensionsString", (GLvoid *) glXQueryExtensionsString },
-   { "glXQueryServerString", (GLvoid *) glXQueryServerString },
-
-   { "glXGetCurrentDisplay", (GLvoid *) glXGetCurrentDisplay },
-
-   { "glXChooseFBConfig", (GLvoid *) glXChooseFBConfig },
-   { "glXCreateNewContext", (GLvoid *) glXCreateNewContext },
-   { "glXCreatePbuffer", (GLvoid *) glXCreatePbuffer },
-   { "glXCreatePixmap", (GLvoid *) glXCreatePixmap },
-   { "glXCreateWindow", (GLvoid *) glXCreateWindow },
-   { "glXDestroyPbuffer", (GLvoid *) glXDestroyPbuffer },
-   { "glXDestroyPixmap", (GLvoid *) glXDestroyPixmap },
-   { "glXDestroyWindow", (GLvoid *) glXDestroyWindow },
-   { "glXGetCurrentReadDrawable", (GLvoid *) glXGetCurrentReadDrawable },
-   { "glXGetFBConfigAttrib", (GLvoid *) glXGetFBConfigAttrib },
-   { "glXGetFBConfigs", (GLvoid *) glXGetFBConfigs },
-   { "glXGetSelectedEvent", (GLvoid *) glXGetSelectedEvent },
-   { "glXGetVisualFromFBConfig", (GLvoid *) glXGetVisualFromFBConfig },
-   { "glXMakeContextCurrent", (GLvoid *) glXMakeContextCurrent },
-   { "glXQueryContext", (GLvoid *) glXQueryContext },
-   { "glXQueryDrawable", (GLvoid *) glXQueryDrawable },
-   { "glXSelectEvent", (GLvoid *) glXSelectEvent },
-
-   /* extension functions */
-   { "glXGetContextIDEXT", (GLvoid *) glXGetContextIDEXT },
-   { "glXGetCurrentDrawableEXT", (GLvoid *) glXGetCurrentDrawableEXT },
-   { "glXImportContextEXT", (GLvoid *) glXImportContextEXT },
-   { "glXFreeContextEXT", (GLvoid *) glXFreeContextEXT },
-   { "glXQueryContextInfoEXT", (GLvoid *) glXQueryContextInfoEXT },
-   { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB },
-
-   /* Mesa extensions */
-   { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA },
-   { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA },
-   { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA },
-   { "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA },
-
-   { NULL, NULL }   /* end of list */
-};
-
-
-static const GLvoid *
-get_glx_proc_address(const char *funcName)
-{
-   GLuint i;
-   for (i = 0; GLX_functions[i].Name; i++) {
-      if (strcmp(GLX_functions[i].Name, funcName) == 0)
-         return GLX_functions[i].Address;
-   }
-   return NULL;
+#ifdef GLX_SGI_video_sync
+
+static int xf86DRIGetVideoSyncSGI(unsigned int *count)
+{
+    return 0;
 }
 
+static int xf86DRIWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
+{
+    return 0;
+}
+
+#endif
 
-void (*glXGetProcAddressARB(const GLubyte *procName))()
+struct _glxapi_table *_dri_GetGLXDispatchTable(void)
 {
-   typedef void (*gl_function)();
-   gl_function f;
+   static struct _glxapi_table glx;
+ 
+   /* be sure our dispatch table size <= libGL's table */
+   {
+      int size = sizeof(struct _glxapi_table) / sizeof(void *);
+      (void) size;
+      assert(_glxapi_get_dispatch_table_size() >= size);
+    }
+
+   /* initialize the whole table to no-ops */
+   _glxapi_set_no_op_table(&glx);
+
+   /* now initialize the table with the functions I implement */
+   glx.ChooseVisual = xf86DRIChooseVisual;
+   glx.CopyContext = xf86DRICopyContext;
+   glx.CreateContext = xf86DRICreateContext;
+   glx.CreateGLXPixmap = xf86DRICreateGLXPixmap;
+   glx.DestroyContext = xf86DRIDestroyContext;
+   glx.DestroyGLXPixmap = xf86DRIDestroyGLXPixmap;
+   glx.GetConfig = xf86DRIGetConfig;
+   /*glx.GetCurrentContext = xf86DRIGetCurrentContext;*/
+   /*glx.GetCurrentDrawable = xf86DRIGetCurrentDrawable;*/
+   glx.IsDirect = xf86DRIIsDirect;
+   glx.MakeCurrent = xf86DRIMakeCurrent;
+   glx.QueryExtension = xf86DRIQueryExtension;
+   glx.QueryVersion = xf86DRIQueryVersion;
+   glx.SwapBuffers = xf86DRISwapBuffers;
+   glx.UseXFont = xf86DRIUseXFont;
+   glx.WaitGL = xf86DRIWaitGL;
+   glx.WaitX = xf86DRIWaitX;
+
+#ifdef GLX_VERSION_1_1
+   glx.GetClientString = xf86DRIGetClientString;
+   glx.QueryExtensionsString = xf86DRIQueryExtensionsString;
+   glx.QueryServerString = xf86DRIQueryServerString;
+#endif
 
-#if defined(GLX_DIRECT_RENDERING)
-   __glXRegisterExtensions();
+#ifdef GLX_VERSION_1_2
+   /*glx.GetCurrentDisplay = xf86DRIGetCurrentDisplay;*/
 #endif
 
-   f = (gl_function) get_glx_proc_address((const char *) procName);
-   if (f) {
-      return f;
-   }
+#ifdef GLX_VERSION_1_3
+   glx.ChooseFBConfig = xf86DRIChooseFBConfig;
+   glx.CreateNewContext = xf86DRICreateNewContext;
+   glx.CreatePbuffer = xf86DRICreatePbuffer;
+   glx.CreatePixmap = xf86DRICreatePixmap;
+   glx.CreateWindow = xf86DRICreateWindow;
+   glx.DestroyPbuffer = xf86DRIDestroyPbuffer;
+   glx.DestroyPixmap = xf86DRIDestroyPixmap;
+   glx.DestroyWindow = xf86DRIDestroyWindow;
+   /*glx.GetCurrentReadDrawable = xf86DRIGetCurrentReadDrawable;*/
+   glx.GetFBConfigAttrib = xf86DRIGetFBConfigAttrib;
+   glx.GetSelectedEvent = xf86DRIGetSelectedEvent;
+   glx.GetVisualFromFBConfig = xf86DRIGetVisualFromFBConfig;
+   glx.MakeContextCurrent = xf86DRIMakeContextCurrent;
+   glx.QueryContext = xf86DRIQueryContext;
+   glx.QueryDrawable = xf86DRIQueryDrawable;
+   glx.SelectEvent = xf86DRISelectEvent;
+#endif
+
+#ifdef GLX_SGI_video_sync
+   glx.GetVideoSyncSGI = xf86DRIGetVideoSyncSGI;
+   glx.WaitVideoSyncSGI = xf86DRIWaitVideoSyncSGI;
+#endif
+
+#ifdef GLX_MESA_copy_sub_buffer
+   glx.CopySubBufferMESA = xf86DRICopySubBufferMESA;
+#endif
+
+#ifdef GLX_MESA_release_buffers
+   glx.ReleaseBuffersMESA = xf86DRIReleaseBuffersMESA;
+#endif
+
+#ifdef GLX_MESA_pixmap_colormap
+   glx.CreateGLXPixmapMESA = xf86DRICreateGLXPixmapMESA;
+#endif
+
+#ifdef GLX_MESA_set_3dfx_mode
+   glx.Set3DfxModeMESA = xf86DRISet3DfxModeMESA;
+#endif
 
-   f = (gl_function) _glapi_get_proc_address((const char *) procName);
-   return f;
+   return &glx;
 }
diff -urN Mesa-3.4~/src/DRI/glxext.c Mesa-3.4/src/DRI/glxext.c
--- Mesa-3.4~/src/DRI/glxext.c	Thu Dec  7 15:26:03 2000
+++ Mesa-3.4/src/DRI/glxext.c	Sat Jan  6 02:32:38 2001
@@ -29,16 +29,18 @@
  */
 
 #include "packrender.h"
-#include <Xext.h>
+#include <X11/extensions/Xext.h>
 #include <extutil.h>
 #include <assert.h>
 #include <stdio.h>
 #include "indirect_init.h"
 #include "glapi.h"
 #ifdef XTHREADS
-#include "Xthreads.h"
+#include <X11/Xthreads.h>
 #endif
 
+#define GLXContext __GLXcontext *
+
 #ifdef DEBUG
 void __glXDumpDrawBuffer(__GLXcontext *ctx);
 #endif
@@ -693,7 +695,7 @@
 
 /************************************************************************/
 
-GLXContext glXGetCurrentContext(void)
+GLXContext xf86DRIGetCurrentContext(void)
 {
     GLXContext cx = __glXGetCurrentContext();
     
@@ -704,16 +706,18 @@
     }
 }
 
-GLXDrawable glXGetCurrentDrawable(void)
+GLXDrawable xf86DRIGetCurrentDrawable(void)
 {
     GLXContext gc = __glXGetCurrentContext();
     return gc->currentDrawable;
 }
 
+#if 0
 GLXDrawable glXGetCurrentDrawableEXT(void)
 {
     return glXGetCurrentDrawable();
 }
+#endif
 
 /************************************************************************/
 
@@ -748,7 +752,7 @@
 ** Make a particular context current.
 ** NOTE: this is in this file so that it can access dummyContext.
 */
-Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
+Bool xf86DRIMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
 {
     xGLXMakeCurrentReq *req;
     xGLXMakeCurrentReply reply;
diff -urN Mesa-3.4~/src/DRI/glxext.c.orig Mesa-3.4/src/DRI/glxext.c.orig
--- Mesa-3.4~/src/DRI/glxext.c.orig	Wed Dec 31 19:00:00 1969
+++ Mesa-3.4/src/DRI/glxext.c.orig	Sat Jan  6 02:30:43 2001
@@ -0,0 +1,1017 @@
+/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.9 2000/12/07 20:26:03 dawes Exp $ */
+
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+*/
+
+/*
+ * Direct rendering support added by Precision Insight, Inc.
+ *
+ * Authors:
+ *   Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ */
+
+#include "packrender.h"
+#include <X11/extensions/Xext.h>
+#include <extutil.h>
+#include <assert.h>
+#include <stdio.h>
+#include "indirect_init.h"
+#include "glapi.h"
+#ifdef XTHREADS
+#include <X11/Xthreads.h>
+#endif
+
+#define GLXContext __GLXcontext *
+
+#ifdef DEBUG
+void __glXDumpDrawBuffer(__GLXcontext *ctx);
+#endif
+
+/*
+** We setup some dummy structures here so that the API can be used
+** even if no context is current.
+*/
+
+static GLubyte dummyBuffer[__GLX_BUFFER_LIMIT_SIZE];
+
+/*
+** Dummy context used by small commands when there is no current context.
+** All the
+** gl and glx entry points are designed to operate as nop's when using
+** the dummy context structure.
+*/
+static __GLXcontext dummyContext = {
+    &dummyBuffer[0],
+    &dummyBuffer[0],
+    &dummyBuffer[0],
+    &dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
+    sizeof(dummyBuffer),
+};
+
+
+/*
+** All indirect rendering contexts will share the same indirect dispatch table.
+*/
+static __GLapi *IndirectAPI = NULL;
+
+
+/*
+ * Current context management and locking
+ */
+
+#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
+
+/* thread safe */
+static GLboolean TSDinitialized = GL_FALSE;
+static xthread_key_t ContextTSD;
+
+__GLXcontext *__glXGetCurrentContext(void)
+{
+   if (!TSDinitialized) {
+      xthread_key_create(&ContextTSD, NULL);
+      TSDinitialized = GL_TRUE;
+      return &dummyContext;
+   }
+   else {
+      void *p;
+      xthread_get_specific(ContextTSD, &p);
+      if (!p)
+         return &dummyContext;
+      else
+         return (__GLXcontext *) p;
+   }
+}
+
+void __glXSetCurrentContext(__GLXcontext *c)
+{
+   if (!TSDinitialized) {
+      xthread_key_create(&ContextTSD, NULL);
+      TSDinitialized = GL_TRUE;
+   }
+   xthread_set_specific(ContextTSD, c);
+}
+
+
+/* Used by the __glXLock() and __glXUnlock() macros */
+xmutex_rec __glXmutex;
+xmutex_rec __glXSwapBuffersMutex;
+
+#else
+
+/* not thread safe */
+__GLXcontext *__glXcurrentContext = &dummyContext;
+
+#endif
+
+
+/*
+** You can set this cell to 1 to force the gl drawing stuff to be
+** one command per packet
+*/
+int __glXDebug = 0;
+
+/*
+** forward prototype declarations
+*/
+int __glXCloseDisplay(Display *dpy, XExtCodes *codes);
+
+/************************************************************************/
+
+/* Extension required boiler plate */
+
+static char *__glXExtensionName = GLX_EXTENSION_NAME;
+XExtensionInfo *__glXExtensionInfo = NULL;
+
+static /* const */ char *error_list[] = {
+    "GLXBadContext",
+    "GLXBadContextState",
+    "GLXBadDrawable",
+    "GLXBadPixmap",
+    "GLXBadContextTag",
+    "GLXBadCurrentWindow",
+    "GLXBadRenderRequest",
+    "GLXBadLargeRequest",
+    "GLXUnsupportedPrivateRequest",
+};
+
+int __glXCloseDisplay(Display *dpy, XExtCodes *codes)
+{
+  GLXContext gc;
+
+  gc = __glXGetCurrentContext();
+  if (dpy == gc->currentDpy) {
+    __glXSetCurrentContext(&dummyContext);
+#ifdef GLX_DIRECT_RENDERING
+    _glapi_set_dispatch(NULL);  /* no-op functions */
+#endif
+    __glXFreeContext(gc);
+  }
+
+  return XextRemoveDisplay(__glXExtensionInfo, dpy);
+}
+
+
+static XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
+				  __GLX_NUMBER_ERRORS, error_list)
+
+static /* const */ XExtensionHooks __glXExtensionHooks = {
+    NULL,				/* create_gc */
+    NULL,				/* copy_gc */
+    NULL,				/* flush_gc */
+    NULL,				/* free_gc */
+    NULL,				/* create_font */
+    NULL,				/* free_font */
+    __glXCloseDisplay,			/* close_display */
+    NULL,				/* wire_to_event */
+    NULL,				/* event_to_wire */
+    NULL,				/* error */
+    __glXErrorString,			/* error_string */
+};
+
+static
+XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
+			   __glXExtensionName, &__glXExtensionHooks,
+			   __GLX_NUMBER_EVENTS, NULL)
+
+/************************************************************************/
+
+/*
+** Free the per screen configs data as well as the array of
+** __glXScreenConfigs.
+*/
+static void FreeScreenConfigs(__GLXdisplayPrivate *priv)
+{
+    __GLXscreenConfigs *psc;
+    GLint i, screens;
+
+    /* Free screen configuration information */
+    psc = priv->screenConfigs;
+    screens = ScreenCount(priv->dpy);
+    for (i = 0; i < screens; i++, psc++) {
+	if (psc->configs) {
+	    Xfree((char*) psc->configs);
+	    if(psc->effectiveGLXexts)
+		Xfree(psc->effectiveGLXexts);
+	    psc->configs = 0;	/* NOTE: just for paranoia */
+	}
+
+#if 0 /* GLX_DIRECT_RENDERING */
+	/* Free the direct rendering per screen data */
+	if (psc->driScreen.private)
+	    (*psc->driScreen.destroyScreen)(priv->dpy, i,
+					    psc->driScreen.private);
+	psc->driScreen.private = NULL;
+#endif
+    }
+    XFree((char*) priv->screenConfigs);
+}
+
+/*
+** Release the private memory referred to in a display private
+** structure.  The caller will free the extension structure.
+*/
+static int __glXFreeDisplayPrivate(XExtData *extension)
+{
+    __GLXdisplayPrivate *priv;
+
+    priv = (__GLXdisplayPrivate*) extension->private_data;
+    FreeScreenConfigs(priv);
+    if(priv->serverGLXvendor) {
+	Xfree((char*)priv->serverGLXvendor);
+	priv->serverGLXvendor = 0x0; /* to protect against double free's */
+    }
+    if(priv->serverGLXversion) {
+	Xfree((char*)priv->serverGLXversion);
+	priv->serverGLXversion = 0x0; /* to protect against double free's */
+    }
+
+#if 0 /* GLX_DIRECT_RENDERING */
+    /* Free the direct rendering per display data */
+    if (priv->driDisplay.private)
+	(*priv->driDisplay.destroyDisplay)(priv->dpy,
+					   priv->driDisplay.private);
+    priv->driDisplay.private = NULL;
+#endif
+
+#ifdef GLX_DIRECT_RENDERING
+    XFree(priv->driDisplay.createScreen);
+#endif
+
+    Xfree((char*) priv);
+    return 0;
+}
+
+/************************************************************************/
+
+/*
+** Query the version of the GLX extension.  This procedure works even if
+** the client extension is not completely set up.
+*/
+static Bool QueryVersion(Display *dpy, int opcode, int *major, int *minor)
+{
+    xGLXQueryVersionReq *req;
+    xGLXQueryVersionReply reply;
+
+    /* Send the glXQueryVersion request */
+    LockDisplay(dpy);
+    GetReq(GLXQueryVersion,req);
+    req->reqType = opcode;
+    req->glxCode = X_GLXQueryVersion;
+    req->majorVersion = GLX_MAJOR_VERSION;
+    req->minorVersion = GLX_MINOR_VERSION;
+    _XReply(dpy, (xReply*) &reply, 0, False);
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    if (reply.majorVersion != GLX_MAJOR_VERSION) {
+	/*
+	** The server does not support the same major release as this
+	** client.
+	*/
+	return GL_FALSE;
+    }
+    *major = reply.majorVersion;
+    *minor = min(reply.minorVersion, GLX_MINOR_VERSION);
+    return GL_TRUE;
+}
+
+/*
+** Allocate the memory for the per screen configs for each screen.
+** If that works then fetch the per screen configs data.
+*/
+static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
+{
+    xGLXGetVisualConfigsReq *req;
+    xGLXGetVisualConfigsReply reply;
+    __GLXscreenConfigs *psc;
+    __GLXvisualConfig *config;
+    GLint i, j, k, nprops, screens;
+    INT32 buf[__GLX_TOTAL_CONFIG], *props;
+
+    /*
+    ** First allocate memory for the array of per screen configs.
+    */
+    screens = ScreenCount(dpy);
+    psc = (__GLXscreenConfigs*) Xmalloc(screens * sizeof(__GLXscreenConfigs));
+    if (!psc) {
+	return GL_FALSE;
+    }
+    memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
+    priv->screenConfigs = psc;
+    
+    /*
+    ** Now fetch each screens configs structures.  If a screen supports
+    ** GL (by returning a numVisuals > 0) then allocate memory for our
+    ** config structure and then fill it in.
+    */
+    for (i = 0; i < screens; i++, psc++) {
+	/* Send the glXGetVisualConfigs request */
+	LockDisplay(dpy);
+	GetReq(GLXGetVisualConfigs,req);
+	req->reqType = priv->majorOpcode;
+	req->glxCode = X_GLXGetVisualConfigs;
+	req->screen = i;
+	if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+	    /* Something is busted. Punt. */
+	    UnlockDisplay(dpy);
+	    FreeScreenConfigs(priv);
+	    return GL_FALSE;
+	}
+	UnlockDisplay(dpy);
+	if (!reply.numVisuals) {
+	    /* This screen does not support GL rendering */
+	    continue;
+	}
+
+	/* Check number of properties */
+	nprops = reply.numProps;
+	if ((nprops < __GLX_MIN_CONFIG_PROPS) ||
+	    (nprops > __GLX_MAX_CONFIG_PROPS)) {
+	    /* Huh?  Not in protocol defined limits.  Punt */
+	    FreeScreenConfigs(priv);
+	    return GL_FALSE;
+	}
+
+	/* Allocate memory for our config structure */
+	psc->configs = (__GLXvisualConfig*)
+	    Xmalloc(reply.numVisuals * sizeof(__GLXvisualConfig));
+	psc->numConfigs = reply.numVisuals;
+	if (!psc->configs) {
+	    FreeScreenConfigs(priv);
+	    return GL_FALSE;
+	}
+	/* Allocate memory for the properties, if needed */
+	if (nprops <= __GLX_MIN_CONFIG_PROPS) {
+	    props = buf;
+	} else {
+	    props = (INT32 *) Xmalloc(nprops * __GLX_SIZE_INT32);
+	} 
+
+	/* Read each config structure and convert it into our format */
+	config = psc->configs;
+	for (j = 0; j < reply.numVisuals; j++, config++) {
+	    INT32 *bp = props;
+
+	    _XRead(dpy, (char *)bp, nprops * __GLX_SIZE_INT32);
+
+	    /* Copy in the first set of properties */
+	    config->vid = *bp++;
+	    config->class = *bp++;
+	    config->rgba = *bp++;
+
+	    config->redSize = *bp++;
+	    config->greenSize = *bp++;
+	    config->blueSize = *bp++;
+	    config->alphaSize = *bp++;
+	    config->accumRedSize = *bp++;
+	    config->accumGreenSize = *bp++;
+	    config->accumBlueSize = *bp++;
+	    config->accumAlphaSize = *bp++;
+
+	    config->doubleBuffer = *bp++;
+	    config->stereo = *bp++;
+
+	    config->bufferSize = *bp++;
+	    config->depthSize = *bp++;
+	    config->stencilSize = *bp++;
+	    config->auxBuffers = *bp++;
+	    config->level = *bp++;
+
+	    /*
+	    ** Additional properties may be in a list at the end
+	    ** of the reply.  They are in pairs of property type
+	    ** and property value.
+	    */
+	    config->visualRating = GLX_NONE_EXT;
+	    config->transparentPixel = GL_FALSE;
+
+	    for (k = __GLX_MIN_CONFIG_PROPS; k < nprops; k+=2) {
+		switch(*bp++) {
+		  case GLX_VISUAL_CAVEAT_EXT:
+		    config->visualRating = *bp++;    
+		    break;
+		  case GLX_TRANSPARENT_TYPE_EXT:
+		    config->transparentPixel = *bp++;    
+		    break;
+		  case GLX_TRANSPARENT_INDEX_VALUE_EXT:
+		    config->transparentIndex = *bp++;    
+		    break;
+		  case GLX_TRANSPARENT_RED_VALUE_EXT:
+		    config->transparentRed = *bp++;    
+		    break;
+		  case GLX_TRANSPARENT_GREEN_VALUE_EXT:
+		    config->transparentGreen = *bp++;    
+		    break;
+		  case GLX_TRANSPARENT_BLUE_VALUE_EXT:
+		    config->transparentBlue = *bp++;    
+		    break;
+		  case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
+		    config->transparentAlpha = *bp++;    
+		    break;
+		}
+	    }
+	}
+	if (props != buf) {
+	    Xfree((char *)props);
+	}
+
+#ifdef GLX_DIRECT_RENDERING
+	/* Initialize the direct rendering per screen data and functions */
+	if (priv->driDisplay.private)
+	    psc->driScreen.private =
+		(*priv->driDisplay.createScreen)(dpy, i, &psc->driScreen,
+						 psc->numConfigs,
+						 psc->configs);
+#endif
+    }
+    SyncHandle();
+    return GL_TRUE;
+}
+
+/*
+** Initialize the client side extension code.
+*/
+__GLXdisplayPrivate *__glXInitialize(Display* dpy)
+{
+    XExtDisplayInfo *info = __glXFindDisplay(dpy);
+    XExtData **privList, *private, *found;
+    __GLXdisplayPrivate *dpyPriv;
+    XEDataObject dataObj;
+    int major, minor;
+
+#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
+    {
+        static int firstCall = 1;
+        if (firstCall) {
+            /* initialize the GLX mutexes */
+            xmutex_init(&__glXmutex);
+            xmutex_init(&__glXSwapBuffersMutex);
+            firstCall = 0;
+        }
+    }
+#endif
+
+    /* The one and only long long lock */
+    __glXLock();
+
+    if (!XextHasExtension(info)) {
+	/* No GLX extension supported by this server. Oh well. */
+	__glXUnlock();
+	XMissingExtension(dpy, __glXExtensionName);
+	return 0;
+    }
+
+    /* See if a display private already exists.  If so, return it */
+    dataObj.display = dpy;
+    privList = XEHeadOfExtensionList(dataObj);
+    found = XFindOnExtensionList(privList, info->codes->extension);
+    if (found) {
+	__glXUnlock();
+	return (__GLXdisplayPrivate *) found->private_data;
+    }
+
+    /* See if the versions are compatible */
+    if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) {
+	/* The client and server do not agree on versions.  Punt. */
+	__glXUnlock();
+	return 0;
+    }
+
+    /*
+    ** Allocate memory for all the pieces needed for this buffer.
+    */
+    private = (XExtData *) Xmalloc(sizeof(XExtData));
+    if (!private) {
+	__glXUnlock();
+	return 0;
+    }
+    dpyPriv = (__GLXdisplayPrivate *) Xmalloc(sizeof(__GLXdisplayPrivate));
+    if (!dpyPriv) {
+	__glXUnlock();
+	Xfree((char*) private);
+	return 0;
+    }
+
+    /*
+    ** Init the display private and then read in the screen config
+    ** structures from the server.
+    */
+    dpyPriv->majorOpcode = info->codes->major_opcode;
+    dpyPriv->majorVersion = major;
+    dpyPriv->minorVersion = minor;
+    dpyPriv->dpy = dpy;
+
+    dpyPriv->serverGLXvendor = 0x0; 
+    dpyPriv->serverGLXversion = 0x0;
+
+#ifdef GLX_DIRECT_RENDERING
+    /*
+    ** Initialize the direct rendering per display data and functions.
+    ** Note: This _must_ be done before calling any other DRI routines
+    ** (e.g., those called in AllocAndFetchScreenConfigs).
+    */
+    if (getenv("LIBGL_ALWAYS_INDIRECT")) {
+        /* Assinging zero here assures we'll never go direct */
+        dpyPriv->driDisplay.private = 0;
+        dpyPriv->driDisplay.destroyDisplay = 0;
+        dpyPriv->driDisplay.createScreen = 0;
+    }
+    else {
+        dpyPriv->driDisplay.private =
+            driCreateDisplay(dpy, &dpyPriv->driDisplay);
+    }
+#endif
+
+    if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
+	__glXUnlock();
+	Xfree((char*) dpyPriv);
+	Xfree((char*) private);
+	return 0;
+    }
+
+    /*
+    ** Fill in the private structure.  This is the actual structure that
+    ** hangs off of the Display structure.  Our private structure is
+    ** referred to by this structure.  Got that?
+    */
+    private->number = info->codes->extension;
+    private->next = 0;
+    private->free_private = __glXFreeDisplayPrivate;
+    private->private_data = (char *) dpyPriv;
+    XAddToExtensionList(privList, private);
+
+    if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) {
+#if 0
+        __glXClientInfo(dpy, dpyPriv->majorOpcode);
+#endif
+    }
+    __glXUnlock();
+
+    return dpyPriv;
+}
+
+/*
+** Setup for sending a GLX command on dpy.  Make sure the extension is
+** initialized.  Try to avoid calling __glXInitialize as its kinda slow.
+*/
+CARD8 __glXSetupForCommand(Display *dpy)
+{
+    GLXContext gc;
+    __GLXdisplayPrivate *priv;
+
+    /* If this thread has a current context, flush its rendering commands */
+    gc = __glXGetCurrentContext();
+    if (gc->currentDpy) {
+	/* Flush rendering buffer of the current context, if any */
+	(void) __glXFlushRenderBuffer(gc, gc->pc);
+
+	if (gc->currentDpy == dpy) {
+	    /* Use opcode from gc because its right */
+	    return gc->majorOpcode;
+	} else {
+	    /*
+	    ** Have to get info about argument dpy because it might be to
+	    ** a different server
+	    */
+	}
+    }
+
+    /* Forced to lookup extension via the slow initialize route */
+    priv = __glXInitialize(dpy);
+    if (!priv) {
+	return 0;
+    }
+    return priv->majorOpcode;
+}
+
+/*
+** Flush the drawing command transport buffer.
+*/
+GLubyte *__glXFlushRenderBuffer(__GLXcontext *ctx, GLubyte *pc)
+{
+    Display *dpy;
+    xGLXRenderReq *req;
+    GLint size;
+
+    if (!(dpy = ctx->currentDpy)) {
+	/* Using the dummy context */
+	ctx->pc = ctx->buf;
+	return ctx->pc;
+    }
+
+    size = pc - ctx->buf;
+    if (size) {
+	/* Send the entire buffer as an X request */
+	LockDisplay(dpy);
+	GetReq(GLXRender,req); 
+	req->reqType = ctx->majorOpcode;
+	req->glxCode = X_GLXRender; 
+	req->contextTag = ctx->currentContextTag;
+	req->length += (size + 3) >> 2;
+	_XSend(dpy, (char *)ctx->buf, size);
+	UnlockDisplay(dpy);
+	SyncHandle();
+    }
+
+    /* Reset pointer and return it */
+    ctx->pc = ctx->buf;
+    return ctx->pc;
+}
+
+/*
+** Send a large command, one that is too large for some reason to
+** send using the GLXRender protocol request.  One reason to send
+** a large command is to avoid copying the data.
+*/
+void __glXSendLargeCommand(__GLXcontext *ctx,
+			   const GLvoid *header, GLint headerLen,
+			   const GLvoid *data, GLint dataLen)
+{
+    Display *dpy = ctx->currentDpy;
+    xGLXRenderLargeReq *req;
+    GLint maxSize, amount;
+    GLint totalRequests, requestNumber;
+
+    maxSize = ctx->bufSize - sizeof(xGLXRenderLargeReq);
+    totalRequests = 1 + (dataLen / maxSize);
+    if (dataLen % maxSize) totalRequests++;
+
+    /*
+    ** Send all of the command, except the large array, as one request.
+    */
+    LockDisplay(dpy);
+    GetReq(GLXRenderLarge,req); 
+    req->reqType = ctx->majorOpcode;
+    req->glxCode = X_GLXRenderLarge; 
+    req->contextTag = ctx->currentContextTag;
+    req->length += (headerLen + 3) >> 2;
+    req->requestNumber = 1;
+    req->requestTotal = totalRequests;
+    req->dataBytes = headerLen;
+    Data(dpy, (const void *)header, headerLen);
+
+    /*
+    ** Send enough requests until the whole array is sent.
+    */
+    requestNumber = 2;
+    while (dataLen > 0) {
+	amount = dataLen;
+	if (amount > maxSize) {
+	    amount = maxSize;
+	}
+	GetReq(GLXRenderLarge,req); 
+	req->reqType = ctx->majorOpcode;
+	req->glxCode = X_GLXRenderLarge; 
+	req->contextTag = ctx->currentContextTag;
+	req->length += (amount + 3) >> 2;
+	req->requestNumber = requestNumber++;
+	req->requestTotal = totalRequests;
+	req->dataBytes = amount;
+	Data(dpy, (const void *)data, amount);
+	dataLen -= amount;
+	data = ((const char*) data) + amount;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+/************************************************************************/
+
+GLXContext glXGetCurrentContext(void)
+{
+    GLXContext cx = __glXGetCurrentContext();
+    
+    if (cx == &dummyContext) {
+	return NULL;
+    } else {
+	return cx;
+    }
+}
+
+GLXDrawable glXGetCurrentDrawable(void)
+{
+    GLXContext gc = __glXGetCurrentContext();
+    return gc->currentDrawable;
+}
+
+GLXDrawable glXGetCurrentDrawableEXT(void)
+{
+    return glXGetCurrentDrawable();
+}
+
+/************************************************************************/
+
+#ifdef GLX_DIRECT_RENDERING
+/* Return the DRI per screen structure */
+__DRIscreen *__glXFindDRIScreen(Display *dpy, int scrn)
+{
+    __DRIscreen *pDRIScreen = NULL;
+    XExtDisplayInfo *info = __glXFindDisplay(dpy);
+    XExtData **privList, *found;
+    __GLXdisplayPrivate *dpyPriv;
+    XEDataObject dataObj;
+
+    __glXLock();
+    dataObj.display = dpy;
+    privList = XEHeadOfExtensionList(dataObj);
+    found = XFindOnExtensionList(privList, info->codes->extension);
+    __glXUnlock();
+
+    if (found) {
+	dpyPriv = (__GLXdisplayPrivate *)found->private_data;
+	pDRIScreen = &dpyPriv->screenConfigs[scrn].driScreen;
+    }
+
+    return pDRIScreen;
+}
+#endif
+
+/************************************************************************/
+
+/*
+** Make a particular context current.
+** NOTE: this is in this file so that it can access dummyContext.
+*/
+Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
+{
+    xGLXMakeCurrentReq *req;
+    xGLXMakeCurrentReply reply;
+    GLXContext oldGC;
+    CARD8 opcode, oldOpcode;
+    Display *dpyTmp;
+    Bool sentRequestToOldDpy = False;
+    Bool bindReturnValue = True;
+
+    opcode = __glXSetupForCommand(dpy);
+    if (!opcode) {
+	return GL_FALSE;
+    }
+    /*
+    ** Make sure that the new context has a nonzero ID.  In the request,
+    ** a zero context ID is used only to mean that we bind to no current
+    ** context.
+    */
+    if ((gc != NULL) && (gc->xid == None)) {
+	return GL_FALSE;
+    }
+
+    oldGC = __glXGetCurrentContext();
+    if ((dpy != oldGC->currentDpy || (gc && gc->isDirect)) &&
+	!oldGC->isDirect && oldGC != &dummyContext) {
+	/*
+	** We are either switching from one dpy to another and have to
+	** send a request to the previous dpy to unbind the previous
+	** context, or we are switching away from a indirect context to
+	** a direct context and have to send a request to the dpy to
+	** unbind the previous context.
+	*/
+	sentRequestToOldDpy = True;
+	dpyTmp = dpy;
+
+	if (dpy != oldGC->currentDpy) {
+	    /*
+	    ** The GetReq macro uses "dpy", so we have to save and
+	    ** restore later.
+	    */
+	    dpy = oldGC->currentDpy;
+	    oldOpcode = __glXSetupForCommand(dpy);
+	    if (!oldOpcode) {
+		return GL_FALSE;
+	    }
+	} else {
+	    oldOpcode = opcode;
+	}
+	LockDisplay(dpy);
+	GetReq(GLXMakeCurrent,req);
+	req->reqType = oldOpcode;
+	req->glxCode = X_GLXMakeCurrent;
+	req->drawable = None;
+	req->context = None;
+	req->oldContextTag = oldGC->currentContextTag;
+	if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+	    /* The make current failed.  Just return GL_FALSE. */
+	    UnlockDisplay(dpy);
+	    SyncHandle();
+	    return GL_FALSE;
+	}
+	dpy = dpyTmp;
+	oldGC->currentContextTag = 0;
+    }
+    
+#ifdef GLX_DIRECT_RENDERING
+    /* Unbind the old direct rendering context */
+    if (oldGC->isDirect) {
+	if (oldGC->driContext.private) {
+	    int will_rebind = (gc && gc->isDirect
+			       && draw == oldGC->currentDrawable);
+	    if (!(*oldGC->driContext.unbindContext)(oldGC->currentDpy,
+						    oldGC->screen,
+						    oldGC->currentDrawable,
+						    oldGC,
+						    will_rebind)) {
+		/* The make current failed.  Just return GL_FALSE. */
+		return GL_FALSE;
+	    }
+	}
+	oldGC->currentContextTag = 0;
+    }
+
+    /* Bind the direct rendering context to the drawable */
+    if (gc && gc->isDirect) {
+	if (gc->driContext.private) {
+	    bindReturnValue =
+		(*gc->driContext.bindContext)(dpy, gc->screen, draw, gc);
+	}
+    } else {
+#endif
+        _glapi_check_multithread();
+	/* Send a glXMakeCurrent request to bind the new context. */
+	LockDisplay(dpy);
+	GetReq(GLXMakeCurrent,req);
+	req->reqType = opcode;
+	req->glxCode = X_GLXMakeCurrent;
+	req->drawable = draw;
+	req->context = gc ? gc->xid : None;
+	req->oldContextTag = oldGC->currentContextTag;
+	bindReturnValue = _XReply(dpy, (xReply*) &reply, 0, False);
+        UnlockDisplay(dpy);
+#ifdef GLX_DIRECT_RENDERING
+    }
+#endif
+
+
+    if (!bindReturnValue) {
+	/* The make current failed. */
+	if (!gc->isDirect) {
+	    SyncHandle();
+	}
+
+#ifdef GLX_DIRECT_RENDERING
+	/* If the old context was direct rendering, then re-bind to it. */
+	if (oldGC->isDirect) {
+	    if (oldGC->driContext.private) {
+		if (!(*oldGC->driContext.bindContext)(oldGC->currentDpy,
+						      oldGC->screen,
+						      oldGC->currentDrawable,
+						      oldGC)) {
+		    /*
+		    ** The request failed; this cannot happen with the
+		    ** current API.  If in the future the API is
+		    ** extended to allow context sharing between
+		    ** clients, then this may fail (because another
+		    ** client may have grabbed the context); in that
+		    ** case, we cannot undo the previous request, and
+		    ** cannot adhere to the "no-op" behavior.
+		    */
+		}
+	    }
+	} else
+#endif
+	/*
+	** If we had just sent a request to a previous dpy, we have to
+	** undo that request (because if a command fails, it should act
+	** like a no-op) by making current to the previous context and
+	** drawable.
+	*/
+	if (sentRequestToOldDpy) {
+	    if (dpy != oldGC->currentDpy) {
+		dpy = oldGC->currentDpy;
+		oldOpcode = __glXSetupForCommand(dpy);
+	    } else {
+		oldOpcode = opcode;
+	    }
+	    LockDisplay(dpy);
+	    GetReq(GLXMakeCurrent,req);
+	    req->reqType = oldOpcode;
+	    req->glxCode = X_GLXMakeCurrent;
+	    req->drawable = oldGC->currentDrawable;
+	    req->context = oldGC->xid;
+	    req->oldContextTag = 0;
+	    if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+		UnlockDisplay(dpy);
+		SyncHandle();
+		/*
+		** The request failed; this cannot happen with the
+		** current API.  If in the future the API is extended to
+		** allow context sharing between clients, then this may
+		** fail (because another client may have grabbed the
+		** context); in that case, we cannot undo the previous
+		** request, and cannot adhere to the "no-op" behavior.
+		*/
+	    }
+            else {
+		UnlockDisplay(dpy);
+            }
+	    oldGC->currentContextTag = reply.contextTag;
+	}
+	return GL_FALSE;
+    }
+
+    /* Update our notion of what is current */
+    __glXLock();
+    if (gc == oldGC) {
+	/*
+	** Even though the contexts are the same the drawable might have
+	** changed.  Note that gc cannot be the dummy, and that oldGC
+	** cannot be NULL, therefore if they are the same, gc is not
+	** NULL and not the dummy.
+	*/
+	gc->currentDrawable = draw;
+    } else {
+	if (oldGC != &dummyContext) {
+	    /* Old current context is no longer current to anybody */
+	    oldGC->currentDpy = 0;
+	    oldGC->currentDrawable = None;
+	    oldGC->currentContextTag = 0;
+
+	    if (oldGC
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2008 Oliver Maruhn