From deaea70630647e261d60fa7eb9447d386efd38d2 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 13 Oct 2020 10:36:08 -0500 Subject: wayland: be less strict about when to render efb0c5c changed the rendering logic of mpv on wayland and made it skip rendering when it did not receive frame callback in time. The idea was to skip rendering when the surface was hidden and be less wasteful. This unfortunately had issues in certain instances where a frame callback could be missed (but the window was still in view) due to imprecise rendering (like the default audio video-sync mode). This would lead to the video appearing to stutter since mpv would skip rendering in those cases. To account for this case, simply re-add an old heuristic for detecting if a window is hidden or not since the goal is to simply not render when a window is hidden. If the wait on the frame callback times out enough times in a row, then we consider the window hidden and thus begin to skip rendering then. The actual threshold to consider a surface as hidden is completely arbitrary (greater than your monitor's refresh rate), but it's safe enough since realistically you're not going to miss 60+ frame callbacks in a row unless the surface actually is hidden. Fixes #8169. --- video/out/opengl/context_wayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'video/out/opengl/context_wayland.c') diff --git a/video/out/opengl/context_wayland.c b/video/out/opengl/context_wayland.c index c0a8aee206..2456de1b90 100644 --- a/video/out/opengl/context_wayland.c +++ b/video/out/opengl/context_wayland.c @@ -145,7 +145,7 @@ static bool wayland_egl_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_ struct ra_ctx *ctx = sw->ctx; struct vo_wayland_state *wl = ctx->vo->wl; - bool render = !wl->frame_wait || wl->opts->disable_vsync; + bool render = !wl->hidden || wl->opts->disable_vsync; if (wl->frame_wait && wl->presentation) vo_wayland_sync_clear(wl); -- cgit v1.2.3