diff options
author | Eric Anholt <[email protected]> | 2014-12-14 20:29:10 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-12-14 23:12:11 -0800 |
commit | 80ed075e6033eba68b034fbd748da4e0b82a27f4 (patch) | |
tree | c8968de37e7b1bada2ac8cf1cf382752ecd03d3c /src/gallium/drivers/vc4 | |
parent | 4da9e3d80556253a05179c398ffb1c3120fa3089 (diff) |
vc4: Fix leak of the compiled shader programs in the cache.
Diffstat (limited to 'src/gallium/drivers/vc4')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 21 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c index b26c07127a9..3535ebbb3ed 100644 --- a/src/gallium/drivers/vc4/vc4_context.c +++ b/src/gallium/drivers/vc4/vc4_context.c @@ -431,6 +431,8 @@ vc4_context_destroy(struct pipe_context *pctx) util_slab_destroy(&vc4->transfer_pool); + vc4_program_fini(pctx); + ralloc_free(vc4); } diff --git a/src/gallium/drivers/vc4/vc4_context.h b/src/gallium/drivers/vc4/vc4_context.h index ba92cb36965..962abbfa972 100644 --- a/src/gallium/drivers/vc4/vc4_context.h +++ b/src/gallium/drivers/vc4/vc4_context.h @@ -293,6 +293,7 @@ struct pipe_context *vc4_context_create(struct pipe_screen *pscreen, void vc4_draw_init(struct pipe_context *pctx); void vc4_state_init(struct pipe_context *pctx); void vc4_program_init(struct pipe_context *pctx); +void vc4_program_fini(struct pipe_context *pctx); void vc4_query_init(struct pipe_context *pctx); void vc4_simulator_init(struct vc4_screen *screen); int vc4_simulator_flush(struct vc4_context *vc4, diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 007c18118e6..3af738f6c4b 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2777,3 +2777,24 @@ vc4_program_init(struct pipe_context *pctx) vc4->vs_cache = _mesa_hash_table_create(pctx, vs_cache_hash, vs_cache_compare); } + +void +vc4_program_fini(struct pipe_context *pctx) +{ + struct vc4_context *vc4 = vc4_context(pctx); + + struct hash_entry *entry; + hash_table_foreach(vc4->fs_cache, entry) { + struct vc4_compiled_shader *shader = entry->data; + vc4_bo_unreference(&shader->bo); + ralloc_free(shader); + _mesa_hash_table_remove(vc4->fs_cache, entry); + } + + hash_table_foreach(vc4->vs_cache, entry) { + struct vc4_compiled_shader *shader = entry->data; + vc4_bo_unreference(&shader->bo); + ralloc_free(shader); + _mesa_hash_table_remove(vc4->vs_cache, entry); + } +} |