Bug 1285692 - Acquire surface to allow FB completeness. - r=jrmuizel
☠☠ backed out by 2761e5c78985 ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 08 Jul 2016 17:44:52 -0700
changeset 330695 9d0676755cf83ade1bfcc75e968da5e3454efd74
parent 330694 1fbada95de3a0187784df2d712d9d4047a9a4d84
child 330696 45136034045a6b0e44ddf1119b29c40b53b2ca30
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1285692
milestone50.0a1
Bug 1285692 - Acquire surface to allow FB completeness. - r=jrmuizel MozReview-Commit-ID: H9IidhUqqw9
gfx/gl/GLScreenBuffer.cpp
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -940,19 +940,30 @@ ReadBuffer::Create(GLContext* gl,
     gl->AttachBuffersToFB(colorTex, colorRB, depthRB, stencilRB, fb, target);
     gl->mFBOMapping[fb] = surf;
 
     UniquePtr<ReadBuffer> ret( new ReadBuffer(gl, fb, depthRB,
                                               stencilRB, surf) );
 
     GLenum err = localError.GetError();
     MOZ_ASSERT_IF(err != LOCAL_GL_NO_ERROR, err == LOCAL_GL_OUT_OF_MEMORY);
-    if (err || !gl->IsFramebufferComplete(fb)) {
-        ret = nullptr;
+    if (err)
+        return nullptr;
+
+    const bool needsAcquire = !surf->IsProducerAcquired();
+    if (needsAcquire) {
+        surf->ProducerAcquire();
     }
+    const bool isComplete = gl->IsFramebufferComplete(fb);
+    if (needsAcquire) {
+        surf->ProducerRelease();
+    }
+
+    if (!isComplete)
+        return nullptr;
 
     return Move(ret);
 }
 
 ReadBuffer::~ReadBuffer()
 {
     if (!mGL->MakeCurrent())
         return;