[xserver-commit] xserver/miext/damage damage.c,1.1.2.1,1.1.2.2

Keith Packard xserver-commit@pdx.freedesktop.org
Wed, 22 Oct 2003 14:23:47 -0700


Committed by: keithp

Update of /cvs/xserver/xserver/miext/damage
In directory pdx:/tmp/cvs-serv16883/miext/damage

Modified Files:
      Tag: xfixes_2_branch
	damage.c 
Log Message:
	* hw/kdrive/mach64/mach64draw.c: (mach64Setup), (mach64DoneSolid),
	(mach64DoneCopy):
	Added SYNC_ALWAYS for debugging (sync after each operation)
	* mi/misprite.c: (miSpriteReportDamage), (miSpriteCopyWindow):
	Add SPRITE_DEBUG_ENABLE to help debug cursor problems
	* miext/damage/damage.c: (damageDamageRegion), (damageDamageBox),
	(damageDamageRect), (damageValidateGC):
	Leave all GCs redirected through Damage GC ops so that adding
	damage doesn't require revalidating all GCs (that would require
	walking the window tree and resetting all serial numbers).
	Add DAMAGE_DEBUG_ENABLE to help debug damage problems


Index: damage.c
===================================================================
RCS file: /cvs/xserver/xserver/miext/damage/Attic/damage.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- damage.c	22 Oct 2003 06:01:44 -0000	1.1.2.1
+++ damage.c	22 Oct 2003 21:23:45 -0000	1.1.2.2
@@ -53,6 +53,13 @@
      (a)->x2 == (b)->x2 && \
      (a)->y2 == (b)->y2)
 
+#define DAMAGE_DEBUG_ENABLE 0
+#if DAMAGE_DEBUG_ENABLE
+#define DAMAGE_DEBUG(x)	ErrorF x
+#else
+#define DAMAGE_DEBUG(x)
+#endif
+
 static PixmapPtr
 GetDrawablePixmap (DrawablePtr pDrawable)
 {
@@ -78,11 +85,18 @@
     DamagePtr	*pPrev = (DamagePtr *) \
 	    &(pPixmap->devPrivates[damagePixPrivateIndex].ptr);
 
+#if DAMAGE_DEBUG_ENABLE
+static void
+_damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, char *where)
+#define damageDamageRegion(d,r) _damageDamageRegion(d,r,__FUNCTION__)
+#else
 static void
 damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion)
+#endif
 {
     damageScrPriv(pDrawable->pScreen);
     drawableDamage(pDrawable);
+    DamagePtr	    pNext;
     RegionPtr	    pClip;
     RegionRec	    pixClip;
     Bool	    was_empty;
@@ -102,12 +116,21 @@
 	pClip = &pixClip;
     }
     REGION_INTERSECT (pScreen, pRegion, pRegion, pClip);
+    DAMAGE_DEBUG (("%s %d x %d +%d +%d\n", where,
+		   pRegion->extents.x2 - pRegion->extents.x1,
+		   pRegion->extents.y2 - pRegion->extents.y1,
+		   pRegion->extents.x1, pRegion->extents.y1));
     if (!REGION_NOTEMPTY(pScreen, pRegion))
     	return;
-    for (; pDamage; pDamage = pDamage->pNext)
+    for (; pDamage; pDamage = pNext)
     {
+	pNext = pDamage->pNext;
 	if (pScrPriv->internalLevel > 0 && !pDamage->isInternal)
+	{
+	    DAMAGE_DEBUG (("non internal damage, skipping at %d\n",
+			   pScrPriv->internalLevel));
 	    continue;
+	}
 	switch (pDamage->damageLevel) {
 	case DamageReportRawRegion:
 	    (*pDamage->damageReport) (pDamage, pRegion, pDamage->closure);
@@ -144,18 +167,34 @@
     }
 }
 
+#if DAMAGE_DEBUG_ENABLE
+#define damageDamageBox(d,b) _damageDamageBox(d,b,__FUNCTION__)
+static void
+_damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, char *where)
+#else
 static void
 damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox)
+#endif
 {
     RegionRec	region;
 
     REGION_INIT (pDrawable->pScreen, &region, pBox, 1);
+#if DAMAGE_DEBUG_ENABLE
+    _damageDamageRegion (pDrawable, &region, where);
+#else
     damageDamageRegion (pDrawable, &region);
+#endif
     REGION_UNINIT (pDrawable->pScreen, &region);
 }
 
+#if DAMAGE_DEBUG_ENABLE
+#define damageDamageRect(d,x,y,w,h) _damageDamageRect(d,x,y,w,h,__FUNCTION__)
+static void
+_damageDamageRect (DrawablePtr pDrawable, int x, int y, int w, int h, char *where)
+#else
 static void
 damageDamageRect (DrawablePtr pDrawable, int x, int y, int w, int h)
+#endif    
 {
     BoxRec	box;
 
@@ -165,7 +204,11 @@
     box.x2 = x + w;
     box.y1 = y;
     box.y2 = y + h;
+#if DAMAGE_DEBUG_ENABLE
+    _damageDamageBox (pDrawable, &box, where);
+#else
     damageDamageBox (pDrawable, &box);
+#endif
 }
 
 static void damageValidateGC(GCPtr, unsigned long, DrawablePtr);
@@ -248,10 +291,7 @@
 {
     DAMAGE_GC_FUNC_PROLOGUE (pGC);
     (*pGC->funcs->ValidateGC)(pGC, changes, pDrawable);
-    if (getDrawableDamage (pDrawable))
-	pGCPriv->ops = pGC->ops;  /* just so it's not NULL */
-    else
-	pGCPriv->ops = NULL;
+    pGCPriv->ops = pGC->ops;  /* just so it's not NULL */
     DAMAGE_GC_FUNC_EPILOGUE (pGC);
 }