From d023ae4686b86e8df62ad0b9cf2d1fa91ca89dbc Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Mon, 9 May 2022 15:02:17 +0200 Subject: [PATCH] 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: --- 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; }