summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-15 19:55:50 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-15 19:55:50 +0000
commitcc4b616990fa71e96d38512d8cdb4c3e2abb21c0 (patch)
tree4f8d2156b90c13dfbb825a89ddf0f8501cac0dd8 /src
parent7f480ba02c66fcc02bad483731c4c0cf6c746c0d (diff)
sna/video: Increase the level of paranoia
In how many different ways can we check that the scanout is allocated before we start decoding video? Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna.h2
-rw-r--r--src/sna/sna_video_textured.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 6f726981..185bc1de 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -479,7 +479,7 @@ sna_drawable_move_to_gpu(DrawablePtr drawable, unsigned flags)
static inline Bool
sna_pixmap_is_gpu(PixmapPtr pixmap)
{
- struct sna_pixmap *priv = sna_pixmap(pixmap);
+ struct sna_pixmap *priv = pixmap ? sna_pixmap(pixmap) : NULL;
return priv && priv->gpu_bo;
}
diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index ba0e146c..a72d3351 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -229,7 +229,10 @@ sna_video_textured_put_image(ScrnInfoPtr scrn,
Bool flush = false;
Bool ret;
- if (!sna_pixmap(pixmap))
+ if (buf == 0)
+ return BadAlloc;
+
+ if (!sna_pixmap_is_gpu(pixmap))
return BadAlloc;
sna_video_frame_init(sna, video, id, width, height, &frame);