Mesa (master): r600g: fix memory leaks running gears.
Dave Airlie
airlied at kemper.freedesktop.org
Thu Aug 12 17:23:04 PDT 2010
Module: Mesa
Branch: master
Commit: f2804e70623c4c71e5758a24d695f8d6b74bf6d7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2804e70623c4c71e5758a24d695f8d6b74bf6d7
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Aug 13 10:16:29 2010 +1000
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.
---
src/gallium/drivers/r600/r600_state.c | 5 +++++
src/gallium/winsys/r600/drm/radeon_ctx.c | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index b9b46d6..3efd409 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -379,6 +379,8 @@ static void r600_set_scissor_state(struct pipe_context *ctx,
rstate = r600_context_state(rctx, pipe_scissor_type, state);
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,
@@ -389,6 +391,8 @@ static void r600_set_stencil_ref(struct pipe_context *ctx,
rstate = r600_context_state(rctx, pipe_stencil_ref_type, state);
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,
@@ -433,6 +437,7 @@ static void r600_set_viewport_state(struct pipe_context *ctx,
rstate = r600_context_state(rctx, pipe_viewport_type, state);
r600_bind_state(ctx, rstate);
+ r600_delete_state(ctx, rstate);
}
void r600_init_state_functions(struct r600_context *rctx)
diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c
index ff70ce6..45b706b 100644
--- a/src/gallium/winsys/r600/drm/radeon_ctx.c
+++ b/src/gallium/winsys/r600/drm/radeon_ctx.c
@@ -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->radeon = radeon_decref(ctx->radeon);
+ free(ctx->state);
free(ctx->draw);
free(ctx->bo);
free(ctx->pm4);
More information about the mesa-commit
mailing list