There are basically two types of scenarios to consider:
- Secondary command buffers that run inside a render pass.
- Secondary command buffers that run outside a render pass.
For the former we want to record their commands into a binning command list that we can branch to when executed into a primary command buffer. This means this kind of command buffers don't spawn new jobs, just the default one where they record the binning commands which won't include the frame setup, which will be provided by the primary they will be executed in.
For the latter we don't require anything special, we just record as many jobs as we need as usual and link that job list from the primary job list when executed.
This handles most scenarios except:- vkCmdWaitForEvents- VkCmdClearAttachments
Both of these can spawn new jobs inside a render pass, which is not what we want for secondary command buffers. We will address this is follow-up patches.
6a34ef65655 v3dv: add basic support for secondary command buffers
src/broadcom/vulkan/v3dv_cmd_buffer.c | 443 ++++++++++++++++++++++++++++------
src/broadcom/vulkan/v3dv_device.c | 2 +-
src/broadcom/vulkan/v3dv_private.h | 14 +-
src/broadcom/vulkan/v3dv_queue.c | 6 +-
4 files changed, 387 insertions(+), 78 deletions(-)