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.
This commit is contained in:
Kristian Høgsberg 2008-02-25 16:14:37 -05:00
parent b49a8f805a
commit 6e8d21d72f
16 changed files with 10 additions and 82 deletions

View File

@ -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);
};

View File

@ -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;
}
}

View File

@ -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,
};

View File

@ -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,

View File

@ -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

View File

@ -614,7 +614,6 @@ static const struct __DriverAPIRec ffbAPI = {
.MakeCurrent = ffbMakeCurrent,
.UnbindContext = ffbUnbindContext,
.GetSwapInfo = NULL,
.GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,

View File

@ -412,7 +412,6 @@ static const struct __DriverAPIRec i810API = {
.MakeCurrent = i810MakeCurrent,
.UnbindContext = i810UnbindContext,
.GetSwapInfo = NULL,
.GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,

View File

@ -672,7 +672,6 @@ static const struct __DriverAPIRec intelAPI = {
.MakeCurrent = intelMakeCurrent,
.UnbindContext = intelUnbindContext,
.GetSwapInfo = intelGetSwapInfo,
.GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,

View File

@ -483,7 +483,6 @@ static struct __DriverAPIRec mach64API = {
.MakeCurrent = mach64MakeCurrent,
.UnbindContext = mach64UnbindContext,
.GetSwapInfo = NULL,
.GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,

View File

@ -950,7 +950,6 @@ static const struct __DriverAPIRec mgaAPI = {
.MakeCurrent = mgaMakeCurrent,
.UnbindContext = mgaUnbindContext,
.GetSwapInfo = getSwapInfo,
.GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,

View File

@ -205,7 +205,6 @@ static const struct __DriverAPIRec nouveauAPI = {
.MakeCurrent = nouveauMakeCurrent,
.UnbindContext = nouveauUnbindContext,
.GetSwapInfo = nouveauGetSwapInfo,
.GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,

View File

@ -410,7 +410,6 @@ static struct __DriverAPIRec r128API = {
.MakeCurrent = r128MakeCurrent,
.UnbindContext = r128UnbindContext,
.GetSwapInfo = NULL,
.GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,

View File

@ -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,

View File

@ -313,7 +313,6 @@ static struct __DriverAPIRec sisAPI = {
.MakeCurrent = sisMakeCurrent,
.UnbindContext = sisUnbindContext,
.GetSwapInfo = NULL,
.GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,

View File

@ -354,7 +354,6 @@ static const struct __DriverAPIRec tdfxAPI = {
.MakeCurrent = tdfxMakeCurrent,
.UnbindContext = tdfxUnbindContext,
.GetSwapInfo = NULL,
.GetMSC = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,

View File

@ -333,7 +333,6 @@ static struct __DriverAPIRec viaAPI = {
.MakeCurrent = viaMakeCurrent,
.UnbindContext = viaUnbindContext,
.GetSwapInfo = getSwapInfo,
.GetMSC = driGetMSC32,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,