xserver: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Sun Jul 19 17:12:48 PDT 2009


 exa/exa.c        |   27 +++++----
 exa/exa_accel.c  |  155 +++++++++++++++++++++++++++++--------------------------
 exa/exa_glyphs.c |   15 +++--
 exa/exa_render.c |   91 +++++++++++++++++---------------
 4 files changed, 157 insertions(+), 131 deletions(-)

New commits:
commit 2415e2dce918efd49d5e6d71f705255a234a866b
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Mon Jul 20 02:08:31 2009 +0200

    EXA: Bail earlier from exaDoPutImage if the driver has no UploadToScreen hook.
    
    Also remove dead code associated with access_prepared local variable.

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 1466bf5..a554fc9 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -149,10 +149,9 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
     int nbox;
     int xoff, yoff;
     int bpp = pDrawable->bitsPerPixel;
-    Bool access_prepared = FALSE;
     Bool ret = TRUE;
 
-    if (pExaPixmap->accel_blocked)
+    if (pExaPixmap->accel_blocked || !pExaScr->info->UploadToScreen)
 	return FALSE;
 
     /* Don't bother with under 8bpp, XYPixmaps. */
@@ -179,7 +178,7 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 
     pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
 
-    if (!pPix || !pExaScr->info->UploadToScreen)
+    if (!pPix)
 	return FALSE;
 
     x += pDrawable->x;
@@ -221,9 +220,7 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 	}
     }
 
-    if (access_prepared)
-	exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
-    else
+    if (ret)
 	exaMarkSync(pDrawable->pScreen);
 
     return ret;
commit 00fe4a297744c81b40f0243fb56ad848a9be6a2b
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Mon Jul 20 02:04:40 2009 +0200

    EXA: Completely eliminate exaDoMigration calls for drivers that manage pixmaps.

diff --git a/exa/exa.c b/exa/exa.c
index 608c81f..8d488b3 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -616,19 +616,24 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
 void
 exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
 {
-    ExaMigrationRec pixmaps[1];
+    PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
+    ExaPixmapPriv(pPixmap);
 
-    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;
+    if (pExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[1];
 
-    exaDoMigration(pixmaps, 1, FALSE);
+	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 = pPixmap;
+	pixmaps[0].pReg = pReg;
+
+	exaDoMigration(pixmaps, 1, FALSE);
+    }
 
     ExaDoPrepareAccess(pDrawable, index);
 }
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 001a4f0..1466bf5 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -50,12 +50,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
     int		    fullX1, fullX2, fullY1;
     int		    partX1, partX2;
     int		    off_x, off_y;
-    ExaMigrationRec pixmaps[1];
-
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pPixmap;
-    pixmaps[0].pReg = NULL;
 
     if (pExaScr->swappedOut ||
 	pGC->fillStyle != FillSolid ||
@@ -63,7 +57,14 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
     {
 	ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
 	return;
-    } else {
+    } else if (pExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[1];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pPixmap;
+	pixmaps[0].pReg = NULL;
+
 	exaDoMigration (pixmaps, 1, TRUE);
     }
 
@@ -375,7 +376,6 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
     ExaPixmapPrivPtr pSrcExaPixmap, pDstExaPixmap;
     int	    src_off_x, src_off_y;
     int	    dst_off_x, dst_off_y;
-    ExaMigrationRec pixmaps[2];
     RegionPtr srcregion = NULL, dstregion = NULL;
     xRectangle *rects;
     Bool ret = TRUE;
@@ -425,14 +425,6 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 	}
     }
 
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pDstPixmap;
-    pixmaps[0].pReg = dstregion;
-    pixmaps[1].as_dst = FALSE;
-    pixmaps[1].as_src = TRUE;
-    pixmaps[1].pPix = pSrcPixmap;
-    pixmaps[1].pReg = srcregion;
 
     pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap);
     pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
@@ -466,7 +458,19 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
         }
     }
 
