Move swap_interval to new extension mechanism.
authorKristian Høgsberg <krh@hinata.boston.redhat.com>
Tue, 15 May 2007 20:09:44 +0000 (16:09 -0400)
committerKristian Høgsberg <krh@redhat.com>
Wed, 10 Oct 2007 23:14:10 +0000 (19:14 -0400)
19 files changed:
include/GL/internal/dri_interface.h
src/glx/x11/glxclient.h
src/glx/x11/glxcmds.c
src/glx/x11/glxext.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/common/vblank.c
src/mesa/drivers/dri/i915/intel_context.c
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mach64/mach64_screen.h
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/r128/r128_screen.h
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.h
src/mesa/drivers/dri/unichrome/via_screen.c
src/mesa/drivers/dri/unichrome/via_screen.h

index e2050c16b4fc5ae358aade2128371fd36416ce09..7eb168a1b90872c748d81976a574632bbd20b60b 100644 (file)
@@ -59,6 +59,7 @@ typedef struct __DRIinterfaceMethodsRec       __DRIinterfaceMethods;
 
 typedef struct __DRIextensionRec       __DRIextension;
 typedef struct __DRIcopySubBufferExtensionRec  __DRIcopySubBufferExtension;
+typedef struct __DRIswapControlExtensionRec    __DRIswapControlExtension;
 /*@}*/
 
 
@@ -83,6 +84,16 @@ struct __DRIcopySubBufferExtensionRec {
     void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
 };
 
+/**
+ * Used by drivers that implement the GLX_SGI_swap_control or
+ * GLX_MESA_swap_control extension.
+ */
+#define __DRI_SWAP_CONTROL "DRI_SwapControl"
+struct __DRIswapControlExtensionRec {
+    __DRIextension base;
+    void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
+    unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
+};
 
 /**
  * \name Functions provided by the driver loader.
@@ -483,14 +494,6 @@ struct __DRIdrawableRec {
     int (*queryFrameTracking)(__DRIdrawable *drawable,
                              int64_t * sbc, int64_t * missedFrames,
                              float * lastMissedUsage, float * usage);
-
-    /**
-     * Used by drivers that implement the GLX_SGI_swap_control or
-     * GLX_MESA_swap_control extension.
-     *
-     * \since Internal API version 20030317.
-     */
-    unsigned swap_interval;
 };
 
 #endif
