Bug 1136242 - Make sure we acquire the mutexes when copying the surfaces. r=jgilbert, a=lsblakk
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Fri, 27 Feb 2015 14:17:55 -0500
changeset 250352 71e45360880e
parent 250351 7e93dd7c7feb
child 250353 97c57043b3fc
push id4555
push userryanvm@gmail.com
push date2015-03-11 19:14 +0000
treeherdermozilla-beta@7949e470a547 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, lsblakk
bugs1136242
milestone37.0
Bug 1136242 - Make sure we acquire the mutexes when copying the surfaces. r=jgilbert, a=lsblakk This was causing badness when using preserveDrawingBuffers = true
gfx/gl/GLScreenBuffer.cpp
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -433,33 +433,37 @@ 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)
     {
         auto src  = mFront->Surf();
         auto dest = mBack->Surf();
         SharedSurface::ProdCopy(src, dest, mFactory.get());
     }
 
+    // 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();