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

Maarten Maathuis madman2003 at gmail.com
Fri Feb 27 13:31:41 PST 2009


- 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).
---
 exa/exa.c         |   29 ++++++++++++-----------------
 exa/exa.h         |    6 +++---
 exa/exa_unaccel.c |   14 +++++++-------
 3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/exa/exa.c b/exa/exa.c
index 76860a4..994a67a 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -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);
 }
diff --git a/exa/exa.h b/exa/exa.h
index f3868b8..8339a3e 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -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
 	/** @} */
 
     /**
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 9a0b0e5..d16ecf7 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -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);
 }
-- 
1.6.1.3



More information about the xorg-devel mailing list