mpv/video/out
Dudemanguy c26d83348b wayland: shuffle around the render loop again
Take two. f4e89dd went wrong by moving vo_wayland_wait_frame before
start_frame was called. Whether or not this matters depends on the
compositor, but some weird things can happen. Basically, it's a
scheduling issue. vo_wayland_wait_frame queues all events and sends them
to the server to process (with no blocking if presentation time is
available). If mpv changes state while rendering (and this function is
called before every frame is drawn), then that event also gets
dispatched and sent to the compositor. This, in some cases, can cause
some funny behavior because the next frame gets attached to the surface
while the old buffer is getting released. It's safer to call this
function after the swap already happens and well before mpv calls its
next draw. There's no weird scheduling of events, and the compositor log
is more normal.

The second part of this is to fix some stuttering issues. This is mostly
just conjecture, but probably what was happening was this thing called
"composition". The easiest way to see this is to play a video on the
default audio sync mode (probably easiest to see on a typical 23.976
video). Have that in a window and float it over firefox (floating
windows are bloat on a tiling wm anyway). Then in firefox, do some short
bursts of smooth scrolling (likely uses egl). Some stutter in video
rendering could be observed, particularly in panning shots.

Compositors are supposed to prevent tearing so what likely was happening
was that the compositor was simply holding the buffer a wee bit longer
to make sure it happened in sync with the smooth scrolling. Because the
mpv code waits precisely on presentation time, the loop would timeout on
occasion instead of receiving the frame callback. This would then lead
to a skipped frame when rendering and thus causing stuttering.

The fix is simple: just only count consecutive timeouts as not receiving
frame callback. If a compositor holds the mpv buffer slightly longer to
avoid tearing, then we will definitely receive frame callback on the
next round of the render loop. This logic also appears to be sound for
plasma (funfact: Plasma always returns frame callback even when the
window is hidden. Not sure what's up with that, but luckily it doesn't
matter to us.), so get rid of the goofy 1/vblank_time thing and just
keep it a simple > 1 check.
2021-05-24 19:20:31 +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: fix extreme clipping with --gamut-clipping for HDR outputs 2021-05-22 21:18:51 +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
vulkan wayland: shuffle around the render loop again 2021-05-24 19:20:31 +00:00
win32
android_common.c
android_common.h
aspect.c
aspect.h
bitmap_packer.c
bitmap_packer.h
cocoa_cb_common.swift
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
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_tct.c
vo_vaapi.c
vo_vdpau.c
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 command: add display-width/display-height property 2021-05-06 17:36:55 +00:00
w32_common.h
wayland_common.c wayland: shuffle around the render loop again 2021-05-24 19:20:31 +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