From bedca07a021863d264e7c4c471cc30102899500f Mon Sep 17 00:00:00 2001 From: dudemanguy Date: Thu, 10 Oct 2019 14:14:40 -0500 Subject: wayland: add presentation time Use ust/msc/refresh values from wayland's presentation time in mpv's ra_swapchain_fns.get_vsync for the wayland contexts. --- video/out/wayland_common.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'video/out/wayland_common.h') diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 1415c6935d..606d9ed218 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -25,6 +25,14 @@ #include "vo.h" #include "input/event.h" +struct vo_wayland_sync { + int64_t ust; + int64_t msc; + int64_t sbc; + int64_t refresh_usec; + bool filled; +}; + struct vo_wayland_output { struct vo_wayland_state *wl; uint32_t id; @@ -56,7 +64,7 @@ struct vo_wayland_state { bool fullscreen; bool maximized; bool configured; - bool callback_wait; + bool frame_wait; int wakeup_pipe[2]; int pending_vo_events; int mouse_x; @@ -74,11 +82,25 @@ struct vo_wayland_state { struct xdg_wm_base *wm_base; struct xdg_toplevel *xdg_toplevel; struct xdg_surface *xdg_surface; + struct wp_presentation *presentation; + struct wp_presentation_feedback *feedback; struct zxdg_decoration_manager_v1 *xdg_decoration_manager; struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration; struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; struct zwp_idle_inhibitor_v1 *idle_inhibitor; + /* Presentation Feedback */ + struct vo_wayland_sync *sync; + int sync_size; + int64_t user_sbc; + int64_t last_ust; + int64_t last_msc; + int64_t last_sbc; + int64_t last_sbc_mp_time; + int64_t vsync_duration; + int64_t last_skipped_vsyncs; + int64_t last_queue_display_time; + /* Input */ struct wl_seat *seat; struct wl_pointer *pointer; @@ -109,10 +131,14 @@ struct vo_wayland_state { int vo_wayland_init(struct vo *vo); int vo_wayland_reconfig(struct vo *vo); int vo_wayland_control(struct vo *vo, int *events, int request, void *arg); +int last_available_sync(struct vo_wayland_state *wl); void vo_wayland_check_events(struct vo *vo); void vo_wayland_uninit(struct vo *vo); void vo_wayland_wakeup(struct vo *vo); void vo_wayland_wait_events(struct vo *vo, int64_t until_time_us); void vo_wayland_wait_frame(struct vo_wayland_state *wl); +void wayland_sync_swap(struct vo_wayland_state *wl); +void vo_wayland_sync_shift(struct vo_wayland_state *wl); +void queue_new_sync(struct vo_wayland_state *wl); #endif /* MPLAYER_WAYLAND_COMMON_H */ -- cgit v1.2.3