Bug 1285692 - Acquire surface to allow FB completeness. - r=jrmuizel
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 08 Jul 2016 17:44:52 -0700
changeset 353676 a67661b37e17afb179b76503ca5bf57a5df863ad
parent 353675 b6c64d5ccdd627c9d0d35020a6431e235005648a
child 353677 92796a154d600385d6d2939f3b3f064bf8e0ae3e
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1285692
milestone51.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 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
@@ -941,19 +941,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;