summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_pipe.h
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-06-11 19:57:40 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-07-05 00:47:13 +0200
commit5c92c21369ee3b4f52eb5aed183092ba3ee7e079 (patch)
treed1464436b7410d1169ffd0a8e003db54f8c9e422 /src/gallium/drivers/radeonsi/si_pipe.h
parent84824935cf28b72bac9f73787aadf20b95dea230 (diff)
downloadexternal_mesa3d-5c92c21369ee3b4f52eb5aed183092ba3ee7e079.zip
external_mesa3d-5c92c21369ee3b4f52eb5aed183092ba3ee7e079.tar.gz
external_mesa3d-5c92c21369ee3b4f52eb5aed183092ba3ee7e079.tar.bz2
radeonsi: do compilation from si_create_shader_selector asynchronously
Main shader parts and geometry shaders are compiled asynchronously by util_queue. si_create_shader_selector doesn't wait and returns. si_draw_vbo(si_shader_select) waits for completion. This has the best effect when shaders are compiled at app-loading time. It doesn't help much for shaders compiled on demand, even though VS+PS compilation should take as much as time as the bigger one of the two. If an app creates more shaders, at most 4 threads will be used to compile them. Debug output disables this for shader stats to be printed in the correct order. (We could go even further and build variants asynchronously too, then emit draw calls without waiting and emit incomplete shader states, then force IB chaining to give the compiler more time, then sync the compilation at the IB flush and patch the IB with correct shader states. This is great for compilation before draw calls, but there are some difficulties such as scratch and tess states requiring the compiler output, and an on-disk shader cache will likely be a much better and simpler solution.) Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.h')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index fc7e73e..1f63c12 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -27,6 +27,7 @@
#define SI_PIPE_H
#include "si_state.h"
+#include "util/u_queue.h"
#include <llvm-c/TargetMachine.h>
@@ -110,6 +111,10 @@ struct si_screen {
*/
pipe_mutex shader_cache_mutex;
struct hash_table *shader_cache;
+
+ /* Shader compiler queue for multithreaded compilation. */
+ struct util_queue shader_compiler_queue;
+ LLVMTargetMachineRef tm[4]; /* used by the queue only */
};
struct si_blend_color {
@@ -207,7 +212,7 @@ struct si_context {
struct pipe_fence_handle *last_gfx_fence;
struct si_shader_ctx_state fixed_func_tcs_shader;
- LLVMTargetMachineRef tm;
+ LLVMTargetMachineRef tm; /* only non-threaded compilation */
bool gfx_flush_in_progress;
/* Atoms (direct states). */