summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-10-19 11:00:15 -0500
committerDudemanguy <random342@airmail.cc>2020-10-19 11:04:44 -0500
commit9976c83e0f225c846004a1ddd83d80372ec83723 (patch)
tree7fee114d8d4f70fad22ba7690775cf93675d23b2 /video
parentcbbdb3fae4343b4a00fc8e628a511b48736be589 (diff)
downloadmpv-9976c83e0f225c846004a1ddd83d80372ec83723.tar.bz2
mpv-9976c83e0f225c846004a1ddd83d80372ec83723.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c7
1 files 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;