xserver: Branch 'master' - 2 commits

Maarten Maathuis madman2003 at kemper.freedesktop.org
Fri Oct 3 15:00:26 PDT 2008


 exa/exa_glyphs.c |    5 +-
 exa/exa_render.c |  107 +++++++------------------------------------------------
 2 files changed, 17 insertions(+), 95 deletions(-)

New commits:
commit a29af6465883796a6acf04b72ce812a0632b2186
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Fri Oct 3 23:54:10 2008 +0200

    exa: remove "direct" case for exa{Trapezoids,Triangles}
    
    - By adding a small hack to the xserver i was able to easily test the performance of the normally rare direct case (using cairo).
    - It turned out to be 70% slower for me (large test on an otherwise idle computer), which seems enough of a reason to remove it.
    - AddTraps could also use a 2nd look, but since noone is using that it's a bit hard and less useful to test.

diff --git a/exa/exa_render.c b/exa/exa_render.c
index c2c1df0..a41b9b9 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -1046,51 +1046,13 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
     ScreenPtr		pScreen = pDst->pDrawable->pScreen;
     PictureScreenPtr    ps = GetPictureScreen(pScreen);
     BoxRec		bounds;
-    Bool		direct = op == PictOpAdd && miIsSolidAlpha (pSrc);
 
