From 3f60810de0a2960ec15118ef9888d9efc9ea605a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 9 May 2019 15:40:13 -0700 Subject: [PATCH] i965: Fix memory leaks in brw_upload_cs_work_groups_surface(). This was taking a reference to the 64kB upload buffer and never returning it, leaking a reference each time this atom triggered. This leaked lots of 64kB upload BOs, eventually running us out of of VMA space. This would usually happen when using mpv to watch a movie, after 20-40 minutes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110134 Fixes: 63d7b33f516 i965/cs: Setup surface binding for gl_NumWorkGroups Reviewed-by: Caio Marcelo de Oliveira Filho --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 8175fbf0db4..f1defb3f148 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -1685,6 +1685,11 @@ brw_upload_cs_work_groups_surface(struct brw_context *brw) ISL_FORMAT_RAW, 3 * sizeof(GLuint), 1, RELOC_WRITE); + + /* The state buffer now holds a reference to our upload, drop ours. */ + if (bo != brw->compute.num_work_groups_bo) + brw_bo_unreference(bo); + brw->ctx.NewDriverState |= BRW_NEW_SURFACES; } } -- 2.30.2