diff options
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/x11/glxcmds.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 1497c6b30eb..37bfc2a67cf 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1942,13 +1942,24 @@ static int __glXGetVideoSyncSGI(unsigned int *count) if ( (gc != NULL) && gc->isDirect ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); - if (psc->msc != NULL && psc->driScreen.private != NULL) { - int ret; - int64_t temp; - - ret = psc->msc->getMSC(&psc->driScreen, &temp); - *count = (unsigned) temp; - return (ret == 0) ? 0 : GLX_BAD_CONTEXT; + if ( psc->msc && psc->driScreen.private ) { + __DRIdrawable * const pdraw = + GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); + int64_t temp; + int ret; + + /* + * Try to use getDrawableMSC first so we get the right + * counter... + */ + if (psc->msc->base.version >= 2 && psc->msc->getDrawableMSC) + ret = (*psc->msc->getDrawableMSC)( &psc->driScreen, + pdraw->private, + & temp); + else + ret = (*psc->msc->getMSC)( &psc->driScreen, & temp); + *count = (unsigned) temp; + return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } } #else @@ -1971,16 +1982,14 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count if (psc->msc != NULL && psc->driScreen.private ) { __DRIdrawable * const pdraw = GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); - if (pdraw != NULL) { - int ret; - int64_t msc; - int64_t sbc; - - ret = (*psc->msc->waitForMSC)(pdraw, 0, - divisor, remainder, &msc, &sbc); - *count = (unsigned) msc; - return (ret == 0) ? 0 : GLX_BAD_CONTEXT; - } + int ret; + int64_t msc; + int64_t sbc; + + ret = (*psc->msc->waitForMSC)(pdraw, 0, divisor, remainder, &msc, + &sbc); + *count = (unsigned) msc; + return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } } #else |