[PATCH 2/2] exa: fixup exaAssertNotDirty.

Maarten Maathuis madman2003 at gmail.com
Thu Feb 26 14:24:52 PST 2009


- Do the right thing based on prepare access.
---
 exa/exa.c           |   13 ++++++++++---
 exa/exa_migration.c |    8 ++++++--
 exa/exa_priv.h      |    2 +-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/exa/exa.c b/exa/exa.c
index a647699..8b6aab2 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -517,7 +517,10 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
 	return NULL;
 }
 
-void
+/**
+ * Returns TRUE if pixmap can be accessed offscreen.
+ */
+Bool
 ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
 {
     ScreenPtr	    pScreen = pDrawable->pScreen;
@@ -531,19 +534,23 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
     }
 
     if (!offscreen)
-	return;
+	return FALSE;
 
     exaWaitSync (pDrawable->pScreen);
 
     if (pExaScr->info->PrepareAccess == NULL)
-	return;
+	return TRUE;
 
     if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
 	ExaPixmapPriv (pPixmap);
 	if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
 	    FatalError("Driver failed PrepareAccess on a pinned pixmap\n");
 	exaMoveOutPixmap (pPixmap);
+
+	return FALSE;
     }
+
+    return TRUE;
 }
 
 void
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 9d0eda0..b6f192b 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -566,7 +566,9 @@ exaAssertNotDirty (PixmapPtr pPixmap)
     src_pitch = pExaPixmap->fb_pitch;
     cpp = pPixmap->drawable.bitsPerPixel / 8;
 
-    ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
+    if (!ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC))
+	goto skip;
+
     while (nbox--) {
 	    int rowbytes;
 
@@ -579,7 +581,7 @@ exaAssertNotDirty (PixmapPtr pPixmap)
 		continue;
 
 	    rowbytes = (pBox->x2 - pBox->x1) * cpp;
-	    src = pExaPixmap->fb_ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
+	    src = (CARD8 *) pPixmap->devPrivate.ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
 	    dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp;
 
 	    for (y = pBox->y1; y < pBox->y2;
@@ -592,6 +594,8 @@ exaAssertNotDirty (PixmapPtr pPixmap)
 		}
 	    }
     }
+
+skip:
     exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
 
 out:
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 8f83701..0509c47 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -443,7 +443,7 @@ void
 ExaOffscreenFini (ScreenPtr pScreen);
 
 /* exa.c */
-void
+Bool
 ExaDoPrepareAccess(DrawablePtr pDrawable, int index);
 
 void
-- 
1.6.1.3



More information about the xorg-devel mailing list