Mesa (main): tu: Rewrite cache UUID based on radv
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri May 13 17:52:17 UTC 2022
Module: Mesa
Branch: main
Commit: d023ae4686b86e8df62ad0b9cf2d1fa91ca89dbc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d023ae4686b86e8df62ad0b9cf2d1fa91ca89dbc
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Mon May 9 15:02:17 2022 +0200
tu: Rewrite cache UUID based on radv
Switch to using sha1 so that we can add as many other flags as we need
to easily.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
---
src/freedreno/vulkan/tu_device.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 4f4a30b128e..32fdc7ea9b9 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -60,16 +60,19 @@
static int
tu_device_get_cache_uuid(uint16_t family, void *uuid)
{
- uint32_t mesa_timestamp;
- uint16_t f = family;
+ struct mesa_sha1 ctx;
+ unsigned char sha1[20];
+
memset(uuid, 0, VK_UUID_SIZE);
- if (!disk_cache_get_function_timestamp(tu_device_get_cache_uuid,
- &mesa_timestamp))
+ _mesa_sha1_init(&ctx);
+
+ if (!disk_cache_get_function_identifier(tu_device_get_cache_uuid, &ctx))
return -1;
- memcpy(uuid, &mesa_timestamp, 4);
- memcpy((char *) uuid + 4, &f, 2);
- snprintf((char *) uuid + 6, VK_UUID_SIZE - 10, "tu");
+ _mesa_sha1_update(&ctx, &family, sizeof(family));
+ _mesa_sha1_final(&ctx, sha1);
+
+ memcpy(uuid, sha1, VK_UUID_SIZE);
return 0;
}
More information about the mesa-commit
mailing list