Backed out changeset 4d2c317e3936 (bug 1408781)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 20 Oct 2017 20:52:50 +0200
changeset 387354 6975e103f7535ac9eb830b4a6a10e5b0a5d3cc20
parent 387353 d42c58ea0e8363551863959eb960b671bbd4f1fc
child 387355 7f0e5af74534edde720068b1a802175810f1ab47
push id96428
push userarchaeopteryx@coole-files.de
push dateFri, 20 Oct 2017 18:53:59 +0000
treeherdermozilla-inbound@7f0e5af74534 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1408781
milestone58.0a1
backs out4d2c317e39366a570ac256c5cce9f1c9d2ddafdd
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
Backed out changeset 4d2c317e3936 (bug 1408781)
gfx/layers/mlgpu/LayerManagerMLGPU.cpp
--- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
+++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
@@ -331,30 +331,16 @@ LayerManagerMLGPU::Composite()
   mSwapChain->Present();
 
   // We call this here to mimic the behavior in LayerManagerComposite, as to
   // not change what Talos measures. That is, we do not record an empty frame
   // as a frame, since we short-circuit at the top of this function.
   RecordFrame();
 
   mDevice->EndFrame();
-
-  // Free the old cloned property tree, then clone a new one. Note that we do
-  // this after compositing, since layer preparation actually mutates the layer
-  // tree (for example, ImageHost::mLastFrameID). We want the property tree to
-  // pick up these changes. Similarly, we are careful to not mutate the tree
-  // in any way that we *don't* want LayerProperties to catch, lest we cause
-  // extra invalidation.
-  //
-  // Note that the old Compositor performs occlusion culling directly on the
-  // shadow visible region, and does this *before* cloning layer tree
-  // properties. Advanced Layers keeps the occlusion region separate and
-  // performs invalidation against the clean layer tree.
-  mClonedLayerTreeProperties = nullptr;
-  mClonedLayerTreeProperties = LayerProperties::CloneFrom(mRoot);
 }
 
 void
 LayerManagerMLGPU::RenderLayers()
 {
   AUTO_PROFILER_LABEL("LayerManagerMLGPU::RenderLayers", GRAPHICS);
 
   // Traverse the layer tree and assign each layer to a render target.
@@ -487,16 +473,30 @@ LayerManagerMLGPU::ComputeInvalidRegion(
   // it for the next frame instead.
   if (mTarget) {
     mInvalidRegion = mTargetRect;
     mNextFrameInvalidRegion.OrWith(changed);
   } else {
     mInvalidRegion = Move(mNextFrameInvalidRegion);
     mInvalidRegion.OrWith(changed);
   }
+
+  // Free the old cloned property tree, then clone a new one. Note that we do
+  // this before compositing since our CPU-based occlusion culling will update
+  // the visible region to contain non-occluded draw rects. If a layer will not
+  // be drawn, it will have no visible region. LTI might save this, and if the
+  // layer is removed next frame, LTI will invalidate the wrong area.
+  //
+  // Instead, we always invalidate based on the full shadow tree.
+  //
+  // Note that the old compositor performs CPU-based occlusion culling *before*
+  // invalidation. This maintains consistency, but we have more accurate draw
+  // regions.
+  mClonedLayerTreeProperties = nullptr;
+  mClonedLayerTreeProperties = LayerProperties::CloneFrom(mRoot);
 }
 
 void
 LayerManagerMLGPU::AddInvalidRegion(const nsIntRegion& aRegion)
 {
   mNextFrameInvalidRegion.OrWith(aRegion);
 }