From 023972827af13f9dbc91a334fc5b59bb1d5474d7 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: --- 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 +++++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt index 9a4f5774454..e480ab02c62 100644 --- a/src/panfrost/ci/panfrost-g52-fails.txt +++ b/src/panfrost/ci/panfrost-g52-fails.txt @@ -415,7 +415,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 # CTS bug, see https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/5700 diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c index d606eedaf11..4ecc7c27402 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 2ddbc6dd361..5951020dac2 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c @@ -422,6 +422,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;