mpv/video/out
Dudemanguy d7f3d1fff7 wayland: refactor dispatching events
This was originally just a bugfix for a race condition, but the scope
expanded a bit. Currently, the wayland code does a prepare_read ->
dispatch_pending -> display_flush -> read_events -> dispatch_pending
routine that's basically straight from the wayland client API
documentation. This essentially just queues up all the wayland events
mpv has and dispatches them to the compositor. We do this for blocking
purposes on every frame we render. A very similar thing is done for
wait_events from the VO.

This code can pretty easily be unified and split off into a separate
function, vo_wayland_dispatch_events. vo_wayland_wait_frame will call
this function in a while loop (which will break either on timeout or if
we receive frame callback from the compositor). wait_events needs to
just check this in case we get some state change on the wakeup_pipe
(i.e. waking up from the paused state).

As for the actual bugfix part of this, it's a slight regression from
c26d833. The toplevel config event always forced a redraw when a surface
became activated again. This is for something like displaying cover art
on a music file. If the window was originally out of view and then later
brought back into focus, no picture would be rendered (i.e. the window
is just black). That's because something like cover art is just 1 frame
and the VO stops doing any other additional rendering. If you miss that
1 frame, nothing would show up ever again. The fix in this case is to
always just force a redraw when the mpv window comes back into view.

Well with the aforementioned commit, we stopped doing
wl_display_roundtrip calls on every frame. That means we no longer do
roundtrip blocking calls. We just be sure to queue up all of the events
we have and then dispatch them. Because wayland is fundamentally an
asynchronous protocol, there's no guarantee what order these events
would be processed in. This meant that on occasion, a
vo_wayland_wait_frame call (this could occur multiple times depending on
the exact situation) would occur before the compositor would send back
frame callback. That would result in the aforementioned bug of having
just a black window. The fix, in this case, is to just do a
vo_wayland_wait_frame call directly before we force the VO to do a
redraw. Note that merely dispatching events isn't enough because we
specifically need to wait for the compositor to give us frame callback
before doing a new render.

P.S. fix a typo too.
2021-05-28 16:11:01 +00:00
..
cocoa
d3d11 options: Make validation and help possible for all option types 2021-03-28 19:46:27 +03:00
gpu vo_gpu: replace --icc-contrast by --icc-force-contrast 2021-05-26 17:35:29 +02:00
hwdec vo_gpu: hwdec_vaapi: silence errors while probing 2021-05-19 04:06:52 +02:00
mac mac: add support for display-width/display-height property 2021-05-06 17:36:55 +00:00
opengl wayland: shuffle around the render loop again 2021-05-24 19:20:31 +00:00
placebo vo_gpu: placebo: keep track of texture sample mode 2021-03-21 17:18:20 +01:00
vulkan wayland: shuffle around the render loop again 2021-05-24 19:20:31 +00:00
win32
android_common.c options: simplify --android-surface-size handling 2020-09-20 12:04:25 +02:00
android_common.h
aspect.c
aspect.h
bitmap_packer.c
bitmap_packer.h
cocoa_cb_common.swift mac: fix traditional fullscreen on macOS 11 2021-02-27 13:12:46 +01:00
cocoa_common.h
cocoa_common.m
dither.c
dither.h
dr_helper.c
dr_helper.h
drm_atomic.c
drm_atomic.h
drm_common.c options: Make validation and help possible for all option types 2021-03-28 19:46:27 +03:00
drm_common.h
drm_prime.c
drm_prime.h
filter_kernels.c filter_kernels: fix quadric window 2021-05-04 13:18:43 +02:00
filter_kernels.h
libmpv.h
libmpv_sw.c
vo.c video/out/vo_sixel.c: Implement sixel as a output device 2020-11-07 18:51:49 +02:00
vo.h command: add display-width/display-height property 2021-05-06 17:36:55 +00:00
vo_caca.c
vo_direct3d.c
vo_drm.c command: add display-width/display-height property 2021-05-06 17:36:55 +00:00
vo_gpu.c vo_gpu: fix trivial memory leak 2021-05-07 15:01:15 +02:00
vo_image.c
vo_lavc.c
vo_libmpv.c
vo_mediacodec_embed.c
vo_null.c
vo_rpi.c command: add display-width/display-height property 2021-05-06 17:36:55 +00:00
vo_sdl.c
vo_sixel.c vo_sixel: don't divide by zero on small terminal 2020-12-02 17:06:11 +02:00
vo_tct.c vo_tct: don't leak the frame reference 2020-11-29 14:15:51 +02:00
vo_vaapi.c
vo_vdpau.c vo_vdpau: remove an unused variable 2020-09-10 23:25:30 +02:00
vo_wlshm.c wayland: shuffle around the render loop again 2021-05-24 19:20:31 +00:00
vo_x11.c
vo_xv.c
w32_common.c win32: support the property 'focused' 2021-05-27 13:49:07 +03:00
w32_common.h
wayland_common.c wayland: refactor dispatching events 2021-05-28 16:11:01 +00:00
wayland_common.h wayland: shuffle around the render loop again 2021-05-24 19:20:31 +00:00
win_state.c
win_state.h
x11_common.c command: add display-width/display-height property 2021-05-06 17:36:55 +00:00
x11_common.h x11: update geometry/autofit opts on runtime 2020-12-14 22:44:05 +00:00