diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-05 18:41:26 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-05 19:14:43 +0000 |
commit | 53c943b551b86402067ea96cd9fcca2848e84387 (patch) | |
tree | 78c31fd27d9e7df067a100e83ad1dac21b04c9ee | |
parent | 307276d7da99ceb84c175e412452e5d86d615cf4 (diff) |
sna: Check for usable pixmap before deference its private
Beware the NULL pointer and early deference.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index b14d2e96..9bb257f7 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2157,7 +2157,7 @@ sna_put_xypixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, struct sna *sna = to_sna_from_pixmap(pixmap); struct sna_pixmap *priv = sna_pixmap(pixmap); struct sna_damage **damage; - struct kgem_bo *bo = priv->gpu_bo; + struct kgem_bo *bo; int16_t dx, dy; unsigned i, skip; @@ -2169,6 +2169,7 @@ sna_put_xypixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, &damage)) return false; + bo = priv->gpu_bo; if (bo->tiling == I915_TILING_Y) { DBG(("%s: converting bo from Y-tiling\n", __FUNCTION__)); if (!sna_pixmap_change_tiling(pixmap, I915_TILING_X)) @@ -8977,15 +8978,15 @@ sna_push_pixels_solid_blt(GCPtr gc, int n; uint8_t rop = copy_ROP[gc->alu]; + if (!sna_drawable_use_gpu_bo(drawable, ®ion->extents, &damage)) + return false; + if (priv->gpu_bo->tiling == I915_TILING_Y) { DBG(("%s: converting bo from Y-tiling\n", __FUNCTION__)); if (!sna_pixmap_change_tiling(pixmap, I915_TILING_X)) return false; } - if (!sna_drawable_use_gpu_bo(drawable, ®ion->extents, &damage)) - return false; - get_drawable_deltas(drawable, pixmap, &dx, &dy); RegionTranslate(region, dx, dy); |