From a7c35fa4c3155d10ad75ac33aefb03dafa010aba Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 4 Jan 2012 12:33:09 +0000 Subject: sna: Only allow mappable pixmaps to be mapped If we did not allocate the pixel data, such as for wedged pixmaps or scratch buffers, then we cannot perform the pointer dance nor do we want to create the GPU buffer. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 3b3dc920..c9f4add7 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -225,11 +225,14 @@ sna_pixmap_alloc_cpu(struct sna *sna, done: pixmap->devPrivate.ptr = priv->ptr; pixmap->devKind = priv->stride; + assert(priv->stride); return priv->ptr != NULL; } static void sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv) { + assert(priv->stride); + if (priv->cpu_bo) { DBG(("%s: discarding CPU buffer, handle=%d, size=%d\n", __FUNCTION__, priv->cpu_bo->handle, priv->cpu_bo->size)); @@ -941,7 +944,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, } } - if (priv->gpu_bo == NULL && + if (priv->gpu_bo == NULL && priv->stride && sna_pixmap_choose_tiling(pixmap) != I915_TILING_NONE && region_inplace(sna, pixmap, region, priv) && sna_pixmap_create_mappable_gpu(pixmap)) { -- cgit v1.2.3