[Mesa-dev] [PATCH 05/18] radeonsi: don't compile pure monolithic shaders asynchronously

Marek Olšák maraeo at gmail.com
Thu Feb 16 12:52:57 UTC 2017


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

there is no point, we have to wait anyway.
---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 9570259..3630911 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1229,45 +1229,49 @@ again:
 	/* Build a new shader. */
 	shader = CALLOC_STRUCT(si_shader);
 	if (!shader) {
 		pipe_mutex_unlock(sel->mutex);
 		return -ENOMEM;
 	}
 	shader->selector = sel;
 	shader->key = *key;
 	shader->compiler_ctx_state = *compiler_state;
 
+	bool is_pure_monolithic =
+		memcmp(&key->mono, &zeroed.mono, sizeof(key->mono)) != 0;
+
 	/* Monolithic-only shaders don't make a distinction between optimized
 	 * and unoptimized. */
 	shader->is_monolithic =
 		!sel->main_shader_part ||
 		sel->main_shader_part->key.as_ls != key->as_ls ||
 		sel->main_shader_part->key.as_es != key->as_es ||
-		memcmp(&key->opt, &zeroed.opt, sizeof(key->opt)) != 0 ||
-		memcmp(&key->mono, &zeroed.mono, sizeof(key->mono)) != 0;
+		is_pure_monolithic ||
+		memcmp(&key->opt, &zeroed.opt, sizeof(key->opt)) != 0;
 
 	shader->is_optimized =
 		!sscreen->use_monolithic_shaders &&
 		memcmp(&key->opt, &zeroed.opt, sizeof(key->opt)) != 0;
 	if (shader->is_optimized)
 		util_queue_fence_init(&shader->optimized_ready);
 
 	if (!sel->last_variant) {
 		sel->first_variant = shader;
 		sel->last_variant = shader;
 	} else {
 		sel->last_variant->next_variant = shader;
 		sel->last_variant = shader;
 	}
 
 	/* If it's an optimized shader, compile it asynchronously. */
 	if (shader->is_optimized &&
+	    !is_pure_monolithic &&
 	    thread_index < 0) {
 		/* Compile it asynchronously. */
 		util_queue_add_job(&sscreen->shader_compiler_queue,
 				   shader, &shader->optimized_ready,
 				   si_build_shader_variant, NULL);
 
 		/* Use the default (unoptimized) shader for now. */
 		memset(&key->opt, 0, sizeof(key->opt));
 		pipe_mutex_unlock(sel->mutex);
 		goto again;
-- 
2.7.4



More information about the mesa-dev mailing list