lavapipe: use os_time for timing related things
authorDave Airlie <airlied@redhat.com>
Thu, 18 Feb 2021 01:19:16 +0000 (17:19 -0800)
committerMarge Bot <eric+marge@anholt.net>
Fri, 19 Feb 2021 02:27:15 +0000 (02:27 +0000)
drop the use of the Linux code.

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

src/gallium/frontends/lavapipe/lvp_device.c
src/gallium/frontends/lavapipe/lvp_private.h

index bbd575b..1839bcc 100644 (file)
@@ -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;
index 1dd90d7..ac651cf 100644 (file)
@@ -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 {