v3dv: fix semaphore wait from CPU job
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 11 Mar 2022 10:01:43 +0000 (11:01 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 18 Mar 2022 13:17:58 +0000 (13:17 +0000)
commitdaa865fb2c6c9fe8c8529f299552b48aeb12bf24
tree65eadf9456c36b5f5a0e42e0bc9244aefbd21e4a
parent3b8ab8a9ce70495b39f3b40188b38fe1c3d93c82
v3dv: fix semaphore wait from CPU job

If a CPU job comes first in a command buffer with a semaphore wait operation
we need to wait on the CPU for the semaphore to be signaled before we process
the job.

We have been doing this with a WaitForIdle operation, but that only works
if the semaphore has been submitted for signaling from the same instance
of the driver. If we have an imported payload from another instance in our
semaphore however, waitForIdle may return too early since the submission
to signal the semaphore may have been submitted by a different instance
of the driver as well, and our wait for idle checks only know about this
instance submissions.

To fix this, we always submit a noop job from our instance that waits on
the semaphores on the GPU and follow up with WaitForIdle to wait for that
to complete.

Fixes test failures and/or assert crashes in:
dEQP-VK.synchronization.cross_instance.*
(when enabling support for semaphore imports)

Reviewed-by: Melissa Wen <mwen@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15342>
src/broadcom/vulkan/v3dv_queue.c