EXA: Handle separate alpha maps in Composite fallback.

Michel Dänzer michel at daenzer.net
Sun Feb 22 07:40:40 PST 2009


From: Michel Dänzer <daenzer at vmware.com>

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=18710 .

Signed-off-by: Michel Dänzer <daenzer at vmware.com>
---
 exa/exa.h         |    4 ++++
 exa/exa_unaccel.c |   23 +++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

A couple of doubts:

* Can we just add new PrepareAccess indices like this, or do we need to bump
  the EXA major/minor version?
* Does the separate alpha map matter for the Composite destination?

diff --git a/exa/exa.h b/exa/exa.h
index 21a0f1a..8f5d49c 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -672,6 +672,10 @@ typedef struct _ExaDriver {
 	 * from.
 	 */
 	#define EXA_PREPARE_MASK	2
+
+	#define EXA_PREPARE_ALPHAMAP_DEST	3
+	#define EXA_PREPARE_ALPHAMAP_SRC	4
+	#define EXA_PREPARE_ALPHAMAP_MASK	5
 	/** @} */
 
     /**
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index c821f0d..4530e15 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -387,6 +387,7 @@ ExaCheckComposite (CARD8      op,
     PictureScreenPtr	ps = GetPictureScreen(pScreen);
 #endif /* RENDER */
     ExaScreenPriv(pScreen);
+    ExaPixmapPrivPtr pExaDstAlphaPix = NULL, pExaMaskAlphaPix = NULL, pExaSrcAlphaPix = NULL;
     RegionRec region;
     int xoff, yoff;
 
@@ -408,13 +409,29 @@ ExaCheckComposite (CARD8      op,
     } else
 	exaPrepareAccess (pDst->pDrawable, EXA_PREPARE_DEST);
 
+    if (pDst->alphaMap && pDst->alphaMap->pDrawable) {
+	pExaDstAlphaPix =
+	    ExaGetPixmapPriv(exaGetDrawablePixmap(pDst->alphaMap->pDrawable));
+	exaPrepareAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_ALPHAMAP_DEST);
+    }
+
     EXA_FALLBACK(("from picts %p/%p to pict %p\n",
 		 pSrc, pMask, pDst));
 
     if (pSrc->pDrawable != NULL)
 	exaPrepareAccess (pSrc->pDrawable, EXA_PREPARE_SRC);
+    if (pSrc->alphaMap && pSrc->alphaMap->pDrawable) {
+	pExaSrcAlphaPix =
+	    ExaGetPixmapPriv(exaGetDrawablePixmap(pSrc->alphaMap->pDrawable));
+	exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_ALPHAMAP_SRC);
+    }
     if (pMask && pMask->pDrawable != NULL)
 	exaPrepareAccess (pMask->pDrawable, EXA_PREPARE_MASK);
+    if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable) {
+	pExaMaskAlphaPix =
+	    ExaGetPixmapPriv(exaGetDrawablePixmap(pMask->alphaMap->pDrawable));
+	exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_ALPHAMAP_MASK);
+    }
 #ifdef RENDER
     swap(pExaScr, ps, Composite);
     ps->Composite (op,
@@ -433,9 +450,15 @@ ExaCheckComposite (CARD8      op,
 #endif /* RENDER */
     if (pMask && pMask->pDrawable != NULL)
 	exaFinishAccess (pMask->pDrawable, EXA_PREPARE_MASK);
+    if (pExaMaskAlphaPix)
+	exaFinishAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_ALPHAMAP_MASK);
     if (pSrc->pDrawable != NULL)
 	exaFinishAccess (pSrc->pDrawable, EXA_PREPARE_SRC);
+    if (pExaSrcAlphaPix)
+	exaFinishAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_ALPHAMAP_SRC);
     exaFinishAccess (pDst->pDrawable, EXA_PREPARE_DEST);
+    if (pExaDstAlphaPix)
+	exaFinishAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_ALPHAMAP_DEST);
 
     REGION_UNINIT(pScreen, &region);
 }
-- 
1.6.2.rc1




More information about the xorg-devel mailing list