Bug 1345017 - Disable OMTA with webrender by default, r?kats draft
authorpeter chang <pchang@mozilla.com>
Mon, 17 Apr 2017 22:22:47 +0800
changeset 564068 ab942c044d69f36f9da5e70873771fcd60c6ed5f
parent 564067 a11c4fa227dbe0d7c483720ec29d0dda78c3c081
child 624659 f87e3527dd06a2295319ce8d921528f556edb4d4
push id54512
push userbmo:howareyou322@gmail.com
push dateTue, 18 Apr 2017 08:40:13 +0000
reviewerskats
bugs1345017
milestone55.0a1
Bug 1345017 - Disable OMTA with webrender by default, r?kats MozReview-Commit-ID: 4cA8n8XYall
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderContainerLayer.cpp
gfx/layers/wr/WebRenderContainerLayer.h
gfx/thebes/gfxPrefs.h
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -636,26 +636,29 @@ WebRenderBridgeParent::SampleAnimations(
 
 void
 WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect)
 {
   if (mPaused) {
     return;
   }
 
-  nsTArray<WrOpacityProperty> opacityArray;
-  nsTArray<WrTransformProperty> transformArray;
-  SampleAnimations(opacityArray, transformArray);
+  if (gfxPrefs::WebRenderOMTAEnabled()) {
+    nsTArray<WrOpacityProperty> opacityArray;
+    nsTArray<WrTransformProperty> transformArray;
+    SampleAnimations(opacityArray, transformArray);
 
-  if (!transformArray.IsEmpty() || !opacityArray.IsEmpty()) {
-    mApi->GenerateFrame(opacityArray, transformArray);
-    ScheduleComposition();
-  } else {
-    mApi->GenerateFrame();
+    if (!transformArray.IsEmpty() || !opacityArray.IsEmpty()) {
+      mApi->GenerateFrame(opacityArray, transformArray);
+      ScheduleComposition();
+      return;
+    }
   }
+
+  mApi->GenerateFrame();
 }
 
 void
 WebRenderBridgeParent::HoldPendingTransactionId(uint32_t aWrEpoch, uint64_t aTransactionId)
 {
   // The transaction ID might get reset to 1 if the page gets reloaded, see
   // https://bugzilla.mozilla.org/show_bug.cgi?id=1145295#c41
   // Otherwise, it should be continually increasing.
--- a/gfx/layers/wr/WebRenderContainerLayer.cpp
+++ b/gfx/layers/wr/WebRenderContainerLayer.cpp
@@ -32,17 +32,18 @@ WebRenderContainerLayer::RenderLayer(wr:
     printf_stderr("ContainerLayer %p using bounds=%s, overflow=%s, transform=%s, mix-blend-mode=%s\n",
                   this->GetLayer(),
                   Stringify(relBounds).c_str(),
                   Stringify(overflow).c_str(),
                   Stringify(transform).c_str(),
                   Stringify(mixBlendMode).c_str());
   }
 
-  if (GetAnimations().Length()) {
+  if (gfxPrefs::WebRenderOMTAEnabled() &&
+      GetAnimations().Length()) {
     MOZ_ASSERT(GetCompositorAnimationsId());
 
     CompositorAnimations anim;
     anim.animations() = GetAnimations();
     anim.id() = GetCompositorAnimationsId();
     WrBridge()->AddWebRenderParentCommand(OpAddCompositorAnimations(anim));
 
     float* maybeOpacity = HasOpacityAnimation() ? nullptr : &opacity;
--- a/gfx/layers/wr/WebRenderContainerLayer.h
+++ b/gfx/layers/wr/WebRenderContainerLayer.h
@@ -20,17 +20,19 @@ public:
     : ContainerLayer(aManager, static_cast<WebRenderLayer*>(this))
   {
     MOZ_COUNT_CTOR(WebRenderContainerLayer);
   }
 
 protected:
   virtual ~WebRenderContainerLayer()
   {
-    if (GetAnimations().Length()) {
+
+    if (gfxPrefs::WebRenderOMTAEnabled() &&
+        GetAnimations().Length()) {
       mManager->AsWebRenderLayerManager()->
         AddCompositorAnimationsIdForDiscard(GetCompositorAnimationsId());
     }
 
     ContainerLayer::RemoveAllChildren();
     MOZ_COUNT_DTOR(WebRenderContainerLayer);
   }
 
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -450,16 +450,17 @@ private:
   DECL_GFX_PREF(Once, "gfx.touch.resample.delay-threshold",    TouchResampleVsyncDelayThreshold, int32_t, 20);
   DECL_GFX_PREF(Once, "gfx.touch.resample.max-predict",        TouchResampleMaxPredict, int32_t, 8);
   DECL_GFX_PREF(Once, "gfx.touch.resample.min-delta",          TouchResampleMinDelta, int32_t, 2);
   DECL_GFX_PREF(Once, "gfx.touch.resample.old-touch-threshold",TouchResampleOldTouchThreshold, int32_t, 17);
   DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust",       TouchVsyncSampleAdjust, int32_t, 5);
 
   DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms",   CollectScrollTransforms, bool, false);
   DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count",  CompositorUnobserveCount, int32_t, 10);
+  DECL_GFX_PREF(Live, "gfx.webrender.omta.enabled",            WebRenderOMTAEnabled, bool, false);
   DECL_GFX_PREF(Live, "gfx.webrender.profiler.enable",         WebRenderProfilerEnabled, bool, false);
   // Use vsync events generated by hardware
   DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs",           WorkAroundDriverBugs, bool, true);
   DECL_GFX_PREF(Once, "gfx.screen-mirroring.enabled",          ScreenMirroringEnabled, bool, false);
 
   DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist",       IgnoreDXInterop2Blacklist, bool, false);
   DECL_GFX_PREF(Live, "gl.msaa-level",                         MSAALevel, uint32_t, 2);
 #if defined(XP_MACOSX)