From 5840bf0b1b41c5a01088300516885cd1f421aaa6 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 18 Feb 2026 18:50:12 -0500 Subject: [PATCH] tu: Use HW offset 0 in 3d loads/clears with FDM The HW uses ViewportIndex to select which GRAS_BIN_FOVEAT offset to use. For normal 3d draws, either the ViewportIndex equals the view/layer or we make the offset the same for all viewports/layers, but we aren't aware of this in the 3d path and we always use viewport 0. Use the HW offset 0 when subtracting the HW offset. This is a bit of a hack, but it should work. This fixes LOAD_OP_LOAD with FDM. Fixes: b34b089ca13 ("tu: Use GRAS bin offset registers") (cherry picked from commit 68c0031f56c303644a72bc6387b39f6c26954650) Part-of: --- .pick_status.json | 2 +- src/freedreno/vulkan/tu_clear_blit.cc | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ae6a4f9095d..4f8cb28503b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5264,7 +5264,7 @@ "description": "tu: Use HW offset 0 in 3d loads/clears with FDM", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "b34b089ca1327a5d48bc3cfceb9647c44763b52d", "notes": null diff --git a/src/freedreno/vulkan/tu_clear_blit.cc b/src/freedreno/vulkan/tu_clear_blit.cc index d99948690b8..fc0a6e56320 100644 --- a/src/freedreno/vulkan/tu_clear_blit.cc +++ b/src/freedreno/vulkan/tu_clear_blit.cc @@ -4084,8 +4084,10 @@ fdm_apply_sysmem_clear_coords(struct tu_cmd_buffer *cmd, VkExtent2D frag_area = frag_areas[MIN2(state->view, views - 1)]; VkRect2D bin = bins[MIN2(state->view, views - 1)]; - VkOffset2D hw_viewport_offset = - hw_viewport_offsets[MIN2(state->view, views - 1)]; + /* On a7xx, GRAS_BIN_FOVEAT_OFFSET_* is applied per-viewport. We only use + * viewport 0 in the 3d blit so use offset 0. + */ + VkOffset2D hw_viewport_offset = hw_viewport_offsets[0]; VkOffset2D offset = tu_fdm_per_bin_offset(frag_area, bin, common_bin_offset); @@ -5026,8 +5028,10 @@ fdm_apply_load_coords(struct tu_cmd_buffer *cmd, (const struct apply_load_coords_state *)data; VkExtent2D frag_area = frag_areas[MIN2(state->view, views - 1)]; VkRect2D bin = bins[MIN2(state->view, views - 1)]; - VkOffset2D hw_viewport_offset = - hw_viewport_offsets[MIN2(state->view, views - 1)]; + /* On a7xx, GRAS_BIN_FOVEAT_OFFSET_* is applied per-viewport. We only use + * viewport 0 in the 3d blit so use offset 0. + */ + VkOffset2D hw_viewport_offset = hw_viewport_offsets[0]; assert(bin.extent.width % frag_area.width == 0); assert(bin.extent.height % frag_area.height == 0);