Bug 818575 - Only sync viewport for primary layer. r=cjones
authorJeff Muizelaar <jrmuizel@mozilla.com>
Wed, 09 Jan 2013 16:49:48 +0100
changeset 118393 fe583d3e91651efff5140c3b145c1d5ebc85f080
parent 118392 6b2dd2dd39924b927df18537a5784b91d0e25611
child 118397 2946bcb127f7d53febd75a9f8904e2a93abde534
push id21032
push userncameron@mozilla.com
push dateThu, 10 Jan 2013 15:58:23 +0000
treeherdermozilla-inbound@fe583d3e9165 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs818575
milestone21.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 818575 - Only sync viewport for primary layer. r=cjones
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -888,17 +888,19 @@ CompositorParent::ApplyAsyncContentTrans
 
     appliedTransform = true;
   }
 
   return appliedTransform;
 }
 
 void
-CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRootTransform)
+CompositorParent::TransformScrollableLayer(Layer* aLayer,
+                                           const gfx3DMatrix& aRootTransform,
+                                           bool aPrimaryLayer)
 {
   ShadowLayer* shadow = aLayer->AsShadowLayer();
   ContainerLayer* container = aLayer->AsContainerLayer();
 
   const FrameMetrics& metrics = container->GetFrameMetrics();
   // We must apply the resolution scale before a pan/zoom transform, so we call
   // GetTransform here.
   const gfx3DMatrix& currentTransform = aLayer->GetTransform();
@@ -944,19 +946,21 @@ CompositorParent::TransformScrollableLay
     NS_lround(displayPortLayersPixels.x * devPixelRatioX),
     NS_lround(displayPortLayersPixels.y * devPixelRatioY),
     NS_lround(displayPortLayersPixels.width * devPixelRatioX),
     NS_lround(displayPortLayersPixels.height * devPixelRatioY));
 
   displayPortDevPixels.x += scrollOffsetDevPixels.x;
   displayPortDevPixels.y += scrollOffsetDevPixels.y;
 
-  SyncViewportInfo(displayPortDevPixels, 1/rootScaleX, mLayersUpdated,
-                   mScrollOffset, mXScale, mYScale);
-  mLayersUpdated = false;
+  if (aPrimaryLayer) {
+    SyncViewportInfo(displayPortDevPixels, 1/rootScaleX, mLayersUpdated,
+                     mScrollOffset, mXScale, mYScale);
+    mLayersUpdated = false;
+  }
 
   // Handle transformations for asynchronous panning and zooming. We determine the
   // zoom used by Gecko from the transformation set on the root layer, and we
   // determine the scroll offset used by Gecko from the frame metrics of the
   // primary scrollable layer. We compare this to the desired zoom and scroll
   // offset in the view transform we obtained from Java in order to compute the
   // transformation we need to apply.
   float tempScaleDiffX = rootScaleX * mXScale;
@@ -1033,17 +1037,17 @@ CompositorParent::TransformShadowTree(Ti
   // code also includes Fennec which is rendered async.  Fennec uses
   // its own platform-specific async rendering that is done partially
   // in Gecko and partially in Java.
   if (!ApplyAsyncContentTransformToTree(aCurrentFrame, root, &wantNextFrame)) {
     nsAutoTArray<Layer*,1> scrollableLayers;
     mLayerManager->GetScrollableLayers(scrollableLayers);
 
     for (uint32_t i = 0; i < scrollableLayers.Length(); i++) {
-      TransformScrollableLayer(scrollableLayers[i], rootTransform);
+      TransformScrollableLayer(scrollableLayers[i], rootTransform, i == 0);
     }
   }
 
   return wantNextFrame;
 }
 
 void
 CompositorParent::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom,
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -180,17 +180,18 @@ private:
   void PauseComposition();
   void ResumeComposition();
   void ResumeCompositionAndResize(int width, int height);
   void ForceComposition();
 
   // Sample transforms for layer trees.  Return true to request
   // another animation frame.
   bool TransformShadowTree(TimeStamp aCurrentFrame);
-  void TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRootTransform);
+  void TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRootTransform,
+                                bool aPrimaryLayer);
   // Return true if an AsyncPanZoomController content transform was
   // applied for |aLayer|.  *aWantNextFrame is set to true if the
   // controller wants another animation frame.
   bool ApplyAsyncContentTransformToTree(TimeStamp aCurrentFrame, Layer* aLayer,
                                         bool* aWantNextFrame);
 
   inline PlatformThreadId CompositorThreadID();