[Intel-gfx] [PATCH 1/2] uxa: Skip fill of temporary alpha picture that just gets copied over.

Eric Anholt eric at anholt.net
Fri Jul 10 09:07:47 CEST 2009


This was needed when we were doing the mask computations in this pixmap,
but now they're done in a temporary and then uploaded later.

This reduces runtime of firefox-20090601 from 52.6 (+/- .96%) to 50.7
(+/- .41%) seconds on my G45.
---
 uxa/uxa-render.c |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 33af636..02373b0 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -806,9 +806,7 @@ uxa_create_alpha_picture (ScreenPtr     pScreen,
 {
     PixmapPtr	    pPixmap;
     PicturePtr	    pPicture;
-    GCPtr	    pGC;
     int		    error;
-    xRectangle	    rect;
 
     if (width > 32767 || height > 32767)
 	return 0;
@@ -827,19 +825,6 @@ uxa_create_alpha_picture (ScreenPtr     pScreen,
 					pPictFormat->depth, 0);
     if (!pPixmap)
 	return 0;
-    pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
-    if (!pGC)
-    {
-	(*pScreen->DestroyPixmap) (pPixmap);
-	return 0;
-    }
-    ValidateGC (&pPixmap->drawable, pGC);
-    rect.x = 0;
-    rect.y = 0;
-    rect.width = width;
-    rect.height = height;
-    uxa_check_poly_fill_rect (&pPixmap->drawable, pGC, 1, &rect);
-    FreeScratchGC (pGC);
     pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
 			      0, 0, serverClient, &error);
     (*pScreen->DestroyPixmap) (pPixmap);
@@ -950,6 +935,7 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	    FreePicture (pPicture, 0);
 	    return;
 	}
+	ValidateGC (pPicture->pDrawable, pGC);
 
 	(*pGC->ops->CopyArea) (&pPixmap->drawable, pPicture->pDrawable,
 			       pGC, 0, 0, width, height, 0, 0);
@@ -1023,16 +1009,33 @@ uxa_triangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	PicturePtr	pPicture;
 	INT16		xDst, yDst;
 	INT16		xRel, yRel;
-	
+	int width = bounds.x2 - bounds.x1;
+	int height = bounds.y2 - bounds.y1;
+	GCPtr pGC;
+	xRectangle rect;
+
 	xDst = tris[0].p1.x >> 16;
 	yDst = tris[0].p1.y >> 16;
 
 	pPicture = uxa_create_alpha_picture (pScreen, pDst, maskFormat,
-					  bounds.x2 - bounds.x1,
-					  bounds.y2 - bounds.y1);
+					     width, height);
 	if (!pPicture)
 	    return;
 
+	/* Clear the alpha picture to 0. */
+	pGC = GetScratchGC (pPicture->pDrawable->depth, pScreen);
+	if (!pGC) {
+	    FreePicture (pPicture, 0);
+	    return;
+	}
+	ValidateGC (pPicture->pDrawable, pGC);
+	rect.x = 0;
+	rect.y = 0;
+	rect.width = width;
+	rect.height = height;
+	uxa_check_poly_fill_rect (pPicture->pDrawable, pGC, 1, &rect);
+	FreeScratchGC (pGC);
+
 	if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) {
 	    (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
 	    uxa_finish_access(pPicture->pDrawable);
-- 
1.6.3.3




More information about the Intel-gfx mailing list