pvr: allow STORAGE usage for WSI images

WSI images are expected to accept the same usage with OPTIMAL tiling
images, and this is checked in the CTS dEQP-VK.wsi.*.headless.swapchain.
create.image_usage test.

As storage to 2D linear images seems to be okay, check whether the image
is a WSI one by Mesa-private pNext, and allow STORAGE usage for those
that are created by Mesa WSI.

Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
This commit is contained in:
Icenowy Zheng 2026-05-05 17:29:31 +08:00
parent f6b7a40571
commit e06352d502

View file

@ -629,6 +629,16 @@ pvr_get_image_format_properties(struct pvr_physical_device *pdevice,
goto err_unsupported_format;
}
/* Allow STORAGE usage for WSI linear images, which is expected by the
* Vulkan specification (because WSI images should be as capable as optimal
* images). WSI images are expected to be all 2D.
*/
if (vk_find_struct_const(info->pNext, WSI_IMAGE_CREATE_INFO_MESA) &&
tiling == VK_IMAGE_TILING_LINEAR &&
(pvr_format->bind & PVR_BIND_STORAGE_IMAGE)) {
tiling_features2 |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT;
}
/* If VK_IMAGE_CREATE_EXTENDED_USAGE_BIT is set, the driver can't decide if a
* specific format isn't supported based on the usage.
*/
@ -809,7 +819,8 @@ VkResult pvr_GetPhysicalDeviceImageFormatProperties2(
/* Extract input structs */
vk_foreach_struct_const (ext, pImageFormatInfo->pNext) {
switch (ext->sType) {
/* Casting to accept Mesa-private types w/o compiler warning */
switch ((unsigned)ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO:
external_info = (const void *)ext;
break;
@ -817,6 +828,7 @@ VkResult pvr_GetPhysicalDeviceImageFormatProperties2(
break;
case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO:
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT:
case VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA:
/* Nothing to do here, it's handled in
* pvr_get_image_format_properties)
*/