From e47a60255a028b8bca66ac0a14325842cb9082b3 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 11 Nov 2025 16:16:26 +0100 Subject: [PATCH] radv: add a workaround for color<->stencil only copies on SDMA4-5 For weird reasons, on SDMA4-5 color<->stencil only copies don't work correctly. I compared NAVI21 (SDMA 5) vs NAVI31 (SDMA 6), everything is bits-to-bits exact but the same test doesn't pass on NAVI21. So, it's potentially a hardware bug on SDMA < 6. Fixes dEQP-VK.api.ds_color_copy.*_tq on GFX9-GFX10.3. Fixes: 0034f5a9487 ("radv: allow ds<->color copies on compute/transfer queues") Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_sdma.c | 9 +++++++++ src/amd/vulkan/radv_sdma.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/amd/vulkan/radv_sdma.c b/src/amd/vulkan/radv_sdma.c index e32a16de2b9..dbab3356661 100644 --- a/src/amd/vulkan/radv_sdma.c +++ b/src/amd/vulkan/radv_sdma.c @@ -292,6 +292,7 @@ radv_sdma_get_surf(const struct radv_device *const device, const struct radv_ima const uint64_t va = binding->addr; const uint32_t bpe = radv_sdma_get_bpe(image, subresource.aspectMask); struct radv_sdma_surf info = { + .format = image->vk.format, .extent = { .width = vk_format_get_plane_width(image->vk.format, plane_idx, image->vk.extent.width), @@ -813,6 +814,14 @@ radv_sdma_use_t2t_scanline_copy(const struct radv_device *device, const struct r !util_is_aligned(dst_offset_blk.z, alignment->depth)) return true; + if (ver < SDMA_6_0 && ((src->format == VK_FORMAT_S8_UINT && vk_format_is_color(dst->format)) || + (vk_format_is_color(src->format) && dst->format == VK_FORMAT_S8_UINT))) { + /* For weird reasons, color<->stencil only T2T subwindow copies on SDMA4-5 don't work as + * expected, and the driver needs to fallback to scanline copies to workaround them. + */ + return true; + } + return false; } diff --git a/src/amd/vulkan/radv_sdma.h b/src/amd/vulkan/radv_sdma.h index 62818ee2ad2..098365a8bb4 100644 --- a/src/amd/vulkan/radv_sdma.h +++ b/src/amd/vulkan/radv_sdma.h @@ -16,6 +16,7 @@ extern "C" { #endif struct radv_sdma_surf { + VkFormat format; /* Image format. */ VkExtent3D extent; /* Image extent. */ VkOffset3D offset; /* Image offset. */ uint64_t va; /* Virtual address of image data. */