Bug 1170189 - Fix tiling crash on Linux. r=jrmuizel
authorNicolas Silva <nsilva@mozilla.com>
Wed, 10 Jun 2015 17:56:23 +0200
changeset 248073 9e8d13cb9fdbf241c1a3e2ca44640eb0a848dd64
parent 248072 242d698982c3c36588375ef1024dd13a2dad91d8
child 248074 615a3fe84722dc0071161247f0615d66bf0eb14c
push id28888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:29:45 +0000
treeherdermozilla-central@04c057942da4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1170189
milestone41.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 1170189 - Fix tiling crash on Linux. r=jrmuizel
gfx/layers/composite/TiledContentHost.cpp
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -107,41 +107,53 @@ TiledContentHost::UseTiledLayerBuffer(IS
 
 void
 UseTileTexture(CompositableTextureHostRef& aTexture,
                CompositableTextureSourceRef& aTextureSource,
                const IntRect& aUpdateRect,
                TextureHost* aNewTexture,
                Compositor* aCompositor)
 {
-  if (aTexture && aTexture->GetFormat() != aNewTexture->GetFormat()) {
-    // Only reuse textures if their format match the new texture's.
-    aTextureSource = nullptr;
-    aTexture = nullptr;
+  MOZ_ASSERT(aNewTexture);
+  if (!aNewTexture) {
+    return;
   }
+
+  if (aTexture) {
+    aTexture->SetCompositor(aCompositor);
+    aNewTexture->SetCompositor(aCompositor);
+
+    if (aTexture->GetFormat() != aNewTexture->GetFormat()) {
+      // Only reuse textures if their format match the new texture's.
+      aTextureSource = nullptr;
+      aTexture = nullptr;
+    }
+  }
+
   aTexture = aNewTexture;
-  if (aTexture) {
-    if (aCompositor) {
-      aTexture->SetCompositor(aCompositor);
-    }
+
 
-    if (!aUpdateRect.IsEmpty()) {
+  if (aCompositor) {
+    aTexture->SetCompositor(aCompositor);
+  }
+
+  if (!aUpdateRect.IsEmpty()) {
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
-      aTexture->Updated(nullptr);
+    aTexture->Updated(nullptr);
 #else
-      // We possibly upload the entire texture contents here. This is a purposeful
-      // decision, as sub-image upload can often be slow and/or unreliable, but
-      // we may want to reevaluate this in the future.
-      // For !HasInternalBuffer() textures, this is likely a no-op.
-      nsIntRegion region = aUpdateRect;
-      aTexture->Updated(&region);
+    // We possibly upload the entire texture contents here. This is a purposeful
+    // decision, as sub-image upload can often be slow and/or unreliable, but
+    // we may want to reevaluate this in the future.
+    // For !HasInternalBuffer() textures, this is likely a no-op.
+    nsIntRegion region = aUpdateRect;
+    aTexture->Updated(&region);
 #endif
-    }
-    aTexture->PrepareTextureSource(aTextureSource);
   }
+
+  aTexture->PrepareTextureSource(aTextureSource);
 }
 
 bool
 GetCopyOnWriteLock(const TileLock& ipcLock, TileHost& aTile, ISurfaceAllocator* aAllocator) {
   MOZ_ASSERT(aAllocator);
 
   nsRefPtr<gfxSharedReadLock> sharedLock;
   if (ipcLock.type() == TileLock::TShmemSection) {