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

Timothy Arceri timothy.arceri at collabora.com
Tue Nov 29 03:58:42 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 enables 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 2f013bf..d65565f0 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -163,6 +163,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 755e63d..00798e7 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -398,6 +398,10 @@ upload_cached_program(struct brw_context *brw, gl_shader_stage stage)
        prog->sh.LinkedTransformFeedback->api_enabled)
       return false;
 
+   /* 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 afca36e..006dc42 100644
--- a/src/mesa/drivers/dri/i965/intel_debug.h
+++ b/src/mesa/drivers/dri/i965/intel_debug.h
@@ -73,6 +73,7 @@ extern uint64_t INTEL_DEBUG;
 #define DEBUG_L3                  (1ull << 37)
 #define DEBUG_DO32                (1ull << 38)
 #define DEBUG_NO_RBC              (1ull << 39)
+#define DEBUG_CACHE_FALLBACK      (1ull << 40)
 
 #ifdef HAVE_ANDROID_PLATFORM
 #define LOG_TAG "INTEL-MESA"
-- 
2.7.4



More information about the mesa-dev mailing list