{damage,exa}: sanitise damage

- Redo damage naming for more consistency.
- Call post submission functions only where appropriate.
- EXA can now live without it's odd damage workarounds.
This commit is contained in:
Maarten Maathuis 2008-08-29 22:15:23 +02:00
parent 5af77d43fe
commit 1861250cd7
11 changed files with 93 additions and 122 deletions

View File

@ -224,7 +224,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
DamageRegister (&pWin->drawable, cw->damage); DamageRegister (&pWin->drawable, cw->damage);
cw->damageRegistered = TRUE; cw->damageRegistered = TRUE;
pWin->redirectDraw = RedirectDrawAutomatic; pWin->redirectDraw = RedirectDrawAutomatic;
DamageDamageRegion (&pWin->drawable, &pWin->borderSize); DamageRegionPending(&pWin->drawable, &pWin->borderSize);
} }
if (wasMapped && !pWin->mapped) if (wasMapped && !pWin->mapped)
{ {

View File

@ -585,7 +585,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
REGION_TRANSLATE (prgnSrc, prgnSrc, REGION_TRANSLATE (prgnSrc, prgnSrc,
pWin->drawable.x - ptOldOrg.x, pWin->drawable.x - ptOldOrg.x,
pWin->drawable.y - ptOldOrg.y); pWin->drawable.y - ptOldOrg.y);
DamageDamageRegion (&pWin->drawable, prgnSrc); DamageRegionPending(&pWin->drawable, prgnSrc);
} }
cs->CopyWindow = pScreen->CopyWindow; cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow; pScreen->CopyWindow = compCopyWindow;
@ -664,7 +664,7 @@ compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
/* /*
* Report that as damaged so it will be redrawn * Report that as damaged so it will be redrawn
*/ */
DamageDamageRegion (&pWin->drawable, &damage); DamageRegionPending(&pWin->drawable, &damage);
REGION_UNINIT (pScreen, &damage); REGION_UNINIT (pScreen, &damage);
/* /*
* Save the new border clip region * Save the new border clip region

View File

@ -233,7 +233,7 @@ ProcDamageCreate (ClientPtr client)
if (pDrawable->type == DRAWABLE_WINDOW) if (pDrawable->type == DRAWABLE_WINDOW)
{ {
pRegion = &((WindowPtr) pDrawable)->borderClip; pRegion = &((WindowPtr) pDrawable)->borderClip;
DamageDamageRegion (pDrawable, pRegion); DamageRegionPending(pDrawable, pRegion);
} }
return (client->noClientException); return (client->noClientException);
@ -303,7 +303,7 @@ ProcDamageAdd (ClientPtr client)
* screen coordinates like damage expects. * screen coordinates like damage expects.
*/ */
REGION_TRANSLATE(pScreen, pRegion, pDrawable->x, pDrawable->y); REGION_TRANSLATE(pScreen, pRegion, pDrawable->x, pDrawable->y);
DamageDamageRegion(pDrawable, pRegion); DamageRegionPending(pDrawable, pRegion);
REGION_TRANSLATE(pScreen, pRegion, -pDrawable->x, -pDrawable->y); REGION_TRANSLATE(pScreen, pRegion, -pDrawable->x, -pDrawable->y);
return (client->noClientException); return (client->noClientException);

View File

@ -261,21 +261,6 @@ exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
pExaScr->info->pixmapPitchAlign); pExaScr->info->pixmapPitchAlign);
} }
static void
ExaDamageReport(DamagePtr pDamage, RegionPtr pReg, void *pClosure)
{
PixmapPtr pPixmap = pClosure;
ExaPixmapPriv(pPixmap);
RegionPtr pDamageReg = DamageRegion(pDamage);
if (pExaPixmap->pendingDamage) {
REGION_UNION(pScreen, pDamageReg, pDamageReg, pReg);
pExaPixmap->pendingDamage = FALSE;
}
}
/** /**
* exaCreatePixmap() creates a new pixmap. * exaCreatePixmap() creates a new pixmap.
* *
@ -363,8 +348,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
} }
/* Set up damage tracking */ /* Set up damage tracking */
pExaPixmap->pDamage = DamageCreate (ExaDamageReport, NULL, pExaPixmap->pDamage = DamageCreate (NULL, NULL,
DamageReportRawRegion, TRUE, DamageReportNone, TRUE,
pScreen, pPixmap); pScreen, pPixmap);
if (pExaPixmap->pDamage == NULL) { if (pExaPixmap->pDamage == NULL) {
@ -373,6 +358,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
} }
DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage); DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage);
/* This ensures that pending damage reflects the current operation. */
/* This is used by exa to optimize migration. */
DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE); DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE);
} }

