diff options
author | Eric Engestrom <[email protected]> | 2018-10-28 13:37:26 +0000 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-03-11 10:49:36 +0000 |
commit | 1ee01d91c7e9bb0922b112c11a374283e2ca454b (patch) | |
tree | 18f192f0f8e59b5085474f43ea50cddd415586c3 /src/vulkan/wsi/wsi_common_display.c | |
parent | 7bb34ecff9833e0b490e90ab04fdaa6342eadc1b (diff) |
wsi: deduplicate get_current_time() functions between display and x11
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/vulkan/wsi/wsi_common_display.c')
-rw-r--r-- | src/vulkan/wsi/wsi_common_display.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 7ff9d77d88b..987b6dd715a 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -171,17 +171,9 @@ wsi_display_mode_refresh(struct wsi_display_mode *wsi) (double) MAX2(wsi->vscan, 1)); } -static uint64_t wsi_get_current_monotonic(void) -{ - struct timespec tv; - - clock_gettime(CLOCK_MONOTONIC, &tv); - return tv.tv_nsec + tv.tv_sec*1000000000ull; -} - static uint64_t wsi_rel_to_abs_time(uint64_t rel_time) { - uint64_t current_time = wsi_get_current_monotonic(); + uint64_t current_time = wsi_common_get_current_time(); /* check for overflow */ if (rel_time > UINT64_MAX - current_time) @@ -1436,8 +1428,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_get_current_monotonic())); - wsi_display_debug_code(uint64_t start_ns = wsi_get_current_monotonic()); + (int64_t) (timeout - wsi_common_get_current_time())); + wsi_display_debug_code(uint64_t start_ns = wsi_common_get_current_time()); pthread_mutex_lock(&wsi->wait_mutex); VkResult result; @@ -1469,7 +1461,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_get_current_monotonic() - start_ns)) / + ((int64_t) (wsi_common_get_current_time() - start_ns)) / 1.0e6); return result; } |