r600g: fix memory leaks running gears.

I noticed gears memory usage was heading skywards, some r600 "states"
aren't properly refcounted, and the ctx->state is never freed.
This commit is contained in:
Dave Airlie 2010-08-13 10:16:29 +10:00
parent 26c042c30a
commit f2804e7062
2 changed files with 6 additions and 0 deletions

View File

@ -379,6 +379,8 @@ static void r600_set_scissor_state(struct pipe_context *ctx,
rstate = r600_context_state(rctx, pipe_scissor_type, state); rstate = r600_context_state(rctx, pipe_scissor_type, state);
r600_bind_state(ctx, rstate); r600_bind_state(ctx, rstate);
/* refcount is taken care of this */
r600_delete_state(ctx, rstate);
} }
static void r600_set_stencil_ref(struct pipe_context *ctx, static void r600_set_stencil_ref(struct pipe_context *ctx,
@ -389,6 +391,8 @@ static void r600_set_stencil_ref(struct pipe_context *ctx,
rstate = r600_context_state(rctx, pipe_stencil_ref_type, state); rstate = r600_context_state(rctx, pipe_stencil_ref_type, state);
r600_bind_state(ctx, rstate); r600_bind_state(ctx, rstate);
/* refcount is taken care of this */
r600_delete_state(ctx, rstate);
} }
static void r600_set_vertex_buffers(struct pipe_context *ctx, static void r600_set_vertex_buffers(struct pipe_context *ctx,
@ -433,6 +437,7 @@ static void r600_set_viewport_state(struct pipe_context *ctx,
rstate = r600_context_state(rctx, pipe_viewport_type, state); rstate = r600_context_state(rctx, pipe_viewport_type, state);
r600_bind_state(ctx, rstate); r600_bind_state(ctx, rstate);
r600_delete_state(ctx, rstate);
} }
void r600_init_state_functions(struct r600_context *rctx) void r600_init_state_functions(struct r600_context *rctx)

View File

@ -112,6 +112,7 @@ struct radeon_ctx *radeon_ctx_decref(struct radeon_ctx *ctx)
ctx->bo[i] = radeon_bo_decref(ctx->radeon, ctx->bo[i]); ctx->bo[i] = radeon_bo_decref(ctx->radeon, ctx->bo[i]);
} }
ctx->radeon = radeon_decref(ctx->radeon); ctx->radeon = radeon_decref(ctx->radeon);
free(ctx->state);
free(ctx->draw); free(ctx->draw);
free(ctx->bo); free(ctx->bo);
free(ctx->pm4); free(ctx->pm4);