From 3bf1d22879c90fbde99bce1d3a6a54e86d298a5e Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 29 Jul 2023 19:09:45 +0200 Subject: [PATCH] vo_gpu_next: fix assertion on wayland This code failed to handle the case of the swapchain submission being skipped because the window was invisible. Fixes: f9dc695b580c394bf4f9833d36e91b7fcbe009ea --- video/out/vo_gpu_next.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index ddc22bcbde..30034f98b9 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -116,6 +116,7 @@ struct priv { double last_pts; bool is_interpolated; bool want_reset; + bool frame_pending; struct m_config_cache *opts_cache; struct mp_csp_equalizer_state *video_eq; @@ -1064,6 +1065,7 @@ done: pl_tex_clear(gpu, swframe.fbo, (float[4]){ 0.5, 0.0, 1.0, 1.0 }); pl_gpu_flush(gpu); + p->frame_pending = true; } static void flip_page(struct vo *vo) @@ -1071,8 +1073,11 @@ static void flip_page(struct vo *vo) struct priv *p = vo->priv; struct ra_swapchain *sw = p->ra_ctx->swapchain; - if (!pl_swapchain_submit_frame(p->sw)) - MP_ERR(vo, "Failed presenting frame!\n"); + if (p->frame_pending) { + if (!pl_swapchain_submit_frame(p->sw)) + MP_ERR(vo, "Failed presenting frame!\n"); + p->frame_pending = false; + } sw->fns->swap_buffers(sw); }