Bug 1453501 - Allow the compositor to be created in a paused state r=kats
☠☠ backed out by 90a4eaef784d ☠ ☠
authorJames Willcox <snorp@snorp.net>
Wed, 25 Apr 2018 16:35:31 -0500
changeset 418120 8b53a7b34121f03decccc66c29995b0e59f85d06
parent 418119 c075885867014f8e48374746c18f09a5d3aacf21
child 418121 31ad29175009f394b0b9d162a8155d27e883ddf1
push id103228
push userjwillcox@mozilla.com
push dateMon, 14 May 2018 13:16:12 +0000
treeherdermozilla-inbound@77845b8d2930 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1453501
milestone62.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 1453501 - Allow the compositor to be created in a paused state r=kats MozReview-Commit-ID: B0wc8MYaBJg
gfx/ipc/CompositorOptions.h
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/LayersMessageUtils.h
widget/nsBaseWidget.cpp
--- a/gfx/ipc/CompositorOptions.h
+++ b/gfx/ipc/CompositorOptions.h
@@ -28,47 +28,56 @@ namespace layers {
 class CompositorOptions
 {
 public:
   // This constructor needed for IPDL purposes, don't use it anywhere else.
   CompositorOptions()
     : mUseAPZ(false)
     , mUseWebRender(false)
     , mUseAdvancedLayers(false)
+    , mInitiallyPaused(false)
   {
   }
 
   explicit CompositorOptions(bool aUseAPZ,
                              bool aUseWebRender)
     : mUseAPZ(aUseAPZ)
     , mUseWebRender(aUseWebRender)
     , mUseAdvancedLayers(false)
+    , mInitiallyPaused(false)
   {
   }
 
   bool UseAPZ() const { return mUseAPZ; }
   bool UseWebRender() const { return mUseWebRender; }
   bool UseAdvancedLayers() const { return mUseAdvancedLayers; }
+  bool InitiallyPaused() const { return mInitiallyPaused; }
 
   void SetUseAdvancedLayers(bool aUseAdvancedLayers) {
     mUseAdvancedLayers = aUseAdvancedLayers;
   }
 
+  void SetInitiallyPaused(bool aPauseAtStartup) {
+    mInitiallyPaused = aPauseAtStartup;
+  }
+
   bool operator==(const CompositorOptions& aOther) const {
     return mUseAPZ == aOther.mUseAPZ &&
            mUseWebRender == aOther.mUseWebRender &&
            mUseAdvancedLayers == aOther.mUseAdvancedLayers;
   }
 
   friend struct IPC::ParamTraits<CompositorOptions>;
 
 private:
   bool mUseAPZ;
   bool mUseWebRender;
   bool mUseAdvancedLayers;
+  bool mInitiallyPaused;
 
   // Make sure to add new fields to the ParamTraits implementation
+  // in LayersMessageUtils.h
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // _include_mozilla_gfx_ipc_CompositorOptions_h_
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -406,16 +406,18 @@ CompositorBridgeParent::Initialize()
     MOZ_ASSERT(!mApzcTreeManager);
     MOZ_ASSERT(!mApzSampler);
     MOZ_ASSERT(!mApzUpdater);
     mApzcTreeManager = new APZCTreeManager(mRootLayerTreeID);
     mApzSampler = new APZSampler(mApzcTreeManager, mOptions.UseWebRender());
     mApzUpdater = new APZUpdater(mApzcTreeManager, mOptions.UseWebRender());
   }
 
+  mPaused = mOptions.InitiallyPaused();
+
   mCompositorBridgeID = 0;
   // FIXME: This holds on the the fact that right now the only thing that
   // can destroy this instance is initialized on the compositor thread after
   // this task has been processed.
   MOZ_ASSERT(CompositorLoop());
   CompositorLoop()->PostTask(NewRunnableFunction("AddCompositorRunnable",
                                                  &AddCompositor,
                                                  this, &mCompositorBridgeID));
--- a/gfx/layers/ipc/LayersMessageUtils.h
+++ b/gfx/layers/ipc/LayersMessageUtils.h
@@ -630,22 +630,24 @@ template <>
 struct ParamTraits<mozilla::layers::CompositorOptions>
 {
   typedef mozilla::layers::CompositorOptions paramType;
 
   static void Write(Message* aMsg, const paramType& aParam) {
     WriteParam(aMsg, aParam.mUseAPZ);
     WriteParam(aMsg, aParam.mUseWebRender);
     WriteParam(aMsg, aParam.mUseAdvancedLayers);
+    WriteParam(aMsg, aParam.mInitiallyPaused);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
     return ReadParam(aMsg, aIter, &aResult->mUseAPZ)
         && ReadParam(aMsg, aIter, &aResult->mUseWebRender)
-        && ReadParam(aMsg, aIter, &aResult->mUseAdvancedLayers);
+        && ReadParam(aMsg, aIter, &aResult->mUseAdvancedLayers)
+        && ReadParam(aMsg, aIter, &aResult->mInitiallyPaused);
   }
 };
 
 template <>
 struct ParamTraits<mozilla::layers::SimpleLayerAttributes>
   : public PlainOldDataSerializer<mozilla::layers::SimpleLayerAttributes>
 { };
 
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1318,16 +1318,22 @@ nsBaseWidget::CreateCompositorSession(in
     bool enableWR = gfx::gfxVars::UseWebRender() && WidgetTypeSupportsAcceleration()
       && AllowWebRenderForThisWindow();
     bool enableAPZ = UseAPZ();
     CompositorOptions options(enableAPZ, enableWR);
 
     bool enableAL = gfx::gfxConfig::IsEnabled(gfx::Feature::ADVANCED_LAYERS);
     options.SetUseAdvancedLayers(enableAL);
 
+#ifdef MOZ_WIDGET_ANDROID
+    if (!GetNativeData(NS_JAVA_SURFACE)) {
+      options.SetInitiallyPaused(true);
+    }
+#endif
+
     RefPtr<LayerManager> lm;
     if (options.UseWebRender()) {
       lm = new WebRenderLayerManager(this);
     } else {
       lm = new ClientLayerManager(this);
     }
 
     bool retry = false;