[Mesa-dev] [PATCH] radv: add cache items to in memory cache when reading from disk

Timothy Arceri tarceri at itsqueeze.com
Thu Oct 26 02:41:01 UTC 2017


Otherwise we will leak them, load duplicates from disk rather
than memory and never write items loaded from disk to the apps
pipeline cache.

Fixes: fd24be134ffd 'radv: make use of on-disk cache'
---
 src/amd/vulkan/radv_pipeline_cache.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 9ba9a3b61b..89b27fd35f 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -194,20 +194,22 @@ radv_create_shader_variants_from_pipeline_cache(struct radv_device *device,
 
 		uint8_t disk_sha1[20];
 		disk_cache_compute_key(device->physical_device->disk_cache,
 				       sha1, 20, disk_sha1);
 		entry = (struct cache_entry *)
 			disk_cache_get(device->physical_device->disk_cache,
 				       disk_sha1, NULL);
 		if (!entry) {
 			pthread_mutex_unlock(&cache->mutex);
 			return false;
+		} else {
+			radv_pipeline_cache_add_entry(cache, entry);
 		}
 	}
 
 	char *p = entry->code;
 	for(int i = 0; i < MESA_SHADER_STAGES; ++i) {
 		if (!entry->variants[i] && entry->code_sizes[i]) {
 			struct radv_shader_variant *variant;
 			struct cache_entry_variant_info info;
 
 			variant = calloc(1, sizeof(struct radv_shader_variant));
-- 
2.13.6



More information about the mesa-dev mailing list