Bug 1498092 - Add necessary forced frame rendering r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 15 Oct 2018 20:28:01 +0900
changeset 489553 3ad88a9f8f35bbb61b1b6063a3e39450f8b78d43
parent 489552 7035f4405e02b2dbcea1934aef9efe534e9ad549
child 489554 9c535988954c0b2afacafe47597cfc5c884d3e20
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersnical
bugs1498092
milestone64.0a1
Bug 1498092 - Add necessary forced frame rendering r=nical
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.h
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -640,17 +640,17 @@ CompositorBridgeParent::RecvFlushRenderi
 
   return RecvFlushRendering();
 }
 
 mozilla::ipc::IPCResult
 CompositorBridgeParent::RecvForcePresent()
 {
   if (mWrBridge) {
-    mWrBridge->ScheduleGenerateFrame();
+    mWrBridge->ScheduleForcedGenerateFrame();
   }
   // During the shutdown sequence mLayerManager may be null
   if (mLayerManager) {
     mLayerManager->ForcePresent();
   }
   return IPC_OK();
 }
 
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1385,27 +1385,32 @@ WebRenderBridgeParent::UpdateWebRender(C
   mAsyncImageManager->AddPipeline(mPipelineId);
 
   return GetNextWrEpoch(); // Update webrender epoch
 }
 
 mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvScheduleComposite()
 {
+  ScheduleGenerateFrame();
+  return IPC_OK();
+}
+
+void
+WebRenderBridgeParent::ScheduleForcedGenerateFrame()
+{
   if (mDestroyed) {
-    return IPC_OK();
+    return;
   }
 
-  // Force frame rendering during next frame generation.
   wr::TransactionBuilder fastTxn(/* aUseSceneBuilderThread */ false);
   fastTxn.InvalidateRenderedFrame();
   mApi->SendTransaction(fastTxn);
 
   ScheduleGenerateFrame();
-  return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvCapture()
 {
   if (!mDestroyed) {
     mApi->Capture();
   }
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -181,16 +181,24 @@ public:
    * to generate frame. If we need to generate new frame at next composite timing,
    * call this method.
    *
    * Call CompositorVsyncScheduler::ScheduleComposition() directly, if we just
    * want to trigger AsyncImagePipelines update checks.
    */
   void ScheduleGenerateFrame();
 
+  /**
+   * Schedule forced frame rendering at next composite timing.
+   *
+   * WebRender could skip frame rendering if there is no update.
+   * This function is used to force rendering even when there is not update.
+   */
+  void ScheduleForcedGenerateFrame();
+
   wr::Epoch UpdateWebRender(CompositorVsyncScheduler* aScheduler,
                             wr::WebRenderAPI* aApi,
                             AsyncImagePipelineManager* aImageMgr,
                             CompositorAnimationStorage* aAnimStorage,
                             const TextureFactoryIdentifier& aTextureFactoryIdentifier);
 
   void RemoveEpochDataPriorTo(const wr::Epoch& aRenderedEpoch);