Bug 796722 - Send screen update when there is only rotation changed event happened. r=roc
authorpchang@mozilla.com
Tue, 06 Nov 2012 17:11:43 +0800
changeset 124598 78a9c289f6f1f91fdc18121ac6feaa7b5fd09dc2
parent 124597 f9fe02eca03c606b171449fb6559bb3e2356e7ba
child 124599 8b1d3367ca5d8ea0059a80b52d4da6c38adc3e17
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs796722
milestone20.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 796722 - Send screen update when there is only rotation changed event happened. r=roc
gfx/layers/ipc/ShadowLayers.cpp
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -34,22 +34,26 @@ typedef std::vector<Edit> EditVector;
 typedef std::set<ShadowableLayer*> ShadowableLayerSet;
 
 class Transaction
 {
 public:
   Transaction()
     : mSwapRequired(false)
     , mOpen(false)
+    , mRotationChanged(false)
   {}
 
   void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation)
   {
     mOpen = true;
     mTargetBounds = aTargetBounds;
+    if (aRotation != mTargetRotation) {
+        mRotationChanged = true;
+    }
     mTargetRotation = aRotation;
   }
 
   void AddEdit(const Edit& aEdit)
   {
     NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
     mCset.push_back(aEdit);
   }
@@ -81,33 +85,38 @@ public:
   void End()
   {
     mCset.clear();
     mPaints.clear();
     mDyingBuffers.Clear();
     mMutants.clear();
     mOpen = false;
     mSwapRequired = false;
+    mRotationChanged = false;
   }
 
   bool Empty() const {
     return mCset.empty() && mPaints.empty() && mMutants.empty();
   }
+  bool RotationChanged() const {
+    return mRotationChanged;
+  }
   bool Finished() const { return !mOpen && Empty(); }
 
   EditVector mCset;
   EditVector mPaints;
   BufferArray mDyingBuffers;
   ShadowableLayerSet mMutants;
   nsIntRect mTargetBounds;
   ScreenRotation mTargetRotation;
   bool mSwapRequired;
 
 private:
   bool mOpen;
+  bool mRotationChanged;
 
   // disabled
   Transaction(const Transaction&);
   Transaction& operator=(const Transaction&);
 };
 struct AutoTxnEnd {
   AutoTxnEnd(Transaction* aTxn) : mTxn(aTxn) {}
   ~AutoTxnEnd() { mTxn->End(); }
@@ -280,18 +289,18 @@ ShadowLayerForwarder::EndTransaction(Inf
 {
   SAMPLE_LABEL("ShadowLayerForwarder", "EndTranscation");
   RenderTraceScope rendertrace("Foward Transaction", "000091");
   NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
   NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?");
 
   AutoTxnEnd _(mTxn);
 
-  if (mTxn->Empty()) {
-    MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?), skipping Update()"));
+  if (mTxn->Empty() && !mTxn->RotationChanged()) {
+    MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
     return true;
   }
 
   MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
 
   for (uint32_t i = 0; i < mTxn->mDyingBuffers.Length(); ++i) {
     DestroySharedSurface(&mTxn->mDyingBuffers[i]);
   }