From 680fb05f99d701d2156d231f6b5ae614b146c7ce Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 18 Aug 2020 08:31:42 -0400 Subject: [PATCH] panfrost: Use memctx for sysvals 8.74KB leaked over 52 calls from: 0xffffbb5b9fc3 in ?? _mesa_hash_table_init at ../src/util/hash_table.c:163 in /home/alyssa/rockchip_dri.so _mesa_hash_table_create at ../src/util/hash_table.c:186 _mesa_hash_table_u64_create at ../src/util/hash_table.c:701 in /home/alyssa/rockchip_dri.so panfrost_nir_assign_sysvals at ../src/panfrost/util/pan_sysval.c:130 in /home/alyssa/rockchip_dri.so midgard_compile_shader_nir at ../src/panfrost/midgard/midgard_compile.c:2905 in /home/alyssa/rockchip_dri.so Signed-off-by: Alyssa Rosenzweig Cc: mesa-stable Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 2 +- src/panfrost/midgard/midgard_compile.c | 2 +- src/panfrost/util/pan_ir.h | 2 +- src/panfrost/util/pan_sysval.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 0c7942f7e95..cd1eafcd4c3 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -1342,7 +1342,7 @@ bifrost_compile_shader_nir(nir_shader *nir, panfrost_program *program, unsigned nir_print_shader(nir, stdout); } - panfrost_nir_assign_sysvals(&ctx->sysvals, nir); + panfrost_nir_assign_sysvals(&ctx->sysvals, ctx, nir); program->sysval_count = ctx->sysvals.sysval_count; memcpy(program->sysvals, ctx->sysvals.sysvals, sizeof(ctx->sysvals.sysvals[0]) * ctx->sysvals.sysval_count); ctx->blend_types = program->blend_types; diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 239434d7634..249f28fcea3 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -2897,7 +2897,7 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b /* Assign sysvals and counts, now that we're sure * (post-optimisation) */ - panfrost_nir_assign_sysvals(&ctx->sysvals, nir); + panfrost_nir_assign_sysvals(&ctx->sysvals, ctx, nir); program->sysval_count = ctx->sysvals.sysval_count; memcpy(program->sysvals, ctx->sysvals.sysvals, sizeof(ctx->sysvals.sysvals[0]) * ctx->sysvals.sysval_count); diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index 57d8129e770..80e1a877677 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -76,7 +76,7 @@ struct panfrost_sysvals { }; void -panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, nir_shader *shader); +panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, void *memctx, nir_shader *shader); int panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest); diff --git a/src/panfrost/util/pan_sysval.c b/src/panfrost/util/pan_sysval.c index 5f67e71f68c..2789c52daaf 100644 --- a/src/panfrost/util/pan_sysval.c +++ b/src/panfrost/util/pan_sysval.c @@ -124,10 +124,10 @@ panfrost_nir_assign_sysval_body(struct panfrost_sysvals *ctx, nir_instr *instr) } void -panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, nir_shader *shader) +panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, void *memctx, nir_shader *shader) { ctx->sysval_count = 0; - ctx->sysval_to_id = _mesa_hash_table_u64_create(NULL); + ctx->sysval_to_id = _mesa_hash_table_u64_create(memctx); nir_foreach_function(function, shader) { if (!function->impl) continue; -- 2.30.2