xserver: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Fri May 15 07:21:41 PDT 2009


 exa/exa_accel.c   |   35 ++++++++++++-------------
 exa/exa_glyphs.c  |   73 +++++++++++++++++++++++++++---------------------------
 exa/exa_priv.h    |   10 ++++---
 exa/exa_render.c  |    2 -
 exa/exa_unaccel.c |    2 -
 5 files changed, 62 insertions(+), 60 deletions(-)

New commits:
commit 7c8327f0a75087a85864256a9cea80dd4b86def5
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri May 15 15:48:37 2009 +0200

    EXA: Always damage glyph cache pixmap manually after uploading a glyph.
    
    Signed-off-by: Michel Dänzer <daenzer at vmware.com>

diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index d2a0168..b8d2e52 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -354,8 +354,14 @@ exaGlyphCacheHashRemove(ExaGlyphCachePtr cache,
  * is to use the UploadToScreen() driver hook; this allows us to
  * pipeline glyph uploads and to avoid creating offscreen pixmaps for
  * glyphs that we'll never use again.
+ *
+ * If we can't do it with UploadToScreen (because the glyph is offscreen, etc),
+ * we fall back to CompositePicture.
+ *
+ * We need to damage the cache pixmap manually in either case because the damage
+ * layer unwrapped the picture screen before calling exaGlyphs.
  */
-static Bool
+static void
 exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
 			 ExaGlyphCachePtr  cache,
 			 int               pos,
@@ -369,16 +375,16 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
     ExaMigrationRec pixmaps[1];
 
     if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
-	return FALSE;
+	goto composite;
 
     /* If the glyph pixmap is already uploaded, no point in doing
      * things this way */
     if (exaPixmapIsOffscreen(pGlyphPixmap))
-	return FALSE;
+	goto composite;
 
     /* UploadToScreen only works if bpp match */
     if (pGlyphPixmap->drawable.bitsPerPixel != pCachePixmap->drawable.bitsPerPixel)
-	return FALSE;
+	goto composite;
 
     /* cache pixmap must be offscreen. */
     pixmaps[0].as_dst = TRUE;
@@ -388,26 +394,37 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
     exaDoMigration (pixmaps, 1, TRUE);
 
     if (!exaPixmapIsOffscreen(pCachePixmap))
-	return FALSE;
+	goto composite;
 
     /* CACHE_{X,Y} are in pixmap coordinates, no need for cache{X,Y}off */
-    if (!pExaScr->info->UploadToScreen(pCachePixmap,
-				       CACHE_X(pos),
-				       CACHE_Y(pos),
-				       pGlyph->info.width,
-				       pGlyph->info.height,
-				       (char *)pExaPixmap->sys_ptr,
-				       pExaPixmap->sys_pitch))
-	return FALSE;
-
-    /* This pixmap should never be bound to a window, so no need to offset coordinates. */
+    if (pExaScr->info->UploadToScreen(pCachePixmap,
+				      CACHE_X(pos),
+				      CACHE_Y(pos),
+				      pGlyph->info.width,
+				      pGlyph->info.height,
+				      (char *)pExaPixmap->sys_ptr,
+				      pExaPixmap->sys_pitch))
+	goto damage;
+
+composite:
+    CompositePicture (PictOpSrc,
+		      pGlyphPicture,
+		      None,
+		      cache->picture,
+		      0, 0,
+		      0, 0,
+		      CACHE_X(pos),
+		      CACHE_Y(pos),
+		      pGlyph->info.width,
+		      pGlyph->info.height);
+
+damage:
+    /* The cache pixmap isn't a window, so no need to offset coordinates. */
     exaPixmapDirty (pCachePixmap,
 		    CACHE_X(pos),
 		    CACHE_Y(pos),
-		    CACHE_X(pos) + pGlyph->info.width,
-		    CACHE_Y(pos) + pGlyph->info.height);
-
-    return TRUE;
+		    CACHE_X(pos) + cache->glyphWidth,
+		    CACHE_Y(pos) + cache->glyphHeight);
 }
 
 static ExaGlyphCacheResult
@@ -483,23 +500,7 @@ exaGlyphCacheBufferGlyph(ScreenPtr         pScreen,
 	    cache->evictionPosition = rand() % cache->size;
 	}
 
-	/* Now actually upload the glyph into the cache picture; if
-	 * we can't do it with UploadToScreen (because the glyph is
-	 * offscreen, etc), we fall back to CompositePicture.
-	 */
-	if (!exaGlyphCacheUploadGlyph(pScreen, cache, pos, pGlyph)) {
-	    CompositePicture (PictOpSrc,
-			      GlyphPicture(pGlyph)[pScreen->myNum],
-			      None,
-			      cache->picture,
-			      0, 0,
-			      0, 0,
-			      CACHE_X(pos),
-			      CACHE_Y(pos),
-			      pGlyph->info.width,
-			      pGlyph->info.height);
-	}
-
+	exaGlyphCacheUploadGlyph(pScreen, cache, pos, pGlyph);
     }
 
     buffer->mask = cache->picture;
commit 850675d4de4373e5df95507dbf2cd9affaaf54bc
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri May 15 15:48:37 2009 +0200

    EXA: Take GC client clip type into account for migration.
    
    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=18950 .
    
    Signed-off-by: Michel Dänzer <daenzer at vmware.com>

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index d284ff5..39f3437 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -406,7 +406,8 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 	xfree(rects);
 
 	if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
