diff options
author | Jakob Bornecrantz <[email protected]> | 2009-09-22 10:55:41 -0700 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2009-09-22 11:06:56 -0700 |
commit | e369294f760efd89754f4f66a1080bcf384ba4c6 (patch) | |
tree | 4a1dc768caf3a722f58cb336c56d1a0c378c81f0 /src/gallium | |
parent | 67d7021ae06e1c3559f3c0c35162768fcd1402d4 (diff) |
i915g: Do propper references of surfaces in context
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/i915simple/i915_context.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/i915simple/i915_state.c | 10 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c index b43f7352456..e745f3342d1 100644 --- a/src/gallium/drivers/i915simple/i915_context.c +++ b/src/gallium/drivers/i915simple/i915_context.c @@ -175,12 +175,19 @@ i915_is_buffer_referenced(struct pipe_context *pipe, static void i915_destroy(struct pipe_context *pipe) { struct i915_context *i915 = i915_context(pipe); + int i; draw_destroy(i915->draw); if(i915->batch) i915->iws->batchbuffer_destroy(i915->batch); + /* unbind framebuffer */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&i915->framebuffer.cbufs[i], NULL); + } + pipe_surface_reference(&i915->framebuffer.zsbuf, NULL); + FREE(i915); } diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c index 0087dfa410f..7d48e6e84d5 100644 --- a/src/gallium/drivers/i915simple/i915_state.c +++ b/src/gallium/drivers/i915simple/i915_state.c @@ -588,9 +588,17 @@ static void i915_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { struct i915_context *i915 = i915_context(pipe); + int i; + draw_flush(i915->draw); - i915->framebuffer = *fb; /* struct copy */ + i915->framebuffer.width = fb->width; + i915->framebuffer.height = fb->height; + i915->framebuffer.nr_cbufs = fb->nr_cbufs; + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&i915->framebuffer.cbufs[i], fb->cbufs[i]); + } + pipe_surface_reference(&i915->framebuffer.zsbuf, fb->zsbuf); i915->dirty |= I915_NEW_FRAMEBUFFER; } |