summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-12-28 12:42:02 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-12 04:49:15 -0800
commitabf2efb107f7bee329dfd0c89573f70bc4bd7c69 (patch)
tree9c62b935580d25c42600c344c782fb664a8fc5bd
parentf670c64e59119fc91675d8eccf1e350365ee2f55 (diff)
downloadmpv-abf2efb107f7bee329dfd0c89573f70bc4bd7c69.tar.bz2
mpv-abf2efb107f7bee329dfd0c89573f70bc4bd7c69.tar.xz
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.
-rw-r--r--DOCS/man/options.rst3
-rw-r--r--video/out/opengl/context_cocoa.c8
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=<yes|no|auto>``
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)