It is valid to submit with an empty list ofcommand buffers, however, we still need to wait on the pWaitSemaphores provided and only signal the pSignalSemaphores and fence once we have finished waiting on them to honor the semantics of the submission.
Because waiting and signaling happens in the kernel, the easiest way to do this is to submit a trivial no-op job to the GPU. To do this, we need to refactor some of our code so that code that might have been operating on a command buffer starts operating on a job instead, so we can resuse most of our infrastructure to create the no-op job.
Additionally, because no-op jobs are created internally by the driver, we are responsible for destroying them too. For this, we bind a fence to each no-op job we submit and we test for completion of in-flight no-op jobs (and destory them if completed) every time vkQueueSubmit is called.
8ed2e53e0d1 v3dv: support submits without a command buffer
src/broadcom/vulkan/v3dv_cl.c | 10 +-
src/broadcom/vulkan/v3dv_cmd_buffer.c | 105 ++++++++-------
src/broadcom/vulkan/v3dv_device.c | 8 +-
src/broadcom/vulkan/v3dv_meta_clear.c | 24 ++--
src/broadcom/vulkan/v3dv_meta_copy.c | 32 +++--
src/broadcom/vulkan/v3dv_private.h | 36 +++++-
src/broadcom/vulkan/v3dv_queue.c | 234 ++++++++++++++++++++++++++++++++--
7 files changed, 346 insertions(+), 103 deletions(-)