radv: just use UINT64_MAX when getting absolute timeout for that value
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 1 Sep 2021 15:55:08 +0000 (11:55 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 1 Sep 2021 17:47:33 +0000 (17:47 +0000)
this would otherwise result in (UINT64_MAX - gettime()), which can effectively
be rounded to UINT64_MAX without a noticeable change

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12680>

src/amd/vulkan/radv_device.c

index 6bf2b80..77688d0 100644 (file)
@@ -99,11 +99,15 @@ radv_get_current_time(void)
 static uint64_t
 radv_get_absolute_timeout(uint64_t timeout)
 {
-   uint64_t current_time = radv_get_current_time();
+   if (timeout == UINT64_MAX) {
+      return timeout;
+   } else {
+      uint64_t current_time = radv_get_current_time();
 
-   timeout = MIN2(UINT64_MAX - current_time, timeout);
+      timeout = MIN2(UINT64_MAX - current_time, timeout);
 
-   return current_time + timeout;
+      return current_time + timeout;
+   }
 }
 
 static int