summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-03-04 12:25:23 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-03-05 13:50:07 -0800
commit626559ed3717a205c1315040caa4308e77c70eb5 (patch)
tree63ff5c98cb8c4f2b49a7cf94f7efe1bd0ec79b20 /src/intel/vulkan
parent07441c344c845bd663398529dbf484759d09cd54 (diff)
anv: Add anv_pipeline_cache_add_entry()
This function will grow the cache to make room and then add the entry.
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_pipeline_cache.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index 0b260528f81..c85916fd1f8 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -195,6 +195,20 @@ anv_pipeline_cache_grow(struct anv_pipeline_cache *cache)
return VK_SUCCESS;
}
+static void
+anv_pipeline_cache_add_entry(struct anv_pipeline_cache *cache,
+ struct cache_entry *entry, uint32_t entry_offset)
+{
+ if (cache->kernel_count == cache->table_size / 2)
+ anv_pipeline_cache_grow(cache);
+
+ /* Failing to grow that hash table isn't fatal, but may mean we don't
+ * have enough space to add this new kernel. Only add it if there's room.
+ */
+ if (cache->kernel_count < cache->table_size / 2)
+ anv_pipeline_cache_set_entry(cache, entry, entry_offset);
+}
+
uint32_t
anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
const unsigned char *sha1,
@@ -224,14 +238,7 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
assert(anv_pipeline_cache_search(cache, sha1, NULL) == NO_KERNEL);
memcpy(entry->sha1, sha1, sizeof(entry->sha1));
- if (cache->kernel_count == cache->table_size / 2)
- anv_pipeline_cache_grow(cache);
-
- /* Failing to grow that hash table isn't fatal, but may mean we don't
- * have enough space to add this new kernel. Only add it if there's room.
- */
- if (cache->kernel_count < cache->table_size / 2)
- anv_pipeline_cache_set_entry(cache, entry, state.offset);
+ anv_pipeline_cache_add_entry(cache, entry, state.offset);
}
pthread_mutex_unlock(&cache->mutex);