index 2c7302823975526f5a793221e366359f06e1517e..09ae70212acf76ac73ba6aba11f6243239d57292 100644 (file)
@@ -481,6 +481,10 @@ struct __GLXscreenConfigsRec {
     __DRIcopySubBufferExtension *copySubBuffer;
 #endif
 
+#ifdef __DRI_SWAP_CONTROL
+    __DRIswapControlExtension *swapControl;
+#endif
+
 #endif
 
     /**
index 1bc5fff957c83c1d74397ff1fc55750d351444cb..6fda5125db720c313a525bb0b0d8955064fb276e 100644 (file)
@@ -1731,16 +1731,15 @@ static int __glXSwapIntervalSGI(int interval)
       return GLX_BAD_VALUE;
    }
 
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_SWAP_CONTROL
    if ( gc->isDirect ) {
        __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                             gc->screen );
        __DRIdrawable * const pdraw = GetDRIDrawable( gc->currentDpy,
                                                     gc->currentDrawable,
                                                     NULL );
-       if ( __glXExtensionBitIsEnabled( psc, SGI_swap_control_bit )
-           && (pdraw != NULL) ) {
-          pdraw->swap_interval = interval;
+       if (psc->swapControl != NULL && pdraw != NULL) {
+          psc->swapControl->setSwapInterval(pdraw, interval);
           return 0;
        }
        else {
@@ -1778,7 +1777,7 @@ static int __glXSwapIntervalSGI(int interval)
 */
 static int __glXSwapIntervalMESA(unsigned int interval)
 {
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_SWAP_CONTROL
    GLXContext gc = __glXGetCurrentContext();
 
    if ( interval < 0 ) {
@@ -1789,12 +1788,11 @@ static int __glXSwapIntervalMESA(unsigned int interval)
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                            gc->screen );
       
-      if ( (psc != NULL) && (psc->driScreen.private != NULL)
-          && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) {
+      if ( (psc != NULL) && (psc->driScreen.private != NULL) ) {
         __DRIdrawable * const pdraw = 
             GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
-        if ( pdraw != NULL ) {
-           pdraw->swap_interval = interval;
+        if (psc->swapControl != NULL && pdraw != NULL) {
+           psc->swapControl->setSwapInterval(pdraw, interval);
            return 0;
         }
       }
@@ -1809,19 +1807,18 @@ static int __glXSwapIntervalMESA(unsigned int interval)
 
 static int __glXGetSwapIntervalMESA(void)
 {
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_SWAP_CONTROL
    GLXContext gc = __glXGetCurrentContext();
 
    if ( (gc != NULL) && gc->isDirect ) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
                                                            gc->screen );
       
-      if ( (psc != NULL) && (psc->driScreen.private != NULL)
-          && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) {
+      if ( (psc != NULL) && (psc->driScreen.private != NULL) ) {
         __DRIdrawable * const pdraw = 
             GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
-        if ( pdraw != NULL ) {
-           return pdraw->swap_interval;
+        if (psc->swapControl != NULL && pdraw != NULL) {
+           return psc->swapControl->getSwapInterval(pdraw);
         }
       }
    }
index d0a7a64445a06d3efff30b46fe64ee2f735b8b0f..1563ca63943231c86b35784d11f994c086d7389c 100644 (file)
@@ -1027,6 +1027,18 @@ static void queryExtensions(__GLXscreenConfigs *psc)
            
        }
 #endif
+
+#ifdef __DRI_SWAP_CONTROL
+       if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
+           psc->swapControl = (__DRIswapControlExtension *) extensions[i];
+           __glXScrEnableExtension(&psc->driScreen,
+                                   "GLX_SGI_swap_control");
+           __glXScrEnableExtension(&psc->driScreen,
+                                   "GLX_MESA_swap_control");
+           
+       }
+#endif
+
        /* Ignore unknown extensions */
     }
 }
index fc7755797d65027e5f7ead0062015adb13cf0efe..ba677f6ff866e25ecd01eb41a0090309c29d5d06 100644 (file)
@@ -435,6 +435,27 @@ const __DRIcopySubBufferExtension driCopySubBufferExtension = {
     { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer
 };
 
+static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval)
+{
+    __DRIdrawablePrivate *dpriv = drawable->private;
+
+    dpriv->swap_interval = interval;
+}
+
+static unsigned int driGetSwapInterval(__DRIdrawable *drawable)
+{
+    __DRIdrawablePrivate *dpriv = drawable->private;
+
+    return dpriv->swap_interval;
+}
+
+const __DRIswapControlExtension driSwapControlExtension = {
+    { __DRI_SWAP_CONTROL },
+    driSetSwapInterval,
+    driGetSwapInterval
+};
+
+
 /**
  * This is called via __DRIscreenRec's createNewDrawable pointer.
  */
@@ -501,7 +522,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen,
      * default value when the drawable is first bound to a direct
      * rendering context. 
      */
-    pdraw->swap_interval = (unsigned)-1;
+    pdp->swap_interval = (unsigned)-1;
 
     pdp->swapBuffers = psp->DriverAPI.SwapBuffers;
 
@@ -716,7 +737,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc,
                             
 {
     __DRIscreenPrivate *psp;
-    static const __DRIextension emptyExtensionList[] = { NULL };
+    static const __DRIextension *emptyExtensionList[] = { NULL };
     dri_interface = interface;
     api_ver = internal_api_version;
 
@@ -868,8 +889,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
 
 
    if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) {
-      interval = (dPriv->pdraw->swap_interval != 0)
-         ? dPriv->pdraw->swap_interval : 1;
+      interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1;
 
 
       /* We want to calculate
index 59bb66d21bce3b47e09c4faac24e9468ad4caf5c..78320307d60dca8504e0423e351816b2a207b01e 100644 (file)
@@ -77,6 +77,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp);
  * Extensions.
  */
 extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
+extern const __DRIswapControlExtension driSwapControlExtension;
 
 /**
  * Used by DRI_VALIDATE_DRAWABLE_INFO
@@ -327,6 +328,12 @@ struct __DRIdrawablePrivateRec {
      * Called via glXSwapBuffers().
      */
     void (*swapBuffers)( __DRIdrawablePrivate *dPriv );
+
+    /**
+     * Controls swap interval as used by GLX_SGI_swap_control and
+     * GLX_MESA_swap_control.
+     */
+    unsigned int swap_interval;
 };
 
 /**
index e7ed545f13c87a41913d38894d5732e4202e5058..3b5acfecb128cff27f79f54adee1a27b370aa065 100644 (file)
@@ -255,13 +255,13 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
 void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags,
                            GLuint *vbl_seq )
 {
-   if ( priv->pdraw->swap_interval == (unsigned)-1 ) {
+   if ( priv->swap_interval == (unsigned)-1 ) {
       /* Get current vertical blank sequence */
       drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } };
       do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd );
 
