summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2007-05-15 16:09:44 -0400
committerKristian Høgsberg <[email protected]>2007-10-10 19:14:10 -0400
commitefaf90b03e8b69e04909bce071f8ef6b65cc0e9d (patch)
tree04ec5f1e1f7e6b96ee986763ee6b48d4de43b5f3
parentac3e838fa748c8c8a6ffc04d1ab13da71f75f103 (diff)
Move swap_interval to new extension mechanism.
-rw-r--r--include/GL/internal/dri_interface.h19
-rw-r--r--src/glx/x11/glxclient.h4
-rw-r--r--src/glx/x11/glxcmds.c25
-rw-r--r--src/glx/x11/glxext.c12
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c28
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h7
-rw-r--r--src/mesa/drivers/dri/common/vblank.c10
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c8
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.h2
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c9
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c7
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c14
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.h2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c7
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.h2
19 files changed, 114 insertions, 52 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index e2050c16b4f..7eb168a1b90 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -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
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 2c730282397..09ae70212ac 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -481,6 +481,10 @@ struct __GLXscreenConfigsRec {
__DRIcopySubBufferExtension *copySubBuffer;
#endif
+#ifdef __DRI_SWAP_CONTROL
+ __DRIswapControlExtension *swapControl;
+#endif
+
#endif
/**
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 1bc5fff957c..6fda5125db7 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -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);
}
}
}
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index d0a7a64445a..1563ca63943 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -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 */
}
}
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index fc7755797d6..ba677f6ff86 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -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
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 59bb66d21bc..78320307d60 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -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;
};
/**
diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c
index e7ed545f13c..3b5acfecb12 100644
--- a/src/mesa/drivers/dri/common/vblank.c
+++ b/src/mesa/drivers/dri/common/vblank.c
@@ -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;
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 041a155fe73..d7af432ad6b 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -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)
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 792f26b5ed4..f507a3bf05f 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -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");
}
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 1f74103f651..c75a86bf5b2 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -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" );
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index ff261c841d7..46314b426f7 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h
index 5305058e2fb..36da7157707 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.h
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.h
@@ -73,6 +73,8 @@ typedef struct {
__DRIscreenPrivate *driScreen;
driOptionCache optionCache;
+
+ const __DRIextension *extensions[2];
} mach64ScreenRec, *mach64ScreenPtr;
#endif /* __MACH64_SCREEN_H__ */
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 5b4693983af..eba96486f67 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -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" );
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index 446280c399f..9e5c25d7207 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h
index 8db8eea3587..97339272742 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.h
+++ b/src/mesa/drivers/dri/r128/r128_screen.h
@@ -78,6 +78,8 @@ typedef struct {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
+ const __DRIextension *extensions[2];
+
} r128ScreenRec, *r128ScreenPtr;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 7e533fef2cc..46160babb01 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -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)) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index 25e6fcf399a..eceab53f5f5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -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) \
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 53f4c5c5642..153e401a165 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h
index 84aa5aef88e..85f87c4da39 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.h
+++ b/src/mesa/drivers/dri/unichrome/via_screen.h
@@ -70,6 +70,8 @@ typedef struct {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
+
+ const __DRIextension *extensions[2];
} viaScreenPrivate;