panvk/csf: Add a knob to force texture cache invalidation on RUN_FRAGMENT

Applications tend to forget to describe subpass dependencies, especially
when it comes to write -> read dependencies on attachments. The
proprietary driver forces "others" invalidation as a workaround, and this
invalidation even became implicit (done as part of the RUN_FRAGMENT) on
v13+.

We will consider adding a dri-conf hook for this option in the future,
but for now, let's just keep it as an opt-in debug flag.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33056>
This commit is contained in:
Boris Brezillon 2025-01-16 09:56:42 +01:00 committed by Marge Bot
parent c72379e506
commit 373d9df7ce
3 changed files with 16 additions and 0 deletions

View file

@ -2236,6 +2236,8 @@ static VkResult
issue_fragment_jobs(struct panvk_cmd_buffer *cmdbuf)
{
struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device);
struct panvk_instance *instance =
to_panvk_instance(dev->vk.physical->instance);
const struct cs_tracing_ctx *tracing_ctx =
&cmdbuf->state.cs[PANVK_SUBQUEUE_FRAGMENT].tracing;
struct pan_fb_info *fbinfo = &cmdbuf->state.gfx.render.fb.info;
@ -2320,6 +2322,18 @@ issue_fragment_jobs(struct panvk_cmd_buffer *cmdbuf)
cs_add64(b, cs_sr_reg64(b, 40), cs_sr_reg64(b, 40),
(1 + PANVK_IR_LAST_PASS) * fbd_ir_pass_offset);
/* Applications tend to forget to describe subpass dependencies, especially
* when it comes to write -> read dependencies on attachments. The
* proprietary driver forces "others" invalidation as a workaround, and this
* invalidation even became implicit (done as part of the RUN_FRAGMENT) on
* v13+. We don't do that in panvk, but we provide a debug flag to help
* identify those issues. */
if (unlikely(instance->debug_flags & PANVK_DEBUG_IMPLICIT_OTHERS_INV)) {
cs_flush_caches(b, 0, 0, true, length_reg,
cs_defer(0x0, SB_ID(IMM_FLUSH)));
cs_wait_slot(b, SB_ID(IMM_FLUSH), false);
}
cs_req_res(b, CS_FRAG_RES);
if (cmdbuf->state.gfx.render.layer_count > 1) {
struct cs_index layer_count = cs_sr_reg32(b, 47);

View file

@ -40,6 +40,7 @@ static const struct debug_control panvk_debug_options[] = {
{"cs", PANVK_DEBUG_CS},
{"copy_gfx", PANVK_DEBUG_COPY_GFX},
{"force_simultaneous", PANVK_DEBUG_FORCE_SIMULTANEOUS},
{"implicit_others_inv", PANVK_DEBUG_IMPLICIT_OTHERS_INV},
{NULL, 0}};
VKAPI_ATTR VkResult VKAPI_CALL

View file

@ -24,6 +24,7 @@ enum panvk_debug_flags {
PANVK_DEBUG_CS = 1 << 8,
PANVK_DEBUG_COPY_GFX = 1 << 9,
PANVK_DEBUG_FORCE_SIMULTANEOUS = 1 << 10,
PANVK_DEBUG_IMPLICIT_OTHERS_INV = 1 << 11,
};
#if defined(VK_USE_PLATFORM_WAYLAND_KHR) || \