Remove the last remnants of GLX_BUILT_IN_XMESA. This allows the removal of
[mesa.git] / src / glx / x11 / glxcmds.c
index 32560dca4a35f567c2b8a6675a8e1180833342d6..39e5f11e43befbe478d27cdb812385f159a7ecd3 100644 (file)
 #ifdef GLX_DIRECT_RENDERING
 #include "indirect_init.h"
 #include "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 );
-
-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 );
-}
-
-
-/****************************************************************************/
-/**
- * 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) );
-    }
-    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;
-               }
-           }
-       }
-    }
-
-    return ctx_priv;
-}
-#endif
-
-
 /****************************************************************************/
 /**
  * Get the __DRIdrawable for the drawable associated with a GLXContext
@@ -370,8 +256,6 @@ GLXContext AllocateGLXContext( Display *dpy )
     state->storePack.alignment = 4;
     state->storeUnpack.alignment = 4;
 
-    __glXInitVertexArrayState(gc);
-
     gc->attributes.stackPointer = &gc->attributes.stack[0];
 
     /*
@@ -466,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;
@@ -540,9 +424,8 @@ CreateContext(Display *dpy, XVisualInfo *vis,
     return gc;
 }
 
-
-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);
@@ -616,7 +499,8 @@ DestroyContext(Display *dpy, GLXContext gc)
        SyncHandle();
     }
 }
-void GLX_PREFIX(glXDestroyContext)(Display *dpy, GLXContext gc)
+
+PUBLIC void glXDestroyContext(Display *dpy, GLXContext gc)
 {
     DestroyContext(dpy, gc);
 }
@@ -624,7 +508,7 @@ void GLX_PREFIX(glXDestroyContext)(Display *dpy, GLXContext gc)
 /*
 ** Return the major and minor version #s for the GLX extension
 */
-Bool GLX_PREFIX(glXQueryVersion)(Display *dpy, int *major, int *minor)
+PUBLIC Bool glXQueryVersion(Display *dpy, int *major, int *minor)
 {
     __GLXdisplayPrivate *priv;
 
@@ -640,7 +524,7 @@ Bool GLX_PREFIX(glXQueryVersion)(Display *dpy, int *major, int *minor)
 /*
 ** Query the existance of the GLX extension
 */
-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;
@@ -657,7 +541,7 @@ Bool GLX_PREFIX(glXQueryExtension)(Display *dpy, int *errorBase, int *eventBase)
 ** Put a barrier in the token stream that forces the GL to finish its
 ** work before X can proceed.
 */
-void GLX_PREFIX(glXWaitGL)(void)
+PUBLIC void glXWaitGL(void)
 {
     xGLXWaitGLReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -693,7 +577,7 @@ void GLX_PREFIX(glXWaitGL)(void)
 ** Put a barrier in the token stream that forces X to finish its
 ** work before GL can proceed.
 */
-void GLX_PREFIX(glXWaitX)(void)
+PUBLIC void glXWaitX(void)
 {
     xGLXWaitXReq *req;
     GLXContext gc = __glXGetCurrentContext();
@@ -723,7 +607,7 @@ void GLX_PREFIX(glXWaitX)(void)
     SyncHandle();
 }
 
-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();
@@ -761,8 +645,8 @@ void GLX_PREFIX(glXUseXFont)(Font font, int first, int count, int listBase)
 ** Copy the source context to the destination context using the
 ** attribute "mask".
 */
-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();
@@ -836,7 +720,13 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID)
     return reply.isDirect;
 }
 
-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;
@@ -848,7 +738,8 @@ Bool GLX_PREFIX(glXIsDirect)(Display *dpy, GLXContext gc)
     return __glXIsDirect(dpy, gc->xid);
 }
 
