* 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
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);
};
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;
}
}
&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,
const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = {
{ __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION },
- driGetMSC,
driWaitForMSC,
driDrawableGetMSC,
};
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.
*/
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,
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
.MakeCurrent = ffbMakeCurrent,
.UnbindContext = ffbUnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,
.MakeCurrent = i810MakeCurrent,
.UnbindContext = i810UnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,
.MakeCurrent = intelMakeCurrent,
.UnbindContext = intelUnbindContext,
.GetSwapInfo = intelGetSwapInfo,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = mach64MakeCurrent,
.UnbindContext = mach64UnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = mgaMakeCurrent,
.UnbindContext = mgaUnbindContext,
.GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = nouveauMakeCurrent,
.UnbindContext = nouveauUnbindContext,
.GetSwapInfo = nouveauGetSwapInfo,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = r128MakeCurrent,
.UnbindContext = r128UnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = radeonMakeCurrent,
.UnbindContext = radeonUnbindContext,
.GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = r200MakeCurrent,
.UnbindContext = r200UnbindContext,
.GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.MakeCurrent = sisMakeCurrent,
.UnbindContext = sisUnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,
.MakeCurrent = tdfxMakeCurrent,
.UnbindContext = tdfxUnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,
.MakeCurrent = viaMakeCurrent,
.UnbindContext = viaUnbindContext,
.GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,