summaryrefslogtreecommitdiffstats
path: root/video/out/vo_wayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_wayland.c')
-rw-r--r--video/out/vo_wayland.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c
index 3367e46fe6..5d3c77e2bf 100644
--- a/video/out/vo_wayland.c
+++ b/video/out/vo_wayland.c
@@ -389,14 +389,12 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
p->original_image = mpi;
}
- if (!p->wl->frame.pending)
- return;
+ if (!vo_wayland_wait_frame(vo))
+ MP_DBG(p->wl, "discarding frame callback\n");
shm_buffer_t *buf = buffer_pool_get_back(&p->video_bufpool);
if (!buf) {
- // TODO: use similar handling of busy buffers as the osd buffers
- // if the need arises
MP_VERBOSE(p->wl, "can't draw, back buffer is busy\n");
return;
}
@@ -504,25 +502,31 @@ static void draw_osd(struct vo *vo)
osd_draw(vo->osd, p->osd, pts, 0, osd_formats, draw_osd_cb, p);
}
-static void flip_page(struct vo *vo)
+static void redraw(void *data, uint32_t time)
{
- struct priv *p = vo->priv;
-
- if (!p->wl->frame.pending)
- return;
-
- buffer_pool_swap(&p->video_bufpool);
+ struct priv *p = data;
shm_buffer_t *buf = buffer_pool_get_front(&p->video_bufpool);
wl_surface_attach(p->wl->window.video_surface, buf->buffer, p->x, p->y);
wl_surface_damage(p->wl->window.video_surface, 0, 0, p->dst_w, p->dst_h);
- wl_surface_commit(p->wl->window.video_surface);
buffer_finalise_front(buf);
p->x = 0;
p->y = 0;
p->recent_flip_time = mp_time_us();
- p->wl->frame.pending = false;
+}
+
+static void flip_page(struct vo *vo)
+{
+ struct priv *p = vo->priv;
+
+ buffer_pool_swap(&p->video_bufpool);
+
+ if (!p->wl->frame.callback)
+ vo_wayland_request_frame(vo, p, redraw);
+
+ if (!vo_wayland_wait_frame(vo))
+ MP_DBG(p->wl, "discarding frame callback\n");
}
static int query_format(struct vo *vo, int format)