[Mesa-dev] [PATCH 2/2] radeonsi: add a debug option to compile shaders when they're created

Marek Olšák maraeo at gmail.com
Fri Apr 10 15:21:18 PDT 2015


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

---
 src/gallium/drivers/radeon/r600_pipe_common.c   | 1 +
 src/gallium/drivers/radeon/r600_pipe_common.h   | 1 +
 src/gallium/drivers/radeonsi/si_state_shaders.c | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 0ef5fc2..2b27e0a 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -323,6 +323,7 @@ static const struct debug_named_value common_debug_options[] = {
 	{ "notiling", DBG_NO_TILING, "Disable tiling" },
 	{ "switch_on_eop", DBG_SWITCH_ON_EOP, "Program WD/IA to switch on end-of-packet." },
 	{ "forcedma", DBG_FORCE_DMA, "Use asynchronous DMA for all operations when possible." },
+	{ "precompile", DBG_PRECOMPILE, "Compile one shader variant at shader creation." },
 
 	DEBUG_NAMED_VALUE_END /* must be last */
 };
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index a08d08c..febd2a1 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -83,6 +83,7 @@
 #define DBG_NO_TILING		(1 << 14)
 #define DBG_SWITCH_ON_EOP	(1 << 15)
 #define DBG_FORCE_DMA		(1 << 16)
+#define DBG_PRECOMPILE		(1 << 17)
 /* The maximum allowed bit is 20. */
 
 #define R600_MAP_BUFFER_ALIGNMENT 64
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index b0a6fb9..1bbc6b3 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -465,6 +465,7 @@ static void *si_create_shader_state(struct pipe_context *ctx,
 				    const struct pipe_shader_state *state,
 				    unsigned pipe_shader_type)
 {
+	struct si_screen *sscreen = (struct si_screen *)ctx->screen;
 	struct si_shader_selector *sel = CALLOC_STRUCT(si_shader_selector);
 	int i;
 
@@ -494,6 +495,9 @@ static void *si_create_shader_state(struct pipe_context *ctx,
 		}
 	}
 
+	if (sscreen->b.debug_flags & DBG_PRECOMPILE)
+		si_shader_select(ctx, sel);
+
 	return sel;
 }
 
-- 
2.1.0



More information about the mesa-dev mailing list