Recreate GLTextureSources after changing compositors on Mac. (bug 1247611, r=mattwoodrow)
authorDavid Anderson <danderson@mozilla.com>
Wed, 30 Mar 2016 09:33:24 -0400
changeset 290905 7c4258b493b12d00a89276c41a5f39cdcf28d2fc
parent 290904 57e8e4c71ecf66ccf431eebf8c88083df266f65c
child 290906 5df20795af1438c88a7997255e52ac44ec07047e
push id74426
push userdanderson@mozilla.com
push dateWed, 30 Mar 2016 16:39:28 +0000
treeherdermozilla-inbound@7c4258b493b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1247611
milestone48.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
Recreate GLTextureSources after changing compositors on Mac. (bug 1247611, r=mattwoodrow)
gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.cpp
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -68,21 +68,23 @@ MacIOSurfaceTextureHostOGL::Lock()
 void
 MacIOSurfaceTextureHostOGL::SetCompositor(Compositor* aCompositor)
 {
   if (!AssertGLCompositor(aCompositor)) {
     mTextureSource = nullptr;
     mCompositor = nullptr;
     return;
   }
+
   CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
+  if (mCompositor != glCompositor) {
+    // Cannot share GL texture identifiers across compositors.
+    mTextureSource = nullptr;
+  }
   mCompositor = glCompositor;
-  if (mTextureSource) {
-    mTextureSource->SetCompositor(glCompositor);
-  }
 }
 
 gfx::SurfaceFormat
 MacIOSurfaceTextureHostOGL::GetFormat() const {
   return mSurface->GetFormat();
 }
 
 gfx::SurfaceFormat
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -348,16 +348,21 @@ GLTextureSource::BindTexture(GLenum aTex
 }
 
 void
 GLTextureSource::SetCompositor(Compositor* aCompositor)
 {
   if (!AssertGLCompositor(aCompositor)) {
     return;
   }
+
+  if (mCompositor && mCompositor != aCompositor) {
+    gfxCriticalError() << "GLTextureSource does not support changing compositors";
+  }
+
   mCompositor = static_cast<CompositorOGL*>(aCompositor);
   if (mNextSibling) {
     mNextSibling->SetCompositor(aCompositor);
   }
 }
 
 bool
 GLTextureSource::IsValid() const