[PATCH v2] dri2: Destroy buffer before reseting the private key

Pauli ext-pauli.nieminen at Nokia.com
Thu Dec 2 02:47:41 PST 2010


From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>

Destroying buffers after reseting the private key would prevent DDX
from calling DRI2 functions that require private.

This can be result to
[DRI2] DRI2SwapComplete: bad drawable
when drivers calls SwapCompletion in state clean up code.

Restriction can be avoided if destroy buffer hook is called before
private key clean up.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---

v2:
* Set pDraw before using it.

 hw/xfree86/dri2/dri2.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index e4693d9..d61443f 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -290,6 +290,13 @@ static int DRI2DrawableGone(pointer p, XID id)
 	return Success;
 
     pDraw = pPriv->drawable;
+    if (pPriv->buffers != NULL) {
+	for (i = 0; i < pPriv->bufferCount; i++)
+	    (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+
+	free(pPriv->buffers);
+    }
+
     if (pDraw->type == DRAWABLE_WINDOW) {
 	pWin = (WindowPtr) pDraw;
 	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
@@ -298,13 +305,6 @@ static int DRI2DrawableGone(pointer p, XID id)
 	dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
     }
 
-    if (pPriv->buffers != NULL) {
-	for (i = 0; i < pPriv->bufferCount; i++)
-	    (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
-
-	free(pPriv->buffers);
-    }
-
     free(pPriv);
 
     return Success;
-- 
1.7.0.4



More information about the xorg-devel mailing list