Bug 1027343 - Geometry change flag needs to be set for modified layer tree. r=mattwoodrow, a=2.0+
authorSushil Chauhan <sushilchauhan@codeaurora.org>
Mon, 07 Jul 2014 12:58:26 -0700
changeset 208048 4ce7f53e3274dc2fe36001d085367ed212d23727
parent 208047 dab59c1307c423cd1271ccbede121aea22a063d3
child 208049 6a7c58688d9452acd7aa05f5e7b7686168387b83
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, 2
bugs1027343
milestone32.0a2
Bug 1027343 - Geometry change flag needs to be set for modified layer tree. r=mattwoodrow, a=2.0+
gfx/layers/LayerTreeInvalidation.cpp
gfx/layers/composite/LayerManagerComposite.cpp
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -172,16 +172,17 @@ struct LayerPropertiesBase : public Laye
 
     if (mMaskLayer && otherMask) {
       AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback, aGeometryChanged),
                            mTransform);
     }
 
     if (mUseClipRect && otherClip) {
       if (!mClipRect.IsEqualInterior(*otherClip)) {
+        aGeometryChanged = true;
         nsIntRegion tmp; 
         tmp.Xor(mClipRect, *otherClip); 
         AddRegion(result, tmp);
       }
     }
 
     mLayer->ClearInvalidRect();
     return result;
@@ -273,16 +274,17 @@ struct ContainerLayerProperties : public
           // |child| is new
           invalidateChildsCurrentArea = true;
         }
       } else {
         // |child| is new, or was reordered to a higher index
         invalidateChildsCurrentArea = true;
       }
       if (invalidateChildsCurrentArea) {
+        aGeometryChanged = true;
         gfx3DMatrix transform;
         gfx::To3DMatrix(child->GetTransform(), transform);
         AddTransformedRegion(result, child->GetVisibleRegion(), transform);
         if (aCallback) {
           NotifySubdocumentInvalidationRecursive(child, aCallback);
         } else {
           ClearInvalidations(child);
         }
@@ -317,16 +319,17 @@ struct ColorLayerProperties : public Lay
   { }
 
   virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
                                             bool& aGeometryChanged)
   {
     ColorLayer* color = static_cast<ColorLayer*>(mLayer.get());
 
     if (mColor != color->GetColor()) {
+      aGeometryChanged = true;
       return NewTransformedBounds();
     }
 
     return nsIntRegion();
   }
 
   gfxRGBA mColor;
 };
@@ -343,25 +346,27 @@ struct ImageLayerProperties : public Lay
   }
 
   virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
                                             bool& aGeometryChanged)
   {
     ImageLayer* imageLayer = static_cast<ImageLayer*>(mLayer.get());
     
     if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) {
+      aGeometryChanged = true;
       nsIntRect result = NewTransformedBounds();
       result = result.Union(OldTransformedBounds());
       return result;
     }
 
     if (mContainer != imageLayer->GetContainer() ||
         mFilter != imageLayer->GetFilter() ||
         mScaleToSize != imageLayer->GetScaleToSize() ||
         mScaleMode != imageLayer->GetScaleMode()) {
+      aGeometryChanged = true;
       return NewTransformedBounds();
     }
 
     return nsIntRect();
   }
 
   nsRefPtr<ImageContainer> mContainer;
   GraphicsFilter mFilter;
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -242,16 +242,19 @@ LayerManagerComposite::EndTransaction(Dr
     }
 
     // The results of our drawing always go directly into a pixel buffer,
     // so we don't need to pass any global transform here.
     mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
 
     Render();
     mGeometryChanged = false;
+  } else {
+    // Modified layer tree
+    mGeometryChanged = true;
   }
 
   mCompositor->ClearTargetContext();
   mTarget = nullptr;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   Log();
   MOZ_LAYERS_LOG(("]----- EndTransaction"));
@@ -394,16 +397,18 @@ LayerManagerComposite::Render()
   if (!mTarget && composer2D && composer2D->TryRender(mRoot, mWorldMatrix, mGeometryChanged)) {
     if (mFPS) {
       double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
       if (gfxPrefs::LayersDrawFPS()) {
         printf_stderr("HWComposer: FPS is %g\n", fps);
       }
     }
     mCompositor->EndFrameForExternalComposition(mWorldMatrix);
+    // Reset the invalid region as compositing is done
+    mInvalidRegion.SetEmpty();
     return;
   }
 
   {
     PROFILER_LABEL("LayerManagerComposite", "PreRender",
       js::ProfileEntry::Category::GRAPHICS);
 
     if (!mCompositor->GetWidget()->PreRender(this)) {