-    exaDoMigration (pixmaps, 2, TRUE);
+    if (pDstExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[2];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pDstPixmap;
+	pixmaps[0].pReg = dstregion;
+	pixmaps[1].as_dst = FALSE;
+	pixmaps[1].as_src = TRUE;
+	pixmaps[1].pPix = pSrcPixmap;
+	pixmaps[1].pReg = srcregion;
+	exaDoMigration (pixmaps, 2, TRUE);
+    }
 
     /* Mixed directions must be handled specially if the card is lame */
     if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
@@ -766,7 +770,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
     int		    xoff, yoff;
     int		    xorg, yorg;
     int		    n;
-    ExaMigrationRec pixmaps[2];
     RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
 
     /* Compute intersection of rects and clip region */
@@ -777,11 +780,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
 	goto out;
     }
 
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pPixmap;
-    pixmaps[0].pReg = NULL;
-
     exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
 
     if (pExaScr->swappedOut || pExaPixmap->accel_blocked)
@@ -814,7 +812,16 @@ exaPolyFillRect(DrawablePtr pDrawable,
 	goto fallback;
     }
 
-    exaDoMigration (pixmaps, 1, TRUE);
+    if (pExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[2];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pPixmap;
+	pixmaps[0].pReg = NULL;
+
+	exaDoMigration (pixmaps, 1, TRUE);
+    }
 
     if (!exaPixmapIsOffscreen (pPixmap) ||
 	!(*pExaScr->info->PrepareSolid) (pPixmap,
@@ -972,23 +979,24 @@ exaFillRegionSolid (DrawablePtr	pDrawable, RegionPtr pRegion, Pixel pixel,
     PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
     ExaPixmapPriv (pPixmap);
     int xoff, yoff;
-    ExaMigrationRec pixmaps[1];
     Bool ret = FALSE;
 
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pPixmap;
-    pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
-					    alu, clientClipType)
-	? NULL : pRegion;
-
     exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
     REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
 
     if (pExaPixmap->accel_blocked)
     {
 	goto out;
-    } else {
+    } else if (pExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[1];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pPixmap;
+	pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
+						alu, clientClipType)
+	    ? NULL : pRegion;
+
 	exaDoMigration (pixmaps, 1, TRUE);
     }
 
@@ -1053,7 +1061,6 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
     ExaPixmapPrivPtr pTileExaPixmap = ExaGetPixmapPriv(pTile);
     int xoff, yoff;
     int tileWidth, tileHeight;
-    ExaMigrationRec pixmaps[2];
     int nbox = REGION_NUM_RECTS (pRegion);
     BoxPtr pBox = REGION_RECTS (pRegion);
     Bool ret = FALSE;
@@ -1070,23 +1077,26 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
 				  exaGetPixmapFirstPixel (pTile), planemask,
 				  alu, clientClipType);
 
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
-    pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
-					    alu, clientClipType)
-	? NULL : pRegion;
-    pixmaps[1].as_dst = FALSE;
-    pixmaps[1].as_src = TRUE;
-    pixmaps[1].pPix = pTile;
-    pixmaps[1].pReg = NULL;
-
+    pPixmap = exaGetDrawablePixmap (pDrawable);
     pExaPixmap = ExaGetPixmapPriv (pPixmap);
 
     if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked)
     {
 	return FALSE;
-    } else {
+    } else if (pExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[2];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pPixmap;
+	pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
+						alu, clientClipType)
+	    ? NULL : pRegion;
+	pixmaps[1].as_dst = FALSE;
+	pixmaps[1].as_src = TRUE;
+	pixmaps[1].pPix = pTile;
+	pixmaps[1].pReg = NULL;
+
 	exaDoMigration (pixmaps, 2, TRUE);
     }
 
@@ -1225,31 +1235,36 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
 	     unsigned int format, unsigned long planeMask, char *d)
 {
     ExaScreenPriv (pDrawable->pScreen);
-    ExaMigrationRec pixmaps[1];
-    BoxRec Box;
-    RegionRec Reg;
-    PixmapPtr pPix;
+    PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
     int xoff, yoff;
     Bool ok;
 
-    pixmaps[0].as_dst = FALSE;
-    pixmaps[0].as_src = TRUE;
-    pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
-    pixmaps[0].pReg = &Reg;
+    if (pExaScr->swappedOut)
+	goto fallback;
 
-    exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff);
+    if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
+	BoxRec Box;
+	RegionRec Reg;
+	ExaMigrationRec pixmaps[1];
 