View File

@ -42,39 +42,6 @@
#define DBG_MIGRATE(a) #define DBG_MIGRATE(a)
#endif #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(DrawablePtr pDrawable, PixmapPtr pPix, RegionPtr region)
{
ScreenPtr pScreen = pDrawable->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(pDrawable, 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 * 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 * fake pixmap for the frontbuffer (no pixmap private) or it's a scratch
@ -332,9 +299,6 @@ exaDoMoveInPixmap (ExaMigrationPtr migrate)
ExaScreenPriv (pScreen); ExaScreenPriv (pScreen);
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
if (migrate->as_dst)
pExaPixmap->pendingDamage = TRUE;
/* If we're VT-switched away, no touching card memory allowed. */ /* If we're VT-switched away, no touching card memory allowed. */
if (pExaScr->swappedOut) if (pExaScr->swappedOut)
return; return;
@ -403,9 +367,6 @@ exaDoMoveOutPixmap (ExaMigrationPtr migrate)
PixmapPtr pPixmap = migrate->pPix; PixmapPtr pPixmap = migrate->pPix;
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
if (migrate->as_dst)
pExaPixmap->pendingDamage = TRUE;
if (!pExaPixmap->area || exaPixmapIsPinned(pPixmap)) if (!pExaPixmap->area || exaPixmapIsPinned(pPixmap))
return; return;

View File

@ -226,7 +226,6 @@ typedef struct {
* location. * location.
*/ */
DamagePtr pDamage; DamagePtr pDamage;
Bool pendingDamage;
/** /**
* The valid regions mark the valid bits (at least, as they're derived from * The valid regions mark the valid bits (at least, as they're derived from
* damage, which may be overreported) of a pixmap's system and FB copies. * damage, which may be overreported) of a pixmap's system and FB copies.
@ -494,7 +493,4 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
void void
exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area); exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
Bool
exaDamageDestForMigration(DrawablePtr pDrawable, PixmapPtr pPix, RegionPtr region);
#endif /* EXAPRIV_H */ #endif /* EXAPRIV_H */

View File

@ -466,11 +466,11 @@ exaCompositeRects(CARD8 op,
{ {
PixmapPtr pPixmap = exaGetDrawablePixmap(pDst->pDrawable); PixmapPtr pPixmap = exaGetDrawablePixmap(pDst->pDrawable);
ExaPixmapPriv(pPixmap); ExaPixmapPriv(pPixmap);
RegionRec region;
int n; int n;
ExaCompositeRectPtr r; ExaCompositeRectPtr r;
if (pExaPixmap->pDamage) { if (pExaPixmap->pDamage) {
RegionRec region;
int x1 = MAXSHORT; int x1 = MAXSHORT;
int y1 = MAXSHORT; int y1 = MAXSHORT;
int x2 = MINSHORT; int x2 = MINSHORT;
@ -518,7 +518,9 @@ exaCompositeRects(CARD8 op,
REGION_INIT(pScreen, &region, &box, 1); REGION_INIT(pScreen, &region, &box, 1);
exaDamageDestForMigration(pDst->pDrawable, pPixmap, &region); DamageRegionPending(pDst->pDrawable, &region);
REGION_UNINIT(pScreen, &region);
} }
/************************************************************/ /************************************************************/
@ -543,13 +545,10 @@ exaCompositeRects(CARD8 op,
if (pExaPixmap->pDamage) { if (pExaPixmap->pDamage) {
/* Now we have to flush the damage out from pendingDamage => damage /* Now we have to flush the damage out from pendingDamage => damage
* Calling DamageDamageRegion has that effect. (We could pass * Calling DamageRegionSubmitted has that effect.
* in an empty region here, but we pass in the same region we
* use above; the effect is the same.)
*/ */
DamageDamageRegion(pDst->pDrawable, &region); DamageRegionSubmitted(pDst->pDrawable);
REGION_UNINIT(pScreen, &region);
} }
} }
@ -1064,16 +1063,20 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
DrawablePtr pDraw = pDst->pDrawable; DrawablePtr pDraw = pDst->pDrawable;
PixmapPtr pixmap = exaGetDrawablePixmap (pDraw); PixmapPtr pixmap = exaGetDrawablePixmap (pDraw);
ExaPixmapPriv (pixmap); ExaPixmapPriv (pixmap);
/* Damage manually, because Trapezoids expects to hit Composite normally. */
/* Composite is wrapped by damage, but Trapezoids isn't. */
if (pExaPixmap->pDamage) {
RegionRec migration; RegionRec migration;
if (pExaPixmap->pDamage) {
bounds.x1 += pDraw->x; bounds.x1 += pDraw->x;
bounds.y1 += pDraw->y; bounds.y1 += pDraw->y;
bounds.x2 += pDraw->x; bounds.x2 += pDraw->x;
bounds.y2 += pDraw->y; bounds.y2 += pDraw->y;
REGION_INIT(pScreen, &migration, &bounds, 1); REGION_INIT(pScreen, &migration, &bounds, 1);
exaDamageDestForMigration(pDraw, pixmap, &migration); DamageRegionPending(pDraw, &migration);
REGION_UNINIT(pScreen, &migration);
} }
exaPrepareAccess(pDraw, EXA_PREPARE_DEST); exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
@ -1083,12 +1086,8 @@ exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
exaFinishAccess(pDraw, EXA_PREPARE_DEST); exaFinishAccess(pDraw, EXA_PREPARE_DEST);
/* Damage manually, because Trapezoids expects to hit Composite normally. */ if (pExaPixmap->pDamage)
/* Composite is wrapped by damage, but Trapezoids isn't. */ DamageRegionSubmitted(pDraw);
if (pExaPixmap->pDamage) {
DamageDamageRegion(pDraw, &migration);
REGION_UNINIT(pScreen, &migration);
}
} }
else if (maskFormat) else if (maskFormat)
{ {
@ -1168,28 +1167,28 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
DrawablePtr pDraw = pDst->pDrawable; DrawablePtr pDraw = pDst->pDrawable;
PixmapPtr pixmap = exaGetDrawablePixmap (pDraw); PixmapPtr pixmap = exaGetDrawablePixmap (pDraw);
ExaPixmapPriv (pixmap); ExaPixmapPriv (pixmap);
/* Damage manually, because Triangles expects to hit Composite normally. */
/* Composite is wrapped by damage, but Triangles isn't. */
if (pExaPixmap->pDamage) {
RegionRec migration; RegionRec migration;
if (pExaPixmap->pDamage) {
bounds.x1 += pDraw->x; bounds.x1 += pDraw->x;
bounds.y1 += pDraw->y; bounds.y1 += pDraw->y;
bounds.x2 += pDraw->x; bounds.x2 += pDraw->x;
bounds.y2 += pDraw->y; bounds.y2 += pDraw->y;
REGION_INIT(pScreen, &migration, &bounds, 1); REGION_INIT(pScreen, &migration, &bounds, 1);
exaDamageDestForMigration(pDraw, pixmap, &migration); DamageRegionPending(pDraw, &migration);
REGION_UNINIT(pScreen, &migration);
} }
exaPrepareAccess(pDraw, EXA_PREPARE_DEST); exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
(*ps->AddTriangles) (pDst, 0, 0, ntri, tris); (*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
exaFinishAccess(pDraw, EXA_PREPARE_DEST); exaFinishAccess(pDraw, EXA_PREPARE_DEST);
/* Damage manually, because Triangles expects to hit Composite normally. */ if (pExaPixmap->pDamage)
/* Composite is wrapped by damage, but Triangles isn't. */ DamageRegionSubmitted(pDraw);
if (pExaPixmap->pDamage) {
DamageDamageRegion(pDraw, &migration);
REGION_UNINIT(pScreen, &migration);
}
} }
else if (maskFormat) else if (maskFormat)
{ {

View File

@ -804,7 +804,9 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
REGION_INIT(pDraw->pScreen, &region, (BoxPtr) rects, num_rects); REGION_INIT(pDraw->pScreen, &region, (BoxPtr) rects, num_rects);
REGION_TRANSLATE(pScreen, &region, pDraw->x, pDraw->y); REGION_TRANSLATE(pScreen, &region, pDraw->x, pDraw->y);
DamageDamageRegion(pDraw, &region); DamageRegionPending(pDraw, &region);
/* This is wrong, this needs a seperate function. */
DamageRegionSubmitted(pDraw);
REGION_UNINIT(pDraw->pScreen, &region); REGION_UNINIT(pDraw->pScreen, &region);
__glXleaveServer(GL_FALSE); __glXleaveServer(GL_FALSE);

View File

@ -336,7 +336,7 @@ xf86CrtcDamageShadow (xf86CrtcPtr crtc)
damage_box.y1 = crtc->y; damage_box.y1 = crtc->y;
damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation); damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
REGION_INIT (pScreen, &damage_region, &damage_box, 1); REGION_INIT (pScreen, &damage_region, &damage_box, 1);
DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, DamageRegionPending (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
&damage_region); &damage_region);
REGION_UNINIT (pScreen, &damage_region); REGION_UNINIT (pScreen, &damage_region);
} }

View File

@ -168,11 +168,11 @@ DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
#if DAMAGE_DEBUG_ENABLE #if DAMAGE_DEBUG_ENABLE
static void static void
_damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where) _damageRegionPending (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where)
#define damageDamageRegion(d,r,c,m) _damageDamageRegion(d,r,c,m,__FUNCTION__) #define damageRegionPending(d,r,c,m) _damageRegionPending(d,r,c,m,__FUNCTION__)
#else #else
static void static void
damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, damageRegionPending (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
int subWindowMode) int subWindowMode)
#endif #endif
{ {
@ -330,7 +330,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
} }
static void static void
damageReportPostOp (DrawablePtr pDrawable) damageRegionSubmitted (DrawablePtr pDrawable)
{ {
drawableDamage(pDrawable); drawableDamage(pDrawable);
@ -357,9 +357,9 @@ damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode)
REGION_INIT (pDrawable->pScreen, &region, pBox, 1); REGION_INIT (pDrawable->pScreen, &region, pBox, 1);
#if DAMAGE_DEBUG_ENABLE #if DAMAGE_DEBUG_ENABLE
_damageDamageRegion (pDrawable, &region, TRUE, subWindowMode, where); _damageRegionPending (pDrawable, &region, TRUE, subWindowMode, where);
#else #else
damageDamageRegion (pDrawable, &region, TRUE, subWindowMode); damageRegionPending (pDrawable, &region, TRUE, subWindowMode);
#endif #endif
REGION_UNINIT (pDrawable->pScreen, &region); REGION_UNINIT (pDrawable->pScreen, &region);
} }
@ -589,7 +589,7 @@ damageComposite (CARD8 op,
yDst, yDst,
width, width,
height); height);
damageReportPostOp (pDst->pDrawable); damageRegionSubmitted (pDst->pDrawable);
wrap (pScrPriv, ps, Composite, damageComposite); wrap (pScrPriv, ps, Composite, damageComposite);
} }
@ -656,7 +656,7 @@ damageGlyphs (CARD8 op,
} }
unwrap (pScrPriv, ps, Glyphs); unwrap (pScrPriv, ps, Glyphs);
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
damageReportPostOp (pDst->pDrawable); damageRegionSubmitted (pDst->pDrawable);
wrap (pScrPriv, ps, Glyphs, damageGlyphs); wrap (pScrPriv, ps, Glyphs, damageGlyphs);
} }
#endif #endif
@ -709,7 +709,7 @@ damageFillSpans(DrawablePtr pDrawable,
(*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted); (*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -757,7 +757,7 @@ damageSetSpans(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted); (*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -789,7 +789,7 @@ damagePutImage(DrawablePtr pDrawable,
} }
(*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h,
leftPad, format, pImage); leftPad, format, pImage);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -833,7 +833,7 @@ damageCopyArea(DrawablePtr pSrc,
ret = (*pGC->ops->CopyArea)(pSrc, pDst, ret = (*pGC->ops->CopyArea)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty); pGC, srcx, srcy, width, height, dstx, dsty);
damageReportPostOp (pDst); damageRegionSubmitted (pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret; return ret;
} }
@ -879,7 +879,7 @@ damageCopyPlane(DrawablePtr pSrc,
ret = (*pGC->ops->CopyPlane)(pSrc, pDst, ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
damageReportPostOp (pDst); damageRegionSubmitted (pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret; return ret;
} }
@ -921,7 +921,7 @@ damagePolyPoint(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt); (*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -995,7 +995,7 @@ damagePolylines(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt); (*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1074,7 +1074,7 @@ damagePolySegment(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg); (*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1136,7 +1136,7 @@ damagePolyRectangle(DrawablePtr pDrawable,
} }
} }
(*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects); (*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1189,7 +1189,7 @@ damagePolyArc(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs); (*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1248,7 +1248,7 @@ damageFillPolygon(DrawablePtr pDrawable,
} }
(*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt); (*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1287,7 +1287,7 @@ damagePolyFillRect(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects); (*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1329,7 +1329,7 @@ damagePolyFillArc(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs); (*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1440,7 +1440,7 @@ damagePolyText8(DrawablePtr pDrawable,
Linear8Bit, TT_POLY8); Linear8Bit, TT_POLY8);
else else
x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
} }
@ -1461,7 +1461,7 @@ damagePolyText16(DrawablePtr pDrawable,
TT_POLY16); TT_POLY16);
else else
x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
} }
@ -1481,7 +1481,7 @@ damageImageText8(DrawablePtr pDrawable,
Linear8Bit, TT_IMAGE8); Linear8Bit, TT_IMAGE8);
else else
(*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1501,7 +1501,7 @@ damageImageText16(DrawablePtr pDrawable,
TT_IMAGE16); TT_IMAGE16);
else else
(*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1520,7 +1520,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable,
nglyph, ppci, TRUE, pGC->subWindowMode); nglyph, ppci, TRUE, pGC->subWindowMode);
(*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph,
ppci, pglyphBase); ppci, pglyphBase);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1538,7 +1538,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable,
nglyph, ppci, FALSE, pGC->subWindowMode); nglyph, ppci, FALSE, pGC->subWindowMode);
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph,
ppci, pglyphBase); ppci, pglyphBase);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1572,7 +1572,7 @@ damagePushPixels(GCPtr pGC,
damageDamageBox (pDrawable, &box, pGC->subWindowMode); damageDamageBox (pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg); (*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1652,12 +1652,12 @@ damageCopyWindow(WindowPtr pWindow,
* at the destination location. Translate back and forth. * at the destination location. Translate back and forth.
*/ */
REGION_TRANSLATE (pScreen, prgnSrc, dx, dy); REGION_TRANSLATE (pScreen, prgnSrc, dx, dy);
damageDamageRegion (&pWindow->drawable, prgnSrc, FALSE, -1); damageRegionPending (&pWindow->drawable, prgnSrc, FALSE, -1);
REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy); REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy);
} }
unwrap (pScrPriv, pScreen, CopyWindow); unwrap (pScrPriv, pScreen, CopyWindow);
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
damageReportPostOp (&pWindow->drawable); damageRegionSubmitted (&pWindow->drawable);
wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
} }
@ -1740,6 +1740,10 @@ damageCloseScreen (int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (i, pScreen); return (*pScreen->CloseScreen) (i, pScreen);
} }
/**
* Public functions for consumption outside this file.
*/
Bool Bool
DamageSetup (ScreenPtr pScreen) DamageSetup (ScreenPtr pScreen)
{ {
@ -1940,17 +1944,30 @@ DamagePendingRegion (DamagePtr pDamage)
return &pDamage->pendingDamage; return &pDamage->pendingDamage;
} }
_X_EXPORT void
DamageRegionPending (DrawablePtr pDrawable, RegionPtr pRegion)
{
damageRegionPending (pDrawable, pRegion, FALSE, -1);
}
_X_EXPORT void
DamageRegionSubmitted (DrawablePtr pDrawable)
{
damageRegionSubmitted (pDrawable);
}
/* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */
_X_EXPORT void _X_EXPORT void
DamageDamageRegion (DrawablePtr pDrawable, DamageDamageRegion (DrawablePtr pDrawable,
RegionPtr pRegion) RegionPtr pRegion)
{ {
damageDamageRegion (pDrawable, pRegion, FALSE, -1); damageRegionPending (pDrawable, pRegion, FALSE, -1);
/* Go back and report this damage for DamagePtrs with reportAfter set, since /* Go back and report this damage for DamagePtrs with reportAfter set, since
* this call isn't part of an in-progress drawing op in the call chain and * this call isn't part of an in-progress drawing op in the call chain and
* the DDX probably just wants to know about it right away. * the DDX probably just wants to know about it right away.
*/ */
damageReportPostOp (pDrawable); damageRegionSubmitted (pDrawable);
} }
void void

View File

@ -78,6 +78,15 @@ DamageRegion (DamagePtr pDamage);
RegionPtr RegionPtr
DamagePendingRegion (DamagePtr pDamage); DamagePendingRegion (DamagePtr pDamage);
/* Call this function before rendering to a destination. */
void
DamageRegionPending (DrawablePtr pDrawable, RegionPtr pRegion);
/* Call this directly after the rendering operation has been submitted. */
void
DamageRegionSubmitted (DrawablePtr pDrawable);
/* Avoid using this call, it only exists for API compatibility. */
void void
DamageDamageRegion (DrawablePtr pDrawable, DamageDamageRegion (DrawablePtr pDrawable,
const RegionPtr pRegion); const RegionPtr pRegion);