Module: Mesa
Branch: main
Commit: 07f575a8a667c6411540750ad364aef4cb4d2a42
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=07f575a8a667c6411540750ad364aef4cb4d2a42

Author: Chia-I Wu <[email protected]>
Date:   Mon Oct 30 14:39:13 2023 -0700

radv: fix VkSubresourceLayout2KHR for multi-planar formats with modifiers

Memory planes and format planes are equivalent for multi-planar formats
with modifiers.  Do not return the DCC info of plane 0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25964>

---

 src/amd/vulkan/radv_image.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 511a6bb166a..28aa6ccde60 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -2515,14 +2515,15 @@ radv_GetImageSubresourceLayout2KHR(VkDevice _device, 
VkImage _image, const VkIma
    int level = pSubresource->imageSubresource.mipLevel;
    int layer = pSubresource->imageSubresource.arrayLayer;
 
+   const unsigned plane_count = vk_format_get_plane_count(image->vk.format);
    unsigned plane_id = 0;
-   if (vk_format_get_plane_count(image->vk.format) > 1)
+   if (plane_count > 1)
       plane_id = 
radv_plane_from_aspect(pSubresource->imageSubresource.aspectMask);
 
    struct radv_image_plane *plane = &image->planes[plane_id];
    struct radeon_surf *surface = &plane->surface;
 
-   if (image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
+   if (image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT && 
plane_count == 1) {
       unsigned mem_plane_id = 
radv_plane_from_aspect(pSubresource->imageSubresource.aspectMask);
 
       assert(level == 0);

Reply via email to