[PATCH 1/7] damage: Implicitly unregister on destroy

Adam Jackson ajax at redhat.com
Mon Sep 2 07:18:56 PDT 2013


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

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 damageext/damageext.c     | 1 -
 dix/pixmap.c              | 1 -
 exa/exa_classic.c         | 1 -
 exa/exa_migration_mixed.c | 1 -
 exa/exa_mixed.c           | 2 --
 hw/kdrive/ephyr/ephyr.c   | 3 ---
 miext/damage/damage.c     | 4 +++-
 7 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/damageext/damageext.c b/damageext/damageext.c
index e02a28f..db0a753 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -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);
diff --git a/dix/pixmap.c b/dix/pixmap.c
index fe92147..d5dc383 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -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);
diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index 1fa534b..0fa422f 100644
--- a/exa/exa_classic.c
+++ b/exa/exa_classic.c
@@ -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;
         }
diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 445c4fc..5e0bf15 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -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;
 
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 0fb4091..3e2dcf2 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -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);
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 0ee2cf3..db08e98 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -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,
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index c215497..4753fb5 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1637,7 +1637,6 @@ damageDestroyWindow(WindowPtr pWindow)
     damageScrPriv(pScreen);
 
     while ((pDamage = damageGetWinPriv(pWindow))) {
-        DamageUnregister(&pWindow->drawable, pDamage);
         DamageDestroy(pDamage);
     }
     unwrap(pScrPriv, pScreen, DestroyWindow);
@@ -1884,6 +1883,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);
-- 
1.8.3.1



More information about the xorg-devel mailing list