From 43d34682673bd3203a536906991bc9b43d6f18df Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 22 Jul 2024 11:35:57 -0500 Subject: [PATCH] nvk: Reject sparse images on Maxwell A and earlier Even though we don't advertise the sparseResidency feature, a bunch of CTS tests just call GetPhysicalDeviceImageFormatProperties2() with SPARSE_RESIDENCY_BIT and see if that fails. Fixes: d2177f47649b ("nvk: Don't advertise sparse residency on Maxwell A") Part-of: (cherry picked from commit 68d6cdfbc50df5969e84ec2391a3404d7b94ae58) --- .pick_status.json | 2 +- src/nouveau/vulkan/nvk_image.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5522c9dcdfa..ac9ec9e9473 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -594,7 +594,7 @@ "description": "nvk: Reject sparse images on Maxwell A and earlier", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d2177f47649bb39d8afd84eca95deabe63c447fb", "notes": null diff --git a/src/nouveau/vulkan/nvk_image.c b/src/nouveau/vulkan/nvk_image.c index 71f524b45b8..6f8752c5f56 100755 --- a/src/nouveau/vulkan/nvk_image.c +++ b/src/nouveau/vulkan/nvk_image.c @@ -348,6 +348,11 @@ nvk_GetPhysicalDeviceImageFormatProperties2( if (ycbcr_info && pImageFormatInfo->type != VK_IMAGE_TYPE_2D) return VK_ERROR_FORMAT_NOT_SUPPORTED; + /* Maxwell B and earlier don't support sparse residency */ + if ((pImageFormatInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) && + pdev->info.cls_eng3d < MAXWELL_B) + return VK_ERROR_FORMAT_NOT_SUPPORTED; + /* From the Vulkan 1.3.279 spec: * * VUID-VkImageCreateInfo-tiling-04121 @@ -360,7 +365,7 @@ nvk_GetPhysicalDeviceImageFormatProperties2( * "If imageType is VK_IMAGE_TYPE_1D, flags must not contain * VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT" */ - if (pImageFormatInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT && + if ((pImageFormatInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) && (pImageFormatInfo->type == VK_IMAGE_TYPE_1D || pImageFormatInfo->tiling == VK_IMAGE_TILING_LINEAR)) return VK_ERROR_FORMAT_NOT_SUPPORTED;