summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorTimothy Arceri <tarceri@itsqueeze.com>2017-05-20 11:06:25 +1000
committerTimothy Arceri <tarceri@itsqueeze.com>2017-05-23 09:09:43 +1000
commit0bbcfbfc0b35c7fa59441006adb1f69519a7df8f (patch)
treeba4aa3c4990f96b8cf184a5e554b58e0d3c0c57d /src/util
parentd970f773f4d72814721f6f58a71c307a608ab30d (diff)
util/disk_cache: add new driver_flags param to cache keys
This will be used for things such as adding driver specific environment variables to the key. Allowing us to set environment vars that change the shader and not have the driver ignore them if it finds existing shaders in the cache. Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/disk_cache.c8
-rw-r--r--src/util/disk_cache.h6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index cf5d518f096..138d7ec174f 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -161,7 +161,8 @@ concatenate_and_mkdir(void *ctx, const char *path, const char *name)
}
struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp)
+disk_cache_create(const char *gpu_name, const char *timestamp,
+ uint64_t driver_flags)
{
void *local;
struct disk_cache *cache = NULL;
@@ -356,6 +357,9 @@ disk_cache_create(const char *gpu_name, const char *timestamp)
size_t ptr_size_size = sizeof(ptr_size);
cache->driver_keys_blob_size += ptr_size_size;
+ size_t driver_flags_size = sizeof(driver_flags);
+ cache->driver_keys_blob_size += driver_flags_size;
+
cache->driver_keys_blob =
ralloc_size(cache, cache->driver_keys_blob_size);
if (!cache->driver_keys_blob)
@@ -365,6 +369,8 @@ disk_cache_create(const char *gpu_name, const char *timestamp)
memcpy(cache->driver_keys_blob + ts_size, gpu_name, gpu_name_size);
memcpy(cache->driver_keys_blob + ts_size + gpu_name_size, &ptr_size,
ptr_size_size);
+ memcpy(cache->driver_keys_blob + ts_size + gpu_name_size + ptr_size_size,
+ &driver_flags, driver_flags_size);
/* Seed our rand function */
s_rand_xorshift128plus(cache->seed_xorshift128plus, true);
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index 2bb1cf537d0..72f44638a55 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -93,7 +93,8 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
* assistance in computing SHA-1 signatures.
*/
struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp);
+disk_cache_create(const char *gpu_name, const char *timestamp,
+ uint64_t driver_flags);
/**
* Destroy a cache object, (freeing all associated resources).
@@ -171,7 +172,8 @@ disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
#else
static inline struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp)
+disk_cache_create(const char *gpu_name, const char *timestamp,
+ uint64_t driver_flags)
{
return NULL;
}