From 6e8d21d72f35767e07081a8bee4323aaaf5e2aae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 25 Feb 2008 16:14:37 -0500 Subject: [PATCH] Remove GetMSC DriverAPI function. The DriverAPI is internal to the DRI drivers and GetDrawableMSC obsoletes GetMSC. Also, since the DRI driver interface has not yet been released, just drop the getMSC function from the DRI interface instead using the ABI preserving version mechanism. Finally, using void pointer privates in the DRI interface is not allowed, always pass the actual types around (__DRIdrawable in this case) to enhance type safety and readability of the code. --- include/GL/internal/dri_interface.h | 15 ++--------- src/glx/x11/glxcmds.c | 12 ++------- src/mesa/drivers/dri/common/dri_util.c | 16 +++--------- src/mesa/drivers/dri/common/dri_util.h | 11 +++----- src/mesa/drivers/dri/common/vblank.c | 26 ------------------- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 1 - src/mesa/drivers/dri/i810/i810screen.c | 1 - src/mesa/drivers/dri/intel/intel_screen.c | 1 - src/mesa/drivers/dri/mach64/mach64_screen.c | 1 - src/mesa/drivers/dri/mga/mga_xmesa.c | 1 - src/mesa/drivers/dri/nouveau/nouveau_screen.c | 1 - src/mesa/drivers/dri/r128/r128_screen.c | 1 - src/mesa/drivers/dri/radeon/radeon_screen.c | 2 -- src/mesa/drivers/dri/sis/sis_screen.c | 1 - src/mesa/drivers/dri/tdfx/tdfx_screen.c | 1 - src/mesa/drivers/dri/unichrome/via_screen.c | 1 - 16 files changed, 10 insertions(+), 82 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index b83aff18f97..888b91df586 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -171,16 +171,10 @@ struct __DRIframeTrackingExtensionRec { * Used by drivers that implement the GLX_SGI_video_sync extension. */ #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" -#define __DRI_MEDIA_STREAM_COUNTER_VERSION 2 +#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 struct __DRImediaStreamCounterExtensionRec { __DRIextension base; - /** - * Get the number of vertical refreshes since some point in time before - * this function was first called (i.e., system start up). - */ - int (*getMSC)(__DRIscreen *screen, int64_t *msc); - /** * Wait for the MSC to equal target_msc, or, if that has already passed, * the next time (MSC % divisor) is equal to remainder. If divisor is @@ -192,15 +186,10 @@ struct __DRImediaStreamCounterExtensionRec { int64_t * msc, int64_t * sbc); /** - * Like the screen version of getMSC, but also takes a drawable so that - * the appropriate pipe's counter can be retrieved. - * * Get the number of vertical refreshes since some point in time before * this function was first called (i.e., system start up). - * - * \since Internal API version 2 */ - int (*getDrawableMSC)(__DRIscreen *screen, void *drawablePrivate, + int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable, int64_t *msc); }; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 7ff2bf700c9..3b7b7b94c35 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1953,17 +1953,9 @@ static int __glXGetVideoSyncSGI(unsigned int *count) 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); + ret = (*psc->msc->getDrawableMSC)(&psc->driScreen, pdraw, &temp); *count = (unsigned) temp; + return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 01751582faf..9928a0f0319 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -450,22 +450,13 @@ static void driSwapBuffers(__DRIdrawable *drawable) &rect, 1, GL_TRUE); } -static int driDrawableGetMSC( __DRIscreen *screen, void *drawablePrivate, +static int driDrawableGetMSC( __DRIscreen *screen, __DRIdrawable *drawable, int64_t *msc ) { __DRIscreenPrivate *sPriv = screen->private; + __DRIdrawablePrivate *dPriv = drawable->private; - return sPriv->DriverAPI.GetDrawableMSC( sPriv, drawablePrivate, msc ); -} - -/** - * Called directly from a number of higher-level GLX functions. - */ -static int driGetMSC( __DRIscreen *screen, void *drawablePrivate, int64_t *msc ) -{ - __DRIscreenPrivate *sPriv = screen->private; - - return sPriv->DriverAPI.GetMSC( sPriv, msc ); + return sPriv->DriverAPI.GetDrawableMSC(sPriv, dPriv, msc); } static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, @@ -496,7 +487,6 @@ static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, - driGetMSC, driWaitForMSC, driDrawableGetMSC, }; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index fb2081412a6..cb9e8909b7e 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -183,12 +183,6 @@ struct __DriverAPIRec { int (*GetSwapInfo)( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); - /** - * Required if GLX_SGI_video_sync or GLX_OML_sync_control is - * supported. - */ - int (*GetMSC)( __DRIscreenPrivate * priv, int64_t * count ); - /** * These are required if GLX_OML_sync_control is supported. */ @@ -206,8 +200,9 @@ struct __DriverAPIRec { int x, int y, int w, int h); /** - * New version of GetMSC so we can pass drawable data to the low level - * DRM driver (e.g. pipe info). + * New version of GetMSC so we can pass drawable data to the low + * level DRM driver (e.g. pipe info). Required if + * GLX_SGI_video_sync or GLX_OML_sync_control is supported. */ int (*GetDrawableMSC) ( __DRIscreenPrivate * priv, __DRIdrawablePrivate *drawablePrivate, diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index 8f8d94853ea..e81cc6886f2 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -91,32 +91,6 @@ int driDrawableGetMSC32( __DRIscreenPrivate * priv, return ret; } -/** - * Get the current MSC refresh counter. - * - * Stores the 64-bit count of vertical refreshes since some (arbitrary) - * point in time in \c count. Unless the value wraps around, which it - * may, it will never decrease. - * - * \warning This function is called from \c glXGetVideoSyncSGI, which expects - * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which - * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl - * currently always returns a \c sequence of type \c unsigned. - * - * Since this function doesn't take a drawable, it may end up getting the MSC - * value from a pipe not associated with the caller's context, resuling in - * undesired behavior. - * - * \param priv Pointer to the DRI screen private struct. - * \param count Storage to hold MSC counter. - * \return Zero is returned on success. A negative errno value - * is returned on failure. - */ -int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ) -{ - return driDrawableGetMSC32(priv, NULL, count); -} - /****************************************************************************/ /** * Wait for a specified refresh count. This implements most of the diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 173c5fa952a..0293a6185c3 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -614,7 +614,6 @@ static const struct __DriverAPIRec ffbAPI = { .MakeCurrent = ffbMakeCurrent, .UnbindContext = ffbUnbindContext, .GetSwapInfo = NULL, - .GetMSC = NULL, .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 1a0d3c33d7b..a0d8103dc1c 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -412,7 +412,6 @@ static const struct __DriverAPIRec i810API = { .MakeCurrent = i810MakeCurrent, .UnbindContext = i810UnbindContext, .GetSwapInfo = NULL, - .GetMSC = NULL, .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 50cab3de06f..8dec808ecfc 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -672,7 +672,6 @@ static const struct __DriverAPIRec intelAPI = { .MakeCurrent = intelMakeCurrent, .UnbindContext = intelUnbindContext, .GetSwapInfo = intelGetSwapInfo, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index a04b7754842..e59cc914c8b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -483,7 +483,6 @@ static struct __DriverAPIRec mach64API = { .MakeCurrent = mach64MakeCurrent, .UnbindContext = mach64UnbindContext, .GetSwapInfo = NULL, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 896f2d94fc6..b0282e5f65b 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -950,7 +950,6 @@ static const struct __DriverAPIRec mgaAPI = { .MakeCurrent = mgaMakeCurrent, .UnbindContext = mgaUnbindContext, .GetSwapInfo = getSwapInfo, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 4838ffcb0b4..f6274ac1f2b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -205,7 +205,6 @@ static const struct __DriverAPIRec nouveauAPI = { .MakeCurrent = nouveauMakeCurrent, .UnbindContext = nouveauUnbindContext, .GetSwapInfo = nouveauGetSwapInfo, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 719f9367c01..e24fb509278 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -410,7 +410,6 @@ static struct __DriverAPIRec r128API = { .MakeCurrent = r128MakeCurrent, .UnbindContext = r128UnbindContext, .GetSwapInfo = NULL, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 5afc6d9c2f4..0b303b3c34a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -995,7 +995,6 @@ static struct __DriverAPIRec radeonAPI = { .MakeCurrent = radeonMakeCurrent, .UnbindContext = radeonUnbindContext, .GetSwapInfo = getSwapInfo, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, @@ -1013,7 +1012,6 @@ static const struct __DriverAPIRec r200API = { .MakeCurrent = r200MakeCurrent, .UnbindContext = r200UnbindContext, .GetSwapInfo = getSwapInfo, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 671193577d4..d361d14e62e 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -313,7 +313,6 @@ static struct __DriverAPIRec sisAPI = { .MakeCurrent = sisMakeCurrent, .UnbindContext = sisUnbindContext, .GetSwapInfo = NULL, - .GetMSC = NULL, .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 6298de82f40..53c04e7bb14 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -354,7 +354,6 @@ static const struct __DriverAPIRec tdfxAPI = { .MakeCurrent = tdfxMakeCurrent, .UnbindContext = tdfxUnbindContext, .GetSwapInfo = NULL, - .GetMSC = NULL, .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 8d6cebeb795..e6cc99eb86a 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -333,7 +333,6 @@ static struct __DriverAPIRec viaAPI = { .MakeCurrent = viaMakeCurrent, .UnbindContext = viaUnbindContext, .GetSwapInfo = getSwapInfo, - .GetMSC = driGetMSC32, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, -- 2.30.2