From 3e0565c262479ce078d37e891da9d629ecea0fe5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 18 Aug 2020 08:07:15 -0400 Subject: [PATCH] panfrost: Free cloned NIR shader Fixes heaptrack leak: 19.37KB leaked over 63 calls from: 0xffff92bbefc3 in ?? nir_alu_instr_create at ../src/compiler/nir/nir.c:442 in /home/alyssa/rockchip_dri.so clone_alu at ../src/compiler/nir/nir_clone.c:277 in /home/alyssa/rockchip_dri.so clone_instr at ../src/compiler/nir/nir_clone.c:495 in /home/alyssa/rockchip_dri.so clone_block at ../src/compiler/nir/nir_clone.c:544 clone_cf_list at ../src/compiler/nir/nir_clone.c:594 clone_function_impl at ../src/compiler/nir/nir_clone.c:672 in /home/alyssa/rockchip_dri.so nir_shader_clone at ../src/compiler/nir/nir_clone.c:744 in /home/alyssa/rockchip_dri.so panfrost_shader_compile at ../src/gallium/drivers/panfrost/pan_assemble.c:154 in /home/alyssa/rockchip_dri.so Signed-off-by: Alyssa Rosenzweig Cc: mesa-stable Reviewed-by: Tomeu Vizoso Part-of: (cherry picked from commit 9146f596ed1e8854a2a6c9137396a902bc92946c) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_assemble.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 62264175c70..c91a5769d7b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -580,7 +580,7 @@ "description": "panfrost: Free cloned NIR shader", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index 4a3bf793913..5db02edd931 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -287,4 +287,8 @@ panfrost_shader_compile(struct panfrost_context *ctx, var->data.precision, var->data.location_frac); } } + + /* In both clone and tgsi_to_nir paths, the shader is ralloc'd against + * a NULL context */ + ralloc_free(s); }