Bug 1136242. Make sure we acquire the mutexes when copying the surfaces. r=jgilbert
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Fri, 27 Feb 2015 14:17:55 -0500
changeset 232748 ad32a8ae26313d174340f33f2c0345b266da70bf
parent 232747 ee33df27bf15a1b28c77ce6d4f464a495b4c3d02
child 232749 cb931e2210e1aa71adf3d07c3583c9b81cad48d1
push id56648
push userjmuizelaar@mozilla.com
push dateTue, 10 Mar 2015 14:48:53 +0000
treeherdermozilla-inbound@ad32a8ae2631 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1136242
milestone39.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 1136242. Make sure we acquire the mutexes when copying the surfaces. r=jgilbert This was causing badness when using preserveDrawingBuffers = true
gfx/gl/GLScreenBuffer.cpp
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -439,20 +439,16 @@ GLScreenBuffer::Swap(const gfx::IntSize&
 
     if (!Attach(newBack->Surf(), size))
         return false;
     // Attach was successful.
 
     mFront = mBack;
     mBack = newBack;
 
-    // Fence before copying.
-    if (mFront) {
-        mFront->Surf()->ProducerRelease();
-    }
     if (mBack) {
         mBack->Surf()->ProducerAcquire();
     }
 
     if (ShouldPreserveBuffer() &&
         mFront &&
         mBack)
     {
@@ -465,16 +461,24 @@ GLScreenBuffer::Swap(const gfx::IntSize&
 
         SharedSurface::ProdCopy(src, dest, mFactory.get());
 
         //srcPixel = ReadPixel(src);
         //destPixel = ReadPixel(dest);
         //printf_stderr("After: src: 0x%08x, dest: 0x%08x\n", srcPixel, destPixel);
     }
 
+    // XXX: We would prefer to fence earlier on platforms that don't need
+    // the full ProducerAcquire/ProducerRelease semantics, so that the fence
+    // doesn't include the copy operation. Unfortunately, the current API
+    // doesn't expose a good way to do that.
+    if (mFront) {
+        mFront->Surf()->ProducerRelease();
+    }
+
     return true;
 }
 
 bool
 GLScreenBuffer::PublishFrame(const gfx::IntSize& size)
 {
     AssureBlitted();