[Mesa-dev] [PATCH 11/11] radeonsi/gfx9: prevent a race when the previous shader's main part is missing

Marek Olšák maraeo at gmail.com
Thu Jun 1 18:18:29 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 727bf4b..08d647b 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1627,23 +1627,25 @@ again:
 		if (previous_stage_sel) {
 			struct si_shader_key shader1_key = zeroed;
 
 			if (sel->type == PIPE_SHADER_TESS_CTRL)
 				shader1_key.as_ls = 1;
 			else if (sel->type == PIPE_SHADER_GEOMETRY)
 				shader1_key.as_es = 1;
 			else
 				assert(0);
 
+			mtx_lock(&previous_stage_sel->mutex);
 			ok = si_check_missing_main_part(sscreen,
 							previous_stage_sel,
 							compiler_state, &shader1_key);
+			mtx_unlock(&previous_stage_sel->mutex);
 		} else {
 			ok = si_check_missing_main_part(sscreen, sel,
 							compiler_state, key);
 		}
 		if (!ok) {
 			FREE(shader);
 			mtx_unlock(&sel->mutex);
 			return -ENOMEM; /* skip the draw call */
 		}
 	}
-- 
2.7.4



More information about the mesa-dev mailing list