From aae19cbc5d0ddcf247451d06e063b2550a7ff16f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 24 Jan 2012 19:58:29 +0000 Subject: [PATCH] sna: Only reset devPrivate.ptr if owned by the CPU bo when freeing If the pixmap is mapped to the GPU bo, we should continue to use the current mapping rather than revoke it. Otherwise if we write to the GPU bo inplace, thereby discarding the CPU bo, we set the pointer we are about to copy to, to NULL. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 6247fa64..46016e0c 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -296,8 +296,9 @@ static void sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv) } else free(priv->ptr); - priv->pixmap->devPrivate.ptr = priv->ptr = NULL; - priv->mapped = false; + priv->ptr = NULL; + if (!priv->mapped) + priv->pixmap->devPrivate.ptr = NULL; } static Bool sna_destroy_private(PixmapPtr pixmap, struct sna_pixmap *priv)