Bug 1519654. Implement CONTENT_FRAME_TIME_WITH_SVG for non-WebRender contains svg. r=mattwoodrow
authorJeff Muizelaar <jrmuizel@gmail.com>
Tue, 15 Jan 2019 19:16:48 +0000
changeset 513965 2a889da359eefbaf82a5924fb07fc7a716aea076
parent 513964 4dfee3ce7d5eda9eb7ba1d0f4e91b18b11caecdb
child 513966 4ebefe9136b5a52ce58b9b46e33e4edf0b23b3b7
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1519654
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 1519654. Implement CONTENT_FRAME_TIME_WITH_SVG for non-WebRender contains svg. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D16585
gfx/layers/Layers.h
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayerTransactionParent.h
gfx/layers/ipc/LayersMessages.ipdlh
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
layout/painting/FrameLayerBuilder.cpp
layout/painting/nsDisplayList.cpp
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -238,16 +238,17 @@ class LayerManager : public FrameRecorde
   typedef mozilla::gfx::SurfaceFormat SurfaceFormat;
 
  public:
   LayerManager()
       : mDestroyed(false),
         mSnapEffectiveTransforms(true),
         mId(0),
         mInTransaction(false),
+        mContainsSVG(false),
         mPaintedPixelCount(0) {}
 
   /**
    * Release layers and resources held by this layer manager, and mark
    * it as destroyed.  Should do any cleanup necessary in preparation
    * for its widget going away.  After this call, only user data calls
    * are valid on the layer manager.
    */
@@ -737,16 +738,18 @@ class LayerManager : public FrameRecorde
     MOZ_ASSERT(mPayload.Length() < 10000);
   }
   void RegisterPayload(const InfallibleTArray<CompositionPayload>& aPayload) {
     mPayload.AppendElements(aPayload);
     MOZ_ASSERT(mPayload.Length() < 10000);
   }
   void PayloadPresented();
 
+  void SetContainsSVG(bool aContainsSVG) { mContainsSVG = aContainsSVG; }
+
  protected:
   RefPtr<Layer> mRoot;
   gfx::UserData mUserData;
   bool mDestroyed;
   bool mSnapEffectiveTransforms;
 
   nsIntRegion mRegionToClear;
 
@@ -758,16 +761,19 @@ class LayerManager : public FrameRecorde
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
 
   // Print interesting information about this into layerscope packet.
   // Internally used to implement Dump().
   virtual void DumpPacket(layerscope::LayersPacket* aPacket);
 
   uint64_t mId;
   bool mInTransaction;
