Skip to content

Integrate common vk_sync abstraction and remove pvr_winsys_syncobj one.

This PR is for initial feedback only and contains implementation for both service (2nd last commit) and DRM (last commit) winsys layers. Ignore the initial three commits. Those are from !15507 (merged) and were required for DRM side of things. Services one will be merged into upstream and DRM one will become part of !15507 (merged).

We haven't yet used the vk_common_QueueSubmit2KHR implementation. The reason is we have a sync array that we maintain between each batch (completion_syncobjs) in a single vkQueueSubmit call, to create the final output fence and update our queue syncs. This is a bit different from other drivers where the last output sync from job submission can do the work.

For example:

We have a single QueueSubmit call with:
Submit[0] = Render job.
Submit[1] = Compute job.

In our case we will have:
After the first submit:
completion_syncobjs[GEOM] = VALID
completion_syncobjs[FRAG] = VALID

After the 2nd submit:
completion_syncobjs[GEOM] = VALID
completion_syncobjs[FRAG] = VALID
completion_syncobjs[COMPUTE] = VALID

In the end, we merge completion_syncobjs[COMPUTE], completion_syncobjs[GEOM] and completion_syncobjs[FRAG] to create output fence.
Note that per batch signal semaphores are only created from the new syncobj(s) created as part of that batch only.

With the vk_common_QueueSubmit2KHR path I was not able to find a way to keep the completion_syncobjs state between each invocation of queue->vk.driver_submit. Also given that we create signal syncs only from the syncs created as part of the particular batch and the final fence sync is created from all the syncs from all the batches (I mean the last one of each job type) there is a problem here as well. In the last invocation of queue->vk.driver_submit runtime adds fence sync as part of the signal sync array and there is no way we can differentiate the fence sync from signal semaphore syncs of that batch.

I may be wrong in some places, feel free to correct me. Synchronization is hard to get right 😅

Conclusion: I came to the conclusion that this will require some changes on the runtime side but didn't wanted to do them without a proper discussion first.

Signed-off-by: Rajnesh Kanwal

/cc @jekstrand @frankbinns

Edited by Rajnesh Kanwal

Merge request reports