-    Box.x1 = pDrawable->y + x + xoff;
-    Box.y1 = pDrawable->y + y + yoff;
-    Box.x2 = Box.x1 + w;
-    Box.y2 = Box.y1 + h;
+	exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff);
 
-    REGION_INIT(pScreen, &Reg, &Box, 1);
+	Box.x1 = pDrawable->y + x + xoff;
+	Box.y1 = pDrawable->y + y + yoff;
+	Box.x2 = Box.x1 + w;
+	Box.y2 = Box.y1 + h;
 
-    if (pExaScr->swappedOut)
-	goto fallback;
+	REGION_INIT(pScreen, &Reg, &Box, 1);
+
+	pixmaps[0].as_dst = FALSE;
+	pixmaps[0].as_src = TRUE;
+	pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
+	pixmaps[0].pReg = &Reg;
 
-    exaDoMigration(pixmaps, 1, FALSE);
+	exaDoMigration(pixmaps, 1, FALSE);
+
+	REGION_UNINIT(pScreen, &Reg);
+    }
 
     pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
 
@@ -1271,12 +1286,9 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
 					   PixmapBytePad(w, pDrawable->depth));
     if (ok) {
 	exaWaitSync(pDrawable->pScreen);
-	goto out;
+	return;
     }
 
 fallback:
     ExaCheckGetImage(pDrawable, x, y, w, h, format, planeMask, d);
-
-out:
-    REGION_UNINIT(pScreen, &Reg);
 }
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index b8d2e52..1855de1 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -372,7 +372,6 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
     PixmapPtr pGlyphPixmap = (PixmapPtr)pGlyphPicture->pDrawable;
     ExaPixmapPriv(pGlyphPixmap);
     PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
-    ExaMigrationRec pixmaps[1];
 
     if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
 	goto composite;
