panvk: Take VK_RENDERING_{RESUM,SUSPEND}ING_BIT flags into account

Don't close the current batch when suspending a rendering pass, and
only open a new batch if the cur_batch was closed by a compute job
being queued in the middle.

We also don't re-init the FB info if we're resuming.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29443>
This commit is contained in:
Boris Brezillon
2024-05-22 17:16:35 +02:00
parent 6f8b691c2e
commit 9ff5e56eb7
2 changed files with 25 additions and 3 deletions

View File

@@ -133,6 +133,8 @@ struct panvk_cmd_graphics_state {
} ib;
struct {
VkRenderingFlags flags;
enum vk_rp_attachment_flags bound_attachments;
struct {
VkFormat fmts[MAX_RTS];

View File

@@ -2025,6 +2025,12 @@ panvk_cmd_begin_rendering_init_state(struct panvk_cmd_buffer *cmdbuf,
struct pan_fb_info *fbinfo = &cmdbuf->state.gfx.render.fb.info;
uint32_t att_width = 0, att_height = 0;
cmdbuf->state.gfx.render.flags = pRenderingInfo->flags;
/* Resuming from a suspended pass, the state should be unchanged. */
if (cmdbuf->state.gfx.render.flags & VK_RENDERING_RESUMING_BIT)
return;
cmdbuf->state.gfx.render.fb.bo_count = 0;
memset(cmdbuf->state.gfx.render.fb.bos, 0,
sizeof(cmdbuf->state.gfx.render.fb.bos));
@@ -2170,7 +2176,19 @@ panvk_per_arch(CmdBeginRendering)(VkCommandBuffer commandBuffer,
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
panvk_cmd_begin_rendering_init_state(cmdbuf, pRenderingInfo);
panvk_per_arch(cmd_open_batch)(cmdbuf);
bool resuming = cmdbuf->state.gfx.render.flags & VK_RENDERING_RESUMING_BIT;
/* If we're not resuming, cur_batch should be NULL. */
assert(!cmdbuf->cur_batch || resuming);
/* The opened batch might have been disrupted by a compute job.
* We need to preload in that case. */
if (resuming && !cmdbuf->cur_batch)
panvk_cmd_preload_fb_after_batch_split(cmdbuf);
if (!cmdbuf->cur_batch)
panvk_per_arch(cmd_open_batch)(cmdbuf);
}
VKAPI_ATTR void VKAPI_CALL
@@ -2178,8 +2196,10 @@ panvk_per_arch(CmdEndRendering)(VkCommandBuffer commandBuffer)
{
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
panvk_per_arch(cmd_close_batch)(cmdbuf);
cmdbuf->cur_batch = NULL;
if (!(cmdbuf->state.gfx.render.flags & VK_RENDERING_SUSPENDING_BIT)) {
panvk_per_arch(cmd_close_batch)(cmdbuf);
cmdbuf->cur_batch = NULL;
}
}
VKAPI_ATTR void VKAPI_CALL