radv: initialize disk cache slightly later when creating a physical device

This will allow us to use a per physical device cache key.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27632>
This commit is contained in:
Samuel Pitoiset 2024-02-15 12:31:52 +01:00 committed by Marge Bot
parent 0543394bfa
commit c303d399ff

View file

@ -1956,18 +1956,6 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
snprintf(device->marketing_name, sizeof(device->name), "%s (RADV %s%s)",
marketing_name ? marketing_name : "AMD Unknown", device->rad_info.name, radv_get_compiler_string(device));
if (radv_device_get_cache_uuid(device, device->cache_uuid)) {
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "cannot generate UUID");
goto fail_wsi;
}
/* The gpu id is already embedded in the uuid so we just pass "radv"
* when creating the cache.
*/
char buf[VK_UUID_SIZE * 2 + 1];
mesa_bytes_to_hex(buf, device->cache_uuid, VK_UUID_SIZE);
device->vk.disk_cache = disk_cache_create(device->name, buf, 0);
if (!radv_is_conformant(device))
vk_warn_non_conformant_implementation("radv");
@ -2060,6 +2048,18 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
}
#endif
if (radv_device_get_cache_uuid(device, device->cache_uuid)) {
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "cannot generate UUID");
goto fail_wsi;
}
/* The gpu id is already embedded in the uuid so we just pass "radv"
* when creating the cache.
*/
char buf[VK_UUID_SIZE * 2 + 1];
mesa_bytes_to_hex(buf, device->cache_uuid, VK_UUID_SIZE);
device->vk.disk_cache = disk_cache_create(device->name, buf, 0);
radv_get_physical_device_properties(device);
if ((device->instance->debug_flags & RADV_DEBUG_INFO))