mpv/video/out
dudemanguy ea4685b233 wayland: use callback flag + poll for buffer swap
The old way of using wayland in mpv relied on an external renderloop for
semi-accurate timings. This had multiple issues though. Display sync
would break whenever the window was hidden (since the frame callback
stopped being executed) which was really annoying. Also the entire
external renderloop logic was kind of fragile and didn't play well with
mpv's internal structure (i.e. using presentation time in that old
paradigm breaks stats.lua).

Basically the problem is that swap buffers blocks on wayland which is
crap whenever you hide the mpv window since it looks up the entire
player. So you have to make swap buffers not block, but this has a
different problem. Timings will be terrible if you use the unblocked
swap buffers call.

Based on some discussion in #wayland, the trick here is relatively
simple and works well enough for our purposes. Instead we basically
build a way to block with a timeout in the wayland buffer swap
functions.

A bool is set in the frame callback function that indicates whether or
not mpv is waiting for a frame to be displayed. In the actual buffer
swap function, we enter into a while loop waiting for this flag to be
set. At the same time, the wl_display is polled to block the thread and
wakeup if it receives any events from the compositor. This loop only
breaks if enough time has passed or if the frame callback bool is
received.

In the near future, it is better to set whether or not frame a frame has
been displayed in the presentation feedback. However as a first pass,
doing it in the frame callback is more than good enough.

The "downside" is that we render frames that aren't actually shown on
screen when the player is hidden (it seems like wayland people don't
like that). But who cares. Accurate timings are way more important. It's
probably not too hard to add that behavior back in the player though.
2019-10-10 17:41:19 +00:00
..
cocoa
cocoa-cb cocoa-cb: remove get_property_* usages and split up mpv helper 2019-10-06 13:29:48 +02:00
d3d11 vo_gpu: d3d11: use linear filtering for wrapped textures 2019-10-10 19:52:19 +11:00
gpu vo_gpu/d3d11: add adapter name validation and listing with "help" 2019-09-29 19:39:26 +03:00
hwdec vo_gpu: hwdec_cuda: Synchronise OpenGL Interop 2019-09-28 19:24:24 +03:00
opengl wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
placebo
vulkan wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
win32
android_common.c context_android: move common code to a separate file 2019-09-27 00:05:06 +03:00
android_common.h context_android: move common code to a separate file 2019-09-27 00:05:06 +03:00
aspect.c aspect: add video margin options 2019-09-19 20:37:05 +02:00
aspect.h
bitmap_packer.c
bitmap_packer.h
cocoa_cb_common.swift cocoa-cb: remove get_property_* usages and split up mpv helper 2019-10-06 13:29:48 +02:00
cocoa_common.h
cocoa_common.m
d3d_shader_420p.h
d3d_shader_yuv.hlsl
dither.c
dither.h
dr_helper.c client API: fix potential deadlock problems by throwing more shit at it 2019-09-26 14:14:49 +02:00
dr_helper.h client API: fix potential deadlock problems by throwing more shit at it 2019-09-26 14:14:49 +02:00
drm_atomic.c
drm_atomic.h
drm_common.c drm: refactor page_flipped callback 2019-09-28 14:10:01 +03:00
drm_common.h drm: refactor page_flipped callback 2019-09-28 14:10:01 +03:00
drm_prime.c
drm_prime.h
filter_kernels.c
filter_kernels.h
libmpv.h
vo.c Revert "vo: add support for externally driven renderloop and make wayland use it" 2019-10-10 17:41:19 +00:00
vo.h Revert "vo: add support for externally driven renderloop and make wayland use it" 2019-10-10 17:41:19 +00:00
vo_caca.c
vo_direct3d.c
vo_drm.c vo_drm: fix flickering when setting pan/scan 2019-09-29 12:16:26 +02:00
vo_gpu.c Revert "vo: add support for externally driven renderloop and make wayland use it" 2019-10-10 17:41:19 +00:00
vo_image.c
vo_lavc.c
vo_libmpv.c client API: fix potential deadlock problems by throwing more shit at it 2019-09-26 14:14:49 +02:00
vo_mediacodec_embed.c
vo_null.c
vo_rpi.c
vo_sdl.c vo_sdl: Only create the SDL window once 2019-09-21 12:58:01 +02:00
vo_tct.c
vo_vaapi.c vo: add warning message to vo_vaapi and vo_vdpau 2019-09-14 13:50:10 +02:00
vo_vdpau.c vo: add warning message to vo_vaapi and vo_vdpau 2019-09-14 13:50:10 +02:00
vo_x11.c
vo_xv.c
w32_common.c
w32_common.h
wayland_common.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
wayland_common.h wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
win_state.c win_state: silence a valgrind warning 2019-09-19 20:37:05 +02:00
win_state.h
x11_common.c x11: fix ICC profiling for multiple monitors 2019-09-21 15:36:16 +02:00
x11_common.h x11: fix ICC profiling for multiple monitors 2019-09-21 15:36:16 +02:00