[PATCH] exa/mixed: fix gnome-panel corruption

Maarten Maathuis madman2003 at gmail.com
Tue Feb 16 13:55:36 PST 2010


- A mapped pixmap can't be used for acceleration, any decent memory manager
will refuse this.
- Source pixmaps migrated with a bounding region are incomplete (from the
gpu point of view), so do the upload unconditionally, instead of just for
deferred destination pixmaps.
- Fixes fd.o bug #26076.

Signed-off-by: Maarten Maathuis <madman2003 at gmail.com>
Signed-off-by: Michel Dänzer <daenzer at vmware.com>
---
 exa/exa_migration_mixed.c |   48 ++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 6816e6c..fb47151 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -165,9 +165,37 @@ void
 exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 {
     ExaPixmapPriv(pPixmap);
+    Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+    Bool success;
+
+    success = ExaDoPrepareAccess(pPixmap, index);
+
+    if (success && has_gpu_copy && pExaPixmap->pDamage) {
+	/* You cannot do accelerated operations while a buffer is mapped. */
+	exaFinishAccess(&pPixmap->drawable, index);
+	/* Update the gpu view of both deferred destination pixmaps and of
+	 * source pixmaps that were migrated with a bounding region.
+	 */
+	exaMoveInPixmap_mixed(pPixmap);
+	success = ExaDoPrepareAccess(pPixmap, index);
+
+	if (success) {
+	    /* We have a gpu pixmap that can be accessed, we don't need the cpu
+	     * copy anymore. Drivers that prefer DFS, should fail prepare
+	     * access.
+	     */
+	    DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+	    DamageDestroy(pExaPixmap->pDamage);
+	    pExaPixmap->pDamage = NULL;
+
+	    free(pExaPixmap->sys_ptr);
+	    pExaPixmap->sys_ptr = NULL;
+
+	    return;
+	}
+    }
 
-    if (!ExaDoPrepareAccess(pPixmap, index)) {
-	Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+    if (!success) {
 	ExaMigrationRec pixmaps[1];
 
 	/* Do we need to allocate our system buffer? */
@@ -228,22 +256,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 	pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
 	pPixmap->devKind = pExaPixmap->sys_pitch;
 	pExaPixmap->use_gpu_copy = FALSE;
-    /* We have a gpu pixmap that can be accessed, we don't need the cpu copy
-     * anymore. Drivers that prefer DFS, should fail prepare access. */
-    } else if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
-	ExaScreenPriv(pPixmap->drawable.pScreen);
-
-	/* Copy back any deferred content if needed. */
-	if (pExaScr->deferred_mixed_pixmap &&
-	    pExaScr->deferred_mixed_pixmap == pPixmap)
-	    exaMoveInPixmap_mixed(pPixmap);
-
-	DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
-	DamageDestroy(pExaPixmap->pDamage);
-	pExaPixmap->pDamage = NULL;
-
-	free(pExaPixmap->sys_ptr);
-	pExaPixmap->sys_ptr = NULL;
     }
 }
 
-- 
1.7.0



More information about the xorg-devel mailing list