summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.h
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-09-18 12:29:53 -0500
committerDudemanguy <random342@airmail.cc>2020-09-21 20:42:17 +0000
commitefb0c5c4469ce4dc63fc3345293bdf7536e36581 (patch)
tree051f59036b59009114b3f4da05043226fbdc85be /video/out/wayland_common.h
parent9ba90b4f6ff06bcc2a131237df9df1078c75d9d8 (diff)
downloadmpv-efb0c5c4469ce4dc63fc3345293bdf7536e36581.tar.bz2
mpv-efb0c5c4469ce4dc63fc3345293bdf7536e36581.tar.xz
wayland: only render if we have frame callback
Back in the olden days, mpv's wayland backend was driven by the frame callback. This had several issues and was removed in favor of the current approach which allowed some advanced features (like display-resample and presentation time) to actually work properly. However as a consequence, it meant that mpv always rendered, even if the surface was hidden. Wayland people consider this "wasteful" (and well they aren't wrong). This commit aims to avoid wasteful rendering by doing some additional checks in the swapchain. There's three main parts to this. 1. Wayland EGL now uses an external swapchain (like the drm context). Before we start a new frame, we check to see if we are waiting on a callback from the compositor. If there is no wait, then go ahead and proceed to render the frame, swap buffers, and then initiate vo_wayland_wait_frame to poll (with a timeout) for the next potential callback. If we are still waiting on callback from the compositor when starting a new frame, then we simple skip rendering it entirely until the surface comes back into view. 2. Wayland on vulkan has essentially the same approach although the details are a little different. The ra_vk_ctx does not have support for an external swapchain and although such a mechanism could theoretically be added, it doesn't make much sense with libplacebo. Instead, start_frame was added as a param and used to check for callback. 3. For wlshm, it's simply a matter of adding frame callback to it, leveraging vo_wayland_wait_frame, and using the frame callback value to whether or not to draw the image.
Diffstat (limited to 'video/out/wayland_common.h')
-rw-r--r--video/out/wayland_common.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 7eec7be2d5..27f4f87b0e 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -110,14 +110,11 @@ struct vo_wayland_state {
/* 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;
+ int64_t vsync_duration;
/* Input */
struct wl_seat *seat;
@@ -154,6 +151,7 @@ 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 vo_wayland_sync_clear(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);