summaryrefslogtreecommitdiffstats
path: root/src/glx
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 /src/glx
parentac3e838fa748c8c8a6ffc04d1ab13da71f75f103 (diff)
Move swap_interval to new extension mechanism.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glxclient.h4
-rw-r--r--src/glx/x11/glxcmds.c25
-rw-r--r--src/glx/x11/glxext.c12
3 files changed, 27 insertions, 14 deletions
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 */
}
}