From e44d3904aaf5eae4056b4b4b45f760ff84d288ca Mon Sep 17 00:00:00 2001 From: Mohamed Ahmed Date: Tue, 24 Sep 2024 20:09:22 +0300 Subject: [PATCH] nvk: Block off non-2D DRM format modifier images Fixes: cd428e01d787 ("nvk: Advertise VK_EXT_image_drm_format_modifier") Part-of: (cherry picked from commit 5990de9182dd91a5b2b81296110310191776deef) --- .pick_status.json | 2 +- src/nouveau/vulkan/nvk_image.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 5866486f218..1782004f60d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/nouveau/vulkan/nvk_image.c b/src/nouveau/vulkan/nvk_image.c index 15cdcc2d14b..ce97627f8f2 100644 --- a/src/nouveau/vulkan/nvk_image.c +++ b/src/nouveau/vulkan/nvk_image.c @@ -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 &&