exa: move destination damage for internal calls to a special function

- This should improve clarity for someone who isn't familiar with the code.
This commit is contained in:
Maarten Maathuis 2008-08-26 16:54:29 +02:00
parent ce19347680
commit 988725f32e
4 changed files with 48 additions and 40 deletions

View File

@ -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.

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);