Skip to content

Commit 6ee0bba

Browse files
Patrick LerdaMarge Bot
Patrick Lerda
authored and
Marge Bot
committed
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: f363054 ("f3630548f1da crocus: initial gallium driver for Intel gfx 4-7") Signed-off-by: Patrick Lerda <[email protected]> Reviewed-by: Filip Gawin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23019>
1 parent e2e6adb commit 6ee0bba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/gallium/drivers/crocus/crocus_context.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ crocus_destroy_context(struct pipe_context *ctx)
194194
if (ice->blitter)
195195
util_blitter_destroy(ice->blitter);
196196
screen->vtbl.destroy_state(ice);
197+
198+
for (unsigned i = 0; i < ARRAY_SIZE(ice->shaders.scratch_bos); i++) {
199+
for (unsigned j = 0; j < ARRAY_SIZE(ice->shaders.scratch_bos[i]); j++)
200+
crocus_bo_unreference(ice->shaders.scratch_bos[i][j]);
201+
}
202+
197203
crocus_destroy_program_cache(ice);
198204
u_upload_destroy(ice->query_buffer_uploader);
199205

0 commit comments

Comments
 (0)