summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-27 09:52:55 +0100
committerKevin Mitchell <kevmitch@gmail.com>2017-12-27 04:13:46 -0700
commit016c4405fb62d1f4fb98333fbe847a719d5db000 (patch)
tree9681cc238d01e8eb8c27e0d199d1548cd82518b8 /video
parent9708248eb359037fc3858c464389e8bc5a3161cd (diff)
downloadmpv-016c4405fb62d1f4fb98333fbe847a719d5db000.tar.bz2
mpv-016c4405fb62d1f4fb98333fbe847a719d5db000.tar.xz
vo_gpu: EGL: provide SwapInterval to generic code
This means that we now explicitly set an interval of 1. Although that should be the EGL default, some drivers could possibly ignore this (unconfirmed). In any case, this commit also allows disabling vsync, for users who want it.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/egl_helpers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c
index 0033bf1e33..55bf376973 100644
--- a/video/out/opengl/egl_helpers.c
+++ b/video/out/opengl/egl_helpers.c
@@ -199,6 +199,14 @@ bool mpegl_create_context_cb(struct ra_ctx *ctx, EGLDisplay display,
return false;
}
+static int GLAPIENTRY swap_interval(int interval)
+{
+ EGLDisplay display = eglGetCurrentDisplay();
+ if (!display)
+ return 1;
+ return !eglSwapInterval(display, interval);
+}
+
static void *mpegl_get_proc_address(void *ctx, const char *name)
{
void *p = eglGetProcAddress(name);
@@ -223,4 +231,6 @@ void mpegl_load_functions(struct GL *gl, struct mp_log *log)
egl_exts = eglQueryString(display, EGL_EXTENSIONS);
mpgl_load_functions2(gl, mpegl_get_proc_address, NULL, egl_exts, log);
+ if (!gl->SwapInterval)
+ gl->SwapInterval = swap_interval;
}