summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-02-25 23:32:48 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2011-02-26 14:58:43 +0100
commitb8a0efb2e650eadcc4f2b1d531fcbffb8acacd9e (patch)
tree8849b6ef3abfe028c0d5e4615dae075d65cdb5b0
parent463c8c672898a428d493b3ca98f43181426cfbe5 (diff)
i915g: fix null deref in draw_rect emission
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--src/gallium/drivers/i915/i915_state_emit.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c
index 510fb1ccc6..a9a9d7fcb4 100644
--- a/src/gallium/drivers/i915/i915_state_emit.c
+++ b/src/gallium/drivers/i915/i915_state_emit.c
@@ -413,7 +413,6 @@ i915_emit_hardware_state(struct i915_context *i915 )
{
uint w, h;
struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
- struct i915_texture *tex = i915_texture(cbuf_surface->texture);
unsigned x, y;
int layer;
uint32_t draw_offset;
@@ -422,10 +421,15 @@ i915_emit_hardware_state(struct i915_context *i915 )
ret = framebuffer_size(&i915->framebuffer, &w, &h);
assert(ret);
- layer = cbuf_surface->u.tex.first_layer;
+ if (cbuf_surface) {
+ struct i915_texture *tex = i915_texture(cbuf_surface->texture);
+ layer = cbuf_surface->u.tex.first_layer;
+
+ x = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksx;
+ y = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksy;
- x = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksx;
- y = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksy;
+ } else
+ x = y = 0;
draw_offset = x | (y << 16);