don't ask for frames to be in the past

This commit is contained in:
Patrick Nicolas
2024-03-05 10:37:06 +01:00
parent a2b8955c12
commit 8a7693713e
+6 -1
View File
@@ -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;