radeonsi/gfx10: fix main_shader_part_ngg_es memory leak

Indeed, main_shader_part_ngg_es was not freed.

For instance, this issue is triggered on a radeonsi/gfx10 gpu with
"piglit/bin/arb_gpu_shader5-tf-wrong-stream-value -auto -fbo":
Direct leak of 1464 byte(s) in 1 object(s) allocated from:
    #0 0x7f17904b99a7 in calloc (/usr/lib64/libasan.so.6+0xb19a7)
    #1 0x7f1785d65ac2 in si_init_shader_selector_async ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:3132
    #2 0x7f1783af67d8 in util_queue_thread_func ../src/util/u_queue.c:309
    #3 0x7f1783b51dfa in impl_thrd_routine ../src/c11/impl/threads_posix.c:67
    #4 0x7f178f69d38a  (/lib64/libc.so.6+0x8438a)

Indirect leak of 2024 byte(s) in 1 object(s) allocated from:
    #0 0x7f17904b97ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef)
    #1 0x7f1785d5443a in read_chunk ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:221
    #2 0x7f1785d62cf5 in si_load_shader_binary ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:293
    #3 0x7f1785d65255 in si_shader_cache_load_shader ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:423
    #4 0x7f1785d65ef9 in si_init_shader_selector_async ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:3169
    #5 0x7f1783af67d8 in util_queue_thread_func ../src/util/u_queue.c:309
    #6 0x7f1783b51dfa in impl_thrd_routine ../src/c11/impl/threads_posix.c:67
    #7 0x7f178f69d38a  (/lib64/libc.so.6+0x8438a)

Fixes: 8f72f137ad ("radeonsi/gfx10: add as_ngg variant for TES as ES to select Wave32/64")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27958>
(cherry picked from commit f93f215898)
This commit is contained in:
Patrick Lerda 2024-02-29 00:51:48 +01:00 committed by Eric Engestrom
parent d88d664399
commit c154218160
2 changed files with 3 additions and 1 deletions

View file

@ -1234,7 +1234,7 @@
"description": "radeonsi/gfx10: fix main_shader_part_ngg_es memory leak",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "8f72f137ad168775e6b50b69b1af2ba2754dbcfe",
"notes": null

View file

@ -3856,6 +3856,8 @@ static void si_destroy_shader_selector(struct pipe_context *ctx, void *cso)
si_delete_shader(sctx, sel->main_shader_part_es);
if (sel->main_shader_part_ngg)
si_delete_shader(sctx, sel->main_shader_part_ngg);
if (sel->main_shader_part_ngg_es)
si_delete_shader(sctx, sel->main_shader_part_ngg_es);
free(sel->keys);
free(sel->variants);