radv: fix msaa feedback loop without tc-compat cmask

When in an msaa feedback loop and when the image does not have tc-compat
cmask, we have to decompress and expand fmask.  This can happen on gfx9
when sample count > 2 or when RADV_DEBUG=notccompatcmask is specified.

Fixes: a38de4c011 ("radv: disable tc_compatible_cmask on GFX9 in some cases")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23331>
This commit is contained in:
Chia-I Wu 2023-05-30 15:43:16 -07:00 committed by Marge Bot
parent 7e8e7f0823
commit 6cb5185916

View file

@ -2500,15 +2500,23 @@ radv_layout_fmask_compression(const struct radv_device *device, const struct rad
if (layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && (queue_mask & (1u << RADV_QUEUE_COMPUTE)))
return RADV_FMASK_COMPRESSION_NONE;
if (layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL ||
layout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) {
return radv_image_is_tc_compat_cmask(image) ? RADV_FMASK_COMPRESSION_FULL :
RADV_FMASK_COMPRESSION_PARTIAL;
}
/* Compress images if TC-compat CMASK is enabled. */
if (radv_image_is_tc_compat_cmask(image))
return RADV_FMASK_COMPRESSION_FULL;
/* Only compress concurrent images if TC-compat CMASK is enabled (no FMASK decompression). */
return (queue_mask == (1u << RADV_QUEUE_GENERAL) || radv_image_is_tc_compat_cmask(image)) ?
RADV_FMASK_COMPRESSION_FULL : RADV_FMASK_COMPRESSION_NONE;
switch (layout) {
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
case VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL:
/* Don't compress images but no need to expand FMASK. */
return RADV_FMASK_COMPRESSION_PARTIAL;
case VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT:
/* Don't compress images that are in feedback loops. */
return RADV_FMASK_COMPRESSION_NONE;
default:
/* Don't compress images that are concurrent. */
return queue_mask == (1u << RADV_QUEUE_GENERAL) ?
RADV_FMASK_COMPRESSION_FULL : RADV_FMASK_COMPRESSION_NONE;
}
}
unsigned