1. bgirard
  2. mozilla-central

Commits

bgirard  committed 03f3dc5 Merge

merge mc->bitmc

  • Participants
  • Parent commits db1f131, 9a33d22
  • Branches default

Comments (0)

Files changed (6)

File gfx/layers/basic/BasicTiledThebesLayer.cpp

View file
       ->Paint(aContext, nsnull);
   }
 
-  BasicManager()->PaintedTiledLayerBuffer(BasicManager()->Hold(this), &mTiledBuffer);
+  // Create a heap copy owned and released by the compositor. This is needed
+  // since we're sending this over an async message and content needs to be
+  // be able to modify the tiled buffer in the next transaction.
+  // TODO: Remove me once Bug 747811 lands.
+  BasicTiledLayerBuffer *heapCopy = new BasicTiledLayerBuffer(mTiledBuffer);
+
+  BasicManager()->PaintedTiledLayerBuffer(BasicManager()->Hold(this), heapCopy);
 }
 
 } // mozilla

File gfx/layers/ipc/PLayers.ipdl

View file
   sync Update(Edit[] cset, bool isFirstPaint)
     returns (EditReply[] reply);
 
+  // We don't need to send a sync transaction if
+  // no transaction operate require a swap.
+  async UpdateNoSwap(Edit[] cset, bool isFirstPaint);
+
   async __delete__();
 };
 

File gfx/layers/ipc/ShadowLayers.cpp

View file
 class Transaction
 {
 public:
-  Transaction() : mOpen(false) {}
+  Transaction()
+    : mOpen(false)
+    , mSwapRequired(false)
+  {}
 
   void Begin() { mOpen = true; }
 
   }
   void AddPaint(const Edit& aPaint)
   {
+    AddNoSwapPaint(aPaint);
+    mSwapRequired = true;
+  }
+  void AddNoSwapPaint(const Edit& aPaint)
+  {
     NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
     mPaints.push_back(aPaint);
   }
     mDyingBuffers.Clear();
     mMutants.clear();
     mOpen = false;
+    mSwapRequired = false;
   }
 
   bool Empty() const {
   EditVector mPaints;
   BufferArray mDyingBuffers;
   ShadowableLayerSet mMutants;
+  bool mSwapRequired;
 
 private:
   bool mOpen;
 {
   if (XRE_GetProcessType() != GeckoProcessType_Default)
     NS_RUNTIMEABORT("PaintedTiledLayerBuffer must be made IPC safe (not share pointers)");
-  mTxn->AddPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
+  mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
                                          uintptr_t(aTiledLayerBuffer)));
 }
 
   MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
   PlatformSyncBeforeUpdate();
 
-  MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
-  RenderTraceScope rendertrace3("Foward Transaction", "000093");
-  if (!mShadowManager->SendUpdate(cset, mIsFirstPaint, aReplies)) {
-    MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
-    return false;
+  if (mTxn->mSwapRequired) {
+    MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
+    RenderTraceScope rendertrace3("Forward Transaction", "000093");
+    if (!mShadowManager->SendUpdate(cset, mIsFirstPaint, aReplies)) {
+      MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
+      return false;
+    }
+  } else {
+    // If we don't require a swap we can call SendUpdateNoSwap which
+    // assumes that aReplies is empty (DEBUG assertion)
+    MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction..."));
+    RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
+    if (!mShadowManager->SendUpdateNoSwap(cset, mIsFirstPaint)) {
+      MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
+      return false;
+    }
   }
 
   mIsFirstPaint = false;

File gfx/layers/ipc/ShadowLayersParent.cpp

View file
   }
 }
 
+/* virtual */
+bool
+ShadowLayersParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
+                 const bool& isFirstPaint)
+{
+  InfallibleTArray<EditReply> noReplies;
+  bool success = RecvUpdate(cset, isFirstPaint, &noReplies);
+  NS_ABORT_IF_FALSE(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits");
+  return success;
+}
+
 bool
 ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
                                const bool& isFirstPaint,

File gfx/layers/ipc/ShadowLayersParent.h

View file
                                       const bool& isFirstPaint,
                                       EditReplyArray* reply);
 
+  NS_OVERRIDE virtual bool RecvUpdateNoSwap(const EditArray& cset,
+                                            const bool& isFirstPaint);
+
   NS_OVERRIDE virtual PLayerParent* AllocPLayer();
   NS_OVERRIDE virtual bool DeallocPLayer(PLayerParent* actor);
 

File gfx/layers/opengl/TiledThebesLayerOGL.cpp

View file
 TiledThebesLayerOGL::PaintedTiledLayerBuffer(const BasicTiledLayerBuffer* mTiledBuffer)
 {
   mMainMemoryTiledBuffer = *mTiledBuffer;
+  // TODO: Remove me once Bug 747811 lands.
+  delete mTiledBuffer;
   mRegionToUpload.Or(mRegionToUpload, mMainMemoryTiledBuffer.GetLastPaintRegion());
 
 }