merge the (rest of) texmem branch
[mesa.git] / src / glx / x11 / glxcmds.c
index b9fa4eeb4516de02e13b16a05be61498963cb1cf..9d1bb2a0b55db2d5eaf68484ba2fe4ba655eadba 100644 (file)
 
 #include <inttypes.h>
 #include "glxclient.h"
-#include <extutil.h>
-#include <Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xext.h>
 #include <assert.h>
 #include <string.h>
 #include "glapi.h"
 #ifdef GLX_DIRECT_RENDERING
 #include "indirect_init.h"
-#include "xf86vmode.h"
+#include <X11/extensions/xf86vmode.h>
+#include "xf86dri.h"
 #endif
 #include "glxextensions.h"
 #include "glcontextmodes.h"
 #include "glheader.h"
 #include <sys/time.h>
 
-#ifdef IN_DOXYGEN
-#define GLX_PREFIX(x) x
-#endif /* IN_DOXYGEN */
-
 static const char __glXGLXClientVendorName[] = "SGI";
 static const char __glXGLXClientVersion[] = "1.4";
 
 
-#if defined(GLX_DIRECT_RENDERING)
-#include "xf86dri.h"
-
-static Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
-
-static void * DriverCreateContextWrapper( const __GLXscreenConfigs *psc,
-    Display *dpy, XVisualInfo *vis, void *shared, __DRIcontext *ctx,
-    const __GLcontextModes *fbconfig, int render_type );
-
-#ifndef DRI_NEW_INTERFACE_ONLY
-static Bool dummyBindContext2( Display *dpy, int scrn,
-    GLXDrawable draw, GLXDrawable read, GLXContext gc );
-
-static Bool dummyUnbindContext2( Display *dpy, int scrn,
-    GLXDrawable draw, GLXDrawable read, GLXContext gc );
-
-/****************************************************************************/
-
-/**
- * Used as glue when a driver does not support
- * \c __DRIcontextRec::bindContext2.
- * 
- * XXX .bindContext is only defined as a function pointer if
- * !DRI_NEW_INTERFACE_ONLY.
- *
- * \sa DriverCreateContextWrapper, __DRIcontextRec::bindContext2
- */
-static Bool dummyBindContext2( Display *dpy, int scrn,
-                              GLXDrawable draw, GLXDrawable read,
-                              GLXContext gc )
-{
-    assert( draw == read );
-    return (*gc->driContext.bindContext)( dpy, scrn, draw, gc );
-}
-
-/**
- * Used as glue when a driver does not support
- * \c __DRIcontextRec::unbindContext2.
- * 
- * XXX .unbindContext is only defined as a function pointer if
- * !DRI_NEW_INTERFACE_ONLY.
- *
- * \sa DriverCreateContextWrapper, __DRIcontextRec::unbindContext2
- */
-static Bool dummyUnbindContext2( Display *dpy, int scrn,
-                                GLXDrawable draw, GLXDrawable read,
-                                GLXContext gc )
-{
-    assert( draw == read );
-    return (*gc->driContext.unbindContext)( dpy, scrn, draw, gc, GL_FALSE );
-}
-#endif /* DRI_NEW_INTERFACE_ONLY */
-
-
-/****************************************************************************/
-/**
- * Wrap the call to the driver's \c createContext function.
- *
- * The \c createContext function is wrapped because not all drivers support
- * the "new" \c unbindContext2 and \c bindContext2 interfaces.  libGL should
- * not have to check to see which functions the driver supports.  Instead,
- * if either function is not supported it is wrapped.  The wrappers test to
- * make sure that both drawables are the same and pass control to the old
- * interface.
- *
- * \sa dummyBindContext2, dummyUnbindContext2,
- *      __DRIcontextRec::bindContext2, __DRIcontextRec::unbindContext2
- */
-
-static void * DriverCreateContextWrapper( const __GLXscreenConfigs *psc,
-                                         Display *dpy, XVisualInfo *vis,
-                                         void *shared,
-                                         __DRIcontext *ctx,
-                                         const __GLcontextModes *modes,
-                                         int render_type )
-{
-    void * ctx_priv = NULL;
-
-    if ( psc->driScreen.createNewContext != NULL ) {
-       assert( modes != NULL );
-       ctx_priv = (*psc->driScreen.createNewContext)(dpy, modes, render_type,
-                                                     shared, ctx);
-
-       /* If the driver supports the createNewContext interface, then 
-        * it MUST also support either the bindContext2 / unbindContext2
-        * interface or the bindContext3 / unbindContext3 interface.
-        */
-
-       assert( (ctx_priv == NULL) || (ctx->unbindContext2 != NULL)
-               || (ctx->unbindContext3 != NULL) );
-       assert( (ctx_priv == NULL) || (ctx->bindContext2 != NULL)
-               || (ctx->bindContext3 != NULL) );
-    }
-#ifndef DRI_NEW_INTERFACE_ONLY
-    else {
-       if ( vis != NULL ) {
-           ctx_priv = (*psc->driScreen.createContext)(dpy, vis, shared, ctx);
-
-           if ( ctx_priv != NULL ) {
-               if ( ctx->unbindContext2 == NULL ) {
-                   ctx->unbindContext2 = dummyUnbindContext2;
-               }
-
-               if ( ctx->bindContext2 == NULL ) {
-                   ctx->bindContext2 = dummyBindContext2;
-               }
-           }
-       }
-    }
-#endif
-
-    return ctx_priv;
-}
-#endif
-
-
 /****************************************************************************/
 /**
  * Get the __DRIdrawable for the drawable associated with a GLXContext
@@ -469,10 +350,10 @@ CreateContext(Display *dpy, XVisualInfo *vis,
            if (psc && psc->driScreen.private) {
                void * const shared = (shareList != NULL)
                    ? shareList->driContext.private : NULL;
-               gc->driContext.private =
-                   DriverCreateContextWrapper( psc, dpy, vis, shared,
-                                               &gc->driContext, mode,
-                                               renderType );
+               gc->driContext.private = 
+                 (*psc->driScreen.createNewContext)( dpy, mode, renderType,
+                                                     shared,
+                                                     &gc->driContext );
                if (gc->driContext.private) {
                    gc->isDirect = GL_TRUE;
                    gc->screen = mode->screen;
@@ -543,9 +424,8 @@ CreateContext(Display *dpy, XVisualInfo *vis,
     return gc;
 }
 
-PUBLIC GLXContext GLX_PREFIX(glXCreateContext)(Display *dpy, XVisualInfo *vis,
-                                               GLXContext shareList,
-                                               Bool allowDirect)
+PUBLIC GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
+                                  GLXContext shareList, Bool allowDirect)
 {
    return CreateContext(dpy, vis, NULL, shareList, allowDirect, None,
                        False, 0);
@@ -620,7 +500,7 @@ DestroyContext(Display *dpy, GLXContext gc)
     }
 }
 
-PUBLIC void GLX_PREFIX(glXDestroyContext)(Display *dpy, GLXContext gc)
+PUBLIC void glXDestroyContext(Display *dpy, GLXContext gc)
 {
     DestroyContext(dpy, gc);
 }
@@ -628,7 +508,7 @@ PUBLIC void GLX_PREFIX(glXDestroyContext)(Display *dpy, GLXContext gc)
 /*
 ** Return the major and minor version #s for the GLX extension
 */
