summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-08-16 16:29:00 -0500
committerDudemanguy <random342@airmail.cc>2020-08-16 16:29:00 -0500
commit486516f723d3159c82c75b15a2eefed366542b77 (patch)
treef483150f77212987b1fa166814dc42e4f8e330ec /video
parente9cde72536b60fc1bad304aa02a4638f63de258b (diff)
downloadmpv-486516f723d3159c82c75b15a2eefed366542b77.tar.bz2
mpv-486516f723d3159c82c75b15a2eefed366542b77.tar.xz
wayland: don't rely on presentation discarded
When using presentation time, we have to be sure to update the ust when no presentation events are received to make sure playback is still smooth and in sync. Part of the recent presentation time refactor was to use the presentation discarded event to signal that the window is hidden. Evidently, this doesn't work the same everywhere for whatever reason (drivers?? hardware??) and at least one user experienced issues with playback getting out of sync since (presumably) the discarded event didn't occur when hiding the window. Instead, let's just go back to the old way of checking if the last_ust is equal to the ust value of the last member in the wayland sync queue. Fixes #8010.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/context_wayland.c3
-rw-r--r--video/out/vulkan/context_wayland.c3
-rw-r--r--video/out/wayland_common.c7
-rw-r--r--video/out/wayland_common.h1
4 files changed, 4 insertions, 10 deletions
diff --git a/video/out/opengl/context_wayland.c b/video/out/opengl/context_wayland.c
index 11df19da8c..59e24ded43 100644
--- a/video/out/opengl/context_wayland.c
+++ b/video/out/opengl/context_wayland.c
@@ -77,13 +77,10 @@ static void feedback_presented(void *data, struct wp_presentation_feedback *fbac
wl->sync[index].ust = sec * 1000000LL + (uint64_t) tv_nsec / 1000;
wl->sync[index].msc = (uint64_t) seq_lo + ((uint64_t) seq_hi << 32);
wl->sync[index].filled = true;
- wl->presentation_discarded = false;
}
static void feedback_discarded(void *data, struct wp_presentation_feedback *fback)
{
- struct vo_wayland_state *wl = data;
- wl->presentation_discarded = true;
}
static const struct wp_presentation_feedback_listener feedback_listener = {
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index faac07cdcb..8c69c2d249 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -67,13 +67,10 @@ static void feedback_presented(void *data, struct wp_presentation_feedback *fbac
wl->sync[index].ust = sec * 1000000LL + (uint64_t) tv_nsec / 1000;
wl->sync[index].msc = (uint64_t) seq_lo + ((uint64_t) seq_hi << 32);
wl->sync[index].filled = true;
- wl->presentation_discarded = false;
}
static void feedback_discarded(void *data, struct wp_presentation_feedback *fback)
{
- struct vo_wayland_state *wl = data;
- wl->presentation_discarded = true;
}
static const struct wp_presentation_feedback_listener feedback_listener = {
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 993c7b0e54..99aa8ee018 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1607,9 +1607,10 @@ void wayland_sync_swap(struct vo_wayland_state *wl)
wl->last_skipped_vsyncs = 0;
- // If the presentation event was discarded, update the values based on
- // the difference in mp_time.
- if (wl->presentation_discarded) {
+ // If these are the same, presentation feedback has not been received.
+ // This will happen if the window is obscured/hidden in some way. Update
+ // the values based on the difference in mp_time.
+ if (wl->sync[index].ust == wl->last_ust && wl->last_ust) {
wl->sync[index].ust += mp_time - wl->sync[index].last_mp_time;
wl->sync[index].msc += 1;
wl->sync[index].sbc += 1;
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 7bfe0e85e0..895db3393d 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -107,7 +107,6 @@ struct vo_wayland_state {
/* Presentation Feedback */
struct vo_wayland_sync *sync;
int sync_size;
- bool presentation_discarded;
int64_t user_sbc;
int64_t last_ust;
int64_t last_msc;