summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2014-01-04 17:19:24 +0100
committerwm4 <wm4@nowhere>2014-01-06 20:22:08 +0100
commit35b01c9604163fa3a168d7085b6c3c20a301ccd6 (patch)
tree176fb695259230eaea1999295224298bbcff5c67
parent09b95257fe8ae393c6bafb907d0ae71004f1105c (diff)
downloadmpv-35b01c9604163fa3a168d7085b6c3c20a301ccd6.tar.bz2
mpv-35b01c9604163fa3a168d7085b6c3c20a301ccd6.tar.xz
wayland/egl: use redraw callback
This solves the issue where we would not receive any frame events. The difference to my earlier tests is that now it looks like eglSwapBuffers uses it's own event queue or something similiar along the lines. Becaues the performance is the same as without any redraw callback.
-rw-r--r--video/out/gl_wayland.c30
-rw-r--r--video/out/wayland_common.h3
2 files changed, 32 insertions, 1 deletions
diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c
index e13314f531..ddc12c2486 100644
--- a/video/out/gl_wayland.c
+++ b/video/out/gl_wayland.c
@@ -196,12 +196,40 @@ static void releaseGlContext_wayland(MPGLContext *ctx)
wl->egl_context.egl.ctx = NULL;
}
-static void swapGlBuffers_wayland(MPGLContext *ctx)
+static const struct wl_callback_listener frame_listener;
+
+static void frame_handle_redraw(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+
{
+ MPGLContext *ctx = data;
struct vo_wayland_state *wl = ctx->vo->wayland;
+
+ if (callback)
+ wl_callback_destroy(callback);
+
+ //struct wl_callback *tmp = wl_surface_frame(wl->window.surface);
+ //wl_callback_add_listener(tmp, &frame_listener, ctx);
+ wl->egl_context.redraw_callback = wl_surface_frame(wl->window.surface);
+ wl_callback_add_listener(wl->egl_context.redraw_callback, &frame_listener, ctx);
+
eglSwapBuffers(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
}
+static const struct wl_callback_listener frame_listener = {
+ frame_handle_redraw
+};
+
+static void swapGlBuffers_wayland(MPGLContext *ctx)
+{
+ struct vo_wayland_state *wl = ctx->vo->wayland;
+// eglSwapBuffers(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
+
+ if (!wl->egl_context.redraw_callback)
+ frame_handle_redraw(ctx, NULL, 0);
+}
+
static int control(struct vo *vo, int *events, int request, void *data)
{
struct vo_wayland_state *wl = vo->wayland;
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index efbe071f9d..152b438220 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -60,6 +60,9 @@ struct vo_wayland_state {
EGLContext ctx;
EGLConfig conf;
} egl;
+
+
+ struct wl_callback * redraw_callback;
} egl_context;
#endif