i915g: Do propper references of surfaces in context

This commit is contained in:
Jakob Bornecrantz 2009-09-22 10:55:41 -07:00
parent 67d7021ae0
commit e369294f76
2 changed files with 16 additions and 1 deletions

View File

@ -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);
}

View File

@ -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;
}