mesa: don't leak performance monitors on context destroy

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Ilia Mirkin
2013-11-29 05:52:27 -05:00
committed by Kenneth Graunke
parent c45cf6199f
commit 267679be84
3 changed files with 23 additions and 0 deletions

View File

@@ -1194,6 +1194,7 @@ _mesa_free_context_data( struct gl_context *ctx )
_mesa_free_sync_data(ctx);
_mesa_free_varray_data(ctx);
_mesa_free_transform_feedback(ctx);
_mesa_free_performance_monitors(ctx);
_mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL);
_mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, NULL);

View File

@@ -93,6 +93,25 @@ fail:
return NULL;
}
static void
free_performance_monitor(GLuint key, void *data, void *user)
{
struct gl_perf_monitor_object *m = data;
struct gl_context *ctx = user;
ralloc_free(m->ActiveGroups);
ralloc_free(m->ActiveCounters);
ctx->Driver.DeletePerfMonitor(ctx, m);
}
void
_mesa_free_performance_monitors(struct gl_context *ctx)
{
_mesa_HashDeleteAll(ctx->PerfMonitor.Monitors,
free_performance_monitor, ctx);
_mesa_DeleteHashTable(ctx->PerfMonitor.Monitors);
}
static inline struct gl_perf_monitor_object *
lookup_monitor(struct gl_context *ctx, GLuint id)
{

View File

@@ -35,6 +35,9 @@
extern void
_mesa_init_performance_monitors(struct gl_context *ctx);
extern void
_mesa_free_performance_monitors(struct gl_context *ctx);
extern void GLAPIENTRY
_mesa_GetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize,
GLuint *groups);