mpv/video/out
Dudemanguy 10e11834e5 wayland: avoid potential deadlocks
wl_display_dispatch is dangerous because it will block forever if the
event queue is empty. Any direct calls to this function should just be
replaced with wl_display_dispatch_pending which accomplishes the same
thing for mpv's purposes without any chance of blocking.

The other potential trap is wl_display_roundtrip. It can internally call
wl_display_dispatch which in certain circumstances could potentially
block. There are cases where we need the server to finish processing
client requests before doing anything else so this can not be cleanly
avoided. The dangerous call is the usage of wl_display_roundtrip in
vo_wayland_wait_frame. In the majority of cases, this shouldn't be a
problem because the previous wl_display_read_events should always queue
up some events on the fd for wl_display_roundtrip to send. However, the
compositor could potentially send us an error in the display queue that
could lead to bad behavior when wl_display_roundtrip is called.

The wl_display_roundtrip can't be removed because we are relying on its
semi-blocking capabilities, but the logic can be slightly adjusted to be
safer. The obvious thing to do is to make sure we check the pollfd for
any errors. If one is returned, then we call wl_display_cancel_read and
try again. The less obvious trick is to call wl_display_dispatch_pending
and move wl_display_roundtrip outside of the blocking + timeout loop.

This change has some subtle but important differences. Previously,
vo_wayland_wait_frame would read an event and wait on the server to
process it one-by-one. With this change, the events are dispatched as
soon as possible to the server and then we wait on all of those
(potentially multiple) events to be processed after we have either
received frame callback or the loop times out.

After that is done, we can then check for if there are any errors on the
display. If it's all clear, we can run wl_display_roundtrip without any
worries. If some error happens, then don't execute the function at all.
2020-07-31 21:23:45 +00:00
..
cocoa
cocoa-cb cocoa-cb: fix unfs window size when toggling out of fullscreen 2020-07-12 12:06:56 +02:00
d3d11 vo_gpu: d3d11: only use presentation feedback with flip model 2020-05-07 00:17:50 +10:00
gpu vo_gpu: clip highlights before tone-mapping 2020-07-19 08:07:48 +02:00
hwdec vo_gpu: hwdec_vaapi: handle lack of object size with AMD drivers 2020-07-14 07:32:04 +02:00
opengl wayland: fix build 2020-06-04 20:15:43 +02:00
placebo vo_gpu: placebo: add fallback code for stride mismatch 2020-06-16 02:54:59 +02:00
vulkan vo_gpu: vulkan: print libplacebo API ver 2020-07-16 09:41:09 +02:00
win32
android_common.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
android_common.h
aspect.c options: add --video-scale-x/y 2020-06-03 17:26:44 +02:00
aspect.h
bitmap_packer.c
bitmap_packer.h
cocoa_cb_common.swift cocoa-cb: report actual unfs window size for current window scale 2020-04-25 11:37:53 +02:00
cocoa_common.h
cocoa_common.m build: change filenames of generated files 2020-06-04 16:59:05 +02:00
dither.c
dither.h
dr_helper.c
dr_helper.h
drm_atomic.c
drm_atomic.h
drm_common.c drm_common: set frsig to a valid signal 2020-04-22 11:27:18 +02:00
drm_common.h
drm_prime.c drm_prime: fallback to drmModeAddFB2 2020-05-08 21:26:25 +02:00
drm_prime.h
filter_kernels.c
filter_kernels.h
libmpv.h client API: add software rendering API 2020-07-08 22:42:05 +02:00
libmpv_sw.c client API: add software rendering API 2020-07-08 22:42:05 +02:00
vo.c Warn if on GNOME 2020-07-07 21:22:19 +02:00
vo.h video: remove another redundant wakeup 2020-04-10 01:33:38 +02:00
vo_caca.c
vo_direct3d.c vo_direct3d: dumb down OSD rendering 2020-05-13 23:16:32 +02:00
vo_drm.c vo_wlshm, vo_drm: set image size with mp_image_set_size 2020-05-17 12:53:26 +02:00
vo_gpu.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
vo_image.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
vo_lavc.c
vo_libmpv.c client API: add software rendering API 2020-07-08 22:42:05 +02:00
vo_mediacodec_embed.c
vo_null.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
vo_rpi.c rpi: use "brcm" variant of libGLESv2 2020-04-23 14:05:32 +02:00
vo_sdl.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
vo_tct.c video/out/vo_tct: query terminal size generically 2020-04-23 23:25:41 +03:00
vo_vaapi.c draw_bmp: use command line options for any used scalers 2020-05-13 20:07:59 +02:00
vo_vdpau.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
vo_wlshm.c vo_wlshm, vo_drm: set image size with mp_image_set_size 2020-05-17 12:53:26 +02:00
vo_x11.c vo_x11: partially restore operation on bad endian systems 2020-06-17 19:44:50 +02:00
vo_xv.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
w32_common.c w32_common: Scale window when moving to display with different DPI 2020-05-08 21:47:32 +10:00
w32_common.h
wayland_common.c wayland: avoid potential deadlocks 2020-07-31 21:23:45 +00:00
wayland_common.h wayland: remove unused declaration 2020-07-19 15:21:05 -05:00
win_state.c
win_state.h
x11_common.c x11: add option to make window appear on a specific workspace 2020-07-12 00:12:55 +02:00
x11_common.h x11: remove terrible xdg-screensaver hack 2020-07-08 22:45:07 +02:00