-GLXPixmap GLX_PREFIX(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis, Pixmap pixmap)
+PUBLIC GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, 
+                                   Pixmap pixmap)
 {
     xGLXCreateGLXPixmapReq *req;
     GLXPixmap xid;
@@ -876,7 +767,7 @@ GLXPixmap GLX_PREFIX(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis, Pixmap
 /*
 ** Destroy the named pixmap
 */
-void GLX_PREFIX(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap glxpixmap)
+PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap)
 {
     xGLXDestroyGLXPixmapReq *req;
     CARD8 opcode;
@@ -896,7 +787,7 @@ void GLX_PREFIX(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap glxpixmap)
     SyncHandle();
 }
 
-void GLX_PREFIX(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
+PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
 {
     xGLXSwapBuffersReq *req;
     GLXContext gc;
@@ -945,8 +836,8 @@ void GLX_PREFIX(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
 ** Return configuration information for the given display, screen and
 ** visual combination.
 */
-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;
@@ -1302,7 +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.
 */
-XVisualInfo *GLX_PREFIX(glXChooseVisual)(Display *dpy, int screen, int *attribList)
+PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList)
 {
     XVisualInfo *visualList = NULL;
     __GLXdisplayPrivate *priv;
@@ -1360,7 +1251,7 @@ XVisualInfo *GLX_PREFIX(glXChooseVisual)(Display *dpy, int screen, int *attribLi
 }
 
 
-const char *GLX_PREFIX(glXQueryExtensionsString)( Display *dpy, int screen )
+PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen )
 {
     __GLXscreenConfigs *psc;
     __GLXdisplayPrivate *priv;
@@ -1388,7 +1279,7 @@ const char *GLX_PREFIX(glXQueryExtensionsString)( Display *dpy, int screen )
     return psc->effectiveGLXexts;
 }
 
-const char *GLX_PREFIX(glXGetClientString)( Display *dpy, int name )
+PUBLIC const char *glXGetClientString( Display *dpy, int name )
 {
     switch(name) {
        case GLX_VENDOR:
@@ -1402,7 +1293,7 @@ const char *GLX_PREFIX(glXGetClientString)( Display *dpy, int name )
     }
 }
 
-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;
@@ -1465,14 +1356,14 @@ void __glXClientInfo (  Display *dpy, int opcode  )
 ** EXT_import_context
 */
 
-Display *glXGetCurrentDisplay(void)
+PUBLIC Display *glXGetCurrentDisplay(void)
 {
     GLXContext gc = __glXGetCurrentContext();
     if (NULL == gc) return NULL;
     return gc->currentDpy;
 }
 
-GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
+PUBLIC GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
          glXGetCurrentDisplay)
 
 /**
@@ -1582,9 +1473,8 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
     return retval;
 }
 
-int
-GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx,
-                           int attribute, int *value)
+PUBLIC int
+glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
 {
     int retVal;
 
@@ -1615,17 +1505,17 @@ GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx,
     return Success;
 }
 
-GLX_ALIAS( int, glXQueryContextInfoEXT,
+PUBLIC GLX_ALIAS( int, glXQueryContextInfoEXT,
           (Display *dpy, GLXContext ctx, int attribute, int *value),
           (dpy, ctx, attribute, value),
           glXQueryContext )
 
-GLXContextID glXGetContextIDEXT(const GLXContext ctx)
+PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
 {
     return ctx->xid;
 }
 
-GLXContext GLX_PREFIX(glXImportContextEXT)(Display *dpy, GLXContextID contextID)
+PUBLIC GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID)
 {
     GLXContext ctx;
 
@@ -1645,7 +1535,7 @@ GLXContext GLX_PREFIX(glXImportContextEXT)(Display *dpy, GLXContextID contextID)
     return ctx;
 }
 
-void GLX_PREFIX(glXFreeContextEXT)(Display *dpy, GLXContext ctx)
+PUBLIC void glXFreeContextEXT(Display *dpy, GLXContext ctx)
 {
     DestroyContext(dpy, ctx);
 }
@@ -1656,16 +1546,17 @@ void GLX_PREFIX(glXFreeContextEXT)(Display *dpy, GLXContext ctx)
  * GLX 1.3 functions - these are just stubs for now!
  */
 
-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) ) {
+    if ( (config_list != NULL) && (list_size > 0) && (attribList != NULL) ) {
        list_size = choose_visual( config_list, list_size, attribList,
                                   GL_TRUE );
        if ( list_size == 0 ) {
@@ -1679,21 +1570,23 @@ GLXFBConfig *GLX_PREFIX(glXChooseFBConfig)(Display *dpy, int screen, const int *
 }
 
 
-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 );
 }
 
 
-GLXDrawable GLX_PREFIX(glXGetCurrentReadDrawable)(void)
+PUBLIC GLXDrawable glXGetCurrentReadDrawable(void)
 {
     GLXContext gc = __glXGetCurrentContext();
     return gc->currentReadable;
 }
 
 
-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;
@@ -1732,7 +1625,8 @@ GLXFBConfig *GLX_PREFIX(glXGetFBConfigs)(Display *dpy, int screen, int *nelement
 }
 
 
-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 );
 
