Mesa (master): lavapipe: use os_time for timing related things

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 19 02:40:59 UTC 2021


Module: Mesa
Branch: master
Commit: 44f76d5fc7630913eab7450b70719bc20588e6d7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=44f76d5fc7630913eab7450b70719bc20588e6d7

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Feb 17 17:19:16 2021 -0800

lavapipe: use os_time for timing related things

drop the use of the Linux code.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9120>

---

 src/gallium/frontends/lavapipe/lvp_device.c  | 9 ++-------
 src/gallium/frontends/lavapipe/lvp_private.h | 2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index bbd575b35b8..1839bcc6448 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -997,13 +997,8 @@ static VkResult queue_wait_idle(struct lvp_queue *queue, uint64_t timeout)
       while (p_atomic_read(&queue->count))
          os_time_sleep(100);
    else {
-      struct timespec t, current;
-      clock_gettime(CLOCK_MONOTONIC, &current);
-      timespec_add_nsec(&t, &current, timeout);
-      bool timedout = false;
-      while (p_atomic_read(&queue->count) && !(timedout = timespec_passed(CLOCK_MONOTONIC, &t)))
-         os_time_sleep(10);
-      if (timedout)
+      int64_t atime = os_time_get_absolute_timeout(timeout);
+      if (!os_wait_until_zero_abs_timeout(&queue->count, atime))
          return VK_TIMEOUT;
    }
    return VK_SUCCESS;
diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h
index 1dd90d75128..ac651cfe6e7 100644
--- a/src/gallium/frontends/lavapipe/lvp_private.h
+++ b/src/gallium/frontends/lavapipe/lvp_private.h
@@ -244,7 +244,7 @@ struct lvp_queue {
    mtx_t m;
    cnd_t new_work;
    struct list_head workqueue;
-   uint32_t count;
+   volatile int count;
 };
 
 struct lvp_queue_work {



More information about the mesa-commit mailing list