summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2008-08-26 16:54:29 +0200
committerMaarten Maathuis <madman2003@gmail.com>2008-08-26 17:56:40 +0200
commit988725f32e082aee9392a71464125157a83d1e67 (patch)
tree82b0df5ca8e244617285d8ca662b92e66efa9b66 /exa
parentce193476808f54d946351458361c62132d81b62f (diff)
exa: move destination damage for internal calls to a special function
- This should improve clarity for someone who isn't familiar with the code.
Diffstat (limited to 'exa')
-rw-r--r--exa/exa.h3
-rw-r--r--exa/exa_accel.c9
-rw-r--r--exa/exa_migration.c33
-rw-r--r--exa/exa_render.c43
4 files changed, 48 insertions, 40 deletions
diff --git a/exa/exa.h b/exa/exa.h
index 256209418..7c2f4c1fc 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 8ac21b8f8..d586fd804 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 25ea73d56..56515ab86 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 704228537..d45af0a14 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);