[PATCH] EXA: Finish access to pixmap if it's prepared at destruction time.

Michel Dänzer michel at daenzer.net
Wed Jul 7 03:38:10 PDT 2010


From: Michel Dänzer <daenzer at vmware.com>

Previously we assumed every pixmap destroyed during a software fallback was
also created during a software fallback and had access prepared, but that's
not always true.

Fixes a server abort reported by 邓逸昕 <bupt.dengyixin at gmail.com> .

Signed-off-by: Michel Dänzer <daenzer at vmware.com>
Tested-by: 邓逸昕 <bupt.dengyixin at gmail.com>
---
Would be great if this could make it into 1.9.

 exa/exa_classic.c |   14 +++++++++++---
 exa/exa_driver.c  |   14 +++++++++++---
 exa/exa_mixed.c   |   16 ++++++++++++----
 3 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index 2cfeda5..b95df9e 100644
--- a/exa/exa_classic.c
+++ b/exa/exa_classic.c
@@ -220,10 +220,18 @@ exaDestroyPixmap_classic (PixmapPtr pPixmap)
     if (pPixmap->refcnt == 1)
     {
 	ExaPixmapPriv (pPixmap);
+	int i;
 
-	/* During a fallback we must finish access, but we don't know the index. */
-	if (pExaScr->fallback_counter)
-	    exaFinishAccess(&pPixmap->drawable, -1);
+	/* Finish access if it was prepared (e.g. pixmap created during
+	 * software fallback)
+	 */
+	for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
+	    if (pExaScr->access[i].pixmap == pPixmap) {
+		exaFinishAccess(&pPixmap->drawable, i);
+		pExaScr->access[i].pixmap = NULL;
+		break;
+	    }
+	}
 
 	if (pExaPixmap->area)
 	{
diff --git a/exa/exa_driver.c b/exa/exa_driver.c
index abe79ba..1f5214f 100644
--- a/exa/exa_driver.c
+++ b/exa/exa_driver.c
@@ -192,10 +192,18 @@ exaDestroyPixmap_driver (PixmapPtr pPixmap)
     if (pPixmap->refcnt == 1)
     {
 	ExaPixmapPriv (pPixmap);
+	int i;
 
-	/* During a fallback we must finish access, but we don't know the index. */
-	if (pExaScr->fallback_counter)
-	    exaFinishAccess(&pPixmap->drawable, -1);
+	/* Finish access if it was prepared (e.g. pixmap created during
+	 * software fallback)
+	 */
+	for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
+	    if (pExaScr->access[i].pixmap == pPixmap) {
+		exaFinishAccess(&pPixmap->drawable, i);
+		pExaScr->access[i].pixmap = NULL;
+		break;
+	    }
+	}
 
 	if (pExaPixmap->driverPriv)
 	    pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 7fa771d..6d434d6 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -244,10 +244,18 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
     if (pPixmap->refcnt == 1)
     {
 	ExaPixmapPriv (pPixmap);
-
-	/* During a fallback we must finish access, but we don't know the index. */
-	if (pExaScr->fallback_counter)
-	    exaFinishAccess(&pPixmap->drawable, -1);
+	int i;
+
+	/* Finish access if it was prepared (e.g. pixmap created during
+	 * software fallback)
+	 */
+	for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
+	    if (pExaScr->access[i].pixmap == pPixmap) {
+		exaFinishAccess(&pPixmap->drawable, i);
+		pExaScr->access[i].pixmap = NULL;
+		break;
+	    }
+	}
 
 	if (pExaScr->deferred_mixed_pixmap == pPixmap)
 	    pExaScr->deferred_mixed_pixmap = NULL;
-- 
1.7.1



More information about the xorg-devel mailing list