xserver: Branch 'master' - 4 commits

Maarten Maathuis madman2003 at kemper.freedesktop.org
Tue Aug 26 08:57:32 PDT 2008


 exa/exa.h           |   34 ++++++++++++++++-----------
 exa/exa_accel.c     |    9 -------
 exa/exa_glyphs.c    |   13 ++++------
 exa/exa_migration.c |   37 ++++++++++++++++++++++++++++-
 exa/exa_priv.h      |    3 ++
 exa/exa_render.c    |   65 +++++++++++++++++++++-------------------------------
 6 files changed, 93 insertions(+), 68 deletions(-)

New commits:
commit 7c14fdbacfcd2f4d56a346e6c72e44e4ba9909c1
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Tue Aug 26 17:21:43 2008 +0200

    exa: some minor cleanup
    - Fix compile warning
    - Order exa.h by source file that exports the function.
    - Move the function i created earlier to private headers.

diff --git a/exa/exa.h b/exa/exa.h
index 7c2f4c1..8d9bcea 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -744,21 +744,36 @@ typedef struct _ExaDriver {
 
 /** @} */
 
+/* in exa.c */
 ExaDriverPtr
 exaDriverAlloc(void);
 
 Bool
-exaDriverInit(ScreenPtr                pScreen,
+exaDriverInit(ScreenPtr      pScreen,
               ExaDriverPtr   pScreenInfo);
 
 void
-exaDriverFini(ScreenPtr                pScreen);
+exaDriverFini(ScreenPtr      pScreen);
 
 void
 exaMarkSync(ScreenPtr pScreen);
 void
 exaWaitSync(ScreenPtr pScreen);
 
+unsigned long
+exaGetPixmapOffset(PixmapPtr pPix);
+
+unsigned long
+exaGetPixmapPitch(PixmapPtr pPix);
+
+unsigned long
+exaGetPixmapSize(PixmapPtr pPix);
+
+void *
+exaGetPixmapDriverPrivate(PixmapPtr p);
+
+
+/* in exa_offscreen.c */
 ExaOffscreenArea *
 exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
                   Bool locked,
@@ -771,32 +786,22 @@ exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
 void
 ExaOffscreenMarkUsed (PixmapPtr pPixmap);
 
-unsigned long
-exaGetPixmapOffset(PixmapPtr pPix);
-
-unsigned long
-exaGetPixmapPitch(PixmapPtr pPix);
-
-unsigned long
-exaGetPixmapSize(PixmapPtr pPix);
-
 void
 exaEnableDisableFBAccess (int index, Bool enable);
 
+
+/* in exa_migration.c */
 void
 exaMoveInPixmap (PixmapPtr pPixmap);
 
 void
 exaMoveOutPixmap (PixmapPtr pPixmap);
 
-void *
-exaGetPixmapDriverPrivate(PixmapPtr p);
 
+/* in exa_unaccel.c */
 CARD32
 exaGetPixmapFirstPixel (PixmapPtr pPixmap);
 
-Bool
-exaDamageDestForMigration(PixmapPtr pPix, RegionPtr region);
 
 /**
  * Returns TRUE if the given planemask covers all the significant bits in the
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 56515ab..0137815 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -242,9 +242,9 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
 				    pBox->x1, pBox->y1,
 				    pBox->x2 - pBox->x1,
 				    pBox->y2 - pBox->y1,
-				    pExaPixmap->sys_ptr
+				    (char *) (pExaPixmap->sys_ptr
 				    + pBox->y1 * pExaPixmap->sys_pitch
-				    + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8,
+				    + pBox->x1 * pPixmap->drawable.bitsPerPixel / 8),
 				    pExaPixmap->sys_pitch))
 	{
 	    if (!access_prepared) {
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index dc6a6e0..7decf8f 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -503,4 +503,7 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
 void
 exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
 
+Bool
+exaDamageDestForMigration(PixmapPtr pPix, RegionPtr region);
+
 #endif /* EXAPRIV_H */
commit de79edbd9f67762950eaac2dc79668035239897c
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Tue Aug 26 17:03:12 2008 +0200

    exa: report damage manually for exa{Trapezoids,Triangles} when needed
    - Plus a micro cleanup of unused variables.

diff --git a/exa/exa_render.c b/exa/exa_render.c
index d45af0a..88ea29a 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -471,12 +471,10 @@ exaCompositeRects(CARD8	              op,
     ExaCompositeRectPtr r;
     
     if (pExaPixmap->pDamage) {
-	int xoff, yoff;
 	int x1 = MAXSHORT;
 	int y1 = MAXSHORT;
 	int x2 = MINSHORT;
 	int y2 = MINSHORT;
-	RegionPtr pending_damage;
 	BoxRec box;
     
 	/* We have to manage the damage ourselves, since CompositeRects isn't
@@ -1066,10 +1064,9 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	DrawablePtr pDraw = pDst->pDrawable;
 	PixmapPtr pixmap = exaGetDrawablePixmap (pDraw);
 	ExaPixmapPriv (pixmap);
+	RegionRec migration;
 
 	if (pExaPixmap->pDamage) {
-	    RegionRec migration;
-
 	    bounds.x1 += pDraw->x;
 	    bounds.y1 += pDraw->y;
 	    bounds.x2 += pDraw->x;
@@ -1085,6 +1082,13 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	    (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
 
 	exaFinishAccess(pDraw, EXA_PREPARE_DEST);
+
+	/* Damage manually, because Trapezoids expects to hit Composite normally. */
+	/* Composite is wrapped by damage, but Trapezoids isn't. */
+	if (pExaPixmap->pDamage) {
+	    DamageDamageRegion(pDraw, &migration);
+	    REGION_UNINIT(pScreen, &migration);
+	}
     }
     else if (maskFormat)
     {
@@ -1164,10 +1168,9 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	DrawablePtr pDraw = pDst->pDrawable;
 	PixmapPtr pixmap = exaGetDrawablePixmap (pDraw);
 	ExaPixmapPriv (pixmap);
+	RegionRec migration;
 
 	if (pExaPixmap->pDamage) {
-	    RegionRec migration;
-
 	    bounds.x1 += pDraw->x;
 	    bounds.y1 += pDraw->y;
 	    bounds.x2 += pDraw->x;
@@ -1180,6 +1183,13 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
 	(*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
 	exaFinishAccess(pDraw, EXA_PREPARE_DEST);
+
+	/* Damage manually, because Triangles expects to hit Composite normally. */
+	/* Composite is wrapped by damage, but Triangles isn't. */
+	if (pExaPixmap->pDamage) {
+	    DamageDamageRegion(pDraw, &migration);
+	    REGION_UNINIT(pScreen, &migration);
+	}
     }
     else if (maskFormat)
     {
commit 988725f32e082aee9392a71464125157a83d1e67
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Tue Aug 26 16:54:29 2008 +0200

    exa: move destination damage for internal calls to a special function
    - This should improve clarity for someone who isn't familiar with the code.

diff --git a/exa/exa.h b/exa/exa.h
index 2562094..7c2f4c1 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -795,6 +795,9 @@ exaGetPixmapDriverPrivate(PixmapPtr p);
 CARD32
 exaGetPixmapFirstPixel (PixmapPtr pPixmap);
 
+Bool
+exaDamageDestForMigration(PixmapPtr pPix, RegionPtr region);
+
 /**
  * Returns TRUE if the given planemask covers all the significant bits in the
  * pixel values for pDrawable.
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 8ac21b8..d586fd8 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -300,7 +300,6 @@ exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
     BoxRec box = { .x1 = pDrawable->x + dx, .y1 = pDrawable->y + dy,
 		   .x2 = pDrawable->x + dx + sw, .y2 = pDrawable->y + dy + sh };
     RegionRec region;
-    int xoff, yoff;
     RegionPtr pending_damage = NULL;
 
     if (pExaPixmap->pDamage)
@@ -308,11 +307,7 @@ exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
 
     if (pending_damage) {
 	REGION_INIT(pScreen, &region, &box, 1);
-
-	exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
-
-	REGION_TRANSLATE(pScreen, &region, xoff, yoff);
-	REGION_UNION(pScreen, pending_damage, pending_damage, &region);
+	exaDamageDestForMigration(pPixmap, &region);
     }
 
     if (!exaDoShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh,
@@ -328,9 +323,7 @@ exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
     }
 
     if (pending_damage) {
-	REGION_TRANSLATE(pScreen, &region, -xoff, -yoff);
 	DamageDamageRegion(pDrawable, &region);
-
 	REGION_UNINIT(pScreen, &region);
     }
 }
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 25ea73d..56515ab 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -43,6 +43,39 @@
 #endif
 
 /**
+ * Returns TRUE if the pixmap has damage.
+ * EXA only migrates the parts of a destination 
+ * that are affected by rendering.
+ * It uses the current damage as indication.
+ * So anything that does not need to be updated won't be.
+ * For clarity this seperate function was made.
+ * Note that some situations don't use this, 
+ * because their calls are wrapped by the damage layer.
+ */
+Bool
+exaDamageDestForMigration(PixmapPtr pPix, RegionPtr region)
+{
+    ScreenPtr pScreen = pPix->drawable.pScreen;
+    (void) pScreen; /* the macros don't use pScreen currently */
+    ExaPixmapPriv (pPix);
+    int x_offset, y_offset;
+    RegionPtr pending_damage;
+
+    if (!pExaPixmap->pDamage)
+	return FALSE;
+
+    exaGetDrawableDeltas(&pPix->drawable, pPix, &x_offset, &y_offset);
+
+    REGION_TRANSLATE(pScreen, region, x_offset, y_offset);
+    pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
+    REGION_UNION(pScreen, pending_damage, pending_damage, region);
+    /* Restore region as we got it. */
+    REGION_TRANSLATE(pScreen, region, -x_offset, -y_offset);
+
+    return TRUE;
+}
+
+/**
  * Returns TRUE if the pixmap is not movable.  This is the case where it's a
  * fake pixmap for the frontbuffer (no pixmap private) or it's a scratch
  * pixmap created by some other X Server internals (the score says it's
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 7042285..d45af0a 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -520,12 +520,7 @@ exaCompositeRects(CARD8	              op,
 
 	REGION_INIT(pScreen, &region, &box, 1);
     
-	exaGetDrawableDeltas(pDst->pDrawable, pPixmap, &xoff, &yoff);
-
-	REGION_TRANSLATE(pScreen, &region, xoff, yoff);
-	pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
-	REGION_UNION(pScreen, pending_damage, pending_damage, &region);
-	REGION_TRANSLATE(pScreen, &region, -xoff, -yoff);
+	exaDamageDestForMigration(pPixmap, &region);
     }
     
     /************************************************************/
@@ -1074,22 +1069,14 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 
 	if (pExaPixmap->pDamage) {
 	    RegionRec migration;
-	    RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
-	    int xoff, yoff;
-
-	    exaGetDrawableDeltas(pDraw, pixmap, &xoff, &yoff);
-
-	    xoff += pDraw->x;
-	    yoff += pDraw->y;
 
-	    bounds.x1 += xoff;
-	    bounds.y1 += yoff;
-	    bounds.x2 += xoff;
-	    bounds.y2 += yoff;
+	    bounds.x1 += pDraw->x;
+	    bounds.y1 += pDraw->y;
+	    bounds.x2 += pDraw->x;
+	    bounds.y2 += pDraw->y;
 
 	    REGION_INIT(pScreen, &migration, &bounds, 1);
-	    REGION_UNION(pScreen, pending_damage, pending_damage, &migration);
-	    REGION_UNINIT(pScreen, &migration);
+	    exaDamageDestForMigration(pixmap, &migration);
 	}
 
 	exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
@@ -1180,22 +1167,14 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 
 	if (pExaPixmap->pDamage) {
 	    RegionRec migration;
-	    RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
-	    int xoff, yoff;
-
-	    exaGetDrawableDeltas(pDraw, pixmap, &xoff, &yoff);
-
-	    xoff += pDraw->x;
-	    yoff += pDraw->y;
 
-	    bounds.x1 += xoff;
-	    bounds.y1 += yoff;
-	    bounds.x2 += xoff;
-	    bounds.y2 += yoff;
+	    bounds.x1 += pDraw->x;
+	    bounds.y1 += pDraw->y;
+	    bounds.x2 += pDraw->x;
+	    bounds.y2 += pDraw->y;
 
 	    REGION_INIT(pScreen, &migration, &bounds, 1);
-	    REGION_UNION(pScreen, pending_damage, pending_damage, &migration);
-	    REGION_UNINIT(pScreen, &migration);
+	    exaDamageDestForMigration(pixmap, &migration);
 	}
 
 	exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
commit ce193476808f54d946351458361c62132d81b62f
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Tue Aug 26 13:18:58 2008 +0200

    exa_glyphs: remove useless offset

diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 59ef394..b23e7f6 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -364,7 +364,6 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
     ExaPixmapPriv(pGlyphPixmap);
     PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
     ExaMigrationRec pixmaps[1];
-    int cacheXoff, cacheYoff;
 
     if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
 	return FALSE;
@@ -385,8 +384,7 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
     pixmaps[0].pReg = NULL;
     exaDoMigration (pixmaps, 1, TRUE);
 
-    pCachePixmap = exaGetOffscreenPixmap ((DrawablePtr)pCachePixmap, &cacheXoff, &cacheYoff);
-    if (!pCachePixmap)
+    if (!exaPixmapIsOffscreen(pCachePixmap))
 	return FALSE;
 
     /* CACHE_{X,Y} are in pixmap coordinates, no need for cache{X,Y}off */
@@ -399,11 +397,12 @@ exaGlyphCacheUploadGlyph(ScreenPtr         pScreen,
 				       pExaPixmap->sys_pitch))
 	return FALSE;
 
+    /* This pixmap should never be bound to a window, so no need to offset coordinates. */
     exaPixmapDirty (pCachePixmap,
-		    CACHE_X(pos) + cacheXoff,
-		    CACHE_Y(pos) + cacheYoff,
-		    CACHE_X(pos) + cacheXoff + pGlyph->info.width,
-		    CACHE_Y(pos) + cacheYoff + pGlyph->info.height);
+		    CACHE_X(pos),
+		    CACHE_Y(pos),
+		    CACHE_X(pos) + pGlyph->info.width,
+		    CACHE_Y(pos) + pGlyph->info.height);
 
     return TRUE;
 }


More information about the xorg-commit mailing list