On Tue, 2009-02-03 at 04:10 +0200, Mart Raudsepp wrote:
> 
> I shamefully admit I haven't actually gotten around to pinpoint this
> glyph perf regression with 101% certainty at Pict_A8 OpAdd's, but
> logically that should be the case.

Does the attached patch help? It should promote a8 masks to argb if the
driver can't composite to a8. Beware, I only tested that it compiles and
doesn't seem to break anything else.


P.S. Moving to the xorg-devel list.

-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer
EXA: If the driver can't composite to an a8 mask, try an argb mask for glyphs.

From:  <daen...@vmware.com>


---

 exa/exa_glyphs.c |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)


diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 93d78b8..937f1f3 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -706,6 +706,7 @@ exaGlyphs (CARD8 	 op,
     PixmapPtr   pMaskPixmap = 0;
     PicturePtr  pMask = NULL;
     ScreenPtr   pScreen = pDst->pDrawable->pScreen;
+    ExaScreenPriv(pScreen);
     int		width = 0, height = 0;
     int		x, y;
     int		xDst = list->xOff, yDst = list->yOff;
@@ -744,11 +745,42 @@ exaGlyphs (CARD8 	 op,
 	pMask = CreatePicture (0, &pMaskPixmap->drawable,
 			       maskFormat, CPComponentAlpha, &component_alpha,
 			       serverClient, &error);
-	if (!pMask)
+	if (!pMask ||
+	    (PICT_FORMAT_RGB(maskFormat->format) == 0 &&
+	     pExaScr->info->CheckComposite &&
+	     !(*pExaScr->info->CheckComposite) (PictOpAdd, pSrc, pMask, pDst)))
 	{
+	    PictFormatPtr argbFormat;
+
 	    (*pScreen->DestroyPixmap) (pMaskPixmap);
-	    return;
+
+	    if (!pMask)
+		return;
+
+	    /* The driver can't composite to a8, let's try argb (but without
+	     * component-alpha) */
+	    FreePicture ((pointer) pMask, (XID) 0);
+
+	    argbFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+
+	    if (argbFormat)
+		maskFormat = argbFormat;
+	    
+	    pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+						    maskFormat->depth,
+						    CREATE_PIXMAP_USAGE_SCRATCH);
+	    if (!pMaskPixmap)
+		return;
+
+	    pMask = CreatePicture (0, &pMaskPixmap->drawable,
+				   maskFormat, CPComponentAlpha,
+				   &component_alpha, serverClient, &error);
+	    if (!pMask) {
+		(*pScreen->DestroyPixmap) (pMaskPixmap);
+		return;
+	    }
 	}
+
 	pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
 	ValidateGC (&pMaskPixmap->drawable, pGC);
 	rect.x = 0;
_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to