From 9976c83e0f225c846004a1ddd83d80372ec83723 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Mon, 19 Oct 2020 11:00:15 -0500 Subject: wayland: don't use presentation time if ust is 0 Testing kwinft out (kwin fork), it was discovered that sometimes it would return a ust value of 0 which subsequently resulted in incorrect presentation statistics (i.e. large negative numbers which are obviously impossible). Arguably, it shouldn't return 0s, but a workaround for mpv in this case is harmless. --- video/out/wayland_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 2d9e63a17d..0046111608 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1663,10 +1663,11 @@ void wayland_sync_swap(struct vo_wayland_state *wl) int index = wl->sync_size - 1; // If these are the same, presentation feedback has not been received. - // This can happen if a frame takes too long and misses vblank. Don't - // attempt to use these statistics and wait until the next presentation + // This can happen if a frame takes too long and misses vblank. + // Additionally, a compositor may return an ust value of 0. In either case, + // Don't attempt to use these statistics and wait until the next presentation // event arrives. - if (wl->sync[index].ust == wl->last_ust) { + if (!wl->sync[index].ust || wl->sync[index].ust == wl->last_ust) { wl->last_skipped_vsyncs = -1; wl->vsync_duration = -1; wl->last_queue_display_time = -1; -- cgit v1.2.3