v3dv: add basic support for secondary command buffers

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.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga
2020-05-26 12:05:43 +02:00
committed by Marge Bot
parent fa03471d45
commit 6a34ef6565
4 changed files with 389 additions and 80 deletions
+3 -3
View File
@@ -320,7 +320,7 @@ event_wait_thread_func(void *_job)
*/
struct v3dv_queue *queue = &job->device->queue;
list_for_each_entry_from(struct v3dv_job, pjob, job->list_link.next,
&job->cmd_buffer->submit_jobs, list_link) {
&job->cmd_buffer->jobs, list_link) {
/* We don't want to spawn more than one wait thread per command buffer.
* If this job also requires a wait for events, we will do the wait here.
*/
@@ -695,11 +695,11 @@ queue_submit_cmd_buffer(struct v3dv_queue *queue,
assert(cmd_buffer);
assert(cmd_buffer->status = V3DV_CMD_BUFFER_STATUS_EXECUTABLE);
if (list_is_empty(&cmd_buffer->submit_jobs))
if (list_is_empty(&cmd_buffer->jobs))
return queue_submit_noop_job(queue, pSubmit);
list_for_each_entry_safe(struct v3dv_job, job,
&cmd_buffer->submit_jobs, list_link) {
&cmd_buffer->jobs, list_link) {
VkResult result = queue_submit_job(queue, job,
pSubmit->waitSemaphoreCount > 0,
wait_thread);