[Mesa-dev] [PATCH 02/15] radeonsi/gfx9: prevent shader-db crashes

Marek Olšák maraeo at gmail.com
Mon Aug 21 21:54:01 UTC 2017


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

- don't precompile LS and ES (they don't exist on GFX9), compile as VS instead
- don't precompile HS and GS (we don't have LS and ES parts)
---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index de5260c..fd9828f 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1882,29 +1882,39 @@ void si_init_shader_selector_async(void *job, int thread_index)
 				case TGSI_SEMANTIC_PSIZE:
 				case TGSI_SEMANTIC_CLIPVERTEX:
 				case TGSI_SEMANTIC_EDGEFLAG:
 					break;
 				}
 			}
 		}
 	}
 
 	/* Pre-compilation. */
-	if (sscreen->b.debug_flags & DBG_PRECOMPILE) {
+	if (sscreen->b.debug_flags & DBG_PRECOMPILE &&
+	    /* GFX9 needs LS or ES for compilation, which we don't have here. */
+	    (sscreen->b.chip_class <= VI ||
+	     (sel->type != PIPE_SHADER_TESS_CTRL &&
+	      sel->type != PIPE_SHADER_GEOMETRY))) {
 		struct si_shader_ctx_state state = {sel};
 		struct si_shader_key key;
 
 		memset(&key, 0, sizeof(key));
 		si_parse_next_shader_property(&sel->info,
 					      sel->so.num_outputs != 0,
 					      &key);
 
+		/* GFX9 doesn't have LS and ES. */
+		if (sscreen->b.chip_class >= GFX9) {
+			key.as_ls = 0;
+			key.as_es = 0;
+		}
+
 		/* Set reasonable defaults, so that the shader key doesn't
 		 * cause any code to be eliminated.
 		 */
 		switch (sel->type) {
 		case PIPE_SHADER_TESS_CTRL:
 			key.part.tcs.epilog.prim_mode = PIPE_PRIM_TRIANGLES;
 			break;
 		case PIPE_SHADER_FRAGMENT:
 			key.part.ps.prolog.bc_optimize_for_persp =
 				sel->info.uses_persp_center &&
-- 
2.7.4



More information about the mesa-dev mailing list