diff options
author | Faith Ekstrand <faith.ekstrand@collabora.com> | 2023-09-27 12:45:39 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-09-28 03:55:53 +0000 |
commit | d08df319ca8f03bd98ce0cac37214e374607dc3d (patch) | |
tree | 7f084687da2b60d2410d1ef87dfd28436f49a4e7 /src/nouveau | |
parent | 1780102923184ef5473c922e29529b77b078e35b (diff) | |
download | mesa-d08df319ca8f03bd98ce0cac37214e374607dc3d.tar.gz mesa-d08df319ca8f03bd98ce0cac37214e374607dc3d.tar.bz2 mesa-d08df319ca8f03bd98ce0cac37214e374607dc3d.zip |
nvk: Store a 20-bit driver_build_sha in nvk_instance
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25443>
Diffstat (limited to 'src/nouveau')
-rw-r--r-- | src/nouveau/vulkan/nvk_instance.c | 7 | ||||
-rw-r--r-- | src/nouveau/vulkan/nvk_instance.h | 2 | ||||
-rw-r--r-- | src/nouveau/vulkan/nvk_physical_device.c | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/nouveau/vulkan/nvk_instance.c b/src/nouveau/vulkan/nvk_instance.c index 1fa5e419dcd..e37b648662f 100644 --- a/src/nouveau/vulkan/nvk_instance.c +++ b/src/nouveau/vulkan/nvk_instance.c @@ -10,6 +10,7 @@ #include "vulkan/wsi/wsi_common.h" #include "util/build_id.h" +#include "util/mesa-sha1.h" VKAPI_ATTR VkResult VKAPI_CALL nvk_EnumerateInstanceVersion(uint32_t *pApiVersion) @@ -152,14 +153,14 @@ nvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, } unsigned build_id_len = build_id_length(note); - if (build_id_len < 20) { + if (build_id_len < SHA1_DIGEST_LENGTH) { result = vk_errorf(NULL, VK_ERROR_INITIALIZATION_FAILED, "build-id too short. It needs to be a SHA"); goto fail_init; } - assert(build_id_len >= VK_UUID_SIZE); - memcpy(instance->driver_uuid, build_id_data(note), VK_UUID_SIZE); + STATIC_ASSERT(sizeof(instance->driver_build_sha) == SHA1_DIGEST_LENGTH); + memcpy(instance->driver_build_sha, build_id_data(note), SHA1_DIGEST_LENGTH); *pInstance = nvk_instance_to_handle(instance); return VK_SUCCESS; diff --git a/src/nouveau/vulkan/nvk_instance.h b/src/nouveau/vulkan/nvk_instance.h index 9623467bf65..705f3ef3f9b 100644 --- a/src/nouveau/vulkan/nvk_instance.h +++ b/src/nouveau/vulkan/nvk_instance.h @@ -12,7 +12,7 @@ struct nvk_instance { struct vk_instance vk; - uint8_t driver_uuid[VK_UUID_SIZE]; + uint8_t driver_build_sha[20]; }; VK_DEFINE_HANDLE_CASTS(nvk_instance, vk.base, VkInstance, VK_OBJECT_TYPE_INSTANCE) diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c index dcf2c82d07c..ff9f693021f 100644 --- a/src/nouveau/vulkan/nvk_physical_device.c +++ b/src/nouveau/vulkan/nvk_physical_device.c @@ -619,7 +619,8 @@ nvk_get_device_properties(const struct nvk_instance *instance, }; STATIC_ASSERT(sizeof(dev_uuid) == VK_UUID_SIZE); memcpy(properties->deviceUUID, &dev_uuid, VK_UUID_SIZE); - memcpy(properties->driverUUID, instance->driver_uuid, VK_UUID_SIZE); + STATIC_ASSERT(sizeof(instance->driver_build_sha) >= VK_UUID_SIZE); + memcpy(properties->driverUUID, instance->driver_build_sha, VK_UUID_SIZE); snprintf(properties->driverName, VK_MAX_DRIVER_NAME_SIZE, "NVK"); snprintf(properties->driverInfo, VK_MAX_DRIVER_INFO_SIZE, |