From e81a47cfa246848f28f9c878f1337df8bd0da007 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 30 Jun 2023 11:53:16 -0700 Subject: [PATCH] freedreno/drm/virtio: Trigger host side wait boost Let the host know that we'll be waiting for a fence via an asynchronous WAIT_FENCE command. Signed-off-by: Rob Clark Part-of: --- src/freedreno/drm/virtio/virtio_pipe.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/freedreno/drm/virtio/virtio_pipe.c b/src/freedreno/drm/virtio/virtio_pipe.c index d155538059e..8350ac244a4 100644 --- a/src/freedreno/drm/virtio/virtio_pipe.c +++ b/src/freedreno/drm/virtio/virtio_pipe.c @@ -122,13 +122,6 @@ virtio_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence, uint64_t ti { MESA_TRACE_FUNC(); - assert(fence->use_fence_fd); - - if (fence->use_fence_fd) - return sync_wait(fence->fence_fd, timeout / 1000000); - - /* TODO remove !use_fence_fd path */ - struct msm_ccmd_wait_fence_req req = { .hdr = MSM_CCMD(WAIT_FENCE, sizeof(req)), .queue_id = to_virtio_pipe(pipe)->queue_id, @@ -138,6 +131,19 @@ virtio_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence, uint64_t ti int64_t end_time = os_time_get_nano() + timeout; int ret; + /* Do a non-blocking wait to trigger host-side wait-boost, + * if the host kernel is new enough + */ + rsp = virtio_alloc_rsp(pipe->dev, &req.hdr, sizeof(*rsp)); + ret = virtio_execbuf(pipe->dev, &req.hdr, false); + if (ret) + goto out; + + virtio_execbuf_flush(pipe->dev); + + if (fence->use_fence_fd) + return sync_wait(fence->fence_fd, timeout / 1000000); + do { rsp = virtio_alloc_rsp(pipe->dev, &req.hdr, sizeof(*rsp));