dri: Drop __driUtilUpdateDrawableInfo and helper macros
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 28 Oct 2011 19:22:43 +0000 (15:22 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 2 Nov 2011 15:15:59 +0000 (11:15 -0400)
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h

index b3e6b126287d07cab321cf124d1f15c671c0b628..c7154df45f729fc4bf52aad4a4d49ae87c1551cc 100644 (file)
@@ -166,98 +166,10 @@ static int driBindContext(__DRIcontext *pcp,
        dri_get_drawable(prp);
     }
 
-    /*
-    ** Now that we have a context associated with this drawable, we can
-    ** initialize the drawable information if has not been done before.
-    */
-
-    if (!psp->dri2.enabled) {
-       if (pdp && !pdp->pStamp) {
-           DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-           __driUtilUpdateDrawableInfo(pdp);
-           DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-       }
-       if (prp && pdp != prp && !prp->pStamp) {
-           DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-           __driUtilUpdateDrawableInfo(prp);
-           DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-        }
-    }
-
     /* Call device-specific MakeCurrent */
     return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
 }
 
-/*@}*/
-
-
-/*****************************************************************/
-/** \name Drawable handling functions                            */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Update private drawable information.
- *
- * \param pdp pointer to the private drawable information to update.
- * 
- * This function basically updates the __DRIdrawable struct's
- * cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo.
- * This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which
- * compares the __DRIdrwablePrivate pStamp and lastStamp values.  If
- * the values are different that means we have to update the clipping
- * info.
- */
-void
-__driUtilUpdateDrawableInfo(__DRIdrawable *pdp)
-{
-    __DRIscreen *psp = pdp->driScreenPriv;
-    __DRIcontext *pcp = pdp->driContextPriv;
-    
-    if (!pcp 
-       || ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) {
-       /* ERROR!!! 
-        * ...but we must ignore it. There can be many contexts bound to a
-        * drawable.
-        */
-    }
-
-    if (pdp->pClipRects) {
-       free(pdp->pClipRects); 
-       pdp->pClipRects = NULL;
-    }
-
-    if (pdp->pBackClipRects) {
-       free(pdp->pBackClipRects); 
-       pdp->pBackClipRects = NULL;
-    }
-
-    DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-
-    if (! (*psp->getDrawableInfo->getDrawableInfo)(pdp,
-                         &pdp->index, &pdp->lastStamp,
-                         &pdp->x, &pdp->y, &pdp->w, &pdp->h,
-                         &pdp->numClipRects, &pdp->pClipRects,
-                         &pdp->backX,
-                         &pdp->backY,
-                         &pdp->numBackClipRects,
-                         &pdp->pBackClipRects,
-                         pdp->loaderPrivate)) {
-       /* Error -- eg the window may have been destroyed.  Keep going
-        * with no cliprects.
-        */
-        pdp->pStamp = &pdp->lastStamp; /* prevent endless loop */
-       pdp->numClipRects = 0;
-       pdp->pClipRects = NULL;
-       pdp->numBackClipRects = 0;
-       pdp->pBackClipRects = NULL;
-    }
-    else
-       pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp);
-
-    DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-}
-
 static __DRIdrawable *
 dri2CreateNewDrawable(__DRIscreen *screen,
                      const __DRIconfig *config,
index 1ace19ebda2f316a221123bb35632e20cf5025d8..c9a398036a831697732c22b28639f8b4ca7d04af 100644 (file)
@@ -65,60 +65,6 @@ extern const __DRIcoreExtension driCoreExtension;
 extern const __DRIdri2Extension driDRI2Extension;
 extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
 
-/**
- * Used by DRI_VALIDATE_DRAWABLE_INFO
- */
-#define DRI_VALIDATE_DRAWABLE_INFO_ONCE(pDrawPriv)              \
-    do {                                                        \
-       if (*(pDrawPriv->pStamp) != pDrawPriv->lastStamp) {     \
-           __driUtilUpdateDrawableInfo(pDrawPriv);             \
-       }                                                       \
-    } while (0)
-
-
-/**
- * Utility macro to validate the drawable information.
- *
- * See __DRIdrawable::pStamp and __DRIdrawable::lastStamp.
- */
-#define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp)                            \
-do {                                                                    \
-    while (*(pdp->pStamp) != pdp->lastStamp) {                          \
-        register unsigned int hwContext = psp->pSAREA->lock.lock &      \
-                    ~(DRM_LOCK_HELD | DRM_LOCK_CONT);                  \
-       DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, hwContext);             \
-                                                                        \
-       DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);     \
-       DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp);                           \
-       DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);   \
-                                                                        \
-       DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, hwContext);         \
-    }                                                                   \
-} while (0)
-
-/**
- * Same as above, but for two drawables simultaneously.
- *
- */
-
-#define DRI_VALIDATE_TWO_DRAWABLES_INFO(psp, pdp, prp)                 \
-do {                                                           \
-    while (*((pdp)->pStamp) != (pdp)->lastStamp ||                     \
-          *((prp)->pStamp) != (prp)->lastStamp) {                      \
-        register unsigned int hwContext = (psp)->pSAREA->lock.lock &   \
-           ~(DRM_LOCK_HELD | DRM_LOCK_CONT);                           \
-       DRM_UNLOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext);         \
-                                                                       \
-       DRM_SPINLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \
-       DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp);                           \
-       DRI_VALIDATE_DRAWABLE_INFO_ONCE(prp);                           \
-       DRM_SPINUNLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \
-                                                                       \
-       DRM_LIGHT_LOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext);     \
-    }                                                                   \
-} while (0)
-
-
 /**
  * Driver callback functions.
  *
@@ -502,9 +448,6 @@ struct __DRIscreenRec {
    void *loaderPrivate;
 };
 
-extern void
-__driUtilUpdateDrawableInfo(__DRIdrawable *pdp);
-
 extern float
 driCalculateSwapUsage( __DRIdrawable *dPriv,
                       int64_t last_swap_ust, int64_t current_ust );