@@ -1742,7 +1636,7 @@ int GLX_PREFIX(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attri
 }
 
 
-XVisualInfo *GLX_PREFIX(glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config)
+PUBLIC XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
 {
     XVisualInfo visualTemplate;
     __GLcontextModes * fbconfig = (__GLcontextModes *) config;
@@ -1760,14 +1654,14 @@ XVisualInfo *GLX_PREFIX(glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig conf
 ** GLX_SGI_make_current_read
 */
 
-GLX_ALIAS(GLXDrawable, glXGetCurrentReadDrawableSGI, (void), (),
+PUBLIC GLX_ALIAS(GLXDrawable, glXGetCurrentReadDrawableSGI, (void), (),
          glXGetCurrentReadDrawable)
 
 
 /*
 ** GLX_SGI_swap_control
 */
-int GLX_PREFIX(glXSwapIntervalSGI)(int interval)
+PUBLIC int glXSwapIntervalSGI(int interval)
 {
    xGLXVendorPrivateReq *req;
    GLXContext gc = __glXGetCurrentContext();
@@ -1828,7 +1722,7 @@ int GLX_PREFIX(glXSwapIntervalSGI)(int interval)
 /*
 ** GLX_MESA_swap_control
 */
-GLint GLX_PREFIX(glXSwapIntervalMESA)(unsigned interval)
+PUBLIC GLint glXSwapIntervalMESA(unsigned interval)
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
@@ -1860,7 +1754,7 @@ GLint GLX_PREFIX(glXSwapIntervalMESA)(unsigned interval)
    return GLX_BAD_CONTEXT;
 }
  
-GLint GLX_PREFIX(glXGetSwapIntervalMESA)( void )
+PUBLIC GLint glXGetSwapIntervalMESA( void )
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
@@ -1890,7 +1784,7 @@ GLint GLX_PREFIX(glXGetSwapIntervalMESA)( void )
 ** GLX_MESA_swap_frame_usage
 */
 
-GLint GLX_PREFIX(glXBeginFrameTrackingMESA)(Display *dpy, GLXDrawable drawable)
+PUBLIC GLint glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1910,7 +1804,7 @@ GLint GLX_PREFIX(glXBeginFrameTrackingMESA)(Display *dpy, GLXDrawable drawable)
 }
 
     
-GLint GLX_PREFIX(glXEndFrameTrackingMESA)(Display *dpy, GLXDrawable drawable)
+PUBLIC GLint glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1930,8 +1824,8 @@ GLint GLX_PREFIX(glXEndFrameTrackingMESA)(Display *dpy, GLXDrawable drawable)
 }
 
 
-GLint GLX_PREFIX(glXGetFrameUsageMESA)(Display *dpy, GLXDrawable drawable,
-                                      GLfloat *usage)
+PUBLIC GLint glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable,
+                                 GLfloat *usage)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1957,9 +1851,9 @@ GLint GLX_PREFIX(glXGetFrameUsageMESA)(Display *dpy, GLXDrawable drawable,
 }
 
 
