damage: Implicitly unregister on destroy

There's no reason not to, and it simplifies quite a few callers.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2013-08-26 13:52:14 -04:00
parent e657635dbe
commit 28708a045d
7 changed files with 3 additions and 10 deletions

View File

@ -429,7 +429,6 @@ FreeDamageExt(pointer value, XID did)
*/
pDamageExt->id = 0;
if (pDamageExt->pDamage) {
DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage);
DamageDestroy(pDamageExt->pDamage);
}
free(pDamageExt);

View File

@ -202,7 +202,6 @@ PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst)
xorg_list_for_each_entry_safe(ent, safe, &screen->pixmap_dirty_list, ent) {
if (ent->src == src && ent->slave_dst == slave_dst) {
DamageUnregister(&src->drawable, ent->damage);
DamageDestroy(ent->damage);
xorg_list_del(&ent->ent);
free(ent);

View File

@ -192,7 +192,6 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
* gpu memory, so there's no need to track damage.
*/
if (pExaPixmap->pDamage) {
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
DamageDestroy(pExaPixmap->pDamage);
pExaPixmap->pDamage = NULL;
}

View File

@ -190,7 +190,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
* copy anymore. Drivers that prefer DFS, should fail prepare
* access.
*/
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
DamageDestroy(pExaPixmap->pDamage);
pExaPixmap->pDamage = NULL;

View File

@ -139,7 +139,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
if (pPixData) {
if (pExaPixmap->driverPriv) {
if (pExaPixmap->pDamage) {
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
DamageDestroy(pExaPixmap->pDamage);
pExaPixmap->pDamage = NULL;
}
@ -189,7 +188,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
if (pExaPixmap->sys_ptr) {
free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = NULL;
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
DamageDestroy(pExaPixmap->pDamage);
pExaPixmap->pDamage = NULL;
RegionEmpty(&pExaPixmap->validSys);

View File

@ -389,10 +389,7 @@ ephyrUnsetInternalDamage(ScreenPtr pScreen)
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
PixmapPtr pPixmap = NULL;
pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
DamageUnregister(&pPixmap->drawable, scrpriv->pDamage);
DamageDestroy(scrpriv->pDamage);
RemoveBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler,

View File

@ -1637,7 +1637,6 @@ damageDestroyWindow(WindowPtr pWindow)
damageScrPriv(pScreen);
while ((pDamage = damageGetWinPriv(pWindow))) {
DamageUnregister(&pWindow->drawable, pDamage);
DamageDestroy(pDamage);
}
unwrap(pScrPriv, pScreen, DestroyWindow);
@ -1888,6 +1887,9 @@ DamageDestroy(DamagePtr pDamage)
damageScrPriv(pScreen);
if (pDamage->pDrawable)
DamageUnregister(pDamage->pDrawable, pDamage);
if (pDamage->damageDestroy)
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
(*pScrPriv->funcs.Destroy) (pDamage);