dri: Drop __driUtilUpdateDrawableInfo and helper macros

This commit is contained in:
Kristian Høgsberg 2011-10-28 15:22:43 -04:00
parent 6260618b29
commit bfb6f9e690
2 changed files with 0 additions and 145 deletions

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

View 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 );