From 5a1d9cb4840d52c01cf554157680a98dc2c70018 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Fri, 12 Apr 2024 01:12:59 +0200 Subject: [PATCH] panfrost: remove panfrost_create_shader_state() related dead code The pointer "xfb" is allocated with a clone of "so->nir" and lost without further processing. The function panfrost_shader_compile() was the one processing "xfb". The call of this function was removed with the commit 40372bd720fe. This makes "xfb" not required anymore. For instance, this issue is triggered on a Mali-T820 with "piglit/bin/arb_transform_feedback2-change-objects-while-paused -auto": Indirect leak of 32776 byte(s) in 1 object(s) allocated from: #0 0xf78f30a6 in malloc (/usr/lib/libasan.so.6+0x840a6) #1 0xee9cd4ee in ralloc_size ../src/util/ralloc.c:118 #2 0xee9cf7ae in create_slab ../src/util/ralloc.c:801 #3 0xee9cf7ae in gc_alloc_size ../src/util/ralloc.c:840 #4 0xef74ab82 in nir_undef_instr_create ../src/compiler/nir/nir.c:888 #5 0xef76212c in clone_ssa_undef ../src/compiler/nir/nir_clone.c:328 #6 0xef76212c in clone_instr ../src/compiler/nir/nir_clone.c:438 #7 0xef7642d8 in clone_block ../src/compiler/nir/nir_clone.c:501 #8 0xef7642d8 in clone_cf_list ../src/compiler/nir/nir_clone.c:555 #9 0xef7657dc in clone_function_impl ../src/compiler/nir/nir_clone.c:632 #10 0xef766cb8 in nir_shader_clone ../src/compiler/nir/nir_clone.c:743 #11 0xf007673e in panfrost_create_shader_state ../src/gallium/drivers/panfrost/pan_shader.c:434 #12 0xeeb6766c in st_create_common_variant ../src/mesa/state_tracker/st_program.c:781 #13 0xeeb71d1c in st_get_common_variant ../src/mesa/state_tracker/st_program.c:834 #14 0xeeb72ea2 in st_precompile_shader_variant ../src/mesa/state_tracker/st_program.c:1320 #15 0xeeb72ea2 in st_finalize_program ../src/mesa/state_tracker/st_program.c:1421 #16 0xef3806ec in st_link_glsl_to_nir ../src/mesa/state_tracker/st_glsl_to_nir.cpp:748 #17 0xef3806ec in st_link_shader ../src/mesa/state_tracker/st_glsl_to_nir.cpp:984 #18 0xef2992f6 in link_program ../src/mesa/main/shaderapi.c:1336 #19 0xef2992f6 in link_program_error ../src/mesa/main/shaderapi.c:1445 Fixes: 40372bd720fe ("panfrost: Implement a disk cache") Signed-off-by: Patrick Lerda Reviewed-by: Boris Brezillon Part-of: (cherry picked from commit 4f5e9a21c5d10c3f3c5521ee5ad5757dade0de05) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_shader.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d9c65277993..7d188fb316d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1574,7 +1574,7 @@ "description": "panfrost: remove panfrost_create_shader_state() related dead code", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "40372bd720fe16186e9abc832bb452a3143d0e00", "notes": null diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index 27716bd64c1..fc6e6d546dd 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -383,10 +383,6 @@ panfrost_create_shader_state(struct pipe_context *pctx, struct panfrost_context *ctx = pan_context(pctx); if (so->nir->xfb_info) { - nir_shader *xfb = nir_shader_clone(NULL, so->nir); - xfb->info.name = ralloc_asprintf(xfb, "%s@xfb", xfb->info.name); - xfb->info.internal = true; - so->xfb = calloc(1, sizeof(struct panfrost_compiled_shader)); so->xfb->key.vs_is_xfb = true;