From 9174a02476e1ca72a4a08bc23b0f2507e3416ca3 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 11 Sep 2025 09:17:24 +0200 Subject: [PATCH] panvk/jm: Preload the FB even if we have no draws queued There seems to be cases where we end up with a depth/stencil preload, with no draw associated to it, so let's make sure we preload in that case, otherwise we will write invalid data back. Fixes: 0bc3502ca36b ("panvk: Implement a custom FB preload logic") Signed-off-by: Boris Brezillon Reviewed-by: Christoph Pillmayer Part-of: (cherry picked from commit 023972827af13f9dbc91a334fc5b59bb1d5474d7) --- .pick_status.json | 2 +- src/panfrost/ci/panfrost-g52-fails.txt | 1 - src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c | 8 +++----- src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c | 7 +++++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 15d1ec0fee3..ea2bb42d35d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4454,7 +4454,7 @@ "description": "panvk/jm: Preload the FB even if we have no draws queued", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "0bc3502ca36b7b5f244e5de34813f46ce2ff4a1b", "notes": null diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt index 02bf690c884..8f958ef6ca5 100644 --- a/src/panfrost/ci/panfrost-g52-fails.txt +++ b/src/panfrost/ci/panfrost-g52-fails.txt @@ -458,7 +458,6 @@ dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.contents_2_secondary_cmdbuffers dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.contents_primary_secondary_cmdbuffers_resuming,Fail dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.contents_secondary_2_primary_cmdbuffers_resuming,Fail dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.contents_secondary_primary_cmdbuffers_resuming,Fail -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil,Fail dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.single_cmdbuffer_resuming,Fail dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.indexed_draw.draw_indexed_triangle_list_offset_minus_one_with_alloc_offset,Fail diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c index c69c0fcd136..6e5952b05a0 100644 --- a/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c +++ b/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c @@ -149,11 +149,9 @@ panvk_per_arch(cmd_close_batch)(struct panvk_cmd_buffer *cmdbuf) fbinfo->first_provoking_vertex = cmdbuf->state.gfx.render.first_provoking_vertex != U_TRISTATE_NO; - if (batch->vtc_jc.first_tiler) { - VkResult result = panvk_per_arch(cmd_fb_preload)(cmdbuf, fbinfo); - if (result != VK_SUCCESS) - return; - } + VkResult result = panvk_per_arch(cmd_fb_preload)(cmdbuf, fbinfo); + if (result != VK_SUCCESS) + return; uint32_t view_mask = cmdbuf->state.gfx.render.view_mask; assert(view_mask == 0 || util_bitcount(view_mask) <= batch->fb.layer_count); diff --git a/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c b/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c index a0d865a2b51..af7388cfcae 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c @@ -441,6 +441,13 @@ cmd_emit_dcd(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo, struct mali_draw_packed dcd_base; + /* If we got a preload without any draw, we end up with a NULL TLS + * descriptor. Allocate a dummy one (no TLS, no WLS) to get things working. */ + if (!batch->tls.cpu) { + panvk_per_arch(cmd_alloc_tls_desc)(cmdbuf, true); + GENX(pan_emit_tls)(&batch->tlsinfo, batch->tls.cpu); + } + pan_pack(&dcd_base, DRAW, cfg) { cfg.thread_storage = batch->tls.gpu; cfg.state = rsd.gpu;