Bug 1484173 - Expose the vsync interval via the CompositorVsyncSchedulerOwner interface. r=sotaro
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 16 Oct 2018 00:33:51 +0000
changeset 441430 b032c73f6f69d6e01fd86125ec1ce183061bdb78
parent 441429 7127bf67c3b90bb70473774659a4cbad492dafe7
child 441431 23ac21b643c2f398affbdfc7a59f97af70733a9c
push id34864
push usercsabou@mozilla.com
push dateTue, 16 Oct 2018 16:24:06 +0000
treeherdermozilla-central@f2e35ed6a692 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1484173
milestone64.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 1484173 - Expose the vsync interval via the CompositorVsyncSchedulerOwner interface. r=sotaro We need this for the next patch. Differential Revision: https://phabricator.services.mozilla.com/D8765
gfx/layers/ipc/CompositorBridgeParent.h
gfx/layers/ipc/CompositorVsyncSchedulerOwner.h
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.h
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -476,17 +476,17 @@ public:
 #endif
   RefPtr<APZSampler> GetAPZSampler();
   RefPtr<APZUpdater> GetAPZUpdater();
 
   CompositorOptions GetOptions() const {
     return mOptions;
   }
 
-  TimeDuration GetVsyncInterval() const {
+  TimeDuration GetVsyncInterval() const override {
     // the variable is called "rate" but really it's an interval
     return mVsyncRate;
   }
 
   PWebRenderBridgeParent* AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
                                                       const LayoutDeviceIntSize& aSize) override;
   bool DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor) override;
   RefPtr<WebRenderBridgeParent> GetWebRenderBridgeParent() const;
--- a/gfx/layers/ipc/CompositorVsyncSchedulerOwner.h
+++ b/gfx/layers/ipc/CompositorVsyncSchedulerOwner.h
@@ -16,14 +16,15 @@ class DrawTarget;
 namespace layers {
 
 class CompositorVsyncSchedulerOwner
 {
 public:
   virtual bool IsPendingComposite() = 0;
   virtual void FinishPendingComposite() = 0;
   virtual void CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr) = 0;
+  virtual TimeDuration GetVsyncInterval() const = 0;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // mozilla_layers_CompositorVsyncSchedulerOwner_h
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1602,16 +1602,27 @@ WebRenderBridgeParent::CompositeToTarget
     // Render thread is busy, try next time.
     mCompositorScheduler->ScheduleComposition();
     mPreviousFrameTimeStamp = TimeStamp();
     return;
   }
   MaybeGenerateFrame(/* aForceGenerateFrame */ false);
 }
 
+TimeDuration
+WebRenderBridgeParent::GetVsyncInterval() const
+{
+  // This function should only get called in the root WRBP
+  MOZ_ASSERT(IsRootWebRenderBridgeParent());
+  if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
+    return cbp->GetVsyncInterval();
+  }
+  return TimeDuration();
+}
+
 void
 WebRenderBridgeParent::MaybeGenerateFrame(bool aForceGenerateFrame)
 {
   // This function should only get called in the root WRBP
   MOZ_ASSERT(IsRootWebRenderBridgeParent());
 
   TimeStamp start = TimeStamp::Now();
   mAsyncImageManager->SetCompositionTime(start);
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -138,16 +138,17 @@ public:
   bool Resume();
 
   void Destroy();
 
   // CompositorVsyncSchedulerOwner
   bool IsPendingComposite() override { return false; }
   void FinishPendingComposite() override { }
   void CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr) override;
+  TimeDuration GetVsyncInterval() const override;
 
   // CompositableParentManager
   bool IsSameProcess() const override;
   base::ProcessId GetChildProcessId() override;
   void NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId) override;
   void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
   void SendPendingAsyncMessages() override;
   void SetAboutToSendAsyncMessages() override;