freedreno: fence_server_sync() fixes
authorRob Clark <robdclark@chromium.org>
Tue, 1 Sep 2020 22:24:38 +0000 (15:24 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 3 Sep 2020 00:06:36 +0000 (00:06 +0000)
commitbf23ff83e69a76424ea083c6641b952868e4b87c
tree20e14516bf378441e330686affbe73fb615880db
parentaae1e68637ff662d45902954390e678516798ecf
freedreno: fence_server_sync() fixes

Two potential problems, batch re-ordering doesn't really play nicely
with fence_server_sync(), so when we switch away from one batch, detect
the case that we need to sync, and if so flush.  The alternative of
trying to track that later batches depend on an earlier batch that had
an in-fence is hairy, and the normal use-case would be to sync at the
beginning of the frame.

But this brings up the second problem, which is that typically we'll get
told to sync on an in-fence before the first draw, which means before
mesa/st flushes down the framebuffer state to the driver.  Which means
we don't yet have the correct batch to attach the fence to.  So we need
to track the in-fence on the context, and transfer it to the batch
before draws, etc.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6575>
src/gallium/drivers/freedreno/freedreno_batch_cache.c
src/gallium/drivers/freedreno/freedreno_context.c
src/gallium/drivers/freedreno/freedreno_context.h
src/gallium/drivers/freedreno/freedreno_fence.c
src/gallium/drivers/freedreno/freedreno_state.c