From cf4793d99ecee4dfd6094e02b1ccb89eb744d313 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Fri, 28 Feb 2014 15:36:31 -0500
Subject: [PATCH] miext/shadow: Remove ancient backwards-compatibility hack

Here's a trip down memory lane.  Back when we merged kdrive we adopted
kdrive's version of shadow, which used damage directly instead of
hand-rolling it.  However a couple of Xorg drivers referred to the
accumulated damage region in the shadow private directly, so I added a
hack to copy the damage region around.

That was 9148d8700b7c5afc2644e5820c57c509378f93ce, back in early 2006.
Eight years is unusually patient for me.  The neomagic and trident drivers
were still relying on this, but they've been modified to ask the damage
code for the region instead.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 miext/shadow/shadow.c | 34 ----------------------------------
 miext/shadow/shadow.h |  2 --
 2 files changed, 36 deletions(-)

diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index 522e21bd00..6690f7047e 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -93,8 +93,6 @@ shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
     wrap(pBuf, pScreen, GetImage);
 }
 
-#define BACKWARDS_COMPATIBILITY
-
 static Bool
 shadowCloseScreen(ScreenPtr pScreen)
 {
@@ -104,35 +102,12 @@ shadowCloseScreen(ScreenPtr pScreen)
     unwrap(pBuf, pScreen, CloseScreen);
     shadowRemove(pScreen, pBuf->pPixmap);
     DamageDestroy(pBuf->pDamage);
-#ifdef BACKWARDS_COMPATIBILITY
-    RegionUninit(&pBuf->damage);        /* bc */
-#endif
     if (pBuf->pPixmap)
         pScreen->DestroyPixmap(pBuf->pPixmap);
     free(pBuf);
     return pScreen->CloseScreen(pScreen);
 }
 
-#ifdef BACKWARDS_COMPATIBILITY
-static void
-shadowReportFunc(DamagePtr pDamage, RegionPtr pRegion, void *closure)
-{
-    ScreenPtr pScreen = closure;
-    shadowBufPtr pBuf = (shadowBufPtr)
-        dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey);
-
-    /* Register the damaged region, use DamageReportNone below when we
-     * want to break BC below... */
-    RegionUnion(&pDamage->damage, &pDamage->damage, pRegion);
-
-    /*
-     * BC hack.  In 7.0 and earlier several drivers would inspect the
-     * 'damage' member directly, so we have to keep it existing.
-     */
-    RegionCopy(&pBuf->damage, pRegion);
-}
-#endif
-
 Bool
 shadowSetup(ScreenPtr pScreen)
 {
@@ -147,15 +122,9 @@ shadowSetup(ScreenPtr pScreen)
     pBuf = malloc(sizeof(shadowBufRec));
     if (!pBuf)
         return FALSE;
-#ifdef BACKWARDS_COMPATIBILITY
-    pBuf->pDamage = DamageCreate((DamageReportFunc) shadowReportFunc,
-                                 (DamageDestroyFunc) NULL,
-                                 DamageReportRawRegion, TRUE, pScreen, pScreen);
-#else
     pBuf->pDamage = DamageCreate((DamageReportFunc) NULL,
                                  (DamageDestroyFunc) NULL,
                                  DamageReportNone, TRUE, pScreen, pScreen);
-#endif
     if (!pBuf->pDamage) {
         free(pBuf);
         return FALSE;
@@ -168,9 +137,6 @@ shadowSetup(ScreenPtr pScreen)
     pBuf->pPixmap = 0;
     pBuf->closure = 0;
     pBuf->randr = 0;
-#ifdef BACKWARDS_COMPATIBILITY
-    RegionNull(&pBuf->damage);  /* bc */
-#endif
 
     dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf);
     return TRUE;
diff --git a/miext/shadow/shadow.h b/miext/shadow/shadow.h
index 421ae96a69..9c5f991f8f 100644
--- a/miext/shadow/shadow.h
+++ b/miext/shadow/shadow.h
@@ -43,12 +43,10 @@ typedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
                                    CARD32 offset,
                                    int mode, CARD32 *size, void *closure);
 
-/* BC hack: do not move the damage member.  see shadow.c for explanation. */
 typedef struct _shadowBuf {
     DamagePtr pDamage;
     ShadowUpdateProc update;
     ShadowWindowProc window;
-    RegionRec damage;
     PixmapPtr pPixmap;
     void *closure;
     int randr;
-- 
GitLab