anv: Turn pipeline cache on by default
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Fri, 4 Mar 2016 23:03:23 +0000 (15:03 -0800)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Sat, 5 Mar 2016 21:54:24 +0000 (13:54 -0800)
Move the environment variable check to cache creation time so we block
both lookups and uploads if it's turned off.

src/intel/vulkan/anv_pipeline_cache.c

index f7a1e1c679a0470bc9caff1859200438684f0763..62dbe3eda74dc108f508dab004bfb23fb47da8bb 100644 (file)
@@ -54,7 +54,8 @@ anv_pipeline_cache_init(struct anv_pipeline_cache *cache,
 
    /* We don't consider allocation failure fatal, we just start with a 0-sized
     * cache. */
-   if (cache->hash_table == NULL)
+   if (cache->hash_table == NULL ||
+       !env_var_as_boolean("ANV_ENABLE_PIPELINE_CACHE", true))
       cache->table_size = 0;
    else
       memset(cache->hash_table, 0xff, byte_size);
@@ -299,7 +300,7 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
           map->sampler_count * sizeof(struct anv_pipeline_binding));
    map->sampler_to_descriptor = p;
 
-   if (sha1 && env_var_as_boolean("ANV_ENABLE_PIPELINE_CACHE", false)) {
+   if (sha1) {
       assert(anv_pipeline_cache_search_unlocked(cache, sha1,
                                                 NULL, NULL) == NO_KERNEL);