Skip to content

Commit

Permalink
panfrost: remove panfrost_create_shader_state() related dead code
Browse files Browse the repository at this point in the history
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 40372bd.
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: 40372bd ("panfrost: Implement a disk cache")
Signed-off-by: Patrick Lerda <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28743>
(cherry picked from commit 4f5e9a2)
  • Loading branch information
Patrick Lerda authored and 1ace committed Apr 22, 2024
1 parent 51dd480 commit 5a1d9cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion .pick_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/gallium/drivers/panfrost/pan_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5a1d9cb

Please sign in to comment.