Bug 912173 - Always AddRef and Release the GLContext when sharing a SurfaceStream to avoid mismatches. r=nrc
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 09 Sep 2013 14:35:20 +1200
changeset 146106 353aa004fed8365c64a5203df6fe73799c3422ca
parent 146105 acc75d3ef7c0f668cd890788d62d5fcdbf831159
child 146107 e47089ae214d177d909b0d712bad1c36b6fba7cb
push id25240
push useremorley@mozilla.com
push dateMon, 09 Sep 2013 12:09:06 +0000
treeherdermozilla-central@9846f07d5867 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnrc
bugs912173
milestone26.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 912173 - Always AddRef and Release the GLContext when sharing a SurfaceStream to avoid mismatches. r=nrc
gfx/layers/client/CanvasClient.cpp
gfx/layers/opengl/TextureHostOGL.cpp
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -201,26 +201,22 @@ DeprecatedCanvasClientSurfaceStream::Upd
     SharedSurface_Gralloc* grallocSurf = SharedSurface_Gralloc::Cast(surf);
     mDeprecatedTextureClient->SetDescriptor(grallocSurf->GetDescriptor());
 #else
     printf_stderr("isCrossProcess, but not MOZ_WIDGET_GONK! Someone needs to write some code!");
     MOZ_ASSERT(false);
 #endif
   } else {
     SurfaceStreamHandle handle = stream->GetShareHandle();
-    SurfaceDescriptor *desc = mDeprecatedTextureClient->GetDescriptor();
-    if (desc->type() != SurfaceDescriptor::TSurfaceStreamDescriptor ||
-        desc->get_SurfaceStreamDescriptor().handle() != handle) {
-      *desc = SurfaceStreamDescriptor(handle, false);
+    mDeprecatedTextureClient->SetDescriptor(SurfaceStreamDescriptor(handle, false));
 
-      // Bug 894405
-      //
-      // Ref this so the SurfaceStream doesn't disappear unexpectedly. The
-      // Compositor will need to unref it when finished.
-      aLayer->mGLContext->AddRef();
-    }
+    // Bug 894405
+    //
+    // Ref this so the SurfaceStream doesn't disappear unexpectedly. The
+    // Compositor will need to unref it when finished.
+    aLayer->mGLContext->AddRef();
   }
 
   aLayer->Painted();
 }
 
 }
 }
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -635,21 +635,18 @@ SurfaceStreamHostOGL::UpdateImpl(const S
 
   // Bug 894405
   //
   // The SurfaceStream's GLContext was refed before being passed up to us, so
   // we need to ensure it gets unrefed when we are finished.
   const SurfaceStreamDescriptor& streamDesc =
       aImage.get_SurfaceStreamDescriptor();
 
-  SurfaceStream *stream = SurfaceStream::FromHandle(streamDesc.handle());
-  if (stream == mStream) {
-    return;
-  }
-  mStream = stream;
+
+  mStream = SurfaceStream::FromHandle(streamDesc.handle());
   MOZ_ASSERT(mStream);
   mStreamGL = dont_AddRef(mStream->GLContext());
 }
 
 void
 SurfaceStreamHostOGL::Unlock()
 {
   // We don't know what this is unless we're locked