summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_wayland.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2016-07-21 12:25:30 +0100
committerwm4 <wm4@nowhere>2016-07-21 14:45:38 +0200
commitc0ef3cf9c2d8db023dd3d5dcdeb2c2c592ad6b58 (patch)
tree91331f7e448cd34974f2b1a639aefc92e7a0e8dd /video/out/opengl/context_wayland.c
parent8f51418ca4d08533fe23a8f233e59afb2241a9b8 (diff)
downloadmpv-c0ef3cf9c2d8db023dd3d5dcdeb2c2c592ad6b58.tar.bz2
mpv-c0ef3cf9c2d8db023dd3d5dcdeb2c2c592ad6b58.tar.xz
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.
Diffstat (limited to 'video/out/opengl/context_wayland.c')
-rw-r--r--video/out/opengl/context_wayland.c15
1 files changed, 13 insertions, 2 deletions
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,
};