anv: Treat non-WSI PRESENT_SRC as TRANSFER_SRC

For non-WSI images, explicitly map VK_IMAGE_LAYOUT_PRESENT_SRC_KHR to
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL in anv_layout_to_aux_state().

Before this patch, the function passed PRESENT_SRC into
vk_image_layout_to_usage_flags() and got a return value of 0 from it
(that function expects that layout to be explicitly handled by the
caller). This caused the logic dependent on the return value to be
unreliable.

Fixes: c5cad407f8 ("anv: handle non-wsi images in anv_layout_to_aux_state")
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39618>
This commit is contained in:
Nanley Chery 2026-02-02 05:02:30 -05:00 committed by Marge Bot
parent 476f461ce7
commit f616d4fb2a

View file

@ -3479,19 +3479,14 @@ anv_layout_to_aux_state(const struct intel_device_info * const devinfo,
case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR: {
assert(image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT);
/* Handle transition to present layout for non wsi images just like
* normal images. Some apps like gfx-reconstruct incorrectly use this
* layout on non-wsi image which is against spec. It's easy enough to
* deal with it here and potentially avoid unnecessary resolve
* operations.
*/
if (!image->from_wsi)
break;
/* If this is a WSI blit source, it will never be scanout directly to
* display but will be copied to a dma-buf that can be scanout.
*
* GFXReconstruct's Virtual Swapchain feature behaves in a similar
* manner. Although this is against spec, it's easy enough to deal with
* it here.
*/
if (image->wsi_blit_src) {
if (!image->from_wsi || image->wsi_blit_src) {
return anv_layout_to_aux_state(devinfo, image, aspect,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
queue_flags);