diff options
author | Patrick Lerda <patrick9876@free.fr> | 2023-05-09 20:22:40 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-05-16 13:44:13 +0000 |
commit | 6ee0bba3ae6777aa8df911301e5ff0a955ebce73 (patch) | |
tree | 3ca38d39eb1f8e76e2e8a2eb2595af8ca9616014 | |
parent | e2e6adbe37844829f26a26bcbe1ad8d9ffbb86d0 (diff) | |
download | mesa-6ee0bba3ae6777aa8df911301e5ff0a955ebce73.tar.gz |
crocus: fix scratch_bos memory leak
This change is inspired from iris_destroy_context().
For instance, this issue is triggered with
"piglit/bin/glsl-1.50-gs-max-output -scan 1 20 -auto -fbo":
Direct leak of 320 byte(s) in 2 object(s) allocated from:
#0 0x7f34fc769987 in calloc (/usr/lib64/libasan.so.6+0xb1987)
#1 0x7f34f4fa168a in bo_calloc ../src/gallium/drivers/crocus/crocus_bufmgr.c:288
#2 0x7f34f4fa168a in alloc_fresh_bo ../src/gallium/drivers/crocus/crocus_bufmgr.c:350
#3 0x7f34f4fa168a in bo_alloc_internal ../src/gallium/drivers/crocus/crocus_bufmgr.c:419
#4 0x7f34f4fe50a9 in crocus_get_scratch_space ../src/gallium/drivers/crocus/crocus_program.c:2678
#5 0x7f34f55e8954 in crocus_upload_dirty_render_state ../src/gallium/drivers/crocus/crocus_state.c:6871
#6 0x7f34f55e8954 in crocus_upload_render_state ../src/gallium/drivers/crocus/crocus_state.c:7812
#7 0x7f34f5d9f680 in crocus_simple_draw_vbo ../src/gallium/drivers/crocus/crocus_draw.c:332
#8 0x7f34f5d9f680 in crocus_draw_vbo ../src/gallium/drivers/crocus/crocus_draw.c:438
#9 0x7f34f1d2eeba in tc_call_draw_single ../src/gallium/auxiliary/util/u_threaded_context.c:3735
#10 0x7f34f1d12e03 in batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:394
#11 0x7f34f1d12e03 in tc_batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:445
#12 0x7f34f1d22c9a in _tc_sync ../src/gallium/auxiliary/util/u_threaded_context.c:680
#13 0x7f34f1d238f8 in tc_texture_map ../src/gallium/auxiliary/util/u_threaded_context.c:2754
#14 0x7f34f120b9d9 in pipe_texture_map_3d ../src/gallium/auxiliary/util/u_inlines.h:579
#15 0x7f34f120b9d9 in st_ReadPixels ../src/mesa/state_tracker/st_cb_readpixels.c:530
#16 0x7f34f10d7355 in read_pixels ../src/mesa/main/readpix.c:1178
#17 0x7f34f10d7355 in _mesa_ReadnPixelsARB ../src/mesa/main/readpix.c:1195
#18 0x7f34f10d7e10 in _mesa_ReadPixels ../src/mesa/main/readpix.c:1210
Fixes: f3630548f1da ("f3630548f1da crocus: initial gallium driver for Intel gfx 4-7")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23019>
-rw-r--r-- | src/gallium/drivers/crocus/crocus_context.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/crocus/crocus_context.c b/src/gallium/drivers/crocus/crocus_context.c index 56e4810e6a6..5ba3049b29e 100644 --- a/src/gallium/drivers/crocus/crocus_context.c +++ b/src/gallium/drivers/crocus/crocus_context.c @@ -194,6 +194,12 @@ crocus_destroy_context(struct pipe_context *ctx) if (ice->blitter) util_blitter_destroy(ice->blitter); screen->vtbl.destroy_state(ice); + + for (unsigned i = 0; i < ARRAY_SIZE(ice->shaders.scratch_bos); i++) { + for (unsigned j = 0; j < ARRAY_SIZE(ice->shaders.scratch_bos[i]); j++) + crocus_bo_unreference(ice->shaders.scratch_bos[i][j]); + } + crocus_destroy_program_cache(ice); u_upload_destroy(ice->query_buffer_uploader); |