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 257592 28738a551bd0a81d7d584f9063900551c2671d0b
parent 257591 398749e97b25f46b6e6865249424c66dc03b30c8
child 257593 b837e465cdf1303897756a42f7fe294772f623b4
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, lsblakk
bugs1136242
milestone38.0a2
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
@@ -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();