[Mesa-dev] [PATCH 74/77] i965: add an env var to force cache fallback

Timothy Arceri timothy.arceri at collabora.com
Mon Oct 3 06:05:33 UTC 2016


There are a number of reasons we can get to the program upload stage
and have neither IR nor a valid cached binary. For example the binary
may have been randomly evicted from the cache to make room or the
binary may have been created with an old version of Mesa.

This environment variable enabled us to force the fallback path that
would be taken in these cases and makes it easier to debug these
otherwise hard to reproduce scenarios.
---
 docs/envvars.html                            | 1 +
 src/mesa/drivers/dri/i965/brw_shader_cache.c | 4 ++++
 src/mesa/drivers/dri/i965/intel_debug.c      | 1 +
 src/mesa/drivers/dri/i965/intel_debug.h      | 1 +
 4 files changed, 7 insertions(+)

diff --git a/docs/envvars.html b/docs/envvars.html
index f0f18b3..8b10682 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -161,6 +161,7 @@ See the <a href="xlibdriver.html">Xlib software driver page</a> for details.
    <li>miptree - emit messages about miptrees</li>
    <li>perf - emit messages about performance issues</li>
    <li>perfmon - emit messages about AMD_performance_monitor</li>
+   <li>cache_fb - force cached shader to be ignored and do a full recompile via the fallback path</li>
    <li>bat - emit batch information</li>
    <li>pix - emit messages about pixel operations</li>
    <li>buf - emit messages about buffer objects</li>
diff --git a/src/mesa/drivers/dri/i965/brw_shader_cache.c b/src/mesa/drivers/dri/i965/brw_shader_cache.c
index 7d0e8a0..e4b764f 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -469,6 +469,10 @@ upload_cached_program(struct brw_context *brw, gl_shader_stage stage)
    if (prog->TransformFeedback.NumVarying > 0 || prog->SeparateShader)
       return;
 
+   /* Force the cache to fallback to a full recompile */
+   if (INTEL_DEBUG & DEBUG_CACHE_FALLBACK)
+      goto FAIL;
+
    if (!read_and_upload(brw, cache, &binary, prog, stage))
       goto FAIL;
 
diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c
index 33e8402..dc0799a 100644
--- a/src/mesa/drivers/dri/i965/intel_debug.c
+++ b/src/mesa/drivers/dri/i965/intel_debug.c
@@ -81,6 +81,7 @@ static const struct debug_control debug_control[] = {
    { "l3",          DEBUG_L3 },
    { "do32",        DEBUG_DO32 },
    { "norbc",       DEBUG_NO_RBC },
+   { "cache_fb",    DEBUG_CACHE_FALLBACK },
    { NULL,    0 }
 };
 
diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h
index f407b6a..756b552 100644
--- a/src/mesa/drivers/dri/i965/intel_debug.h
+++ b/src/mesa/drivers/dri/i965/intel_debug.h
@@ -74,6 +74,7 @@ extern uint64_t INTEL_DEBUG;
 #define DEBUG_L3                  (1ull << 38)
 #define DEBUG_DO32                (1ull << 39)
 #define DEBUG_NO_RBC              (1ull << 40)
+#define DEBUG_CACHE_FALLBACK      (1ull << 41)
 
 #ifdef HAVE_ANDROID_PLATFORM
 #define LOG_TAG "INTEL-MESA"
-- 
2.7.4



More information about the mesa-dev mailing list