exa: fixup aux indices and ensure that the indices are used as they should be.

- In a previous patch i forgot to add a FALSE somewhere it seems.
- Rename AUX indices so the driver (think of driver managed pixmaps) can do optimisations based upon them.
- Fix one abuse of DEST index now that we have the AUX indices (same reason as above).
This commit is contained in:
Maarten Maathuis 2009-02-27 22:26:52 +01:00
parent 8c6b4a8276
commit 7bfad37f77
3 changed files with 22 additions and 27 deletions

View File

@ -541,10 +541,10 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
if (pExaScr->info->PrepareAccess == NULL)
return TRUE;
if (index >= EXA_PREPARE_AUX0 &&
if (index >= EXA_PREPARE_AUX_DEST &&
!(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
exaMoveOutPixmap (pPixmap);
return;
return FALSE;
}
if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
@ -564,8 +564,13 @@ exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
{
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = index == EXA_PREPARE_DEST;
pixmaps[0].as_src = index != EXA_PREPARE_DEST;
if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
} else {
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
}
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = pReg;
@ -610,7 +615,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
if (!exaPixmapIsOffscreen (pPixmap))
return;
if (index >= EXA_PREPARE_AUX0 &&
if (index >= EXA_PREPARE_AUX_DEST &&
!(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
ErrorF("EXA bug: Trying to call driver FinishAccess hook with "
"unsupported index EXA_PREPARE_AUX*\n");
@ -677,7 +682,6 @@ exaCreatePixmapWithPrepare(ScreenPtr pScreen, int w, int h, int depth,
unsigned usage_hint)
{
PixmapPtr pPixmap;
ExaMigrationRec pixmaps[1];
ExaScreenPriv(pScreen);
/* This swaps between this function and the real upper layer function.
@ -690,16 +694,7 @@ exaCreatePixmapWithPrepare(ScreenPtr pScreen, int w, int h, int depth,
if (!pPixmap)
return NULL;
/* We need to use DEST, but we don't actually want to migrate as dest. */
/* SRC is taken by tile, and MASK by stipple. */
pixmaps[0].as_dst = 0;
pixmaps[0].as_src = 1;
pixmaps[0].pPix = exaGetDrawablePixmap (&pPixmap->drawable);
pixmaps[0].pReg = NULL;
exaDoMigration(pixmaps, 1, FALSE);
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_SRC);
return pPixmap;
}
@ -759,7 +754,7 @@ exaValidateGC(GCPtr pGC,
pExaScr->SavedCreatePixmap = old_ptr;
if (pGC->fillStyle == FillTiled && pTile != pGC->tile.pixmap)
exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_DEST);
exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_AUX_SRC);
EXA_GC_EPILOGUE(pGC);
}

View File

@ -657,9 +657,9 @@ typedef struct _ExaDriver {
* EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
* separate alpha maps with Composite operations.
*/
#define EXA_PREPARE_AUX0 3
#define EXA_PREPARE_AUX1 4
#define EXA_PREPARE_AUX2 5
#define EXA_PREPARE_AUX_DEST 3
#define EXA_PREPARE_AUX_SRC 4
#define EXA_PREPARE_AUX_MASK 5
/** @} */
/**

View File

@ -397,9 +397,9 @@ ExaCheckComposite (CARD8 op,
* may be used for moving them out.
*/
if (pSrc->alphaMap && pSrc->alphaMap->pDrawable)
exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX2);
exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC);
if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable)
exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX1);
exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK);
if (!exaOpReadsDestination(op)) {
if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
@ -414,13 +414,13 @@ ExaCheckComposite (CARD8 op,
REGION_TRANSLATE(pScreen, &region, xoff, yoff);
if (pDst->alphaMap && pDst->alphaMap->pDrawable)
exaPrepareAccessReg(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX0,
exaPrepareAccessReg(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST,
&region);
exaPrepareAccessReg (pDst->pDrawable, EXA_PREPARE_DEST, &region);
} else {
if (pDst->alphaMap && pDst->alphaMap->pDrawable)
exaPrepareAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX0);
exaPrepareAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST);
exaPrepareAccess (pDst->pDrawable, EXA_PREPARE_DEST);
}
@ -451,14 +451,14 @@ ExaCheckComposite (CARD8 op,
if (pMask && pMask->pDrawable != NULL)
exaFinishAccess (pMask->pDrawable, EXA_PREPARE_MASK);
if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable)
exaFinishAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX1);
exaFinishAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK);
if (pSrc->pDrawable != NULL)
exaFinishAccess (pSrc->pDrawable, EXA_PREPARE_SRC);
if (pSrc->alphaMap && pSrc->alphaMap->pDrawable)
exaFinishAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX2);
exaFinishAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC);
exaFinishAccess (pDst->pDrawable, EXA_PREPARE_DEST);
if (pDst->alphaMap && pDst->alphaMap->pDrawable)
exaFinishAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX0);
exaFinishAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST);
REGION_UNINIT(pScreen, &region);
}