From 8a7693713ebe7df714d858119494d6f66611e406 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 4 Mar 2024 18:38:39 +0100 Subject: [PATCH] don't ask for frames to be in the past --- server/driver/wivrn_pacer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/driver/wivrn_pacer.cpp b/server/driver/wivrn_pacer.cpp index 95a1153e..a5349b5b 100644 --- a/server/driver/wivrn_pacer.cpp +++ b/server/driver/wivrn_pacer.cpp @@ -42,11 +42,16 @@ void wivrn_pacer::predict( uint64_t & out_predicted_display_time_ns) { std::lock_guard lock(mutex); + auto now = os_monotonic_get_ns(); + if (next_frame_ns == 0) - next_frame_ns = os_monotonic_get_ns(); + next_frame_ns = now; next_frame_ns += frame_duration_ns; + if (next_frame_ns < now) + next_frame_ns = now; + out_wake_up_time_ns = next_frame_ns; out_desired_present_time_ns = out_wake_up_time_ns + mean_wake_up_to_present_ns; out_present_slop_ns = 0;