-      priv->pdraw->swap_interval = (flags & (VBLANK_FLAG_THROTTLE |
-                                            VBLANK_FLAG_SYNC)) != 0 ? 1 : 0;
+      priv->swap_interval = (flags & (VBLANK_FLAG_THROTTLE |
+                                     VBLANK_FLAG_SYNC)) != 0 ? 1 : 0;
    }
 }
 
@@ -277,9 +277,9 @@ driGetVBlankInterval( const  __DRIdrawablePrivate *priv, GLuint flags )
    if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
       /* this must have been initialized when the drawable was first bound
        * to a direct rendering context. */
-      assert ( priv->pdraw->swap_interval != (unsigned)-1 );
+      assert ( priv->swap_interval != (unsigned)-1 );
 
-      return priv->pdraw->swap_interval;
+      return priv->swap_interval;
    }
    else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
       return 1;
index 041a155fe73648db11be7e8d24a76ab51b1b7cd9..d7af432ad6b50493e63d64a8ed31f3b0b169dfa7 100644 (file)
@@ -613,7 +613,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
       if (intel->ctx.DrawBuffer == &intel_fb->Base) {
 
         if (intel->driDrawable != driDrawPriv) {
-           if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) {
+           if (driDrawPriv->swap_interval == (unsigned)-1) {
               int i;
 
               intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0)
index 792f26b5ed402d018ad764a5011e0b834289ff41..f507a3bf05f926bfb4fe0adc262290256b91d3a6 100644 (file)
@@ -421,6 +421,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
 
 static const __DRIextension *intelExtensions[] = {
     &driCopySubBufferExtension.base,
+    &driSwapControlExtension.base,
     NULL
 };
 
@@ -529,9 +530,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
    sPriv->extensions = intelExtensions;
 
    if (glx_enable_extension != NULL) {
-      (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control");
       (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync");
-      (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_control");
       (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage");
       (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read");
    }
index 1f74103f6516d5a886d624eb40ea3b50e14f9e6a..c75a86bf5b2db712ad009fe6c9c20ccb632636c2 100644 (file)
@@ -266,6 +266,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen,
 
 static const __DRIextension *intelExtensions[] = {
     &driCopySubBufferExtension.base,
+    &driSwapControlExtension.base,
     NULL
 };
 
@@ -357,9 +358,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
    sPriv->extensions = intelExtensions;
 
    if (glx_enable_extension != NULL) {
-      (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
       (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
-      (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
       (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
       (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
    }
index ff261c841d7df0e260cd7d37eebfce2f3609daa3..46314b426f7c79d1be145f9b9a1b0a0ba424d7ef 100644 (file)
@@ -210,6 +210,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
    ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
    PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
      (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+   int i;
 
    if (sPriv->devPrivSize != sizeof(ATIDRIRec)) {
       fprintf(stderr,"\nERROR!  sizeof(ATIDRIRec) does not match passed size from device driver\n");
@@ -318,15 +319,18 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
 
    mach64Screen->driScreen = sPriv;
 
+   i = 0;
    if ( glx_enable_extension != NULL ) {
       if ( mach64Screen->irq != 0 ) {
-        (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+        mach64Screen->extensions[i++] = &driSwapControlExtension.base;
+
         (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
-        (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
       }
 
       (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
    }
+   mach64Screen->extensions[i++] = NULL;
+   sPriv->extensions = mach64Screen->extensions;
 
    return mach64Screen;
 }
index 5305058e2fb50542ba2621bd680302fd999979b8..36da7157707d13083b9a5f7b19974639ad507d46 100644 (file)
@@ -73,6 +73,8 @@ typedef struct {
    __DRIscreenPrivate *driScreen;
 
    driOptionCache optionCache;
+
+   const __DRIextension *extensions[2];
 } mach64ScreenRec, *mach64ScreenPtr;
 
 #endif /* __MACH64_SCREEN_H__ */
index 5b4693983af16f51ea91e9b21a05601c950070b2..eba96486f6756cc17fdd8cbfa85d164eaa8b2226 100644 (file)
@@ -193,6 +193,11 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits,
 }
 
 
+static const __DRIextension *mgaExtensions[] = {
+    &driSwapControlExtension.base,
+    NULL
+};
+
 static GLboolean
 mgaInitDriver(__DRIscreenPrivate *sPriv)
 {
@@ -234,11 +239,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
       }
    }
 
+   sPriv->extensions = mgaExtensions;
+
    if ( glx_enable_extension != NULL ) {
-      (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
       (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
       (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
-      (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
       (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
    }
 
index 446280c399f86d264bed0b19195442cd1a71c857..9e5c25d7207e06a713441fbb8019c571ac6ac841 100644 (file)
@@ -100,6 +100,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
    R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv;
    PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
      (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+   int i;
 
    if (sPriv->devPrivSize != sizeof(R128DRIRec)) {
       fprintf(stderr,"\nERROR!  sizeof(R128DRIRec) does not match passed size from device driver\n");
@@ -225,15 +226,17 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
 
    r128Screen->driScreen = sPriv;
 
+   i = 0;
    if ( glx_enable_extension != NULL ) {
       if ( r128Screen->irq != 0 ) {
-        (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+         r128Screen->extensions[i++] = &driSwapControlExtension.base;
         (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
-        (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
       }
 
       (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
    }
+   r128Screen->extensions[i++] = NULL;
+   sPriv->extensions = r128Screen->extensions;
 
    return r128Screen;
 }
index 8db8eea3587d3ef54ea7c2e87cdadd853477e9bb..9733927274223a4a53a1ca21d3d35b01e7bc1e5c 100644 (file)
@@ -78,6 +78,8 @@ typedef struct {
    /* Configuration cache with default values for all contexts */
    driOptionCache optionCache;
 
+   const __DRIextension *extensions[2];
+
 } r128ScreenRec, *r128ScreenPtr;
 
 
index 7e533fef2ccf62273ebb6901fbbeb5d69265090e..46160babb015bdae3d84f47716cc192fe7915200 100644 (file)
@@ -332,11 +332,6 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits,
     return modes;
 }
 
-static const __DRIextension *radeonExtensions[] = {
-    &driCopySubBufferExtension.base,
-    NULL
-};
-
 /* Create the device specific screen private data struct.
  */
 static radeonScreenPtr
@@ -347,6 +342,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
    unsigned char *RADEONMMIO;
    PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
      (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+   int i;
 
    if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
       fprintf(stderr,"\nERROR!  sizeof(RADEONDRIRec) does not match passed size from device driver\n");
@@ -735,13 +731,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
         dri_priv->log2GARTTexGran;
    }
 
-   sPriv->extensions = radeonExtensions;
+   i = 0;
+   screen->extensions[i++] = &driCopySubBufferExtension.base;
 
    if ( glx_enable_extension != NULL ) {
       if ( screen->irq != 0 ) {
-        (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+         screen->extensions[i++] = &driSwapControlExtension.base;
         (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
-        (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
       }
 
       (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
@@ -750,6 +746,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
 
       (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
    }
+   screen->extensions[i++] = NULL;
+   sPriv->extensions = screen->extensions;
 
 #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
    if (IS_R200_CLASS(screen)) {
index 25e6fcf399a0879b7a0956c02b9876f7a27bc607..eceab53f5f50cb4956c4afbf0cbeb0e0be890a39 100644 (file)
@@ -103,6 +103,8 @@ typedef struct {
 
    /* Configuration cache with default values for all contexts */
    driOptionCache optionCache;
+
+   const __DRIextension *extensions[3];
 } radeonScreenRec, *radeonScreenPtr;
 
 #define IS_R100_CLASS(screen) \
index 53f4c5c56424abb0d8f7ede96c752070bc11b19a..153e401a1651e147e2a78dcb68a269d8d0c7821e 100644 (file)
@@ -100,6 +100,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
     VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
     PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
       (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+    int i;
 
     if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
       fprintf(stderr,"\nERROR!  sizeof(VIADRIRec) does not match passed size from device driver\n");
@@ -174,16 +175,18 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
 
     viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset;
 
+    i = 0;
     if ( glx_enable_extension != NULL ) {
        if ( viaScreen->irqEnabled ) {
-         (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+         viaScreen->extensions[i++] = &driSwapControlExtension.base;
          (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
-         (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
        }
 
        (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
        (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
     }
+    viaScreen->extensions[i++] = NULL;
+    sPriv->extensions = viaScreen->extensions;
 
     return GL_TRUE;
 }
index 84aa5aef88e0f0e4d221b38829a212325b29f789..85f87c4da394305108b6d7dfc81c5ee252e2aae4 100644 (file)
@@ -70,6 +70,8 @@ typedef struct {
 
     /* Configuration cache with default values for all contexts */
     driOptionCache optionCache;
+
+    const __DRIextension *extensions[2];
 } viaScreenPrivate;