mpv/video/out/vulkan
Dudemanguy 055a490cef wayland: use mp_time deltas for presentation time
One not-so-nice hack in the wayland code is the assumption of when a
window is hidden (out of view from the compositor) and an arbitrary
delay for enabling/disabling the usage of presentation time. Since you
do not receive any presentation feedback when a window is hidden on
wayland (a feature or misfeature depending on who you ask), the ust is
updated based on the refresh_nsec statistic gathered from the previous
feedback event.

The flaw with this is that refresh_nsec basically just reports back the
display's refresh rate (1 / refresh_rate * 10^9). It doesn't tell you
how long the vsync interval really was. So as a video is left playing
out of view, the wl->last_queue_display_time becomes increasingly
inaccurate. This led to a vsync spike when bringing the mpv window back
into sight after it was hidden for a period of time. The hack for
working around this is to just wait a while before enabling presentation
time again. The discrepancy between the "bogus"
wl->last_queue_display_time and the actual value you get from the
feedback only happens initially after a switch. If you just discard
those values, you avoid the dramatic vsync spike.

It turns out that there's a smarter way to do this. Just use mp_time_us
deltas. The whole reason for these hacks is because
wl->last_queue_display_time wasn't close enough to how long it would
take for a frame to actually display if it wasn't hidden. Instead, mpv's
internal timer can be used, and the difference between wayland_sync_swap
calls is a close enough proxy for the vsync interval (certainly better
than using the monitor's refresh rate). This avoids the entire conundrum
of massive vsync spikes when bringing the player back into view, and it
means we can get rid of extra crap like wl->hidden.
2020-04-20 21:02:02 +00:00
..
common.h vo_gpu: vulkan: use libplacebo instead 2019-04-21 23:55:22 +03:00
context.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
context.h wayland: add presentation time 2019-10-20 15:34:57 +00:00
context_android.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
context_wayland.c wayland: use mp_time deltas for presentation time 2020-04-20 21:02:02 +00:00
context_win.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
context_xlib.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
utils.c vo_gpu: vulkan: use libplacebo instead 2019-04-21 23:55:22 +03:00
utils.h vo_gpu: vulkan: use libplacebo instead 2019-04-21 23:55:22 +03:00