From c0ef3cf9c2d8db023dd3d5dcdeb2c2c592ad6b58 Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Thu, 21 Jul 2016 12:25:30 +0100 Subject: wayland: port to the new wakeup/wait_events framework This fits natively into the vo/backend and allows to simplify the polling code. One new change is the fact that surface_handle_enter flags VO_EVENT_WIN_STATE and VO_EVENT_RESIZE instead of only VO_EVENT_WIN_STATE. Before this, the code hackily relied on the timeout and the loop in the wait_frame function to track and set the scaling factor. Instead, this triggers mpv to run a schedule_resize and adjust the new VO output dimensions immediately. This is also more accurate since surface_handle_enter() gets called when a surface is created, moved and resized, which is exactly what the rest of the player might be interested in. --- video/out/opengl/context_wayland.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'video/out/opengl/context_wayland.c') diff --git a/video/out/opengl/context_wayland.c b/video/out/opengl/context_wayland.c index e74132bcf2..b1d9a32bca 100644 --- a/video/out/opengl/context_wayland.c +++ b/video/out/opengl/context_wayland.c @@ -207,8 +207,7 @@ static void waylandgl_swap_buffers(MPGLContext *ctx) if (!wl->frame.callback) vo_wayland_request_frame(ctx->vo, NULL, NULL); - if (!vo_wayland_wait_frame(ctx->vo)) - MP_DBG(wl, "discarding frame callback\n"); + vo_wayland_wait_events(ctx->vo, 0); eglSwapBuffers(wl->egl_context.egl.dpy, wl->egl_context.egl_surface); } @@ -225,6 +224,16 @@ static int waylandgl_control(MPGLContext *ctx, int *events, int request, return r; } +static void wayland_wakeup(struct MPGLContext *ctx) +{ + vo_wayland_wakeup(ctx->vo); +} + +static void wayland_wait_events(struct MPGLContext *ctx, int64_t until_time_us) +{ + vo_wayland_wait_events(ctx->vo, until_time_us); +} + static int waylandgl_init(struct MPGLContext *ctx, int flags) { if (!vo_wayland_init(ctx->vo)) @@ -239,5 +248,7 @@ const struct mpgl_driver mpgl_driver_wayland = { .reconfig = waylandgl_reconfig, .swap_buffers = waylandgl_swap_buffers, .control = waylandgl_control, + .wakeup = wayland_wakeup, + .wait_events = wayland_wait_events, .uninit = waylandgl_uninit, }; -- cgit v1.2.3