summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2017-08-15 16:26:10 -0700
committerJordan Justen <jordan.l.justen@intel.com>2017-08-18 16:33:30 -0700
commitda6220a677359023af228f6a70b7c55a8cd0c9d2 (patch)
tree1d92b9b328e339736b86a625f3b9ef95eade07c8
parent5680aab8123138c4f9702b90c2d91cf43b441f63 (diff)
i965/brw_disk_cache: Support INTEL_SHADER_CACHE_TIMESTAMP debug overridei965-shader-cache-v1
When making tweaks to the driver that should not affect the code generation, the INTEL_SHADER_CACHE_TIMESTAMP can be set to override the shader disk cache to use a consistent timestamp. This will allow the shader cache entries to remain valid across driver builds, but it should be used with caution. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_disk_cache.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index ef5380126a..bda40fad7a 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -670,7 +670,15 @@ brw_disk_cache_init(struct brw_context *brw)
if (renderer == NULL)
return;
- const struct build_id_note *note = build_id_find_nhdr("i965_dri.so");
+ /* The INTEL_SHADER_CACHE_TIMESTAMP variable is for debug purposes. It can
+ * be used to override the timestamp to a consistent value, which will
+ * allow the cache entries to be reused when making small changes to the
+ * driver that should not affect the program generation.
+ */
+ const char *env_timestamp = getenv("INTEL_SHADER_CACHE_TIMESTAMP");
+
+ const struct build_id_note *note =
+ env_timestamp == NULL ? build_id_find_nhdr("i965_dri.so") : NULL;
int id_size = note ? build_id_length(note) : 0;
char *timestamp;
if (id_size > 0) {
@@ -685,7 +693,7 @@ brw_disk_cache_init(struct brw_context *brw)
for (i = 0; i < id_size; i++)
snprintf(&timestamp[2 * i], 3, "%02x", data[i]);
} else {
- timestamp = strdup("now");
+ timestamp = strdup(env_timestamp ? env_timestamp : "now");
}
if (timestamp == NULL) {
free(renderer);