-GLint GLX_PREFIX(glXQueryFrameTrackingMESA)(Display *dpy, GLXDrawable drawable,
-                                           int64_t *sbc, int64_t *missedFrames,
-                                           GLfloat *lastMissedUsage)
+PUBLIC GLint glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable,
+                                      int64_t *sbc, int64_t *missedFrames,
+                                      GLfloat *lastMissedUsage)
 {
    int   status = GLX_BAD_CONTEXT;
 #ifdef GLX_DIRECT_RENDERING
@@ -1989,7 +1883,7 @@ GLint GLX_PREFIX(glXQueryFrameTrackingMESA)(Display *dpy, GLXDrawable drawable,
 /*
 ** GLX_SGI_video_sync
 */
-int GLX_PREFIX(glXGetVideoSyncSGI)(unsigned int *count)
+PUBLIC 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
@@ -2018,7 +1912,7 @@ int GLX_PREFIX(glXGetVideoSyncSGI)(unsigned int *count)
    return GLX_BAD_CONTEXT;
 }
 
-int GLX_PREFIX(glXWaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count)
+PUBLIC int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
 {
 #ifdef GLX_DIRECT_RENDERING
    GLXContext gc = __glXGetCurrentContext();
@@ -2060,7 +1954,9 @@ int GLX_PREFIX(glXWaitVideoSyncSGI)(int divisor, int remainder, unsigned int *co
 */
 #if defined(_VL_H)
 
-GLXVideoSourceSGIX GLX_PREFIX(glXCreateGLXVideoSourceSGIX)(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
+PUBLIC GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX(Display *dpy,
+                                     int screen, VLServer server, VLPath path,
+                                     int nodeClass, VLNode drainNode)
 {
    (void) dpy;
    (void) screen;
@@ -2071,7 +1967,7 @@ GLXVideoSourceSGIX GLX_PREFIX(glXCreateGLXVideoSourceSGIX)(Display *dpy, int scr
    return 0;
 }
 
-void GLX_PREFIX(glXDestroyGLXVideoSourceSGIX)(Display *dpy, GLXVideoSourceSGIX src)
+PUBLIC void glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
 {
    (void) dpy;
    (void) src;
@@ -2086,22 +1982,23 @@ void GLX_PREFIX(glXDestroyGLXVideoSourceSGIX)(Display *dpy, GLXVideoSourceSGIX s
 ** GLX_functions table.
 */
 
-GLX_ALIAS(int, glXGetFBConfigAttribSGIX,
+PUBLIC GLX_ALIAS(int, glXGetFBConfigAttribSGIX,
          (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value),
          (dpy, config, attribute, value),
          glXGetFBConfigAttrib)
 
-GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX,
+PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX,
          (Display *dpy, int screen, int *attrib_list, int *nelements),
          (dpy, screen, attrib_list, nelements),
          glXChooseFBConfig)
 
-GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
+PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
          (Display * dpy, GLXFBConfigSGIX config),
          (dpy, config),
          glXGetVisualFromFBConfig)
 
-GLXPixmap GLX_PREFIX(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
+PUBLIC GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display *dpy,
+                            GLXFBConfigSGIX config, Pixmap pixmap)
 {
     xGLXVendorPrivateWithReplyReq *vpreq;
     xGLXCreateGLXPixmapWithConfigSGIXReq *req;
@@ -2142,7 +2039,9 @@ GLXPixmap GLX_PREFIX(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy, GLXFBConfig
     return xid;
 }
 
-GLXContext GLX_PREFIX(glXCreateContextWithConfigSGIX)(Display *dpy, GLXFBConfigSGIX config, int renderType, GLXContext shareList, Bool allowDirect)
+PUBLIC GLXContext glXCreateContextWithConfigSGIX(Display *dpy,
+                             GLXFBConfigSGIX config, int renderType,
+                             GLXContext shareList, Bool allowDirect)
 {
     GLXContext gc = NULL;
     const __GLcontextModes * const fbconfig = (__GLcontextModes *) config;
@@ -2164,7 +2063,8 @@ GLXContext GLX_PREFIX(glXCreateContextWithConfigSGIX)(Display *dpy, GLXFBConfigS
 }
 
 
-GLXFBConfigSGIX GLX_PREFIX(glXGetFBConfigFromVisualSGIX)(Display *dpy, XVisualInfo *vis)
+PUBLIC GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX(Display *dpy,
+                                                   XVisualInfo *vis)
 {
     __GLXdisplayPrivate *priv;
     __GLXscreenConfigs *psc;
@@ -2183,7 +2083,7 @@ GLXFBConfigSGIX GLX_PREFIX(glXGetFBConfigFromVisualSGIX)(Display *dpy, XVisualIn
 /*
 ** GLX_SGI_cushion
 */
-void GLX_PREFIX(glXCushionSGI)(Display *dpy, Window win, float cushion)
+PUBLIC void glXCushionSGI(Display *dpy, Window win, float cushion)
 {
    (void) dpy;
    (void) win;
@@ -2194,7 +2094,8 @@ void GLX_PREFIX(glXCushionSGI)(Display *dpy, Window win, float cushion)
 /*
 ** GLX_SGIX_video_resize
 */
-int GLX_PREFIX(glXBindChannelToWindowSGIX)(Display *dpy, int screen, int channel , Window window)
+PUBLIC int glXBindChannelToWindowSGIX(Display *dpy, int screen,
+                                     int channel , Window window)
 {
    (void) dpy;
    (void) screen;
@@ -2203,7 +2104,8 @@ int GLX_PREFIX(glXBindChannelToWindowSGIX)(Display *dpy, int screen, int channel
    return 0;
 }
 
-int GLX_PREFIX(glXChannelRectSGIX)(Display *dpy, int screen, int channel, int x, int y, int w, int h)
+PUBLIC int glXChannelRectSGIX(Display *dpy, int screen, int channel,
+                             int x, int y, int w, int h)
 {
    (void) dpy;
    (void) screen;
@@ -2215,7 +2117,8 @@ int GLX_PREFIX(glXChannelRectSGIX)(Display *dpy, int screen, int channel, int x,
    return 0;
 }
 
-int GLX_PREFIX(glXQueryChannelRectSGIX)(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
+PUBLIC int glXQueryChannelRectSGIX(Display *dpy, int screen, int channel,
+                                  int *x, int *y, int *w, int *h)
 {
    (void) dpy;
    (void) screen;
@@ -2227,7 +2130,8 @@ int GLX_PREFIX(glXQueryChannelRectSGIX)(Display *dpy, int screen, int channel, i
    return 0;
 }
 
-int GLX_PREFIX(glXQueryChannelDeltasSGIX)(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
+int glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel,
+                             int *dx, int *dy, int *dw, int *dh)
 {
    (void) dpy;
    (void) screen;
@@ -2239,7 +2143,8 @@ int GLX_PREFIX(glXQueryChannelDeltasSGIX)(Display *dpy, int screen, int channel,
    return 0;
 }
 
-int GLX_PREFIX(glXChannelRectSyncSGIX)(Display *dpy, int screen, int channel, GLenum synctype)
+PUBLIC int glXChannelRectSyncSGIX(Display *dpy, int screen,
+                                 int channel, GLenum synctype)
 {
    (void) dpy;
    (void) screen;
@@ -2251,7 +2156,8 @@ int GLX_PREFIX(glXChannelRectSyncSGIX)(Display *dpy, int screen, int channel, GL
 
 #if defined(_DM_BUFFER_H_)
 
-Bool GLX_PREFIX(glXAssociateDMPbufferSGIX)(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
+PUBLIC Bool glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer,
+                                     DMparams *params, DMbuffer dmbuffer)
 {
    (void) dpy;
    (void) pbuffer;
@@ -2266,7 +2172,8 @@ Bool GLX_PREFIX(glXAssociateDMPbufferSGIX)(Display *dpy, GLXPbufferSGIX pbuffer,
 /*
 ** GLX_SGIX_swap_group
 */
-void GLX_PREFIX(glXJoinSwapGroupSGIX)(Display *dpy, GLXDrawable drawable, GLXDrawable member)
+PUBLIC void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable,
+                                GLXDrawable member)
 {
    (void) dpy;
    (void) drawable;
@@ -2277,14 +2184,15 @@ void GLX_PREFIX(glXJoinSwapGroupSGIX)(Display *dpy, GLXDrawable drawable, GLXDra
 /*
 ** GLX_SGIX_swap_barrier
 */
-void GLX_PREFIX(glXBindSwapBarrierSGIX)(Display *dpy, GLXDrawable drawable, int barrier)
+PUBLIC void glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable,
+                                  int barrier)
 {
    (void) dpy;
    (void) drawable;
    (void) barrier;
 }
 
-Bool GLX_PREFIX(glXQueryMaxSwapBarriersSGIX)(Display *dpy, int screen, int *max)
+PUBLIC Bool glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
 {
    (void) dpy;
    (void) screen;
@@ -2296,7 +2204,8 @@ Bool GLX_PREFIX(glXQueryMaxSwapBarriersSGIX)(Display *dpy, int screen, int *max)
 /*
 ** GLX_SUN_get_transparent_index
 */
-Status GLX_PREFIX(glXGetTransparentIndexSUN)(Display *dpy, Window overlay, Window underlay, long *pTransparent)
+PUBLIC Status glXGetTransparentIndexSUN(Display *dpy, Window overlay,
+                                       Window underlay, long *pTransparent)
 {
    (void) dpy;
    (void) overlay;
@@ -2309,8 +2218,8 @@ Status GLX_PREFIX(glXGetTransparentIndexSUN)(Display *dpy, Window overlay, Windo
 /*
 ** GLX_OML_sync_control
 */
-Bool GLX_PREFIX(glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
-                                    int64_t *ust, int64_t *msc, int64_t *sbc)
+PUBLIC Bool glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
+                               int64_t *ust, int64_t *msc, int64_t *sbc)
 {
 #ifdef GLX_DIRECT_RENDERING
     __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
@@ -2354,8 +2263,8 @@ Bool GLX_PREFIX(glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
  *       when GLX_OML_sync_control appears in the client extension string.
  */
 
-Bool GLX_PREFIX(glXGetMscRateOML)(Display * dpy, GLXDrawable drawable,
-                                 int32_t * numerator, int32_t * denominator)
+PUBLIC Bool glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
+                            int32_t * numerator, int32_t * denominator)
 {
 #if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
    __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
@@ -2428,9 +2337,9 @@ Bool GLX_PREFIX(glXGetMscRateOML)(Display * dpy, GLXDrawable drawable,
 }
 
 
-int64_t GLX_PREFIX(glXSwapBuffersMscOML)(Display *dpy, GLXDrawable drawable,
-                                        int64_t target_msc,
-                                        int64_t divisor, int64_t remainder)
+PUBLIC int64_t glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
+                                   int64_t target_msc, int64_t divisor,
+                                   int64_t remainder)
 {
 #ifdef GLX_DIRECT_RENDERING
    int screen;
@@ -2463,10 +2372,10 @@ int64_t GLX_PREFIX(glXSwapBuffersMscOML)(Display *dpy, GLXDrawable drawable,
 }
 
 
-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)
+PUBLIC 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;
@@ -2506,9 +2415,9 @@ Bool GLX_PREFIX(glXWaitForMscOML)(Display * dpy, GLXDrawable drawable,
 }
 
 
-Bool GLX_PREFIX(glXWaitForSbcOML)(Display * dpy, GLXDrawable drawable,
-                                 int64_t target_sbc,
-                                 int64_t *ust, int64_t *msc, int64_t *sbc )
+PUBLIC 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;
@@ -2548,11 +2457,9 @@ Bool GLX_PREFIX(glXWaitForSbcOML)(Display * dpy, GLXDrawable drawable,
  */
 /*@{*/
 
-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 );
@@ -2577,7 +2484,7 @@ void *GLX_PREFIX(glXAllocateMemoryMESA)(Display *dpy, int scrn,
 }
 
 
-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 );
@@ -2595,8 +2502,8 @@ void GLX_PREFIX(glXFreeMemoryMESA)(Display *dpy, int scrn, void *pointer)
 }
 
 
-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 );
@@ -2644,7 +2551,7 @@ GLuint GLX_PREFIX(glXGetMemoryOffsetMESA)( Display *dpy, int scrn,
  *     glXDestroyPbuffer glXDestroyPixmap glXDestroyWindow
  *     glXDestroyGLXPbufferSGIX glXDestroyGLXVideoSourceSGIX
  */
-Bool GLX_PREFIX(glXReleaseBuffersMESA)( Display *dpy, GLXDrawable d )
+PUBLIC Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
 {
    (void) dpy;
    (void) d;
@@ -2652,9 +2559,8 @@ Bool GLX_PREFIX(glXReleaseBuffersMESA)( Display *dpy, GLXDrawable d )
 }
 
 
-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;
@@ -2664,8 +2570,8 @@ GLXPixmap GLX_PREFIX(glXCreateGLXPixmapMESA)( Display *dpy,
 }
 
 
-void GLX_PREFIX(glXCopySubBufferMESA)( Display *dpy, GLXDrawable drawable,
-                                       int x, int y, int width, int height )
+PUBLIC void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable,
+                                int x, int y, int width, int height)
 {
    (void) dpy;
    (void) drawable;
@@ -2676,7 +2582,7 @@ void GLX_PREFIX(glXCopySubBufferMESA)( Display *dpy, GLXDrawable drawable,
 }
 
 
-Bool GLX_PREFIX(glXSet3DfxModeMESA)( int mode )
+PUBLIC Bool glXSet3DfxModeMESA( int mode )
 {
    (void) mode;
    return GL_FALSE;
@@ -2866,28 +2772,9 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION( 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 ),
-
    /*** 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 */
@@ -2909,7 +2796,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.
@@ -2919,7 +2805,7 @@ get_glx_proc_address(const char *funcName)
  *
  * \sa glXGetProcAddress
  */
-void (*glXGetProcAddressARB(const GLubyte *procName))( void )
+PUBLIC void (*glXGetProcAddressARB(const GLubyte *procName))( void )
 {
    typedef void (*gl_function)( void );
    gl_function f;
@@ -2950,7 +2836,7 @@ void (*glXGetProcAddressARB(const GLubyte *procName))( void )
  *
  * \sa glXGetProcAddressARB
  */
-void (*glXGetProcAddress(const GLubyte *procName))( void )
+PUBLIC void (*glXGetProcAddress(const GLubyte *procName))( void )
 #if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
     __attribute__ ((alias ("glXGetProcAddressARB")));
 #else
@@ -2958,7 +2844,6 @@ void (*glXGetProcAddress(const GLubyte *procName))( void )
    return glXGetProcAddressARB(procName);
 }
 #endif /* __GNUC__ */
-#endif /* GLX_BUILT_IN_XMESA */
 
 
 #ifdef GLX_DIRECT_RENDERING
@@ -3001,8 +2886,10 @@ int __glXGetInternalVersion(void)
      * 20040415 - Added support for bindContext3 and unbindContext3.
      * 20040602 - Add __glXGetDrawableInfo.  I though that was there
      *            months ago. :(
+     * 20050725 - Gut all the old interfaces.  This breaks compatability with
+     *            any DRI driver built to any previous version.
      */
-    return 20040602;
+    return 20050725;
 }
 
 
@@ -3036,7 +2923,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 *);