From abf2efb107f7bee329dfd0c89573f70bc4bd7c69 Mon Sep 17 00:00:00 2001 From: Akemi Date: Thu, 28 Dec 2017 12:42:02 +0100 Subject: osx: always deactivate the early opengl flush on macOS early flushing only caused problems on macOS, which includes: - performance problems and huge amount of dropped frames - problems with playing back video files with fps close to the display refresh rate - rendering at twice the rate of the video fps - not properly detected display refresh rate we always deactivate any early flush for macOS to fix these problems. --- DOCS/man/options.rst | 3 +++ video/out/opengl/context_cocoa.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 14a901751d..9f0c672919 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -5258,6 +5258,9 @@ The following video options are currently all specific to ``--vo=gpu`` and flipping GL front and backbuffers immediately (i.e. it doesn't call it in display-sync mode). + On OSX this is always deactivated because it only causes performance + problems and other regressions. + ``--gpu-dumb-mode=`` This mode is extremely restricted, and will disable most extended features. That includes high quality scalers and custom shaders! diff --git a/video/out/opengl/context_cocoa.c b/video/out/opengl/context_cocoa.c index 129999932e..da20f400b2 100644 --- a/video/out/opengl/context_cocoa.c +++ b/video/out/opengl/context_cocoa.c @@ -36,6 +36,7 @@ const struct m_sub_options cocoa_conf = { struct priv { GL gl; + void (GLAPIENTRY *Flush)(void); CGLPixelFormatObj pix; CGLContextObj ctx; @@ -49,6 +50,8 @@ static int set_swap_interval(int enabled) return (err == kCGLNoError) ? 0 : -1; } +static void glFlushDummy(void) { } + static void *cocoa_glgetaddr(const char *s) { void *ret = NULL; @@ -138,6 +141,8 @@ static bool create_gl_context(struct ra_ctx *ctx) mpgl_load_functions(gl, (void *)cocoa_glgetaddr, NULL, ctx->vo->log); gl->SwapInterval = set_swap_interval; + p->Flush = gl->Flush; + gl->Flush = glFlushDummy; CGLReleasePixelFormat(p->pix); @@ -155,9 +160,8 @@ static void cocoa_uninit(struct ra_ctx *ctx) static void cocoa_swap_buffers(struct ra_ctx *ctx) { struct priv *p = ctx->priv; - GL *gl = &p->gl; vo_cocoa_swap_buffers(ctx->vo); - gl->Flush(); + p->Flush(); } static bool cocoa_init(struct ra_ctx *ctx) -- cgit v1.2.3