vulkan/wsi: Drop wsi_common_get_current_time()
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 21 Oct 2021 15:52:29 +0000 (10:52 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Tue, 16 Nov 2021 16:54:27 +0000 (10:54 -0600)
Use os_time_get_nano() instead.  At this point, it's just a wrapper
around os_time_get_nano() anyway.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>

src/vulkan/wsi/wsi_common.c
src/vulkan/wsi/wsi_common.h
src/vulkan/wsi/wsi_common_display.c
src/vulkan/wsi/wsi_common_x11.c

index 9559934..2d18d4c 100644 (file)
@@ -25,7 +25,6 @@
 #include "wsi_common_entrypoints.h"
 #include "util/macros.h"
 #include "util/os_file.h"
-#include "util/os_time.h"
 #include "util/xmlconfig.h"
 #include "vk_device.h"
 #include "vk_instance.h"
@@ -802,12 +801,6 @@ wsi_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo)
                                    pPresentInfo);
 }
 
-uint64_t
-wsi_common_get_current_time(void)
-{
-   return os_time_get_nano();
-}
-
 VKAPI_ATTR VkResult VKAPI_CALL
 wsi_GetDeviceGroupPresentCapabilitiesKHR(VkDevice device,
                                          VkDeviceGroupPresentCapabilitiesKHR *pCapabilities)
index fa4d5e9..1b556b4 100644 (file)
@@ -273,7 +273,4 @@ wsi_common_queue_present(const struct wsi_device *wsi,
                          int queue_family_index,
                          const VkPresentInfoKHR *pPresentInfo);
 
-uint64_t
-wsi_common_get_current_time(void);
-
 #endif
index 50a821c..25fec74 100644 (file)
@@ -43,6 +43,7 @@
 #endif
 #include "util/hash_table.h"
 #include "util/list.h"
+#include "util/os_time.h"
 
 #include "vk_device.h"
 #include "vk_instance.h"
@@ -190,7 +191,7 @@ wsi_display_mode_refresh(struct wsi_display_mode *wsi)
 
 static uint64_t wsi_rel_to_abs_time(uint64_t rel_time)
 {
-   uint64_t current_time = wsi_common_get_current_time();
+   uint64_t current_time = os_time_get_nano();
 
    /* check for overflow */
    if (rel_time > UINT64_MAX - current_time)
@@ -1517,8 +1518,8 @@ wsi_display_fence_wait(struct wsi_fence *fence_wsi, uint64_t timeout)
 
    wsi_display_debug("%9lu wait fence %lu %ld\n",
                      pthread_self(), fence->sequence,
-                     (int64_t) (timeout - wsi_common_get_current_time()));
-   wsi_display_debug_code(uint64_t start_ns = wsi_common_get_current_time());
+                     (int64_t) (timeout - os_time_get_nano()));
+   wsi_display_debug_code(uint64_t start_ns = os_time_get_nano());
    pthread_mutex_lock(&wsi->wait_mutex);
 
    VkResult result;
@@ -1553,7 +1554,7 @@ wsi_display_fence_wait(struct wsi_fence *fence_wsi, uint64_t timeout)
    pthread_mutex_unlock(&wsi->wait_mutex);
    wsi_display_debug("%9lu fence wait %f ms\n",
                      pthread_self(),
-                     ((int64_t) (wsi_common_get_current_time() - start_ns)) /
+                     ((int64_t) (os_time_get_nano() - start_ns)) /
                      1.0e6);
    return result;
 }
index a8ea097..de9794c 100644 (file)
@@ -39,6 +39,7 @@
 #include <xf86drm.h>
 #include "drm-uapi/drm_fourcc.h"
 #include "util/hash_table.h"
+#include "util/os_time.h"
 #include "util/u_debug.h"
 #include "util/u_thread.h"
 #include "util/xmlconfig.h"
@@ -1050,7 +1051,7 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
 
 static uint64_t wsi_get_absolute_timeout(uint64_t timeout)
 {
-   uint64_t current_time = wsi_common_get_current_time();
+   uint64_t current_time = os_time_get_nano();
 
    timeout = MIN2(UINT64_MAX - current_time, timeout);
 
@@ -1101,7 +1102,7 @@ x11_acquire_next_image_poll_x11(struct x11_swapchain *chain,
             /* If a non-special event happens, the fd will still
              * poll. So recalculate the timeout now just in case.
              */
-            uint64_t current_time = wsi_common_get_current_time();
+            uint64_t current_time = os_time_get_nano();
             if (atimeout > current_time)
                timeout = atimeout - current_time;
             else