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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-01-24 19:58:29 +00:00
parent 5312ee90ad
commit aae19cbc5d
1 changed files with 3 additions and 2 deletions

View File

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