-    if (maskFormat || direct) {
+    if (maskFormat) {
 	miTrapezoidBounds (ntrap, traps, &bounds);
 
 	if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
 	    return;
-    }
-
-    /*
-     * Check for solid alpha add
-     */
-    if (direct)
-    {
-	DrawablePtr pDraw = pDst->pDrawable;
-	PixmapPtr pixmap = exaGetDrawablePixmap (pDraw);
-	ExaPixmapPriv (pixmap);
-
-	/* Damage manually, because Trapezoids expects to hit Composite normally. */
-	/* Composite is wrapped by damage, but Trapezoids isn't. */
-	if (pExaPixmap->pDamage) {
-	    RegionRec migration;
-
-	    bounds.x1 += pDraw->x;
-	    bounds.y1 += pDraw->y;
-	    bounds.x2 += pDraw->x;
-	    bounds.y2 += pDraw->y;
-
-	    REGION_INIT(pScreen, &migration, &bounds, 1);
-	    DamageRegionAppend(pDraw, &migration);
-	    REGION_UNINIT(pScreen, &migration);
-	}
-
-	exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
-
-	for (; ntrap; ntrap--, traps++)
-	    (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
-
-	exaFinishAccess(pDraw, EXA_PREPARE_DEST);
 
-	if (pExaPixmap->pDamage)
-	    DamageRegionProcessPending(pDraw);
-    }
-    else if (maskFormat)
-    {
 	PicturePtr	pPicture;
 	INT16		xDst, yDst;
 	INT16		xRel, yRel;
@@ -1117,9 +1079,7 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 			  bounds.x2 - bounds.x1,
 			  bounds.y2 - bounds.y1);
 	FreePicture (pPicture, 0);
-    }
-    else
-    {
+    } else {
 	if (pDst->polyEdge == PolyEdgeSharp)
 	    maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
 	else
@@ -1150,52 +1110,17 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
     ScreenPtr		pScreen = pDst->pDrawable->pScreen;
     PictureScreenPtr    ps = GetPictureScreen(pScreen);
     BoxRec		bounds;
-    Bool		direct = op == PictOpAdd && miIsSolidAlpha (pSrc);
 
-    if (maskFormat || direct) {
+    if (maskFormat) {
 	miTriangleBounds (ntri, tris, &bounds);
 
 	if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
 	    return;
-    }
 
-    /*
-     * Check for solid alpha add
-     */
-    if (direct)
-    {
-	DrawablePtr pDraw = pDst->pDrawable;
-	PixmapPtr pixmap = exaGetDrawablePixmap (pDraw);
-	ExaPixmapPriv (pixmap);
-
-	/* Damage manually, because Triangles expects to hit Composite normally. */
-	/* Composite is wrapped by damage, but Triangles isn't. */
-	if (pExaPixmap->pDamage) {
-	    RegionRec migration;
-
-	    bounds.x1 += pDraw->x;
-	    bounds.y1 += pDraw->y;
-	    bounds.x2 += pDraw->x;
-	    bounds.y2 += pDraw->y;
-
-	    REGION_INIT(pScreen, &migration, &bounds, 1);
-	    DamageRegionAppend(pDraw, &migration);
-	    REGION_UNINIT(pScreen, &migration);
-	}
-
-	exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
-	(*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
-	exaFinishAccess(pDraw, EXA_PREPARE_DEST);
-
-	if (pExaPixmap->pDamage)
-	    DamageRegionProcessPending(pDraw);
-    }
-    else if (maskFormat)
-    {
 	PicturePtr	pPicture;
 	INT16		xDst, yDst;
 	INT16		xRel, yRel;
-	
+
 	xDst = tris[0].p1.x >> 16;
 	yDst = tris[0].p1.y >> 16;
 
@@ -1208,21 +1133,19 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
 	(*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
 	exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
-	
+
 	xRel = bounds.x1 + xSrc - xDst;
 	yRel = bounds.y1 + ySrc - yDst;
 	CompositePicture (op, pSrc, pPicture, pDst,
 			  xRel, yRel, 0, 0, bounds.x1, bounds.y1,
 			  bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
 	FreePicture (pPicture, 0);
-    }
-    else
-    {
+    } else {
 	if (pDst->polyEdge == PolyEdgeSharp)
 	    maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
 	else
 	    maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
-	
+
 	for (; ntri; ntri--, tris++)
 	    exaTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
     }
commit 416870d8c9e7e383b87c8513c2296a0cb66e7ef4
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Fri Oct 3 22:59:40 2008 +0200

    exa: remove some excessive whitespace

diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index b23e7f6..2acc891 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -491,7 +491,6 @@ exaGlyphCacheBufferGlyph(ScreenPtr         pScreen,
 	}
 
     }
-    
 
     buffer->source = cache->picture;
 	    
@@ -502,7 +501,7 @@ exaGlyphCacheBufferGlyph(ScreenPtr         pScreen,
     rect->yDst = yGlyph - pGlyph->info.y;
     rect->width = pGlyph->info.width;
     rect->height = pGlyph->info.height;
-	    
+
     buffer->count++;
 
     return ExaGlyphSuccess;
@@ -597,7 +596,7 @@ exaGlyphsToDst(CARD8		 op,
 
     for (i = 0; i < buffer->count; i++) {
 	ExaCompositeRectPtr rect = &buffer->rects[i];
-	
+
 	CompositePicture (op,
 			  pSrc,
 			  buffer->source,
diff --git a/exa/exa_render.c b/exa/exa_render.c
index f9c6b40..c2c1df0 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -371,7 +371,7 @@ exaTryDriverCompositeRects(CARD8	       op,
     }
     
     exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
-	
+
     pixmaps[0].as_dst = TRUE;
     pixmaps[0].as_src = exaOpReadsDestination(op);
     pixmaps[0].pPix = pDstPix;
@@ -406,24 +406,24 @@ exaTryDriverCompositeRects(CARD8	       op,
 	INT16 yDst = rects->yDst + pDst->pDrawable->y;
 	INT16 xSrc = rects->xSrc + pSrc->pDrawable->x;
 	INT16 ySrc = rects->ySrc + pSrc->pDrawable->y;
-	
+
 	RegionRec region;
 	BoxPtr pbox;
 	int nbox;
-	
+
 	if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
 				       xSrc, ySrc, 0, 0, xDst, yDst,
 				       rects->width, rects->height))
 	    goto next_rect;
-	
+
 	REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
-	
+
 	nbox = REGION_NUM_RECTS(&region);
 	pbox = REGION_RECTS(&region);
 
 	xSrc = xSrc + src_off_x - xDst - dst_off_x;
 	ySrc = ySrc + src_off_y - yDst - dst_off_y;
-	
+
 	while (nbox--)
 	{
 	    (*pExaScr->info->Composite) (pDstPix,
@@ -442,10 +442,10 @@ exaTryDriverCompositeRects(CARD8	       op,
 
 	rects++;
     }
-    
+
     (*pExaScr->info->DoneComposite) (pDstPix);
     exaMarkSync(pDst->pDrawable->pScreen);
-	
+
     return 1;
 }
 


More information about the xorg-commit mailing list