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>
(cherry picked from commit c17d0cc488)
This commit is contained in:
Mike Blumenkrantz 2023-01-04 10:22:57 -05:00 committed by Eric Engestrom
parent 8259af094e
commit f259a7b0c3
2 changed files with 8 additions and 3 deletions

View file

@ -1165,7 +1165,7 @@
"description": "lavapipe: use PACKAGE_VERSION for cache uuid in release builds",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "b38879f8c5f57b7f1802e433e33181bdf5e72aef"
},

View file

@ -1076,8 +1076,13 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
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,