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

Pauli ext-pauli.nieminen at nokia.com
Fri Nov 26 07:07:24 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>
---
 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..336fee8 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -289,6 +289,13 @@ static int DRI2DrawableGone(pointer p, XID id)
     if (!list_is_empty(&pPriv->reference_list))
 	return Success;
 
+    if (pPriv->buffers != NULL) {
+	for (i = 0; i < pPriv->bufferCount; i++)
+	    (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+
+	free(pPriv->buffers);
+    }
+
     pDraw = pPriv->drawable;
     if (pDraw->type == DRAWABLE_WINDOW) {
 	pWin = (WindowPtr) pDraw;
@@ -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