diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-04 12:33:09 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-04 12:46:12 +0000 |
commit | a7c35fa4c3155d10ad75ac33aefb03dafa010aba (patch) | |
tree | 84a5e66537508cbebc198d7b653fdd6bcf4d531e | |
parent | 2cbc97d28aae138566e49df05e16d274b533ea86 (diff) |
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 <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 5 |
1 files changed, 4 insertions, 1 deletions
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)) { |