v3dv: disable some TLB paths for cases of linear depth/stencil stores

In the case of buffer to image stores, we work around the limitation
for linear images by loading D/S data into a the color tile buffer
using a compatible format, however, this only works for formats with
a single aspect, for combined depth/stencil formats, since the copies
are specified to only copy a single aspect, we need to be able to
preserve the contents of the other aspect in the destination image,
and for that we still use the depth/stencil buffer, so we are affected
by the restriction.

Fixes some VK_KHR_maintenance5 CTS tests that hit this scenario,
such as some tests in:
dEQP-VK.api.copy_and_blit.core.image_to_image.all_formats.depth_stencil.2d_to_1d.*

In the case of image to image copies, we don't have any workarounds for
linear depth/stencil so we always want to skip the TLB path. I have not
seen any tests hit this scenario.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29597>
This commit is contained in:
Iago Toral Quiroga
2024-06-07 10:08:31 +02:00
parent 993ba4135c
commit d5e2f66314

View File

@@ -1314,6 +1314,10 @@ copy_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
return false;
}
/* We can't do TLB stores of linear D/S */
if (!dst->tiled && vk_format_is_depth_or_stencil(fb_format))
return false;
/* From the Vulkan spec, VkImageCopy valid usage:
*
* "If neither the calling commands srcImage nor the calling commands
@@ -1993,6 +1997,28 @@ copy_buffer_to_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
return false;
}
/* From the Vulkan spec for VkBufferImageCopy2:
*
* "The aspectMask member of imageSubresource must only have a
* single bit set."
*
* For us this has relevant implications because we can't do TLB stores
* of linear depth/stencil so we work around this by loading D/S data to the
* color tile buffer using a compatible color format (see
* emit_copy_buffer_to_layer_per_tile_list and choose_tlb_format functions),
* however, when we are copying a single aspect to a combined D/S image
* we need to preserve the other aspect, and for that we will still use the
* D/S tile buffer to load and store the aspect of the image we need to
* preserve, so in this case we are still constrained by the hw restriction
* for linear D/S stores.
*/
assert(util_bitcount(region->imageSubresource.aspectMask) == 1);
if (!image->tiled &&
vk_format_has_depth(fb_format) &&
vk_format_has_stencil(fb_format)) {
return false;
}
uint32_t internal_type, internal_bpp;
v3dv_X(cmd_buffer->device, get_internal_type_bpp_for_image_aspects)
(fb_format, region->imageSubresource.aspectMask,