Module: Mesa
Branch: main
Commit: f57a01c5f9ad8517b45fc4d11b5785bd3ae26980
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f57a01c5f9ad8517b45fc4d11b5785bd3ae26980

Author: Alejandro PiƱeiro <[email protected]>
Date:   Tue May  3 13:03:54 2022 +0200

v3dv/pipeline_cache: adds check to skip searching for a entry

If we are calling pipeline_cache_upload_shared_data with
from_disk_cache, that means that we had used the disk-cache to found
that entry. And that should only happens if we didn't find the entry
on the cache. So on that case we can skip to search for it.

Reviewed-by: Juan A. Suarez <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16313>

---

 src/broadcom/vulkan/v3dv_pipeline_cache.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_pipeline_cache.c 
b/src/broadcom/vulkan/v3dv_pipeline_cache.c
index 9d2b816a79e..9a78d30a5ba 100644
--- a/src/broadcom/vulkan/v3dv_pipeline_cache.c
+++ b/src/broadcom/vulkan/v3dv_pipeline_cache.c
@@ -427,8 +427,13 @@ pipeline_cache_upload_shared_data(struct 
v3dv_pipeline_cache *cache,
       return;
 
    pipeline_cache_lock(cache);
-   struct hash_entry *entry =
-      _mesa_hash_table_search(cache->cache, shared_data->sha1_key);
+   struct hash_entry *entry = NULL;
+
+   /* If this is being called from the disk cache, we already know that the
+    * entry is not on the hash table
+    */
+   if (!from_disk_cache)
+      entry = _mesa_hash_table_search(cache->cache, shared_data->sha1_key);
 
    if (entry) {
       pipeline_cache_unlock(cache);

Reply via email to