@@ -387,11 +386,15 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
 	goto composite;
 
     /* cache pixmap must be offscreen. */
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pCachePixmap;
-    pixmaps[0].pReg = NULL;
-    exaDoMigration (pixmaps, 1, TRUE);
+    if (pExaPixmap->pDamage) {
+	ExaMigrationRec pixmaps[1];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pCachePixmap;
+	pixmaps[0].pReg = NULL;
+	exaDoMigration (pixmaps, 1, TRUE);
+    }
 
     if (!exaPixmapIsOffscreen(pCachePixmap))
 	goto composite;
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 14d710b..678b6c2 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -253,7 +253,6 @@ exaTryDriverSolidFill(PicturePtr	pSrc,
     ExaPixmapPrivPtr pSrcExaPix, pDstExaPix;
     CARD32 pixel;
     CARD16 red, green, blue, alpha;
-    ExaMigrationRec pixmaps[1];
 
     pDstPix = exaGetDrawablePixmap (pDst->pDrawable);
     pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
@@ -284,11 +283,15 @@ exaTryDriverSolidFill(PicturePtr	pSrc,
 
     pixel = exaGetPixmapFirstPixel (pSrcPix);
 
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = FALSE;
-    pixmaps[0].pPix = pDstPix;
-    pixmaps[0].pReg = &region;
-    exaDoMigration(pixmaps, 1, TRUE);
+    if (pDstExaPix->pDamage) {
+	ExaMigrationRec pixmaps[1];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = FALSE;
+	pixmaps[0].pPix = pDstPix;
+	pixmaps[0].pReg = &region;
+	exaDoMigration(pixmaps, 1, TRUE);
+    }
 
     if (!exaPixmapIsOffscreen(pDstPix)) {
 	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
@@ -343,7 +346,6 @@ exaTryDriverCompositeRects(CARD8	       op,
     int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
     PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
     ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix;
-    ExaMigrationRec pixmaps[3];
 
     if (!pExaScr->info->PrepareComposite)
 	return -1;
@@ -374,23 +376,27 @@ exaTryDriverCompositeRects(CARD8	       op,
     {
 	return -1;
     }
-    
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = exaOpReadsDestination(op);
-    pixmaps[0].pPix = pDstPix;
-    pixmaps[0].pReg = NULL;
-    pixmaps[1].as_dst = FALSE;
-    pixmaps[1].as_src = TRUE;
-    pixmaps[1].pPix = pSrcPix;
-    pixmaps[1].pReg = NULL;
-    if (pMask) {
-	pixmaps[2].as_dst = FALSE;
-	pixmaps[2].as_src = TRUE;
-	pixmaps[2].pPix = pMaskPix;
-	pixmaps[2].pReg = NULL;
-	exaDoMigration(pixmaps, 3, TRUE);
-    } else
-	exaDoMigration(pixmaps, 2, TRUE);
+
+    if (pDstExaPix->pDamage) {
+	ExaMigrationRec pixmaps[3];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = exaOpReadsDestination(op);
+	pixmaps[0].pPix = pDstPix;
+	pixmaps[0].pReg = NULL;
+	pixmaps[1].as_dst = FALSE;
+	pixmaps[1].as_src = TRUE;
+	pixmaps[1].pPix = pSrcPix;
+	pixmaps[1].pReg = NULL;
+	if (pMask) {
+	    pixmaps[2].as_dst = FALSE;
+	    pixmaps[2].as_src = TRUE;
+	    pixmaps[2].pPix = pMaskPix;
+	    pixmaps[2].pReg = NULL;
+	    exaDoMigration(pixmaps, 3, TRUE);
+	} else
+	    exaDoMigration(pixmaps, 2, TRUE);
+    }
 
     pDstPix = exaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
     if (!pDstPix)
@@ -615,7 +621,6 @@ exaTryDriverComposite(CARD8		op,
     int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
     PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
     ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix;
-    ExaMigrationRec pixmaps[3];
 
     pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
     pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
@@ -665,22 +670,26 @@ exaTryDriverComposite(CARD8		op,
 
     REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
 
-    pixmaps[0].as_dst = TRUE;
-    pixmaps[0].as_src = exaOpReadsDestination(op);
-    pixmaps[0].pPix = pDstPix;
-    pixmaps[0].pReg = pixmaps[0].as_src ? NULL : &region;
-    pixmaps[1].as_dst = FALSE;
-    pixmaps[1].as_src = TRUE;
-    pixmaps[1].pPix = pSrcPix;
-    pixmaps[1].pReg = NULL;
-    if (pMask) {
-	pixmaps[2].as_dst = FALSE;
-	pixmaps[2].as_src = TRUE;
-	pixmaps[2].pPix = pMaskPix;
-	pixmaps[2].pReg = NULL;
-	exaDoMigration(pixmaps, 3, TRUE);
-    } else {
-	exaDoMigration(pixmaps, 2, TRUE);
+    if (pDstExaPix->pDamage) {
+	ExaMigrationRec pixmaps[3];
+
+	pixmaps[0].as_dst = TRUE;
+	pixmaps[0].as_src = exaOpReadsDestination(op);
+	pixmaps[0].pPix = pDstPix;
+	pixmaps[0].pReg = pixmaps[0].as_src ? NULL : &region;
+	pixmaps[1].as_dst = FALSE;
+	pixmaps[1].as_src = TRUE;
+	pixmaps[1].pPix = pSrcPix;
+	pixmaps[1].pReg = NULL;
+	if (pMask) {
+	    pixmaps[2].as_dst = FALSE;
+	    pixmaps[2].as_src = TRUE;
+	    pixmaps[2].pPix = pMaskPix;
+	    pixmaps[2].pReg = NULL;
+	    exaDoMigration(pixmaps, 3, TRUE);
+	} else {
+	    exaDoMigration(pixmaps, 2, TRUE);
+	}
     }
 
     pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);


More information about the xorg-commit mailing list