summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2015-08-19 22:39:52 +0300
committerwm4 <wm4@nowhere>2015-08-21 00:01:01 +0200
commit3245bfefc3803904f5aeade0b3e60cd504ccb16c (patch)
tree02f1cd0d32f4470396438c44a828a1e863088b89 /video
parentb144da63a890dfebf6fd4f1d7bfefa6dcac1f7aa (diff)
downloadmpv-3245bfefc3803904f5aeade0b3e60cd504ccb16c.tar.bz2
mpv-3245bfefc3803904f5aeade0b3e60cd504ccb16c.tar.xz
gl_wayland: eglSwapInterval(0) to avoid blocking
This makes mesa not wait for frame callback internally.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_common.h5
-rw-r--r--video/out/gl_wayland.c24
-rw-r--r--video/out/vo_opengl.c3
3 files changed, 14 insertions, 18 deletions
diff --git a/video/out/gl_common.h b/video/out/gl_common.h
index 39cde380a4..50817090be 100644
--- a/video/out/gl_common.h
+++ b/video/out/gl_common.h
@@ -136,11 +136,6 @@ typedef struct MPGLContext {
// Resize the window, or create a new window if there isn't one yet.
// On the first call, it creates a GL context.
bool (*config_window)(struct MPGLContext *ctx, int flags);
-
- // Optional callback on the beginning of a frame. The frame will be finished
- // with swapGlBuffers(). This returns false if use of the OpenGL context
- // should be avoided.
- bool (*start_frame)(struct MPGLContext *);
} MPGLContext;
MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags);
diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c
index ecfa5b3298..2a565a36d6 100644
--- a/video/out/gl_wayland.c
+++ b/video/out/gl_wayland.c
@@ -144,6 +144,20 @@ static void egl_create_window(struct vo_wayland_state *wl)
wl->egl_context.egl.ctx);
wl_display_dispatch_pending(wl->display.display);
+
+ /**
+ * <http://lists.freedesktop.org/archives/wayland-devel/2013-November/012019.html>
+ *
+ * The main change is that if the swap interval is 0 then Mesa won't install a
+ * frame callback so that eglSwapBuffers can be executed as often as necessary.
+ * Instead it will do a sync request after the swap buffers. It will block for
+ * sync complete event in get_back_bo instead of the frame callback. The
+ * compositor is likely to send a release event while processing the new buffer
+ * attach and this makes sure we will receive that before deciding whether to
+ * allocate a new buffer.
+ */
+
+ eglSwapInterval(wl->egl_context.egl.dpy, 0);
}
static bool config_window_wayland(struct MPGLContext *ctx, int flags)
@@ -196,11 +210,8 @@ static void swapGlBuffers_wayland(MPGLContext *ctx)
{
struct vo_wayland_state *wl = ctx->vo->wayland;
- if (!wl->frame.pending)
- return;
eglSwapBuffers(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
- wl->frame.pending = false;
}
static int control(struct vo *vo, int *events, int request, void *data)
@@ -214,12 +225,6 @@ static int control(struct vo *vo, int *events, int request, void *data)
return r;
}
-static bool start_frame(struct MPGLContext *ctx)
-{
- struct vo_wayland_state *wl = ctx->vo->wayland;
- return wl->frame.pending;
-}
-
void mpgl_set_backend_wayland(MPGLContext *ctx)
{
ctx->config_window = config_window_wayland;
@@ -228,5 +233,4 @@ void mpgl_set_backend_wayland(MPGLContext *ctx)
ctx->vo_control = control;
ctx->vo_init = vo_wayland_init;
ctx->vo_uninit = vo_wayland_uninit;
- ctx->start_frame = start_frame;
}
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 76276ccfe0..6fb4206fc4 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -169,9 +169,6 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
struct gl_priv *p = vo->priv;
GL *gl = p->gl;
- if (p->glctx->start_frame && !p->glctx->start_frame(p->glctx))
- return;
-
p->frame_started = true;
gl_video_render_frame(p->renderer, frame, 0);