-					   pGC->fillStyle, pGC->alu)) {
+					   pGC->fillStyle, pGC->alu,
+					   pGC->clientClipType)) {
 	    dstregion = REGION_CREATE(pScreen, NullBox, 0);
 	    REGION_COPY(pScreen, dstregion, srcregion);
 	    REGION_TRANSLATE(pScreen, dstregion, dst_off_x - dx - src_off_x,
@@ -734,7 +735,8 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 }
 
 static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
-				Pixel pixel, CARD32 planemask, CARD32 alu);
+				Pixel pixel, CARD32 planemask, CARD32 alu,
+				unsigned int clientClipType);
 
 static void
 exaPolyFillRect(DrawablePtr pDrawable,
@@ -787,10 +789,11 @@ exaPolyFillRect(DrawablePtr pDrawable,
 	if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel) &&
 	     exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
 				pGC->fgPixel : pGC->tile.pixel,	pGC->planemask,
-				pGC->alu)) ||
+				pGC->alu, pGC->clientClipType)) ||
 	    (pGC->fillStyle == FillTiled && !pGC->tileIsPixel &&
 	     exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap, &pGC->patOrg,
-				pGC->planemask, pGC->alu))) {
+				pGC->planemask, pGC->alu,
+				pGC->clientClipType))) {
 	    goto out;
 	}
     }
@@ -952,11 +955,8 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 }
 
 static Bool
-exaFillRegionSolid (DrawablePtr	pDrawable,
-		    RegionPtr	pRegion,
-		    Pixel	pixel,
-		    CARD32	planemask,
-		    CARD32	alu)
+exaFillRegionSolid (DrawablePtr	pDrawable, RegionPtr pRegion, Pixel pixel,
+		    CARD32 planemask, CARD32 alu, unsigned int clientClipType)
 {
     ExaScreenPriv(pDrawable->pScreen);
     PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
@@ -969,7 +969,8 @@ exaFillRegionSolid (DrawablePtr	pDrawable,
     pixmaps[0].as_src = FALSE;
     pixmaps[0].pPix = pPixmap;
     pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
-					    alu) ? NULL : pRegion;
+					    alu, clientClipType)
+	? NULL : pRegion;
 
     exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
     REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
@@ -1032,12 +1033,9 @@ out:
  * Based on fbFillRegionTiled(), fbTile().
  */
 Bool
-exaFillRegionTiled (DrawablePtr	pDrawable,
-		    RegionPtr	pRegion,
-		    PixmapPtr	pTile,
-		    DDXPointPtr pPatOrg,
-		    CARD32	planemask,
-		    CARD32	alu)
+exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
+		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
+		    unsigned int clientClipType)
 {
     ExaScreenPriv(pDrawable->pScreen);
     PixmapPtr pPixmap;
@@ -1060,13 +1058,14 @@ exaFillRegionTiled (DrawablePtr	pDrawable,
     if (tileWidth == 1 && tileHeight == 1)
 	return exaFillRegionSolid(pDrawable, pRegion,
 				  exaGetPixmapFirstPixel (pTile), planemask,
-				  alu);
+				  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) ? NULL : pRegion;
+					    alu, clientClipType)
+	? NULL : pRegion;
     pixmaps[1].as_dst = FALSE;
     pixmaps[1].as_src = TRUE;
     pixmaps[1].pPix = pTile;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 9efbbc9..874e7e9 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -415,11 +415,12 @@ ExaCheckAddTraps (PicturePtr	pPicture,
 
 static _X_INLINE Bool
 exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
-		      unsigned int fillStyle, unsigned char alu)
+		      unsigned int fillStyle, unsigned char alu,
+		      unsigned int clientClipType)
 {
-    return ((alu != GXcopy && alu != GXclear &&alu != GXset &&
+    return ((alu != GXcopy && alu != GXclear && alu != GXset &&
 	     alu != GXcopyInverted) || fillStyle == FillStippled ||
-	    !EXA_PM_IS_SOLID(pDrawable, planemask));
+	    clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable, planemask));
 }
 
 void
@@ -427,7 +428,8 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
 
 Bool
 exaFillRegionTiled (DrawablePtr	pDrawable, RegionPtr pRegion, PixmapPtr pTile,
-		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu);
+		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
+		    unsigned int clientClipType);
 
 void
 exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
diff --git a/exa/exa_render.c b/exa/exa_render.c
index a934497..14d710b 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -945,7 +945,7 @@ exaComposite(CARD8	op,
 
 		ret = exaFillRegionTiled(pDst->pDrawable, &region,
 					 (PixmapPtr)pSrc->pDrawable,
-					 &patOrg, FB_ALLONES, GXcopy);
+					 &patOrg, FB_ALLONES, GXcopy, CT_NONE);
 
 		REGION_UNINIT(pDst->pDrawable->pScreen, &region);
 
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 4279c87..0d53b67 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -106,7 +106,7 @@ ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
     EXA_GC_PROLOGUE(pGC);
     EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
     if (exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
-			      pGC->alu))
+			      pGC->alu, pGC->clientClipType))
 	exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
     else
 	exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pExaPixmap->pDamage ?


More information about the xorg-commit mailing list