From 016c4405fb62d1f4fb98333fbe847a719d5db000 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 27 Dec 2017 09:52:55 +0100 Subject: 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. --- video/out/opengl/egl_helpers.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } -- cgit v1.2.3