v3dv: support vkCmdClearAttachments in secondary command buffers

Graphics / Mesa 3D Graphics Library / Mesa - Iago Toral Quiroga [igalia.com] - 13 October 2020 21:21 UTC

The main change we are introducing here is that now we allow secondary command buffers that execute in a render pass to have a job list with more than one job.

The main issue with vkCmdClearAttachments is that we currently need this to spawn multiple jobs to clear multilayered framebuffers, as we need to setup a different 2D framebuffer for each layer to clear and therefore emit a different RCL for each. We could avoid this completely by used layered rendering with the "clear rect" path to redirect the clear rects to appropriate layers of the primary framebuffer, however, our hardware only supports layered rendering with geometry shaders, which we don't support at present.

Because vkCmdClearAttachments relies on having framebuffer state available (something we would not need if we used the geometry shader implementation), if this is not available in the secondary we need to postpone emission of the command until the secondary is executed inside a primary. We do this by using a new CPU job
V3DV_JOB_TYPE_CPU_CLEAR_ATTACHMENTS that is processed during
vkCmdExecuteCommands by calling vkCmdClearAttachments directly in the primary.

As a consequence of these changes, it is now possible that a secondary command buffer that runs inside a render pass have any kind of job in its job list, including partial CLs that need to be branched to and full CLs that need to be submitted to the GPU as is, so we introduced a new GPU job type V3DV_JOB_TYPE_GPU_CL_SECONDARY to identify partial CLs.

Part-of:

3092ddf4d50 v3dv: support vkCmdClearAttachments in secondary command buffers
src/broadcom/vulkan/v3dv_cmd_buffer.c | 286 +++++++++++++++++++---------------
src/broadcom/vulkan/v3dv_meta_clear.c | 106 +++++++++----
src/broadcom/vulkan/v3dv_meta_copy.c | 18 ++-
src/broadcom/vulkan/v3dv_private.h | 23 ++-
4 files changed, 264 insertions(+), 169 deletions(-)

Upstream: cgit.freedesktop.org


  • Share