Mesa (master): radv: Add an early exit in the secure compile if we already have the cache entries.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 30 10:57:57 UTC 2019


Module: Mesa
Branch: master
Commit: 2e3a635ee698db793c999cb5f86cd2d66abddd37
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e3a635ee698db793c999cb5f86cd2d66abddd37

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Wed Oct 30 03:29:21 2019 +0100

radv: Add an early exit in the secure compile if we already have the cache entries.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

 src/amd/vulkan/radv_pipeline.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 422b0771a79..55a5d2a3c53 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -4644,6 +4644,20 @@ radv_secure_compile(struct radv_pipeline *pipeline,
 		                       allowed_hashes[i]);
 	}
 
+	/* Do an early exit if all cache entries are already there. */
+	bool may_need_copy_shader = pStages[MESA_SHADER_GEOMETRY];
+	void *main_entry = disk_cache_get(device->physical_device->disk_cache, allowed_hashes[0], 20);
+	void *copy_entry = NULL;
+	if (may_need_copy_shader)
+		copy_entry = disk_cache_get(device->physical_device->disk_cache, allowed_hashes[1], 20);
+
+	bool has_all_cache_entries = main_entry && (!may_need_copy_shader || copy_entry);
+	free(main_entry);
+	free(copy_entry);
+
+	if(has_all_cache_entries)
+		return VK_SUCCESS;
+
 	unsigned process = 0;
 	uint8_t sc_threads = device->instance->num_sc_threads;
 	while (true) {




More information about the mesa-commit mailing list