lavapipe: use PACKAGE_VERSION for cache uuid in release builds

MESA_GIT_SHA1 is defined as "", which results in invalid access

fixes #7673

Fixes: b38879f8c5 ("vallium: initial import of the vulkan frontend")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20520>
This commit is contained in:
Mike Blumenkrantz 2023-01-04 10:22:57 -05:00 committed by Marge Bot
parent 68ded42a38
commit c17d0cc488

View file

@ -889,8 +889,13 @@ lvp_enumerate_physical_devices(struct vk_instance *vk_instance)
void
lvp_device_get_cache_uuid(void *uuid)
{
memset(uuid, 0, VK_UUID_SIZE);
snprintf(uuid, VK_UUID_SIZE, "val-%s", &MESA_GIT_SHA1[4]);
memset(uuid, 'a', VK_UUID_SIZE);
if (MESA_GIT_SHA1[0])
/* debug build */
memcpy(uuid, &MESA_GIT_SHA1[4], strlen(MESA_GIT_SHA1) - 4);
else
/* release build */
memcpy(uuid, PACKAGE_VERSION, strlen(PACKAGE_VERSION));
}
VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,