panvk: Don't clobber registers if the render pass was suspended

Commit 2d3c50d484 ("panvk: Fix barriers in secondary cmdbufs w/o rp's")
started resetting the render flags we were relying on to decide to
clobber registers or not. Introduce a new field to restore that check.

Fixes: 2d3c50d484 ("panvk: Fix barriers in secondary cmdbufs w/o rp's")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33321>
This commit is contained in:
Boris Brezillon 2025-01-31 14:33:20 +01:00 committed by Marge Bot
parent c41b29f450
commit 127af6f38a
3 changed files with 8 additions and 3 deletions

View file

@ -171,7 +171,7 @@ finish_cs(struct panvk_cmd_buffer *cmdbuf, uint32_t subqueue)
* simple with this all-or-nothing approach. */
if ((instance->debug_flags & PANVK_DEBUG_CS) &&
cmdbuf->vk.level != VK_COMMAND_BUFFER_LEVEL_SECONDARY &&
!(cmdbuf->state.gfx.render.flags & VK_RENDERING_SUSPENDING_BIT)) {
!cmdbuf->state.gfx.render.suspended) {
cs_update_cmdbuf_regs(b) {
/* Poison all cmdbuf registers to make sure we don't inherit state from
* a previously executed cmdbuf. */
@ -934,8 +934,8 @@ panvk_per_arch(CmdExecuteCommands)(VkCommandBuffer commandBuffer,
/* We need to propagate the suspending state of the secondary command
* buffer if we want to avoid poisoning the reg file when the secondary
* command buffer suspended the render pass. */
if (secondary->state.gfx.render.flags & VK_RENDERING_SUSPENDING_BIT)
primary->state.gfx.render.flags = secondary->state.gfx.render.flags;
primary->state.gfx.render.suspended =
secondary->state.gfx.render.suspended;
/* If the render context we passed to the secondary command buffer got
* invalidated, reset the FB/tiler descs and treat things as if we

View file

@ -2081,6 +2081,7 @@ panvk_per_arch(cmd_inherit_render_state)(
to_panvk_physical_device(dev->vk.physical);
struct pan_fb_info *fbinfo = &cmdbuf->state.gfx.render.fb.info;
cmdbuf->state.gfx.render.suspended = false;
cmdbuf->state.gfx.render.flags = inheritance_info->flags;
gfx_state_set_dirty(cmdbuf, RENDER_STATE);
@ -2614,6 +2615,7 @@ panvk_per_arch(CmdEndRendering)(VkCommandBuffer commandBuffer)
* so any barrier encountered after EndRendering() doesn't try to flush
* draws. */
cmdbuf->state.gfx.render.flags = 0;
cmdbuf->state.gfx.render.suspended = suspending;
/* If we're not suspending, we need to resolve attachments. */
if (!suspending)

View file

@ -77,6 +77,9 @@ struct panvk_rendering_state {
* inherited context, and the primary command buffer needs to know. */
bool invalidate_inherited_ctx;
/* True if the last render pass was suspended. */
bool suspended;
struct {
/* != 0 if the render pass contains one or more occlusion queries to
* signal. */