summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDaniel van Vugt <daniel.van.vugt@canonical.com>2023-02-17 18:13:30 +0800
committerDudemanguy <random342@airmail.cc>2023-02-28 15:07:14 +0000
commit022790a2b49e4d21cb803842cb54958cca9c732e (patch)
tree5c3a90733b46b7dceeb6e1a2e02bfef1a1d97592 /video/out
parent1f493b76719095c4db612c4102b54ce0f558728d (diff)
downloadmpv-022790a2b49e4d21cb803842cb54958cca9c732e.tar.bz2
mpv-022790a2b49e4d21cb803842cb54958cca9c732e.tar.xz
wayland: request frame callbacks on the topmost surface
Which is wl->video_surface for vo_dmabuf_wayland. Listening on wl->surface results in freezes if it is occluded and culled by the compositor. Which mutter does, and the wl_surface::frame spec warns about: > A server should avoid signaling the frame callbacks if the > surface is not visible in any way, e.g. the surface is off-screen, > or completely obscured by other opaque surfaces.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/wayland_common.c7
-rw-r--r--video/out/wayland_common.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 6fade185fd..192231bb65 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1105,11 +1105,11 @@ static void frame_callback(void *data, struct wl_callback *callback, uint32_t ti
if (callback)
wl_callback_destroy(callback);
- wl->frame_callback = wl_surface_frame(wl->surface);
+ wl->frame_callback = wl_surface_frame(wl->callback_surface);
wl_callback_add_listener(wl->frame_callback, &frame_listener, wl);
if (wl->use_present) {
- struct wp_presentation_feedback *fback = wp_presentation_feedback(wl->presentation, wl->surface);
+ struct wp_presentation_feedback *fback = wp_presentation_feedback(wl->presentation, wl->callback_surface);
add_feedback(wl->fback_pool, fback);
wp_presentation_feedback_add_listener(fback, &feedback_listener, wl->fback_pool);
}
@@ -2187,7 +2187,8 @@ bool vo_wayland_init(struct vo *vo)
update_app_id(wl);
mp_make_wakeup_pipe(wl->wakeup_pipe);
- wl->frame_callback = wl_surface_frame(wl->surface);
+ wl->callback_surface = wl->using_dmabuf_wayland ? wl->video_surface : wl->surface;
+ wl->frame_callback = wl_surface_frame(wl->callback_surface);
wl_callback_add_listener(wl->frame_callback, &frame_listener, wl);
wl_surface_commit(wl->surface);
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 06d742e5ed..c9921cc60b 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -50,6 +50,7 @@ struct vo_wayland_state {
struct wl_shm *shm;
struct wl_surface *surface;
struct wl_surface *video_surface;
+ struct wl_surface *callback_surface;
struct wl_subsurface *video_subsurface;
/* Geometry */