From cee764849e4fe22b00fb3f31838a63906e2e0d54 Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Sun, 17 Sep 2017 13:44:31 +1000 Subject: [PATCH] cocoa: re-enable double buffering This causes a performance regression on 10.11 and newer, but the single buffered method was broken and could cause partially rendered frames to be presented to the screen. This reverts 9f30cd8292b4b7bfe5d7db29fe31a07cc76dec2c and e543853a7ff0ab4dcd4ccaf06c448013fd41c03a. --- video/out/cocoa_common.m | 2 ++ video/out/opengl/context_cocoa.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index abead0fb53..8f09c25b91 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -811,6 +811,8 @@ void vo_cocoa_swap_buffers(struct vo *vo) } pthread_mutex_unlock(&s->sync_lock); + CGLFlushDrawable(s->cgl_ctx); + pthread_mutex_lock(&s->lock); s->frame_w = vo->dwidth; s->frame_h = vo->dheight; diff --git a/video/out/opengl/context_cocoa.c b/video/out/opengl/context_cocoa.c index 585c49f9a9..6d3d8282e1 100644 --- a/video/out/opengl/context_cocoa.c +++ b/video/out/opengl/context_cocoa.c @@ -72,6 +72,7 @@ static CGLError test_gl_version(struct ra_ctx *ctx, CGLOpenGLProfile ver) // rejected attribute to preserve the fallback code kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) ver, + kCGLPFADoubleBuffer, kCGLPFAAccelerated, kCGLPFAAllowOfflineRenderers, // keep this one last to apply the cocoa-force-dedicated-gpu option @@ -155,9 +156,7 @@ static void cocoa_uninit(struct ra_ctx *ctx) static void cocoa_swap_buffers(struct ra_ctx *ctx) { - GL *gl = &p->gl; vo_cocoa_swap_buffers(ctx->vo); - gl->Flush(); } static bool cocoa_init(struct ra_ctx *ctx)