panvk: fix to defer disk cache init after vk_physical_device_init
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Instead of initializing the disk cache earlier, the vk_properties
filling can be deferred after disk cache init is done. Otherwise, the
created disk cache will be zero'ed out in vk_physical_device_init,
ending up with leaked alloc and disabled disk cache (though advertised).

Fixes: acd00c07f6 ("panvk: Initialize the disk cache earlier")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39248>
This commit is contained in:
Yiwei Zhang 2026-01-09 21:33:08 -08:00 committed by Marge Bot
parent 6f4b3c7c9b
commit b41f466045

View file

@ -434,8 +434,6 @@ panvk_physical_device_init(struct panvk_physical_device *device,
memset(device->name, 0, sizeof(device->name));
sprintf(device->name, "%s", device->model->name);
init_shader_caches(device, instance);
result = get_core_masks(device, instance);
if (result != VK_SUCCESS)
goto fail;
@ -466,23 +464,26 @@ panvk_physical_device_init(struct panvk_physical_device *device,
panvk_arch_dispatch(arch, get_physical_device_features, instance,
device, &supported_features);
struct vk_properties properties;
panvk_arch_dispatch(arch, get_physical_device_properties, instance,
device, &properties);
struct vk_physical_device_dispatch_table dispatch_table;
vk_physical_device_dispatch_table_from_entrypoints(
&dispatch_table, &panvk_physical_device_entrypoints, true);
vk_physical_device_dispatch_table_from_entrypoints(
&dispatch_table, &wsi_physical_device_entrypoints, false);
result = vk_physical_device_init(&device->vk, &instance->vk,
&supported_extensions, &supported_features,
&properties, &dispatch_table);
result =
vk_physical_device_init(&device->vk, &instance->vk, &supported_extensions,
&supported_features, NULL, &dispatch_table);
if (result != VK_SUCCESS)
goto fail;
/* initialize disk cache after vk_physical_device_init */
init_shader_caches(device, instance);
/* pipeline binary props rely on disk cache init state */
panvk_arch_dispatch(arch, get_physical_device_properties, instance, device,
&device->vk.properties);
device->vk.supported_sync_types = device->sync_types;
result = panvk_wsi_init(device);