From 988725f32e082aee9392a71464125157a83d1e67 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Tue, 26 Aug 2008 16:54:29 +0200 Subject: exa: move destination damage for internal calls to a special function - This should improve clarity for someone who isn't familiar with the code. --- exa/exa.h | 3 +++ exa/exa_accel.c | 9 +-------- exa/exa_migration.c | 33 +++++++++++++++++++++++++++++++++ exa/exa_render.c | 43 +++++++++++-------------------------------- 4 files changed, 48 insertions(+), 40 deletions(-) (limited to 'exa') 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, ®ion, &box, 1); - - exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff); - - REGION_TRANSLATE(pScreen, ®ion, xoff, yoff); - REGION_UNION(pScreen, pending_damage, pending_damage, ®ion); + exaDamageDestForMigration(pPixmap, ®ion); } 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, ®ion, -xoff, -yoff); DamageDamageRegion(pDrawable, ®ion); - REGION_UNINIT(pScreen, ®ion); } } 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 @@ -42,6 +42,39 @@ #define DBG_MIGRATE(a) #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 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, ®ion, &box, 1); - exaGetDrawableDeltas(pDst->pDrawable, pPixmap, &xoff, &yoff); - - REGION_TRANSLATE(pScreen, ®ion, xoff, yoff); - pending_damage = DamagePendingRegion(pExaPixmap->pDamage); - REGION_UNION(pScreen, pending_damage, pending_damage, ®ion); - REGION_TRANSLATE(pScreen, ®ion, -xoff, -yoff); + exaDamageDestForMigration(pPixmap, ®ion); } /************************************************************/ @@ -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); -- cgit v1.2.3