freedreno: Optimize repeated finishes

Sometimes apps (glances at stk) spin on a syncobj with very short
timeouts.  But ensuring the fence is flushed all the way through to
the kernel (including handling TC unflushed fences) only needs to
be done once.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22098>
This commit is contained in:
Rob Clark
2023-03-24 14:07:39 -07:00
committed by Marge Bot
parent 8416bc1c60
commit 88f3676019
2 changed files with 7 additions and 9 deletions

View File

@@ -42,6 +42,9 @@ fence_flush(struct pipe_context *pctx, struct pipe_fence_handle *fence,
*/
in_dt
{
if (fence->flushed)
return true;
MESA_TRACE_FUNC();
if (!util_queue_fence_is_signalled(&fence->ready)) {
@@ -61,24 +64,18 @@ fence_flush(struct pipe_context *pctx, struct pipe_fence_handle *fence,
}
}
if (fence->fence)
fd_fence_flush(fence->fence);
/* We've already waited for batch to be flushed and fence->batch
* to be cleared:
*/
assert(!fence->batch);
return true;
goto out;
}
if (fence->batch)
fd_batch_flush(fence->batch);
out:
if (fence->fence)
fd_fence_flush(fence->fence);
assert(!fence->batch);
fence->flushed = true;
return true;
}

View File

@@ -79,6 +79,7 @@ struct pipe_fence_handle {
struct fd_fence *fence;
bool use_fence_fd;
bool flushed;
uint32_t syncobj;
};