diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2013-11-29 05:52:27 -0500 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2013-12-06 08:09:03 -0800 |
commit | 6c00504a8aa2670623cc0b26d1b8448f5a75e467 (patch) | |
tree | 9681d4bcad623465371d70f7f1fbe02b84727eea /src/mesa | |
parent | e6710f42179a4750919c18e76a775ff0292b777b (diff) |
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>
(cherry picked from commit 267679be84de5bc9d2bd0fccb1712bc5cddb6be7)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/performance_monitor.c | 19 | ||||
-rw-r--r-- | src/mesa/main/performance_monitor.h | 3 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8cbc9352af3..55d797bea04 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -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); diff --git a/src/mesa/main/performance_monitor.c b/src/mesa/main/performance_monitor.c index 17cae518362..3d9b4f8c5ee 100644 --- a/src/mesa/main/performance_monitor.c +++ b/src/mesa/main/performance_monitor.c @@ -89,6 +89,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) { diff --git a/src/mesa/main/performance_monitor.h b/src/mesa/main/performance_monitor.h index a852a4184c2..76234e5c1bc 100644 --- a/src/mesa/main/performance_monitor.h +++ b/src/mesa/main/performance_monitor.h @@ -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); |