Generally, we can do this when they render to the same collection of attachments and we only need to emit a single RCL for them.
To implement this, we need to track the first subpass that is included in the job and rewrite our loads and stores in the RCL to refer to that subpass instead of the current subpass (which would be the last included in the RCL).
When we merge jobs we also reuse the tile state/alloc BOs and we only emit the binning setup once.
The environment variable V3DV_NO_MERGE_JOBS can be set to disable job merging and have each subpass be in a separate job. This can be useful for debugging issues spawning from incorrect subpass merges.
22e431e6262 v3dv: merge subpasses into the same job when possible
src/broadcom/vulkan/v3dv_cmd_buffer.c | 233 +++++++++++++++++++++++-----------
src/broadcom/vulkan/v3dv_device.c | 2 +
src/broadcom/vulkan/v3dv_private.h | 6 +
3 files changed, 167 insertions(+), 74 deletions(-)