nvk: Block off non-2D DRM format modifier images

Fixes: cd428e01d7 ("nvk: Advertise VK_EXT_image_drm_format_modifier")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30044>
(cherry picked from commit 5990de9182)
This commit is contained in:
Mohamed Ahmed 2024-09-24 20:09:22 +03:00 committed by Eric Engestrom
parent 7b1e3ccccd
commit e44d3904aa
2 changed files with 10 additions and 1 deletions

View file

@ -44,7 +44,7 @@
"description": "nvk: Block off non-2D DRM format modifier images",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "cd428e01d7876da243933ee49f10f866777820f5",
"notes": null

View file

@ -389,6 +389,10 @@ nvk_GetPhysicalDeviceImageFormatProperties2(
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)))
return VK_ERROR_FORMAT_NOT_SUPPORTED;
if (pImageFormatInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
pImageFormatInfo->type != VK_IMAGE_TYPE_2D)
return VK_ERROR_FORMAT_NOT_SUPPORTED;
const uint32_t max_dim =
nvk_image_max_dimension(&pdev->info, VK_IMAGE_TYPE_1D);
VkExtent3D maxExtent;
@ -417,6 +421,11 @@ nvk_GetPhysicalDeviceImageFormatProperties2(
if (ycbcr_info != NULL || pImageFormatInfo->tiling == VK_IMAGE_TILING_LINEAR)
maxMipLevels = 1;
if (pImageFormatInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
maxArraySize = 1;
maxMipLevels = 1;
}
VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT;
if (pImageFormatInfo->tiling == VK_IMAGE_TILING_OPTIMAL &&
pImageFormatInfo->type == VK_IMAGE_TYPE_2D &&