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:
@@ -42,6 +42,9 @@ fence_flush(struct pipe_context *pctx, struct pipe_fence_handle *fence,
|
|||||||
*/
|
*/
|
||||||
in_dt
|
in_dt
|
||||||
{
|
{
|
||||||
|
if (fence->flushed)
|
||||||
|
return true;
|
||||||
|
|
||||||
MESA_TRACE_FUNC();
|
MESA_TRACE_FUNC();
|
||||||
|
|
||||||
if (!util_queue_fence_is_signalled(&fence->ready)) {
|
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)
|
goto out;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fence->batch)
|
if (fence->batch)
|
||||||
fd_batch_flush(fence->batch);
|
fd_batch_flush(fence->batch);
|
||||||
|
|
||||||
|
out:
|
||||||
if (fence->fence)
|
if (fence->fence)
|
||||||
fd_fence_flush(fence->fence);
|
fd_fence_flush(fence->fence);
|
||||||
|
|
||||||
assert(!fence->batch);
|
assert(!fence->batch);
|
||||||
|
fence->flushed = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,6 +79,7 @@ struct pipe_fence_handle {
|
|||||||
struct fd_fence *fence;
|
struct fd_fence *fence;
|
||||||
|
|
||||||
bool use_fence_fd;
|
bool use_fence_fd;
|
||||||
|
bool flushed;
|
||||||
uint32_t syncobj;
|
uint32_t syncobj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user