-PUBLIC Bool GLX_PREFIX(glXQueryVersion)(Display *dpy, int *major, int *minor)
+PUBLIC Bool glXQueryVersion(Display *dpy, int *major, int *minor)
 {
     __GLXdisplayPrivate *priv;
 
@@ -644,8 +524,7 @@ PUBLIC Bool GLX_PREFIX(glXQueryVersion)(Display *dpy, int *major, int *minor)
 /*
 ** Query the existance of the GLX extension
 */
-PUBLIC Bool GLX_PREFIX(glXQueryExtension)(Display *dpy, int *errorBase,
-                                          int *eventBase)
+PUBLIC Bool glXQueryExtension(Display *dpy, int *errorBase, int *eventBase)
 {
     int major_op, erb, evb;
     Bool rv;
@@ -662,7 +541,7 @@ PUBLIC Bool GLX_PREFIX(glXQueryExtension)(Display *dpy, int *errorBase,
 ** Put a barrier in the token stream that forces the GL to finish its
 ** work before X can proceed.
 */
-PUBLIC void GLX_PREFIX(glXWaitGL)(void)
+PUBLIC void glXWaitGL(void)
 {
     xGLXWaitGLReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -698,7 +577,7 @@ PUBLIC void GLX_PREFIX(glXWaitGL)(void)
 ** Put a barrier in the token stream that forces X to finish its
 ** work before GL can proceed.
 */
-PUBLIC void GLX_PREFIX(glXWaitX)(void)
+PUBLIC void glXWaitX(void)
 {
     xGLXWaitXReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -728,8 +607,7 @@ PUBLIC void GLX_PREFIX(glXWaitX)(void)
     SyncHandle();
 }
 
-PUBLIC void GLX_PREFIX(glXUseXFont)(Font font, int first, int count,
-                                    int listBase)
+PUBLIC void glXUseXFont(Font font, int first, int count, int listBase)
 {
     xGLXUseXFontReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -767,8 +645,8 @@ PUBLIC void GLX_PREFIX(glXUseXFont)(Font font, int first, int count,
 ** Copy the source context to the destination context using the
 ** attribute "mask".
 */
-PUBLIC void GLX_PREFIX(glXCopyContext)(Display *dpy, GLXContext source,
-                                       GLXContext dest, unsigned long mask)
+PUBLIC void glXCopyContext(Display *dpy, GLXContext source,
+                          GLXContext dest, unsigned long mask)
 {
     xGLXCopyContextReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -842,7 +720,13 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID)
     return reply.isDirect;
 }
 
-PUBLIC Bool GLX_PREFIX(glXIsDirect)(Display *dpy, GLXContext gc)
+/**
+ * \todo
+ * Shouldn't this function \b always return \c GL_FALSE when
+ * \c GLX_DIRECT_RENDERING is not defined?  Do we really need to bother with
+ * the GLX protocol here at all?
+ */
+PUBLIC Bool glXIsDirect(Display *dpy, GLXContext gc)
 {
     if (!gc) {
        return GL_FALSE;
@@ -854,8 +738,8 @@ PUBLIC Bool GLX_PREFIX(glXIsDirect)(Display *dpy, GLXContext gc)
     return __glXIsDirect(dpy, gc->xid);
 }
 
-PUBLIC GLXPixmap GLX_PREFIX(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis,
-                                                Pixmap pixmap)
+PUBLIC GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, 
+                                   Pixmap pixmap)
 {
     xGLXCreateGLXPixmapReq *req;
     GLXPixmap xid;
@@ -883,7 +767,7 @@ PUBLIC GLXPixmap GLX_PREFIX(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis,
 /*
 ** Destroy the named pixmap
 */
-PUBLIC void GLX_PREFIX(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap glxpixmap)
+PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap)
 {
     xGLXDestroyGLXPixmapReq *req;
     CARD8 opcode;
@@ -903,7 +787,7 @@ PUBLIC void GLX_PREFIX(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap glxpixmap)
     SyncHandle();
 }
 
-PUBLIC void GLX_PREFIX(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
+PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
 {
     xGLXSwapBuffersReq *req;
     GLXContext gc;
@@ -952,8 +836,8 @@ PUBLIC void GLX_PREFIX(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
 ** Return configuration information for the given display, screen and
 ** visual combination.
 */
-PUBLIC int GLX_PREFIX(glXGetConfig)(Display *dpy, XVisualInfo *vis,
-                                    int attribute, int *value_return)
+PUBLIC int glXGetConfig(Display *dpy, XVisualInfo *vis, int attribute,
+                       int *value_return)
 {
     __GLXdisplayPrivate *priv;
     __GLXscreenConfigs *psc;
@@ -1309,8 +1193,7 @@ choose_visual( __GLcontextModes ** configs, int num_configs,
 ** Return the visual that best matches the template.  Return None if no
 ** visual matches the template.
 */
-PUBLIC XVisualInfo *GLX_PREFIX(glXChooseVisual)(Display *dpy, int screen,
-                                                int *attribList)
+PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList)
 {
     XVisualInfo *visualList = NULL;
     __GLXdisplayPrivate *priv;
@@ -1368,8 +1251,7 @@ PUBLIC XVisualInfo *GLX_PREFIX(glXChooseVisual)(Display *dpy, int screen,
 }
 
 
-PUBLIC const char *GLX_PREFIX(glXQueryExtensionsString)( Display *dpy,
-                                                         int screen )
+PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen )
 {
     __GLXscreenConfigs *psc;
     __GLXdisplayPrivate *priv;
@@ -1387,7 +1269,7 @@ PUBLIC const char *GLX_PREFIX(glXQueryExtensionsString)( Display *dpy,
 
        __glXCalculateUsableExtensions(psc,
 #ifdef GLX_DIRECT_RENDERING
-                                      (priv->driDisplay.private != NULL),
+                                      (psc->driScreen.private != NULL),
 #else
                                       GL_FALSE,
 #endif
@@ -1397,7 +1279,7 @@ PUBLIC const char *GLX_PREFIX(glXQueryExtensionsString)( Display *dpy,
     return psc->effectiveGLXexts;
 }
 
-PUBLIC const char *GLX_PREFIX(glXGetClientString)( Display *dpy, int name )
+PUBLIC const char *glXGetClientString( Display *dpy, int name )
 {
     switch(name) {
        case GLX_VENDOR:
@@ -1411,8 +1293,7 @@ PUBLIC const char *GLX_PREFIX(glXGetClientString)( Display *dpy, int name )
     }
 }
 
-PUBLIC const char *GLX_PREFIX(glXQueryServerString)( Display *dpy, int screen,
-                                                     int name )
+PUBLIC const char *glXQueryServerString( Display *dpy, int screen, int name )
 {
     __GLXscreenConfigs *psc;
     __GLXdisplayPrivate *priv;
@@ -1593,8 +1474,7 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
 }
 
 PUBLIC int
-GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx,
-                           int attribute, int *value)
+glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
 {
     int retVal;
 
@@ -1635,8 +1515,7 @@ PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
     return ctx->xid;
 }
 
-PUBLIC GLXContext GLX_PREFIX(glXImportContextEXT)(Display *dpy,
-                                                  GLXContextID contextID)
+PUBLIC GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID)
 {
     GLXContext ctx;
 
@@ -1656,7 +1535,7 @@ PUBLIC GLXContext GLX_PREFIX(glXImportContextEXT)(Display *dpy,
     return ctx;
 }
 
-PUBLIC void GLX_PREFIX(glXFreeContextEXT)(Display *dpy, GLXContext ctx)
+PUBLIC void glXFreeContextEXT(Display *dpy, GLXContext ctx)
 {
     DestroyContext(dpy, ctx);
 }
@@ -1667,16 +1546,15 @@ PUBLIC void GLX_PREFIX(glXFreeContextEXT)(Display *dpy, GLXContext ctx)
  * GLX 1.3 functions - these are just stubs for now!
  */
 
-PUBLIC GLXFBConfig *GLX_PREFIX(glXChooseFBConfig)(Display *dpy, int screen,
-                                                  const int *attribList,
-                                                  int *nitems)
+PUBLIC GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen,
+                                     const int *attribList, int *nitems)
 {
     __GLcontextModes ** config_list;
     int   list_size;
 
 
     config_list = (__GLcontextModes **) 
-       GLX_PREFIX(glXGetFBConfigs)( dpy, screen, & list_size );
+       glXGetFBConfigs( dpy, screen, & list_size );
 
     if ( (config_list != NULL) && (list_size > 0) && (attribList != NULL) ) {
        list_size = choose_visual( config_list, list_size, attribList,
@@ -1692,26 +1570,23 @@ PUBLIC GLXFBConfig *GLX_PREFIX(glXChooseFBConfig)(Display *dpy, int screen,
 }
 
 
-PUBLIC GLXContext GLX_PREFIX(glXCreateNewContext)(Display *dpy,
-                                                  GLXFBConfig config,
-                                                  int renderType,
-                                                  GLXContext shareList,
-                                                  Bool allowDirect)
+PUBLIC GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config,
+                                     int renderType, GLXContext shareList,
+                                     Bool allowDirect)
 {
     return CreateContext( dpy, NULL, (__GLcontextModes *) config, shareList,
                          allowDirect, None, True, renderType );
 }
 
 
-PUBLIC GLXDrawable GLX_PREFIX(glXGetCurrentReadDrawable)(void)
+PUBLIC GLXDrawable glXGetCurrentReadDrawable(void)
 {
     GLXContext gc = __glXGetCurrentContext();
     return gc->currentReadable;
 }
 
 
-PUBLIC GLXFBConfig *GLX_PREFIX(glXGetFBConfigs)(Display *dpy, int screen,
-                                                int *nelements)
+PUBLIC GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements)
 {
     __GLXdisplayPrivate *priv = __glXInitialize(dpy);
     __GLcontextModes ** config = NULL;
@@ -1750,8 +1625,8 @@ PUBLIC GLXFBConfig *GLX_PREFIX(glXGetFBConfigs)(Display *dpy, int screen,
 }
 
 
-PUBLIC int GLX_PREFIX(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config,
-                                            int attribute, int *value)
+PUBLIC int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config,
+                               int attribute, int *value)
 {
     __GLcontextModes * const modes = ValidateGLXFBConfig( dpy, config );
 
@@ -1761,8 +1636,7 @@ PUBLIC int GLX_PREFIX(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config,
 }
 
 
-PUBLIC XVisualInfo *GLX_PREFIX(glXGetVisualFromFBConfig)(Display *dpy,
-                                                         GLXFBConfig config)
+PUBLIC XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
 {
     XVisualInfo visualTemplate;
     __GLcontextModes * fbconfig = (__GLcontextModes *) config;
@@ -1776,18 +1650,10 @@ PUBLIC XVisualInfo *GLX_PREFIX(glXGetVisualFromFBConfig)(Display *dpy,
 }
 
 
-/*
-** GLX_SGI_make_current_read
-*/
-
-PUBLIC GLX_ALIAS(GLXDrawable, glXGetCurrentReadDrawableSGI, (void), (),
-         glXGetCurrentReadDrawable)
-
-
 /*
 ** GLX_SGI_swap_control
 */
-PUBLIC int GLX_PREFIX(glXSwapIntervalSGI)(int interval)
+static int __glXSwapIntervalSGI(int interval)
 {
    xGLXVendorPrivateReq *req;
    GLXContext gc = __glXGetCurrentContext();
@@ -1834,7 +1700,7 @@ PUBLIC int GLX_PREFIX(glXSwapIntervalSGI)(int interval)
    req->vendorCode = X_GLXvop_SwapIntervalSGI;
    req->contextTag = gc->currentContextTag;
 
-   interval_ptr = (CARD32 *) req + 1;
+   interval_ptr = (CARD32 *) (req + 1);
    *interval_ptr = interval;
 
    UnlockDisplay(dpy);
@@ -1848,7 +1714,7 @@ PUBLIC int GLX_PREFIX(glXSwapIntervalSGI)(int interval)
 /*
 ** GLX_MESA_swap_control
 */
-PUBLIC GLint GLX_PREFIX(glXSwapIntervalMESA)(unsigned interval)
+static int __glXSwapIntervalMESA(unsigned int interval)
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
@@ -1880,7 +1746,8 @@ PUBLIC GLint GLX_PREFIX(glXSwapIntervalMESA)(unsigned interval)
    return GLX_BAD_CONTEXT;
 }
  
-PUBLIC GLint GLX_PREFIX(glXGetSwapIntervalMESA)( void )
+
+static int __glXGetSwapIntervalMESA(void)
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
@@ -1910,8 +1777,7 @@ PUBLIC GLint GLX_PREFIX(glXGetSwapIntervalMESA)( void )
 ** GLX_MESA_swap_frame_usage
 */
 
-PUBLIC GLint GLX_PREFIX(glXBeginFrameTrackingMESA)(Display *dpy,
-                                                   GLXDrawable drawable)
+static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1931,8 +1797,7 @@ PUBLIC GLint GLX_PREFIX(glXBeginFrameTrackingMESA)(Display *dpy,
 }
 
     
-PUBLIC GLint GLX_PREFIX(glXEndFrameTrackingMESA)(Display *dpy,
-                                                 GLXDrawable drawable)
+static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1952,9 +1817,8 @@ PUBLIC GLint GLX_PREFIX(glXEndFrameTrackingMESA)(Display *dpy,
 }
 
 
-PUBLIC GLint GLX_PREFIX(glXGetFrameUsageMESA)(Display *dpy,
-                                              GLXDrawable drawable,
-                                              GLfloat *usage)
+static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable,
+                                   GLfloat *usage)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1980,11 +1844,9 @@ PUBLIC GLint GLX_PREFIX(glXGetFrameUsageMESA)(Display *dpy,
 }
 
 
-PUBLIC GLint GLX_PREFIX(glXQueryFrameTrackingMESA)(Display *dpy,
-                                                   GLXDrawable drawable,
-                                                   int64_t *sbc,
-                                                   int64_t *missedFrames,
-                                                   GLfloat *lastMissedUsage)
+static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable,
+                                        int64_t *sbc, int64_t *missedFrames,
+                                        GLfloat *lastMissedUsage)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -2014,7 +1876,7 @@ PUBLIC GLint GLX_PREFIX(glXQueryFrameTrackingMESA)(Display *dpy,
 /*
 ** GLX_SGI_video_sync
 */
-PUBLIC int GLX_PREFIX(glXGetVideoSyncSGI)(unsigned int *count)
+static int __glXGetVideoSyncSGI(unsigned int *count)
 {
    /* FIXME: Looking at the GLX_SGI_video_sync spec in the extension registry,
     * FIXME: there should be a GLX encoding for this call.  I can find no
@@ -2043,8 +1905,7 @@ PUBLIC int GLX_PREFIX(glXGetVideoSyncSGI)(unsigned int *count)
    return GLX_BAD_CONTEXT;
 }
 
-PUBLIC int GLX_PREFIX(glXWaitVideoSyncSGI)(int divisor, int remainder,
-                                           unsigned int *count)
+static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
@@ -2081,34 +1942,6 @@ PUBLIC int GLX_PREFIX(glXWaitVideoSyncSGI)(int divisor, int remainder,
 }
 
 
-/*
-** GLX_SGIS_video_source
-*/
-#if defined(_VL_H)
-
-PUBLIC GLXVideoSourceSGIX GLX_PREFIX(glXCreateGLXVideoSourceSGIX)(Display *dpy,
-                                     int screen, VLServer server, VLPath path,
-                                     int nodeClass, VLNode drainNode)
-{
-   (void) dpy;
-   (void) screen;
-   (void) server;
-   (void) path;
-   (void) nodeClass;
-   (void) drainNode;
-   return 0;
-}
-
-PUBLIC void GLX_PREFIX(glXDestroyGLXVideoSourceSGIX)(Display *dpy,
-                                                     GLXVideoSourceSGIX src)
-{
-   (void) dpy;
-   (void) src;
-}
-
-#endif
-
-
 /*
 ** GLX_SGIX_fbconfig
 ** Many of these functions are aliased to GLX 1.3 entry points in the 
@@ -2130,7 +1963,7 @@ PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
          (dpy, config),
          glXGetVisualFromFBConfig)
 
-PUBLIC GLXPixmap GLX_PREFIX(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy,
+PUBLIC GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display *dpy,
                             GLXFBConfigSGIX config, Pixmap pixmap)
 {
     xGLXVendorPrivateWithReplyReq *vpreq;
@@ -2172,7 +2005,7 @@ PUBLIC GLXPixmap GLX_PREFIX(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy,
     return xid;
 }
 
-PUBLIC GLXContext GLX_PREFIX(glXCreateContextWithConfigSGIX)(Display *dpy,
+PUBLIC GLXContext glXCreateContextWithConfigSGIX(Display *dpy,
                              GLXFBConfigSGIX config, int renderType,
                              GLXContext shareList, Bool allowDirect)
 {
@@ -2196,8 +2029,8 @@ PUBLIC GLXContext GLX_PREFIX(glXCreateContextWithConfigSGIX)(Display *dpy,
 }
 
 
-PUBLIC GLXFBConfigSGIX GLX_PREFIX(glXGetFBConfigFromVisualSGIX)(Display *dpy,
-                                                            XVisualInfo *vis)
+PUBLIC GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX(Display *dpy,
+                                                   XVisualInfo *vis)
 {
     __GLXdisplayPrivate *priv;
     __GLXscreenConfigs *psc;
@@ -2213,103 +2046,11 @@ PUBLIC GLXFBConfigSGIX GLX_PREFIX(glXGetFBConfigFromVisualSGIX)(Display *dpy,
 }
 
 
-/*
-** GLX_SGI_cushion
-*/
-PUBLIC void GLX_PREFIX(glXCushionSGI)(Display *dpy, Window win, float cushion)
-{
-   (void) dpy;
-   (void) win;
-   (void) cushion;
-}
-
-
-/*
-** GLX_SGIX_video_resize
-*/
-PUBLIC int GLX_PREFIX(glXBindChannelToWindowSGIX)(Display *dpy, int screen,
-                                                  int channel , Window window)
-{
-   (void) dpy;
-   (void) screen;
-   (void) channel;
-   (void) window;
-   return 0;
-}
-
-PUBLIC int GLX_PREFIX(glXChannelRectSGIX)(Display *dpy, int screen, int channel,
-                                          int x, int y, int w, int h)
-{
-   (void) dpy;
-   (void) screen;
-   (void) channel;
-   (void) x;
-   (void) y;
-   (void) w;
-   (void) h;
-   return 0;
-}
-
-PUBLIC int GLX_PREFIX(glXQueryChannelRectSGIX)(Display *dpy, int screen,
-                                               int channel, int *x, int *y,
-                                               int *w, int *h)
-{
-   (void) dpy;
-   (void) screen;
-   (void) channel;
-   (void) x;
-   (void) y;
-   (void) w;
-   (void) h;
-   return 0;
-}
-
-int GLX_PREFIX(glXQueryChannelDeltasSGIX)(Display *dpy, int screen, int channel,
-                                          int *dx, int *dy, int *dw, int *dh)
-{
-   (void) dpy;
-   (void) screen;
-   (void) channel;
-   (void) dx;
-   (void) dy;
-   (void) dw;
-   (void) dh;
-   return 0;
-}
-
-PUBLIC int GLX_PREFIX(glXChannelRectSyncSGIX)(Display *dpy, int screen,
-                                              int channel, GLenum synctype)
-{
-   (void) dpy;
-   (void) screen;
-   (void) channel;
-   (void) synctype;
-   return 0;
-}
-
-
-#if defined(_DM_BUFFER_H_)
-
-PUBLIC Bool GLX_PREFIX(glXAssociateDMPbufferSGIX)(Display *dpy,
-                                                  GLXPbufferSGIX pbuffer,
-                                                  DMparams *params,
-                                                  DMbuffer dmbuffer)
-{
-   (void) dpy;
-   (void) pbuffer;
-   (void) params;
-   (void) dmbuffer;
-   return False;
-}
-
-#endif
-
-
 /*
 ** GLX_SGIX_swap_group
 */
-PUBLIC void GLX_PREFIX(glXJoinSwapGroupSGIX)(Display *dpy, GLXDrawable drawable,
-                                             GLXDrawable member)
+static void __glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable,
+                                  GLXDrawable member)
 {
    (void) dpy;
    (void) drawable;
@@ -2320,17 +2061,15 @@ PUBLIC void GLX_PREFIX(glXJoinSwapGroupSGIX)(Display *dpy, GLXDrawable drawable,
 /*
 ** GLX_SGIX_swap_barrier
 */
-PUBLIC void GLX_PREFIX(glXBindSwapBarrierSGIX)(Display *dpy,
-                                               GLXDrawable drawable,
-                                               int barrier)
+static void __glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable,
+                                    int barrier)
 {
    (void) dpy;
    (void) drawable;
    (void) barrier;
 }
 
-PUBLIC Bool GLX_PREFIX(glXQueryMaxSwapBarriersSGIX)(Display *dpy, int screen,
-                                                    int *max)
+static Bool __glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
 {
    (void) dpy;
    (void) screen;
@@ -2339,27 +2078,11 @@ PUBLIC Bool GLX_PREFIX(glXQueryMaxSwapBarriersSGIX)(Display *dpy, int screen,
 }
 
 
-/*
-** GLX_SUN_get_transparent_index
-*/
-PUBLIC Status GLX_PREFIX(glXGetTransparentIndexSUN)(Display *dpy,
-                                                    Window overlay,
-                                                    Window underlay,
-                                                    long *pTransparent)
-{
-   (void) dpy;
-   (void) overlay;
-   (void) underlay;
-   (void) pTransparent;
-   return 0;
-}
-
-
 /*
 ** GLX_OML_sync_control
 */
-PUBLIC Bool GLX_PREFIX(glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
-                                    int64_t *ust, int64_t *msc, int64_t *sbc)
+static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
+                                 int64_t *ust, int64_t *msc, int64_t *sbc)
 {
 #ifdef GLX_DIRECT_RENDERING
     __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
@@ -2403,8 +2126,8 @@ PUBLIC Bool GLX_PREFIX(glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
  *       when GLX_OML_sync_control appears in the client extension string.
  */
 
-PUBLIC Bool GLX_PREFIX(glXGetMscRateOML)(Display * dpy, GLXDrawable drawable,
-                                 int32_t * numerator, int32_t * denominator)
+Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
+                       int32_t * numerator, int32_t * denominator)
 {
 #if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
    __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
@@ -2477,11 +2200,9 @@ PUBLIC Bool GLX_PREFIX(glXGetMscRateOML)(Display * dpy, GLXDrawable drawable,
 }
 
 
-PUBLIC int64_t GLX_PREFIX(glXSwapBuffersMscOML)(Display *dpy,
-                                                GLXDrawable drawable,
-                                                int64_t target_msc,
-                                                int64_t divisor,
-                                                int64_t remainder)
+static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
+                                     int64_t target_msc, int64_t divisor,
+                                     int64_t remainder)
 {
 #ifdef GLX_DIRECT_RENDERING
    int screen;
@@ -2514,10 +2235,10 @@ PUBLIC int64_t GLX_PREFIX(glXSwapBuffersMscOML)(Display *dpy,
 }
 
 
-PUBLIC Bool GLX_PREFIX(glXWaitForMscOML)(Display * dpy, GLXDrawable drawable,
-                                         int64_t target_msc, int64_t divisor,
-                                         int64_t remainder, int64_t *ust,
-                                         int64_t *msc, int64_t *sbc)
+static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
+                              int64_t target_msc, int64_t divisor,
+                              int64_t remainder, int64_t *ust,
+                              int64_t *msc, int64_t *sbc)
 {
 #ifdef GLX_DIRECT_RENDERING
    int screen;
@@ -2557,9 +2278,9 @@ PUBLIC Bool GLX_PREFIX(glXWaitForMscOML)(Display * dpy, GLXDrawable drawable,
 }
 
 
-PUBLIC Bool GLX_PREFIX(glXWaitForSbcOML)(Display * dpy, GLXDrawable drawable,
-                                         int64_t target_sbc, int64_t *ust,
-                                         int64_t *msc, int64_t *sbc )
+static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
+                              int64_t target_sbc, int64_t *ust,
+                              int64_t *msc, int64_t *sbc )
 {
 #ifdef GLX_DIRECT_RENDERING
    int screen;
@@ -2599,9 +2320,9 @@ PUBLIC Bool GLX_PREFIX(glXWaitForSbcOML)(Display * dpy, GLXDrawable drawable,
  */
 /*@{*/
 
-PUBLIC void *GLX_PREFIX(glXAllocateMemoryMESA)(Display *dpy, int scrn,
-                                               size_t size, float readFreq,
-                                               float writeFreq, float priority)
+PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn,
+                                  size_t size, float readFreq,
+                                  float writeFreq, float priority)
 {
 #ifdef GLX_DIRECT_RENDERING
    __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
@@ -2626,7 +2347,7 @@ PUBLIC void *GLX_PREFIX(glXAllocateMemoryMESA)(Display *dpy, int scrn,
 }
 
 
-PUBLIC void GLX_PREFIX(glXFreeMemoryMESA)(Display *dpy, int scrn, void *pointer)
+PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
 {
 #ifdef GLX_DIRECT_RENDERING
    __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
@@ -2644,8 +2365,8 @@ PUBLIC void GLX_PREFIX(glXFreeMemoryMESA)(Display *dpy, int scrn, void *pointer)
 }
 
 
-PUBLIC GLuint GLX_PREFIX(glXGetMemoryOffsetMESA)( Display *dpy, int scrn,
-                                                  const void *pointer )
+PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
+                                     const void *pointer )
 {
 #ifdef GLX_DIRECT_RENDERING
    __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
@@ -2693,7 +2414,7 @@ PUBLIC GLuint GLX_PREFIX(glXGetMemoryOffsetMESA)( Display *dpy, int scrn,
  *     glXDestroyPbuffer glXDestroyPixmap glXDestroyWindow
  *     glXDestroyGLXPbufferSGIX glXDestroyGLXVideoSourceSGIX
  */
-PUBLIC Bool GLX_PREFIX(glXReleaseBuffersMESA)( Display *dpy, GLXDrawable d )
+static Bool __glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
 {
    (void) dpy;
    (void) d;
@@ -2701,10 +2422,8 @@ PUBLIC Bool GLX_PREFIX(glXReleaseBuffersMESA)( Display *dpy, GLXDrawable d )
 }
 
 
-PUBLIC GLXPixmap GLX_PREFIX(glXCreateGLXPixmapMESA)( Display *dpy,
-                                                     XVisualInfo *visual,
-                                                     Pixmap pixmap,
-                                                     Colormap cmap )
+PUBLIC GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
+                                        Pixmap pixmap, Colormap cmap )
 {
    (void) dpy;
    (void) visual;
@@ -2712,29 +2431,182 @@ PUBLIC GLXPixmap GLX_PREFIX(glXCreateGLXPixmapMESA)( Display *dpy,
    (void) cmap;
    return 0;
 }
+/*@}*/
 
 
-PUBLIC void GLX_PREFIX(glXCopySubBufferMESA)(Display *dpy, GLXDrawable drawable,
-                                             int x, int y,
-                                             int width, int height)
+/**
+ * GLX_MESA_copy_sub_buffer
+ */
+#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
+static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable,
+                                  int x, int y, int width, int height)
 {
-   (void) dpy;
-   (void) drawable;
-   (void) x;
-   (void) y;
-   (void) width;
-   (void) height;
+    xGLXVendorPrivateReq *req;
+    GLXContext gc;
+    GLXContextTag tag;
+    CARD32 *drawable_ptr;
+    INT32 *x_ptr, *y_ptr, *w_ptr, *h_ptr;
+    CARD8 opcode;
+
+#ifdef GLX_DIRECT_RENDERING
+    int screen;
+    __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen );
+    if ( pdraw != NULL ) {
+       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
+       if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) {
+           (*pdraw->copySubBuffer)(dpy, pdraw->private, x, y, width, height);
+       }
+
+       return;
+    }
+#endif
+
+    opcode = __glXSetupForCommand(dpy);
+    if (!opcode)
+       return;
+
+    /*
+    ** The calling thread may or may not have a current context.  If it
+    ** does, send the context tag so the server can do a flush.
+    */
+    gc = __glXGetCurrentContext();
+    if ((gc != NULL) && (dpy == gc->currentDpy) &&
+       ((drawable == gc->currentDrawable) ||
+        (drawable == gc->currentReadable)) ) {
+       tag = gc->currentContextTag;
+    } else {
+       tag = 0;
+    }
+
+    LockDisplay(dpy);
+    GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32) * 4,req);
+    req->reqType = opcode;
+    req->glxCode = X_GLXVendorPrivate;
+    req->vendorCode = X_GLXvop_CopySubBufferMESA;
+    req->contextTag = tag;
+
+    drawable_ptr = (CARD32 *) (req + 1);
+    x_ptr = (INT32 *) (drawable_ptr + 1);
+    y_ptr = (INT32 *) (drawable_ptr + 2);
+    w_ptr = (INT32 *) (drawable_ptr + 3);
+    h_ptr = (INT32 *) (drawable_ptr + 4);
+
+    *drawable_ptr = drawable;
+    *x_ptr = x;
+    *y_ptr = y;
+    *w_ptr = width;
+    *h_ptr = height;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
 }
 
 
-PUBLIC Bool GLX_PREFIX(glXSet3DfxModeMESA)( int mode )
+/**
+ * GLX_EXT_texture_from_pixmap
+ */
+/*@{*/
+static void __glXBindTexImageEXT(Display *dpy,
+                                GLXDrawable drawable,
+                                int buffer,
+                                const int *attrib_list)
 {
-   (void) mode;
-   return GL_FALSE;
+    xGLXVendorPrivateReq *req;
+    GLXContext gc = __glXGetCurrentContext();
+    CARD32 *drawable_ptr;
+    INT32 *buffer_ptr;
+    CARD32 *num_attrib_ptr;
+    CARD32 *attrib_ptr;
+    CARD8 opcode;
+    unsigned int i;
+
+    if (gc == NULL)
+       return;
+
+    i = 0;
+    if (attrib_list) {
+       while (attrib_list[i * 2] != None)
+           i++;
+    }
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->isDirect)
+       return;
+#endif
+
+    opcode = __glXSetupForCommand(dpy);
+    if (!opcode)
+       return;
+
+    LockDisplay(dpy);
+    GetReqExtra(GLXVendorPrivate, 12 + 8 * i,req);
+    req->reqType = opcode;
+    req->glxCode = X_GLXVendorPrivate;
+    req->vendorCode = X_GLXvop_BindTexImageEXT;
+    req->contextTag = gc->currentContextTag;
+
+    drawable_ptr = (CARD32 *) (req + 1);
+    buffer_ptr = (INT32 *) (drawable_ptr + 1);
+    num_attrib_ptr = (CARD32 *) (buffer_ptr + 1);
+    attrib_ptr = (CARD32 *) (num_attrib_ptr + 1);
+
+    *drawable_ptr = drawable;
+    *buffer_ptr = buffer;
+    *num_attrib_ptr = (CARD32) i;
+
+    i = 0;
+    if (attrib_list) {
+       while (attrib_list[i * 2] != None)
+       {
+           *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 0];
+           *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 1];
+           i++;
+       }
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
 }
-/*@}*/
 
+static void __glXReleaseTexImageEXT(Display *dpy,
+                                   GLXDrawable drawable,
+                                   int buffer)
+{
+    xGLXVendorPrivateReq *req;
+    GLXContext gc = __glXGetCurrentContext();
+    CARD32 *drawable_ptr;
+    INT32 *buffer_ptr;
+    CARD8 opcode;
+
+    if (gc == NULL)
+       return;
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->isDirect)
+       return;
+#endif
 
+    opcode = __glXSetupForCommand(dpy);
+    if (!opcode)
+       return;
+
+    LockDisplay(dpy);
+    GetReqExtra(GLXVendorPrivate, sizeof(CARD32)+sizeof(INT32),req);
+    req->reqType = opcode;
+    req->glxCode = X_GLXVendorPrivate;
+    req->vendorCode = X_GLXvop_ReleaseTexImageEXT;
+    req->contextTag = gc->currentContextTag;
+
+    drawable_ptr = (CARD32 *) (req + 1);
+    buffer_ptr = (INT32 *) (drawable_ptr + 1);
+
+    *drawable_ptr = drawable;
+    *buffer_ptr = buffer;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+/*@}*/
 
 /**
  * \c strdup is actually not a standard ANSI C or POSIX routine.
@@ -2813,22 +2685,16 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION( glXSelectEvent ),
 
    /*** GLX_SGI_swap_control ***/
-   GLX_FUNCTIONglXSwapIntervalSGI ),
+   GLX_FUNCTION2( glXSwapIntervalSGI, __glXSwapIntervalSGI ),
 
    /*** GLX_SGI_video_sync ***/
-   GLX_FUNCTIONglXGetVideoSyncSGI ),
-   GLX_FUNCTIONglXWaitVideoSyncSGI ),
+   GLX_FUNCTION2( glXGetVideoSyncSGI, __glXGetVideoSyncSGI ),
+   GLX_FUNCTION2( glXWaitVideoSyncSGI, __glXWaitVideoSyncSGI ),
 
    /*** GLX_SGI_make_current_read ***/
    GLX_FUNCTION2( glXMakeCurrentReadSGI, glXMakeContextCurrent ),
    GLX_FUNCTION2( glXGetCurrentReadDrawableSGI, glXGetCurrentReadDrawable ),
 
-   /*** GLX_SGIX_video_source ***/
-#if defined(_VL_H)
-   GLX_FUNCTION( glXCreateGLXVideoSourceSGIX ),
-   GLX_FUNCTION( glXDestroyGLXVideoSourceSGIX ),
-#endif
-
    /*** GLX_EXT_import_context ***/
    GLX_FUNCTION( glXFreeContextEXT ),
    GLX_FUNCTION( glXGetContextIDEXT ),
@@ -2851,30 +2717,12 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION( glXSelectEventSGIX ),
    GLX_FUNCTION( glXGetSelectedEventSGIX ),
 
-   /*** GLX_SGI_cushion ***/
-   GLX_FUNCTION( glXCushionSGI ),
-
-   /*** GLX_SGIX_video_resize ***/
-   GLX_FUNCTION( glXBindChannelToWindowSGIX ),
-   GLX_FUNCTION( glXChannelRectSGIX ),
-   GLX_FUNCTION( glXQueryChannelRectSGIX ),
-   GLX_FUNCTION( glXQueryChannelDeltasSGIX ),
-   GLX_FUNCTION( glXChannelRectSyncSGIX ),
-
-   /*** GLX_SGIX_dmbuffer **/
-#if defined(_DM_BUFFER_H_)
-   GLX_FUNCTION( glXAssociateDMPbufferSGIX ),
-#endif
-
    /*** GLX_SGIX_swap_group ***/
-   GLX_FUNCTIONglXJoinSwapGroupSGIX ),
+   GLX_FUNCTION2( glXJoinSwapGroupSGIX, __glXJoinSwapGroupSGIX ),
 
    /*** GLX_SGIX_swap_barrier ***/
-   GLX_FUNCTION( glXBindSwapBarrierSGIX ),
-   GLX_FUNCTION( glXQueryMaxSwapBarriersSGIX ),
-
-   /*** GLX_SUN_get_transparent_index ***/
-   GLX_FUNCTION( glXGetTransparentIndexSUN ),
+   GLX_FUNCTION2( glXBindSwapBarrierSGIX, __glXBindSwapBarrierSGIX ),
+   GLX_FUNCTION2( glXQueryMaxSwapBarriersSGIX, __glXQueryMaxSwapBarriersSGIX ),
 
    /*** GLX_MESA_allocate_memory ***/
    GLX_FUNCTION( glXAllocateMemoryMESA ),
@@ -2882,26 +2730,23 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION( glXGetMemoryOffsetMESA ),
 
    /*** GLX_MESA_copy_sub_buffer ***/
-   GLX_FUNCTIONglXCopySubBufferMESA ),
+   GLX_FUNCTION2( glXCopySubBufferMESA, __glXCopySubBufferMESA ),
 
    /*** GLX_MESA_pixmap_colormap ***/
    GLX_FUNCTION( glXCreateGLXPixmapMESA ),
 
    /*** GLX_MESA_release_buffers ***/
-   GLX_FUNCTION( glXReleaseBuffersMESA ),
-
-   /*** GLX_MESA_set_3dfx_mode ***/
-   GLX_FUNCTION( glXSet3DfxModeMESA ),
+   GLX_FUNCTION2( glXReleaseBuffersMESA, __glXReleaseBuffersMESA ),
 
    /*** GLX_MESA_swap_control ***/
-   GLX_FUNCTIONglXSwapIntervalMESA ),
-   GLX_FUNCTIONglXGetSwapIntervalMESA ),
+   GLX_FUNCTION2( glXSwapIntervalMESA, __glXSwapIntervalMESA ),
+   GLX_FUNCTION2( glXGetSwapIntervalMESA, __glXGetSwapIntervalMESA ),
 
    /*** GLX_MESA_swap_frame_usage ***/
-   GLX_FUNCTIONglXBeginFrameTrackingMESA ),
-   GLX_FUNCTIONglXEndFrameTrackingMESA ),
-   GLX_FUNCTIONglXGetFrameUsageMESA ),
-   GLX_FUNCTIONglXQueryFrameTrackingMESA ),
+   GLX_FUNCTION2( glXBeginFrameTrackingMESA, __glXBeginFrameTrackingMESA ),
+   GLX_FUNCTION2( glXEndFrameTrackingMESA, __glXEndFrameTrackingMESA ),
+   GLX_FUNCTION2( glXGetFrameUsageMESA, __glXGetFrameUsageMESA ),
+   GLX_FUNCTION2( glXQueryFrameTrackingMESA, __glXQueryFrameTrackingMESA ),
 
    /*** GLX_ARB_get_proc_address ***/
    GLX_FUNCTION( glXGetProcAddressARB ),
