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

2010-11-30 Thread Rami Ylimäki

Reviewed-by: Rami Ylimäki 

On 11/26/2010 05:07 PM, Pauli wrote:

From: Pauli Nieminen

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
---
  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;


___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


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

2010-11-26 Thread Pauli
From: Pauli Nieminen 

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 
---
 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

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel