Bug 1523214 - Don't invalidate for transform/opacity changes in WebRenderCommandBuilder since DLBI handles this already. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 28 Jan 2019 01:48:19 +0000
changeset 455577 d2516083582b94d5e248e2865229bbcbcaf3d06f
parent 455576 8774e60ceebbfd10869498171e0e5f02a8ad7d07
child 455578 8d47e7f253d88207678c3b4255632f02dca8cf7e
child 455643 a83e8d1675ff3936e3709dced76c60eca5e94023
push id35448
push userbtara@mozilla.com
push dateMon, 28 Jan 2019 04:51:03 +0000
treeherdermozilla-central@d2516083582b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1523214
milestone66.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 1523214 - Don't invalidate for transform/opacity changes in WebRenderCommandBuilder since DLBI handles this already. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D17791
gfx/layers/wr/WebRenderCommandBuilder.cpp
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -91,27 +91,23 @@ struct BlobItemData {
 
   // XXX: only used for debugging
   bool mInvalid;
   bool mInvalidRegion;
   bool mEmpty;
 
   // properties that are used to emulate layer tree invalidation
   Matrix mMatrix;  // updated to track the current transform to device space
-  Matrix4x4Flagged mTransform;  // only used with nsDisplayTransform items to
-                                // detect transform changes
-  float mOpacity;  // only used with nsDisplayOpacity items to detect change to
-                   // opacity
   RefPtr<BasicLayerManager> mLayerManager;
 
   IntRect mImageRect;
   LayerIntPoint mGroupOffset;
 
   BlobItemData(DIGroup* aGroup, nsDisplayItem* aItem)
-      : mUsed(false), mGroup(aGroup), mOpacity(0.0) {
+      : mUsed(false), mGroup(aGroup) {
     mInvalid = false;
     mInvalidRegion = false;
     mEmpty = false;
     mDisplayItemKey = aItem->GetPerFrameKey();
     AddFrame(aItem->Frame());
   }
 
  private:
@@ -249,56 +245,32 @@ static bool IsContainerLayerItem(nsDispl
       return true;
     }
     default: { return false; }
   }
 }
 
 #include <sstream>
 
-bool UpdateContainerLayerPropertiesAndDetectChange(
+bool DetectContainerLayerPropertiesBoundsChange(
     nsDisplayItem* aItem, BlobItemData* aData,
     nsDisplayItemGeometry& aGeometry) {
-  bool changed = false;
   switch (aItem->GetType()) {
-    case DisplayItemType::TYPE_TRANSFORM: {
-      auto transformItem = static_cast<nsDisplayTransform*>(aItem);
-      Matrix4x4Flagged trans = transformItem->GetTransform();
-      changed = aData->mTransform != trans;
-
-      if (changed) {
-        std::stringstream ss;
-        // ss << trans << ' ' << aData->mTransform;
-        // GP("UpdateContainerLayerPropertiesAndDetectChange Matrix %d %s\n",
-        //   changed, ss.str().c_str());
-      }
-
-      aData->mTransform = trans;
-      break;
-    }
-    case DisplayItemType::TYPE_OPACITY: {
-      auto opacityItem = static_cast<nsDisplayOpacity*>(aItem);
-      float opacity = opacityItem->GetOpacity();
-      changed = aData->mOpacity != opacity;
-      aData->mOpacity = opacity;
-      GP("UpdateContainerLayerPropertiesAndDetectChange Opacity\n");
-      break;
-    }
     case DisplayItemType::TYPE_MASK:
     case DisplayItemType::TYPE_FILTER: {
       // These two items go through BasicLayerManager composition which clips to
       // the BuildingRect
       aGeometry.mBounds = aGeometry.mBounds.Intersect(aItem->GetBuildingRect());
       break;
     }
     default:
       break;
   }
 
-  return changed || !aGeometry.mBounds.IsEqualEdges(aData->mGeometry->mBounds);
+  return !aGeometry.mBounds.IsEqualEdges(aData->mGeometry->mBounds);
 }
 
 struct DIGroup {
   // XXX: Storing owning pointers to the BlobItemData in a hash table is not
   // a good choice. There are two better options:
   //
   // 1. We should just be using a linked list for this stuff.
   //    That we can iterate over only the used items.
@@ -542,28 +514,28 @@ struct DIGroup {
 
           GP("TransformChange: %s %d %d %d %d\n", aItem->Name(), aData->mRect.x,
              aData->mRect.y, aData->mRect.XMost(), aData->mRect.YMost());
         } else if (IsContainerLayerItem(aItem)) {
           UniquePtr<nsDisplayItemGeometry> geometry(
               aItem->AllocateGeometry(aBuilder));
           // we need to catch bounds changes of containers so that we continue
           // to have the correct bounds rects in the recording
-          if (UpdateContainerLayerPropertiesAndDetectChange(aItem, aData,
+          if (DetectContainerLayerPropertiesBoundsChange(aItem, aData,
                                                             *geometry)) {
             nsRect clippedBounds = clip.ApplyNonRoundedIntersection(
                 geometry->ComputeInvalidationRegion());
             aData->mGeometry = std::move(geometry);
             IntRect transformedRect =
                 ToDeviceSpace(clippedBounds, aMatrix, appUnitsPerDevPixel,
                               mLayerBounds.TopLeft());
             InvalidateRect(aData->mRect.Intersect(mImageBounds));
             aData->mRect = transformedRect.Intersect(mClippedImageBounds);
             InvalidateRect(aData->mRect);
-            GP("UpdateContainerLayerPropertiesAndDetectChange change\n");
+            GP("DetectContainerLayerPropertiesBoundsChange change\n");
           } else if (!aData->mImageRect.IsEqualEdges(mClippedImageBounds)) {
             // Make sure we update mRect for mClippedImageBounds changes
             nsRect clippedBounds = clip.ApplyNonRoundedIntersection(
                 geometry->ComputeInvalidationRegion());
             IntRect transformedRect =
                 ToDeviceSpace(clippedBounds, aMatrix, appUnitsPerDevPixel,
                               mLayerBounds.TopLeft());
             // The invalid rect should contain the old rect and the new rect