@@ -2910,35 +2755,20 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION2( glXGetProcAddress, glXGetProcAddressARB ),
 
    /*** GLX_OML_sync_control ***/
-   GLX_FUNCTIONglXWaitForSbcOML ),
-   GLX_FUNCTIONglXWaitForMscOML ),
-   GLX_FUNCTIONglXSwapBuffersMscOML ),
-   GLX_FUNCTIONglXGetMscRateOML ),
-   GLX_FUNCTIONglXGetSyncValuesOML ),
+   GLX_FUNCTION2( glXWaitForSbcOML, __glXWaitForSbcOML ),
+   GLX_FUNCTION2( glXWaitForMscOML, __glXWaitForMscOML ),
+   GLX_FUNCTION2( glXSwapBuffersMscOML, __glXSwapBuffersMscOML ),
+   GLX_FUNCTION2( glXGetMscRateOML, __glXGetMscRateOML ),
+   GLX_FUNCTION2( glXGetSyncValuesOML, __glXGetSyncValuesOML ),
 
-#ifdef GLX_DIRECT_RENDERING
-   /***
-    *** Internal functions useful to DRI drivers
-    *** With this, the DRI drivers shouldn't need dlopen()/dlsym() to
-    *** access internal libGL functions which may or may not exist.
-    ***/
-   GLX_FUNCTION( __glXInitialize ),
-   GLX_FUNCTION( __glXFindDRIScreen ),
-   GLX_FUNCTION( __glXGetInternalVersion ),
-   GLX_FUNCTION( __glXWindowExists ),
-   GLX_FUNCTION2( __glXCreateContextWithConfig, XF86DRICreateContextWithConfig ),
-   GLX_FUNCTION2( __glXGetDrawableInfo, XF86DRIGetDrawableInfo ),
+   /*** GLX_EXT_texture_from_pixmap ***/
+   GLX_FUNCTION2( glXBindTexImageEXT, __glXBindTexImageEXT ),
+   GLX_FUNCTION2( glXReleaseTexImageEXT, __glXReleaseTexImageEXT ),
 
