[PATCH 4/6] exa: remove a few pExaPixmap checks.

Maarten Maathuis madman2003 at gmail.com
Tue Mar 3 13:34:54 PST 2009


- And make some fatal for a debug build.
---
 exa/exa_migration.c |   39 ++++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 8b91150..a9883a3 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -52,7 +52,16 @@ exaPixmapIsPinned (PixmapPtr pPix)
 {
     ExaPixmapPriv (pPix);
 
-    return pExaPixmap == NULL || pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED;
+    if (pExaPixmap == NULL) {
+#ifdef DEBUG
+	FatalError("EXA bug: exaPixmapIsPinned was called on a non-exa pixmap.\n");
+#else
+	ErrorF("EXA bug: exaPixmapIsPinned was called on a non-exa pixmap.\n");
+	return TRUE;
+#endif
+    }
+
+    return pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED;
 }
 
 /**
@@ -86,8 +95,16 @@ exaPixmapIsDirty (PixmapPtr pPix)
 {
     ExaPixmapPriv (pPix);
 
-    return pExaPixmap == NULL ||
-	REGION_NOTEMPTY (pScreen, DamageRegion(pExaPixmap->pDamage)) ||
+    if (pExaPixmap == NULL) {
+#ifdef DEBUG
+	FatalError("EXA bug: exaPixmapIsDirty was called on a non-exa pixmap.\n");
+#else
+	ErrorF("EXA bug: exaPixmapIsDirty was called on a non-exa pixmap.\n");
+	return TRUE;
+#endif
+    }
+
+    return REGION_NOTEMPTY (pScreen, DamageRegion(pExaPixmap->pDamage)) ||
 	!REGION_EQUAL(pScreen, &pExaPixmap->validSys, &pExaPixmap->validFB);
 }
 
@@ -460,13 +477,6 @@ exaMigrateTowardFb (ExaMigrationPtr migrate)
     PixmapPtr pPixmap = migrate->pPix;
     ExaPixmapPriv (pPixmap);
 
-    if (pExaPixmap == NULL) {
-	DBG_MIGRATE(("UseScreen: ignoring exa-uncontrolled pixmap %p (%s)\n",
-		     (pointer)pPixmap,
-		     exaPixmapIsOffscreen(pPixmap) ? "s" : "m"));
-	return;
-    }
-
     if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) {
 	DBG_MIGRATE(("UseScreen: not migrating pinned pixmap %p\n",
 		     (pointer)pPixmap));
@@ -507,13 +517,6 @@ exaMigrateTowardSys (ExaMigrationPtr migrate)
     PixmapPtr pPixmap = migrate->pPix;
     ExaPixmapPriv (pPixmap);
 
-    if (pExaPixmap == NULL) {
-	DBG_MIGRATE(("UseMem: ignoring exa-uncontrolled pixmap %p (%s)\n",
-		     (pointer)pPixmap,
-		     exaPixmapIsOffscreen(pPixmap) ? "s" : "m"));
-	return;
-    }
-
     DBG_MIGRATE(("UseMem: %p score %d\n", (pointer)pPixmap, pExaPixmap->score));
 
     if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
@@ -625,6 +628,8 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
 
     if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS)
         return;
+    if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
+	return;
 
     /* If this debugging flag is set, check each pixmap for whether it is marked
      * as clean, and if so, actually check if that's the case.  This should help
-- 
1.6.1.3



More information about the xorg-devel mailing list