[Mesa-dev] [PATCH 21/21] i965: add drirc option multithread_glsl_compiler

Chia-I Wu olvaffe at gmail.com
Tue Apr 22 01:58:36 PDT 2014


Setting it to a non-zero value N will cause glCompileShader to be deferred to
a thread pool.  When N is greater than 1, it indicates the maximum number of
threads in the pool.  When N is 1, the number of threads is up to the driver.

Signed-off-by: Chia-I Wu <olv at lunarg.com>
---
 src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 ++++
 src/mesa/drivers/dri/i965/brw_context.c         | 9 +++++++++
 src/mesa/drivers/dri/i965/intel_screen.c        | 2 ++
 3 files changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 3bf804a..a99c930 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -293,6 +293,10 @@ DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
 	DRI_CONF_DESC_END \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_MULTITHREAD_GLSL_COMPILER(def) \
+DRI_CONF_OPT_BEGIN(multithread_glsl_compiler, int, def) \
+        DRI_CONF_DESC(en,gettext("Enable multithreading in the GLSL compiler")) \
+DRI_CONF_OPT_END
 
 
 /**
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 28118b9..9be320f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -565,6 +565,15 @@ brw_process_driconf_options(struct brw_context *brw)
 
    ctx->Const.DisableGLSLLineContinuations =
       driQueryOptionb(options, "disable_glsl_line_continuations");
+
+   const int multithread_glsl_compiler =
+      driQueryOptioni(options, "multithread_glsl_compiler");
+   if (multithread_glsl_compiler > 0) {
+      const int max_threads = (multithread_glsl_compiler > 1) ?
+         multithread_glsl_compiler : 2;
+
+      _mesa_enable_glsl_threadpool(ctx, max_threads);
+   }
 }
 
 GLboolean
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 8cb1260..1a3f6cc 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -48,6 +48,8 @@ static const __DRIconfigOptionsExtension brw_config_options = {
 DRI_CONF_BEGIN
    DRI_CONF_SECTION_PERFORMANCE
       DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_ALWAYS_SYNC)
+      DRI_CONF_MULTITHREAD_GLSL_COMPILER(0)
+
       /* Options correspond to DRI_CONF_BO_REUSE_DISABLED,
        * DRI_CONF_BO_REUSE_ALL
        */
-- 
1.8.5.3



More information about the mesa-dev mailing list