+#ifdef GLX_DIRECT_RENDERING
    /*** DRI configuration ***/
    GLX_FUNCTION( glXGetScreenDriver ),
    GLX_FUNCTION( glXGetDriverConfig ),
-
-   GLX_FUNCTION( __glXScrEnableExtension ),
-
-   GLX_FUNCTION( __glXGetUST ),
-    
-   GLX_FUNCTION2( __glXCreateContextModes, _gl_context_modes_create ),
-   GLX_FUNCTION2( __glXDestroyContextModes, _gl_context_modes_destroy ),
 #endif
 
    { NULL, NULL }   /* end of list */
@@ -2960,7 +2790,6 @@ get_glx_proc_address(const char *funcName)
 }
 
 
-#ifndef GLX_BUILT_IN_XMESA
 /**
  * Get the address of a named GL function.  This is the pre-GLX 1.4 name for
  * \c glXGetProcAddress.
@@ -3009,7 +2838,6 @@ PUBLIC void (*glXGetProcAddress(const GLubyte *procName))( void )
    return glXGetProcAddressARB(procName);
 }
 #endif /* __GNUC__ */
-#endif /* GLX_BUILT_IN_XMESA */
 
 
 #ifdef GLX_DIRECT_RENDERING
@@ -3052,8 +2880,11 @@ int __glXGetInternalVersion(void)
      * 20040415 - Added support for bindContext3 and unbindContext3.
      * 20040602 - Add __glXGetDrawableInfo.  I though that was there
      *            months ago. :(
+     * 20050727 - Gut all the old interfaces.  This breaks compatability with
+     *            any DRI driver built to any previous version.
+     * 20060314 - Added support for GLX_MESA_copy_sub_buffer.
      */
-    return 20040602;
+    return 20060314;
 }
 
 
@@ -3087,7 +2918,7 @@ static int windowExistsErrorHandler(Display *dpy, XErrorEvent *xerr)
  *
  * \since Internal API version 20021128.
  */
-static Bool __glXWindowExists(Display *dpy, GLXDrawable draw)
+Bool __glXWindowExists(Display *dpy, GLXDrawable draw)
 {
     XWindowAttributes xwa;
     int (*oldXErrorHandler)(Display *, XErrorEvent *);