Bug 1576968 - Use glFlush() instead of -[NSOpenGLContext flushBuffer] when we have no framebuffer zero. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Wed, 28 Aug 2019 21:45:23 +0000
changeset 490486 28ed211ab542dfb8c750688701f1353db47a912e
parent 490485 6986632595c9b8a671a2f21261bdd1fecf069333
child 490487 907ee4a0aa61f2ef1dc60e9abb3c21971a00eaa4
push id36504
push userccoroiu@mozilla.com
push dateThu, 29 Aug 2019 04:08:39 +0000
treeherdermozilla-central@7004b8779a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1576968
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1576968 - Use glFlush() instead of -[NSOpenGLContext flushBuffer] when we have no framebuffer zero. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D43648
gfx/gl/GLContextProviderCGL.mm
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -118,17 +118,24 @@ bool GLContextCGL::IsCurrentImpl() const
 
 GLenum GLContextCGL::GetPreferredARGB32Format() const { return LOCAL_GL_BGRA; }
 
 bool GLContextCGL::IsDoubleBuffered() const { return sCGLLibrary.UseDoubleBufferedWindows(); }
 
 bool GLContextCGL::SwapBuffers() {
   AUTO_PROFILER_LABEL("GLContextCGL::SwapBuffers", GRAPHICS);
 
-  [mContext flushBuffer];
+  if (StaticPrefs::gfx_core_animation_enabled_AtStartup()) {
+    // We do not have a framebuffer zero. Just do a flush.
+    // Flushing is necessary if we want our IOSurfaces to have the correct
+    // content once they're picked up by the WindowServer from our CALayers.
+    fFlush();
+  } else {
+    [mContext flushBuffer];
+  }
 
   return true;
 }
 
 void GLContextCGL::GetWSIInfo(nsCString* const out) const { out->AppendLiteral("CGL"); }
 
 Maybe<SymbolLoader> GLContextCGL::GetSymbolLoader() const {
   const auto& lib = sCGLLibrary.Library();