+
+  // Used for tracking CONTENT_FRAME_TIME_WITH_SVG
+  bool mContainsSVG;
   // The time when painting most recently finished. This is recorded so that
   // we can time any play-pending animations from this point.
   TimeStamp mAnimationReadyTime;
   // The count of pixels that were painted in the current transaction.
   uint32_t mPaintedPixelCount;
   // The payload associated with currently pending painting work, for
   // client layer managers that typically means payload that is part of the
   // 'upcoming transaction', for HostLayerManagers this typically means
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -691,17 +691,17 @@ void ClientLayerManager::ForwardTransact
 
   // forward this transaction's changeset to our LayerManagerComposite
   bool sent = false;
   bool ok = mForwarder->EndTransaction(
       mRegionToClear, mLatestTransactionId, aScheduleComposite,
       mPaintSequenceNumber, mIsRepeatTransaction,
       mTransactionIdAllocator->GetVsyncId(),
       mTransactionIdAllocator->GetVsyncStart(), refreshStart, mTransactionStart,
-      mURL, &sent, mPayload);
+      mContainsSVG, mURL, &sent, mPayload);
 
   if (ok) {
     if (sent) {
       // Our payload has now been dispatched.
       mPayload.Clear();
       mNeedsComposite = false;
     }
   } else if (HasShadowManager()) {
--- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp
@@ -388,17 +388,18 @@ void CrossProcessCompositorBridgeParent:
       Telemetry::CONTENT_FULL_PAINT_TIME,
       static_cast<uint32_t>(
           (endTime - aInfo.transactionStart()).ToMilliseconds()));
 
   RegisterPayload(aLayerTree, aInfo.payload());
 
   aLayerTree->SetPendingTransactionId(
       aInfo.id(), aInfo.vsyncId(), aInfo.vsyncStart(), aInfo.refreshStart(),
-      aInfo.transactionStart(), endTime, aInfo.url(), aInfo.fwdTime());
+      aInfo.transactionStart(), endTime, aInfo.containsSVG(), aInfo.url(),
+      aInfo.fwdTime());
 }
 
 void CrossProcessCompositorBridgeParent::DidCompositeLocked(
     LayersId aId, const VsyncId& aVsyncId, TimeStamp& aCompositeStart,
     TimeStamp& aCompositeEnd) {
   sIndirectLayerTreesLock->AssertCurrentThreadOwns();
   if (LayerTransactionParent* layerTree = sIndirectLayerTrees[aId].mLayerTree) {
     TransactionId transactionId =
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -884,17 +884,17 @@ bool LayerTransactionParent::IsSameProce
   return OtherPid() == base::GetCurrentProcId();
 }
 
 TransactionId LayerTransactionParent::FlushTransactionId(
     const VsyncId& aId, TimeStamp& aCompositeEnd) {
   if (mId.IsValid() && mPendingTransaction.IsValid() && !mVsyncRate.IsZero()) {
     RecordContentFrameTime(mTxnVsyncId, mVsyncStartTime, mTxnStartTime, aId,
                            aCompositeEnd, mTxnEndTime - mTxnStartTime,
-                           mVsyncRate, false, false);
+                           mVsyncRate, mContainsSVG, false);
   }
 
 #if defined(ENABLE_FRAME_LATENCY_LOG)
   if (mPendingTransaction.IsValid()) {
     if (mRefreshStartTime) {
       int32_t latencyMs =
           lround((aCompositeEnd - mRefreshStartTime).ToMilliseconds());
       printf_stderr(
--- a/gfx/layers/ipc/LayerTransactionParent.h
+++ b/gfx/layers/ipc/LayerTransactionParent.h
@@ -71,25 +71,26 @@ class LayerTransactionParent final : pub
 
   bool IsSameProcess() const override;
 
   const TransactionId& GetPendingTransactionId() { return mPendingTransaction; }
   void SetPendingTransactionId(TransactionId aId, const VsyncId& aVsyncId,
                                const TimeStamp& aVsyncStartTime,
                                const TimeStamp& aRefreshStartTime,
                                const TimeStamp& aTxnStartTime,
-                               const TimeStamp& aTxnEndTime,
+                               const TimeStamp& aTxnEndTime, bool aContainsSVG,
                                const nsCString& aURL,
                                const TimeStamp& aFwdTime) {
     mPendingTransaction = aId;
     mTxnVsyncId = aVsyncId;
     mVsyncStartTime = aVsyncStartTime;
     mRefreshStartTime = aRefreshStartTime;
     mTxnStartTime = aTxnStartTime;
     mTxnEndTime = aTxnEndTime;
+    mContainsSVG = aContainsSVG;
     mTxnURL = aURL;
     mFwdTime = aFwdTime;
   }
   TransactionId FlushTransactionId(const VsyncId& aId,
                                    TimeStamp& aCompositeEnd);
 
   // CompositableParentManager
   void SendAsyncMessage(
@@ -210,16 +211,17 @@ class LayerTransactionParent final : pub
   TransactionId mPendingTransaction;
   VsyncId mTxnVsyncId;
   TimeStamp mVsyncStartTime;
   TimeStamp mRefreshStartTime;
   TimeStamp mTxnStartTime;
   TimeStamp mTxnEndTime;
   TimeStamp mFwdTime;
   nsCString mTxnURL;
+  bool mContainsSVG;
 
   // When the widget/frame/browser stuff in this process begins its
   // destruction process, we need to Disconnect() all the currently
   // live shadow layers, because some of them might be orphaned from
   // the layer tree.  This happens in Destroy() above.  After we
   // Destroy() ourself, there's a window in which that information
   // hasn't yet propagated back to the child side and it might still
   // send us layer transactions.  We want to ignore those transactions
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -554,16 +554,17 @@ struct TransactionInfo
   FocusTarget focusTarget;
   bool scheduleComposite;
   uint32_t paintSequenceNumber;
   bool isRepeatTransaction;
   VsyncId vsyncId;
   TimeStamp vsyncStart;
   TimeStamp refreshStart;
   TimeStamp transactionStart;
+  bool containsSVG;
   nsCString url;
   TimeStamp fwdTime;
   /* This provides some timing information on any content that is meant to be
    * presented during this transaction.
    */
   CompositionPayload[] payload;
 };
 
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -526,18 +526,19 @@ void ShadowLayerForwarder::SendPaintTime
 }
 
 bool ShadowLayerForwarder::EndTransaction(
     const nsIntRegion& aRegionToClear, TransactionId aId,
     bool aScheduleComposite, uint32_t aPaintSequenceNumber,
     bool aIsRepeatTransaction, const mozilla::VsyncId& aVsyncId,
     const mozilla::TimeStamp& aVsyncStart,
     const mozilla::TimeStamp& aRefreshStart,
-    const mozilla::TimeStamp& aTransactionStart, const nsCString& aURL,
-    bool* aSent, const InfallibleTArray<CompositionPayload>& aPayload) {
+    const mozilla::TimeStamp& aTransactionStart, bool aContainsSVG,
+    const nsCString& aURL, bool* aSent,
+    const InfallibleTArray<CompositionPayload>& aPayload) {
   *aSent = false;
 
   TransactionInfo info;
 
   MOZ_ASSERT(IPCOpen(), "no manager to forward to");
   if (!IPCOpen()) {
     return false;
   }
@@ -672,16 +673,17 @@ bool ShadowLayerForwarder::EndTransactio
   info.scheduleComposite() = aScheduleComposite;
   info.paintSequenceNumber() = aPaintSequenceNumber;
   info.isRepeatTransaction() = aIsRepeatTransaction;
   info.vsyncId() = aVsyncId;
   info.vsyncStart() = aVsyncStart;
   info.refreshStart() = aRefreshStart;
   info.transactionStart() = aTransactionStart;
   info.url() = aURL;
+  info.containsSVG() = aContainsSVG;
 #if defined(ENABLE_FRAME_LATENCY_LOG)
   info.fwdTime() = TimeStamp::Now();
 #endif
   info.payload() = aPayload;
 
   TargetConfig targetConfig(mTxn->mTargetBounds, mTxn->mTargetRotation,
                             mTxn->mTargetOrientation, aRegionToClear);
   info.targetConfig() = targetConfig;
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -251,17 +251,17 @@ class ShadowLayerForwarder final : publi
    */
   bool EndTransaction(const nsIntRegion& aRegionToClear, TransactionId aId,
                       bool aScheduleComposite, uint32_t aPaintSequenceNumber,
                       bool aIsRepeatTransaction,
                       const mozilla::VsyncId& aVsyncId,
                       const mozilla::TimeStamp& aVsyncTime,
                       const mozilla::TimeStamp& aRefreshStart,
                       const mozilla::TimeStamp& aTransactionStart,
-                      const nsCString& aURL, bool* aSent,
+                      bool aContainsSVG, const nsCString& aURL, bool* aSent,
                       const InfallibleTArray<CompositionPayload>& aPayload =
                           InfallibleTArray<CompositionPayload>());
 
   /**
    * Set an actor through which layer updates will be pushed.
    */
   void SetShadowManager(PLayerTransactionChild* aShadowManager);
 
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -1656,16 +1656,24 @@ class FLBDisplayItemIterator : protected
       return false;
     }
 
     if (!mNext->ShouldFlattenAway(mBuilder)) {
       return false;
     }
 
     const DisplayItemType type = mNext->GetType();
+
+    if (type == DisplayItemType::TYPE_SVG_WRAPPER) {
+      // We mark SetContainsSVG for the CONTENT_FRAME_TIME_WITH_SVG metric
+      if (RefPtr<LayerManager> lm = mBuilder->GetWidgetLayerManager()) {
+        lm->SetContainsSVG(true);
+      }
+    }
+
     if (type != DisplayItemType::TYPE_OPACITY &&
         type != DisplayItemType::TYPE_TRANSFORM) {
       return true;
     }
 
     if (type == DisplayItemType::TYPE_OPACITY) {
       nsDisplayOpacity* opacity = static_cast<nsDisplayOpacity*>(mNext);
 
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2555,16 +2555,18 @@ already_AddRefed<LayerManager> nsDisplay
 
   RefPtr<LayerManager> layerManager;
   bool widgetTransaction = false;
   bool doBeginTransaction = true;
   nsView* view = nullptr;
   if (aFlags & PAINT_USE_WIDGET_LAYERS) {
     layerManager = aBuilder->GetWidgetLayerManager(&view);
     if (layerManager) {
+      layerManager->SetContainsSVG(false);
+
       doBeginTransaction = !(aFlags & PAINT_EXISTING_TRANSACTION);
       widgetTransaction = true;
     }
   }
   if (!layerManager) {
     if (!aCtx) {
       NS_WARNING("Nowhere to paint into");
       return nullptr;