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

Rami Ylimäki rami.ylimaki at vincit.fi
Tue Nov 30 07:32:55 PST 2010


Reviewed-by: Rami Ylimäki <rami.ylimaki at vincit.fi>

On 11/26/2010 05:07 PM, Pauli wrote:
> 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;



More information about the xorg-devel mailing list