From a9cdbed5a287f9ac6458976e1fe81c191bd2c7de Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 15 Dec 2022 11:14:58 -0800 Subject: [PATCH] freedreno/drm: Short-circuit kernel for timeout=0 waits We already know from the userspace fence whether the fence has signaled or not. No need to do a syscall if we aren't going to wait. Signed-off-by: Rob Clark Part-of: --- src/freedreno/drm/freedreno_pipe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/freedreno/drm/freedreno_pipe.c b/src/freedreno/drm/freedreno_pipe.c index b81b2907c77..75b16d8df17 100644 --- a/src/freedreno/drm/freedreno_pipe.c +++ b/src/freedreno/drm/freedreno_pipe.c @@ -192,6 +192,9 @@ fd_pipe_wait_timeout(struct fd_pipe *pipe, const struct fd_fence *fence, if (!fd_fence_after(fence->ufence, pipe->control->fence)) return 0; + if (!timeout) + return -ETIMEDOUT; + fd_pipe_flush(pipe, fence->ufence); return pipe->funcs->wait(pipe, fence, timeout);