From 00967135c85990e1f295d00f2ea0142edf8b469d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 7 May 2026 17:24:42 +0200 Subject: [PATCH] radv: fix another case of VRS with mipmaps on GFX10.3 When a VRS view is used with a depth/stencil view, the driver is expected to copy the VRS rates to the HTILE buffer of the depth/stencil view. Though if the image uses mipmaps and the base level can't support HTILE there is no way to copy the rates. The workaround is to force VRS to be 1x1 which is valid in Vulkan. This fixes old VKCTS failures on RAPHAEL just because it supports fragmentShadingRateWithShaderDepthStencilWrites compared to other GPUs in CI (NAVI21/VANGOGH). Cc: mesa-stable Signed-off-by: Samuel Pitoiset (cherry picked from commit da0ee50c3b6f2ec7f8706bb9635d2809d377d6bd) Part-of: --- .pick_status.json | 2 +- src/amd/ci/radv-raphael-fails.txt | 26 -------------------------- src/amd/vulkan/radv_cmd_buffer.c | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 208892885df..e270118fac6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -334,7 +334,7 @@ "description": "radv: fix another case of VRS with mipmaps on GFX10.3", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/ci/radv-raphael-fails.txt b/src/amd/ci/radv-raphael-fails.txt index ef8dc192900..d9e06c1fd0d 100644 --- a/src/amd/ci/radv-raphael-fails.txt +++ b/src/amd/ci/radv-raphael-fails.txt @@ -1,29 +1,3 @@ -# Issues specific to the Raphael. The list can be reduced when disabling VRS flat shading -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.vs,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.ms,Fail -dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.vs,Fail - # https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/6256 dEQP-VK.sparse_resources.image_sparse_residency.2d.r10x6_unorm_pack16.1024_128_1,Crash dEQP-VK.sparse_resources.image_sparse_residency.2d.r10x6_unorm_pack16.11_137_1,Crash diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index b4a7a640188..405023bd14c 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -4240,6 +4240,7 @@ radv_emit_fsr_state(struct radv_cmd_buffer *cmd_buffer) struct radv_device *device = radv_cmd_buffer_device(cmd_buffer); const struct radv_physical_device *pdev = radv_device_physical(device); const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic; + const struct radv_rendering_state *render = &cmd_buffer->state.render; struct radv_cmd_stream *cs = cmd_buffer->cs; /* When per-vertex VRS is forced and the dynamic fragment shading rate is a no-op, ignore @@ -4259,7 +4260,7 @@ radv_emit_fsr_state(struct radv_cmd_buffer *cmd_buffer) assert(pdev->info.gfx_level >= GFX10_3); - if (!cmd_buffer->state.render.vrs_att.iview) { + if (!render->vrs_att.iview) { /* When the current subpass has no VRS attachment, the VRS rates are expected to be 1x1, so we * can cheat by tweaking the different combiner modes. */ @@ -4285,6 +4286,20 @@ radv_emit_fsr_state(struct radv_cmd_buffer *cmd_buffer) default: break; } + } else if (render->ds_att.iview && radv_image_has_vrs_htile(device, render->ds_att.iview->image) && + !radv_htile_enabled(render->ds_att.iview->image, render->ds_att.iview->vk.base_mip_level)) { + /* Otherwise, adjust the combiners to force VRS rate to 1x1 when the depth/stencil view is + * incompatible with VRS which can happen with mipmaps. + */ + switch (htile_comb_mode) { + case VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_KHR: + case VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR: + rate_x = rate_y = 0; + pipeline_comb_mode = V_028848_SC_VRS_COMB_MODE_PASSTHRU; + break; + default: + break; + } } /* Disable VRS and use the rates from PS_ITER_SAMPLES if: