radv: fix TC-compat HTILE images with DST_OPTIMAL on the compute queue
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 10 Dec 2020 13:06:58 +0000 (14:06 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 5 Jan 2021 12:10:11 +0000 (12:10 +0000)
This is probably rare but can happen if someone performs a depth-stencil
copy on the compute queue. This might work (untested by CTS) but it
looks more conservative to decompress before perfoming the operation.

Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8039>

src/amd/vulkan/radv_image.c

index fe12a4e..4203f42 100644 (file)
@@ -1764,6 +1764,11 @@ bool radv_layout_is_htile_compressed(const struct radv_image *image,
                        return true;
                }
 
+               if ((layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL ||
+                    layout == VK_IMAGE_LAYOUT_GENERAL) &&
+                   (queue_mask & (1u << RADV_QUEUE_COMPUTE)))
+                       return false;
+
                return layout != VK_IMAGE_LAYOUT_GENERAL;
        }