Commit d0896622 authored by Adam Jackson's avatar Adam Jackson

damage: Simplify DamageUnregister

You can only register one drawable on a given damage, so there's no
reason to require the caller to specify the drawable, the damage is
enough.  The implementation would do something fairly horrible if you
_did_ pass mismatched drawable and damage, so let's avoid the problem
entirely.

v2: Simplify xf86RotateDestroy even more [anholt]
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarAdam Jackson <ajax@redhat.com>
parent 28708a04
......@@ -205,7 +205,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
anyMarked = compMarkWindows(pWin, &pLayerWin);
if (cw->damageRegistered) {
DamageUnregister(&pWin->drawable, cw->damage);
DamageUnregister(cw->damage);
cw->damageRegistered = FALSE;
}
cw->update = CompositeRedirectManual;
......@@ -638,7 +638,7 @@ compSetParentPixmap(WindowPtr pWin)
CompWindowPtr cw = GetCompWindow(pWin);
if (cw->damageRegistered) {
DamageUnregister(&pWin->drawable, cw->damage);
DamageUnregister(cw->damage);
cw->damageRegistered = FALSE;
DamageEmpty(cw->damage);
}
......
......@@ -272,14 +272,10 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
screenDrawable = &pScreen->root->drawable;
/* Free damage structure */
if (xf86_config->rotation_damage_registered) {
if (screenDrawable)
DamageUnregister(screenDrawable,
xf86_config->rotation_damage);
xf86_config->rotation_damage_registered = FALSE;
DisableLimitedSchedulingLatency();
}
if (screenDrawable)
DamageDestroy(xf86_config->rotation_damage);
DamageDestroy(xf86_config->rotation_damage);
xf86_config->rotation_damage = NULL;
}
}
......
......@@ -146,8 +146,7 @@ static void
miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
{
if (pScreenPriv->damageRegistered) {
DamageUnregister(&(pScreen->GetScreenPixmap(pScreen)->drawable),
pScreenPriv->pDamage);
DamageUnregister(pScreenPriv->pDamage);
pScreenPriv->damageRegistered = 0;
}
}
......
......@@ -1843,8 +1843,9 @@ DamageDrawInternal(ScreenPtr pScreen, Bool enable)
}
void
DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage)
DamageUnregister(DamagePtr pDamage)
{
DrawablePtr pDrawable = pDamage->pDrawable;
ScreenPtr pScreen = pDrawable->pScreen;
damageScrPriv(pScreen);
......@@ -1888,7 +1889,7 @@ DamageDestroy(DamagePtr pDamage)
damageScrPriv(pScreen);
if (pDamage->pDrawable)
DamageUnregister(pDamage->pDrawable, pDamage);
DamageUnregister(pDamage);
if (pDamage->damageDestroy)
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
......
......@@ -80,7 +80,7 @@ extern _X_EXPORT void
DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage);
extern _X_EXPORT void
DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage);
DamageUnregister(DamagePtr pDamage);
extern _X_EXPORT void
DamageDestroy(DamagePtr pDamage);
......
......@@ -219,7 +219,7 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
shadowBuf(pScreen);
if (pBuf->pPixmap) {
DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage);
DamageUnregister(pBuf->pDamage);
pBuf->update = 0;
pBuf->window = 0;
pBuf->randr = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment