From 37c5e7025333fed2943630fa94e59ef2d413030b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Thu, 3 Mar 2016 16:52:20 -0800 Subject: [PATCH] anv: Rename 'table' to 'hash_table' in anv_pipeline_cache A little less ambiguous. --- src/intel/vulkan/anv_pipeline_cache.c | 32 +++++++++++++-------------- src/intel/vulkan/anv_private.h | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c index 932baddb83a..48f36706fef 100644 --- a/src/intel/vulkan/anv_pipeline_cache.c +++ b/src/intel/vulkan/anv_pipeline_cache.c @@ -49,15 +49,15 @@ anv_pipeline_cache_init(struct anv_pipeline_cache *cache, cache->kernel_count = 0; cache->total_size = 0; cache->table_size = 1024; - const size_t byte_size = cache->table_size * sizeof(cache->table[0]); - cache->table = malloc(byte_size); + const size_t byte_size = cache->table_size * sizeof(cache->hash_table[0]); + cache->hash_table = malloc(byte_size); /* We don't consider allocation failure fatal, we just start with a 0-sized * cache. */ - if (cache->table == NULL) + if (cache->hash_table == NULL) cache->table_size = 0; else - memset(cache->table, 0xff, byte_size); + memset(cache->hash_table, 0xff, byte_size); } void @@ -65,7 +65,7 @@ anv_pipeline_cache_finish(struct anv_pipeline_cache *cache) { anv_state_stream_finish(&cache->program_stream); pthread_mutex_destroy(&cache->mutex); - free(cache->table); + free(cache->hash_table); } struct cache_entry { @@ -117,7 +117,7 @@ anv_pipeline_cache_search(struct anv_pipeline_cache *cache, for (uint32_t i = 0; i < cache->table_size; i++) { const uint32_t index = (start + i) & mask; - const uint32_t offset = cache->table[index]; + const uint32_t offset = cache->hash_table[index]; if (offset == ~0) return NO_KERNEL; @@ -150,8 +150,8 @@ anv_pipeline_cache_add_entry(struct anv_pipeline_cache *cache, for (uint32_t i = 0; i < cache->table_size; i++) { const uint32_t index = (start + i) & mask; - if (cache->table[index] == ~0) { - cache->table[index] = entry_offset; + if (cache->hash_table[index] == ~0) { + cache->hash_table[index] = entry_offset; break; } } @@ -165,20 +165,20 @@ anv_pipeline_cache_grow(struct anv_pipeline_cache *cache) { const uint32_t table_size = cache->table_size * 2; const uint32_t old_table_size = cache->table_size; - const size_t byte_size = table_size * sizeof(cache->table[0]); + const size_t byte_size = table_size * sizeof(cache->hash_table[0]); uint32_t *table; - uint32_t *old_table = cache->table; + uint32_t *old_table = cache->hash_table; table = malloc(byte_size); if (table == NULL) return VK_ERROR_OUT_OF_HOST_MEMORY; - cache->table = table; + cache->hash_table = table; cache->table_size = table_size; cache->kernel_count = 0; cache->total_size = 0; - memset(cache->table, 0xff, byte_size); + memset(cache->hash_table, 0xff, byte_size); for (uint32_t i = 0; i < old_table_size; i++) { const uint32_t offset = old_table[i]; if (offset == ~0) @@ -368,10 +368,10 @@ VkResult anv_GetPipelineCacheData( struct cache_entry *entry; for (uint32_t i = 0; i < cache->table_size; i++) { - if (cache->table[i] == ~0) + if (cache->hash_table[i] == ~0) continue; - entry = cache->program_stream.block_pool->map + cache->table[i]; + entry = cache->program_stream.block_pool->map + cache->hash_table[i]; if (end < p + entry_size(entry)) break; @@ -395,11 +395,11 @@ anv_pipeline_cache_merge(struct anv_pipeline_cache *dst, struct anv_pipeline_cache *src) { for (uint32_t i = 0; i < src->table_size; i++) { - if (src->table[i] == ~0) + if (src->hash_table[i] == ~0) continue; struct cache_entry *entry = - src->program_stream.block_pool->map + src->table[i]; + src->program_stream.block_pool->map + src->hash_table[i]; if (anv_pipeline_cache_search(dst, entry->sha1, NULL) != NO_KERNEL) continue; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index f87270466ae..32c8b13c952 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -633,7 +633,7 @@ struct anv_pipeline_cache { uint32_t total_size; uint32_t table_size; uint32_t kernel_count; - uint32_t *table; + uint32_t * hash_table; }; void anv_pipeline_cache_init(struct anv_pipeline_cache *cache, -- 2.30.2