summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/opengl/context_wayland.c2
-rw-r--r--video/out/vo_wlshm.c2
-rw-r--r--video/out/vulkan/context_wayland.c2
-rw-r--r--video/out/wayland_common.c11
-rw-r--r--video/out/wayland_common.h2
5 files changed, 16 insertions, 3 deletions
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);
diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c
index 43a1318c8d..a517d0f09d 100644
--- a/video/out/vo_wlshm.c
+++ b/video/out/vo_wlshm.c
@@ -248,7 +248,7 @@ static void draw_image(struct vo *vo, struct mp_image *src)
struct vo_wayland_state *wl = vo->wl;
struct buffer *buf;
- if (wl->frame_wait)
+ if (wl->hidden)
return;
wl->frame_wait = true;
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index 753854381c..4af0e795ef 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -106,7 +106,7 @@ static bool wayland_vk_start_frame(struct ra_ctx *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);
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index eb1e0f8c21..ecea6fedeb 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1717,6 +1717,17 @@ void vo_wayland_wait_frame(struct vo_wayland_state *wl)
wl_display_dispatch_pending(wl->display);
}
+ if (!wl->hidden && wl->frame_wait) {
+ wl->timeout_count += 1;
+ if (wl->timeout_count > wl->current_output->refresh_rate)
+ wl->hidden = true;
+ }
+
+ if (!wl->frame_wait) {
+ wl->timeout_count = 0;
+ wl->hidden = false;
+ }
+
if (wl_display_get_error(wl->display) == 0)
wl_display_roundtrip(wl->display);
}
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 27f4f87b0e..e54e3ff447 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -79,6 +79,8 @@ struct vo_wayland_state {
bool activated;
bool has_keyboard_input;
bool focused;
+ bool hidden;
+ int timeout_count;
int wakeup_pipe[2];
int pending_vo_events;
int mouse_x;