freedreno: Skip flush_resource with explicit sync

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20975>
This commit is contained in:
Rob Clark 2022-12-29 09:04:31 -08:00 committed by Marge Bot
parent 2503e22717
commit a063caa46a
3 changed files with 16 additions and 0 deletions

View file

@ -324,6 +324,12 @@ struct fd_context {
*/
int in_fence_fd dt;
/**
* If we *ever* see an in-fence-fd, assume that userspace is
* not relying on implicit fences.
*/
bool no_implicit_sync;
/* track last known reset status globally and per-context to
* determine if more resets occurred since then. If global reset
* count increases, it means some other context crashed. If

View file

@ -237,6 +237,8 @@ fd_pipe_fence_server_sync(struct pipe_context *pctx, struct pipe_fence_handle *f
if (!fence->use_fence_fd)
return;
ctx->no_implicit_sync = true;
assert(fence->fence);
if (sync_accumulate("freedreno", &ctx->in_fence_fd, fence->fence->fence_fd)) {
/* error */

View file

@ -702,6 +702,14 @@ fd_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
struct fd_context *ctx = fd_context(pctx);
struct fd_resource *rsc = fd_resource(prsc);
/* Flushing the resource is only required if we are relying on
* implicit-sync, in which case the rendering must be flushed
* to the kernel for the fence to be added to the backing GEM
* object.
*/
if (ctx->no_implicit_sync)
return;
flush_resource(ctx, rsc, PIPE_MAP_READ);
/* If we had to flush a batch, make sure it makes it's way all the