mpv/video/out/opengl
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
..
angle_dynamic.c
angle_dynamic.h
common.c opengl: Support GL_ARB_sync style fences on OpenGL ES 3.0 2019-02-25 01:25:25 +01:00
common.h client API: add a new way to pass X11 Display etc. to render API 2018-03-26 19:47:08 +02:00
context.c vo: make swapchain-depth option generic for all VOs 2019-09-28 14:10:01 +03:00
context.h vo: use a struct for vsync feedback stuff 2018-12-06 10:30:25 +01:00
context_android.c context_android: move common code to a separate file 2019-09-27 00:05:06 +03:00
context_angle.c vo: make swapchain-depth option generic for all VOs 2019-09-28 14:10:01 +03:00
context_cocoa.c cocoa: change deprecation warning from opengl-cb to libmpv 2018-04-29 15:03:47 +03:00
context_drm_egl.c vo: make swapchain-depth option generic for all VOs 2019-09-28 14:10:01 +03:00
context_dxinterop.c vo: make swapchain-depth option generic for all VOs 2019-09-28 14:10:01 +03:00
context_glx.c vo_gpu: x11: remove special vdpau probing, use EGL by default 2019-09-15 20:00:52 +03:00
context_rpi.c rpi: Update for modern systems 2019-09-20 11:39:06 +02:00
context_wayland.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
context_win.c
context_x11egl.c vo_gpu: x11egl: support Mesa OML sync extension 2019-09-08 23:23:43 +10:00
egl_helpers.c egl_helpers: change minimum framebuffer size to 8 bit per component 2018-04-29 02:21:32 +03:00
egl_helpers.h egl_helpers: mpegl_cb can now signal an error condition 2018-02-26 23:56:13 -08:00
formats.c
formats.h
gl_headers.h
hwdec_d3d11egl.c video: rewrite filtering glue code 2018-01-30 03:10:27 -08:00
hwdec_d3d11eglrgb.c video: rewrite filtering glue code 2018-01-30 03:10:27 -08:00
hwdec_drmprime_drm.c vo_gpu: hwdec_drmprime_drm: add hwdec ctx 2019-09-27 13:08:27 +02:00
hwdec_dxva2egl.c
hwdec_dxva2gldx.c client API: add a new way to pass X11 Display etc. to render API 2018-03-26 19:47:08 +02:00
hwdec_ios.m hwdec_ios: fix crash after mapper_init failure 2018-04-17 01:06:29 +03:00
hwdec_osx.c
hwdec_rpi.c client API: add a new way to pass X11 Display etc. to render API 2018-03-26 19:47:08 +02:00
hwdec_vdpau.c vo/gpu: hwdec_vdpau: Support direct mode for 4:4:4 content 2019-07-08 01:11:27 +02:00
libmpv_gl.c client API: add a new way to pass X11 Display etc. to render API 2018-03-26 19:47:08 +02:00
oml_sync.c oml_sync: fix typo in comment 2019-09-20 00:32:29 +02:00
oml_sync.h vo_gpu: glx: move OML sync code to an independent file 2019-09-08 23:23:43 +10:00
ra_gl.c video/out/gpu: Add a `storable` flag to ra_format 2019-07-08 00:59:28 +02:00
ra_gl.h
utils.c vo_gpu: make screenshots use the GL renderer 2018-02-11 17:45:51 -08:00
utils.h vo_gpu: make screenshots use the GL renderer 2018-02-11 17:45:51 -08:00