From 022790a2b49e4d21cb803842cb54958cca9c732e Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 17 Feb 2023 18:13:30 +0800 Subject: 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. --- video/out/wayland_common.c | 7 ++++--- video/out/wayland_common.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'video') 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 */ -- cgit v1.2.3