Remove GetMSC DriverAPI function.
authorKristian Høgsberg <krh@redhat.com>
Mon, 25 Feb 2008 21:14:37 +0000 (16:14 -0500)
committerKristian Høgsberg <krh@redhat.com>
Tue, 26 Feb 2008 00:02:06 +0000 (19:02 -0500)
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.

16 files changed:
include/GL/internal/dri_interface.h
src/glx/x11/glxcmds.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/common/vblank.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/tdfx/tdfx_screen.c
src/mesa/drivers/dri/unichrome/via_screen.c

index b83aff18f9738ca4fa2673ab250998874c618601..888b91df58658f52cf44bd407baecfdad80d1c10 100644 (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);
 };
 
index 7ff2bf700c9482259b831d8a2190e4e16d547c35..3b7b7b94c351b4ea2ca0ac74e2b12472eb593043 100644 (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;
       }
    }
index 01751582faf83167377c05622ced43bb48ee00e3..9928a0f0319af9efc3c68b67a1a4e9fd9cd08c0e 100644 (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,
 };
index fb2081412a69ac837ca26a256c920f364ce47264..cb9e8909b7efd50f02b2cff2515e7c657a25bb4c 100644 (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,
index 8f8d94853ea9945002cdf33a0cf26bdbe87d7235..e81cc6886f2bd5cc97ed6e3f79d09827f7c58273 100644 (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
index 173c5fa952a005657fd578385efd45e6fb4905f9..0293a6185c342bcebc3f118d945bef807acc1e1f 100644 (file)
@@ -614,7 +614,6 @@ static const struct __DriverAPIRec ffbAPI = {
    .MakeCurrent     = ffbMakeCurrent,
    .UnbindContext   = ffbUnbindContext,
    .GetSwapInfo     = NULL,
-   .GetMSC          = NULL,
    .GetDrawableMSC  = NULL,
    .WaitForMSC      = NULL,
    .WaitForSBC      = NULL,
index 1a0d3c33d7b149411910c82b0fc4d6f3d0143d55..a0d8103dc1cc7710c56ad3b0f820f7616c869fea 100644 (file)
@@ -412,7 +412,6 @@ static const struct __DriverAPIRec i810API = {
    .MakeCurrent     = i810MakeCurrent,
    .UnbindContext   = i810UnbindContext,
    .GetSwapInfo     = NULL,
-   .GetMSC          = NULL,
    .GetDrawableMSC  = NULL,
    .WaitForMSC      = NULL,
    .WaitForSBC      = NULL,
index 50cab3de06f9d90854e7eb507dd4d0d7229beee2..8dec808ecfc9f1fe912fc221a02d541fd11b7d95 100644 (file)
@@ -672,7 +672,6 @@ static const struct __DriverAPIRec intelAPI = {
    .MakeCurrent = intelMakeCurrent,
    .UnbindContext = intelUnbindContext,
    .GetSwapInfo = intelGetSwapInfo,
-   .GetMSC = driGetMSC32,
    .GetDrawableMSC = driDrawableGetMSC32,
    .WaitForMSC = driWaitForMSC32,
    .WaitForSBC = NULL,
index a04b7754842e59f707a9e4f34adac9b3f6d4b525..e59cc914c8b0113fb8ae5d4523024b0c6cad4d6a 100644 (file)
@@ -483,7 +483,6 @@ static struct __DriverAPIRec mach64API = {
    .MakeCurrent     = mach64MakeCurrent,
    .UnbindContext   = mach64UnbindContext,
    .GetSwapInfo     = NULL,
-   .GetMSC          = driGetMSC32,
    .GetDrawableMSC  = driDrawableGetMSC32,
    .WaitForMSC      = driWaitForMSC32,
    .WaitForSBC      = NULL,
index 896f2d94fc690eb677c3b093f1fac4d782536776..b0282e5f65b88a18fca421148be8702a125f5c87 100644 (file)
@@ -950,7 +950,6 @@ static const struct __DriverAPIRec mgaAPI = {
    .MakeCurrent     = mgaMakeCurrent,
    .UnbindContext   = mgaUnbindContext,
    .GetSwapInfo     = getSwapInfo,
-   .GetMSC          = driGetMSC32,
    .GetDrawableMSC  = driDrawableGetMSC32,
    .WaitForMSC      = driWaitForMSC32,
    .WaitForSBC      = NULL,
index 4838ffcb0b4668b9dfe47518b4e672b9c9b74f1d..f6274ac1f2bd7790ce6e45c71b8fd9472354c12e 100644 (file)
@@ -205,7 +205,6 @@ static const struct __DriverAPIRec nouveauAPI = {
        .MakeCurrent     = nouveauMakeCurrent,
        .UnbindContext   = nouveauUnbindContext,
        .GetSwapInfo     = nouveauGetSwapInfo,
-       .GetMSC          = driGetMSC32,
        .GetDrawableMSC  = driDrawableGetMSC32,
        .WaitForMSC      = driWaitForMSC32,
        .WaitForSBC      = NULL,
index 719f9367c01f8b2975fa673b54267038ff43f2ae..e24fb5092781f4a2ab9759a053f9c81cbdf50fab 100644 (file)
@@ -410,7 +410,6 @@ static struct __DriverAPIRec r128API = {
    .MakeCurrent     = r128MakeCurrent,
    .UnbindContext   = r128UnbindContext,
    .GetSwapInfo     = NULL,
-   .GetMSC          = driGetMSC32,
    .GetDrawableMSC  = driDrawableGetMSC32,
    .WaitForMSC      = driWaitForMSC32,
    .WaitForSBC      = NULL,
index 5afc6d9c2f446cae8810f2fc4b2fc3e56b610ce8..0b303b3c34a8efc357d15fe250493f81a39f7cfd 100644 (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,
index 671193577d4784ce74810072c1273b2c41bffa64..d361d14e62e2111e8bf6d5a4084c7157e7668319 100644 (file)
@@ -313,7 +313,6 @@ static struct __DriverAPIRec sisAPI = {
    .MakeCurrent     = sisMakeCurrent,
    .UnbindContext   = sisUnbindContext,
    .GetSwapInfo     = NULL,
-   .GetMSC          = NULL,
    .GetDrawableMSC  = NULL,
    .WaitForMSC      = NULL,
    .WaitForSBC      = NULL,
index 6298de82f40f05887aeb08d36d98cc20b789d74b..53c04e7bb14a9d1527285fed777df0cc197dcf7d 100644 (file)
@@ -354,7 +354,6 @@ static const struct __DriverAPIRec tdfxAPI = {
    .MakeCurrent     = tdfxMakeCurrent,
    .UnbindContext   = tdfxUnbindContext,
    .GetSwapInfo     = NULL,
-   .GetMSC          = NULL,
    .GetDrawableMSC  = NULL,
    .WaitForMSC      = NULL,
    .WaitForSBC      = NULL,
index 8d6cebeb795b4f407b71294be3dc4416940b9b37..e6cc99eb86a97a47e1291e6dae75a07fd941c4de 100644 (file)
@@ -333,7 +333,6 @@ static struct __DriverAPIRec viaAPI = {
    .MakeCurrent     = viaMakeCurrent,
    .UnbindContext   = viaUnbindContext,
    .GetSwapInfo     = getSwapInfo,
-   .GetMSC          = driGetMSC32,
    .GetDrawableMSC  = driDrawableGetMSC32,
    .WaitForMSC      = driWaitForMSC32,
    .WaitForSBC      = NULL,