author | Matt Woodrow <mwoodrow@mozilla.com> |
Thu, 16 Feb 2017 11:31:18 +1300 | |
changeset 343212 | c0e8497f31c90ee402404315e08db52242fb8b0b |
parent 343211 | 6e42452c2616386464dbdc1cdd08deafe31387e4 |
child 343213 | 9d9a3692b012221e74ee6fbc70af95dff83e1a7d |
push id | 31372 |
push user | cbook@mozilla.com |
push date | Thu, 16 Feb 2017 12:16:10 +0000 |
treeherder | mozilla-central@2737f66ad6ac [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | nical |
bugs | 1328797 |
milestone | 54.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
|
--- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -57,18 +57,17 @@ using namespace mozilla::gfx; using namespace mozilla::media; typedef std::vector<CompositableOperation> OpVector; typedef nsTArray<OpDestroy> OpDestroyVector; struct CompositableTransaction { CompositableTransaction() - : mSwapRequired(false) - , mFinished(true) + : mFinished(true) {} ~CompositableTransaction() { End(); } bool Finished() const { return mFinished; @@ -76,42 +75,31 @@ struct CompositableTransaction void Begin() { MOZ_ASSERT(mFinished); mFinished = false; } void End() { mFinished = true; - mSwapRequired = false; mOperations.clear(); mDestroyedActors.Clear(); } bool IsEmpty() const { return mOperations.empty() && mDestroyedActors.IsEmpty(); } void AddNoSwapEdit(const CompositableOperation& op) { MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mOperations.push_back(op); } - void AddEdit(const CompositableOperation& op) - { - AddNoSwapEdit(op); - MarkSyncTransaction(); - } - void MarkSyncTransaction() - { - mSwapRequired = true; - } OpVector mOperations; OpDestroyVector mDestroyedActors; - bool mSwapRequired; bool mFinished; }; struct AutoEndTransaction { explicit AutoEndTransaction(CompositableTransaction* aTxn) : mTxn(aTxn) {} ~AutoEndTransaction() { mTxn->End(); } CompositableTransaction* mTxn; }; @@ -550,28 +538,19 @@ ImageBridgeChild::EndTransaction() if (!mTxn->mOperations.empty()) { cset.AppendElements(&mTxn->mOperations.front(), mTxn->mOperations.size()); } if (!IsSameProcess()) { ShadowLayerForwarder::PlatformSyncBeforeUpdate(); } - if (mTxn->mSwapRequired) { - if (!SendUpdate(cset, mTxn->mDestroyedActors, GetFwdTransactionId())) { - NS_WARNING("could not send async texture transaction"); - return; - } - } else { - // If we don't require a swap we can call SendUpdateNoSwap which - // assumes that aReplies is empty (DEBUG assertion) - if (!SendUpdateNoSwap(cset, mTxn->mDestroyedActors, GetFwdTransactionId())) { - NS_WARNING("could not send async texture transaction (no swap)"); - return; - } + if (!SendUpdate(cset, mTxn->mDestroyedActors, GetFwdTransactionId())) { + NS_WARNING("could not send async texture transaction"); + return; } } void ImageBridgeChild::SendImageBridgeThreadId() { }
--- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -172,27 +172,16 @@ ImageBridgeParent::RecvUpdate(EditArray& // buffers have completed, so that neither process stomps on the // other's buffer contents. LayerManagerComposite::PlatformSyncBeforeReplyUpdate(); } return IPC_OK(); } -mozilla::ipc::IPCResult -ImageBridgeParent::RecvUpdateNoSwap(EditArray&& aEdits, OpDestroyArray&& aToDestroy, - const uint64_t& aFwdTransactionId) -{ - bool success = RecvUpdate(Move(aEdits), Move(aToDestroy), aFwdTransactionId); - if (!success) { - return IPC_FAIL_NO_REASON(this); - } - return IPC_OK(); -} - /* static */ bool ImageBridgeParent::CreateForContent(Endpoint<PImageBridgeParent>&& aEndpoint) { MessageLoop* loop = CompositorThreadHolder::Loop(); RefPtr<ImageBridgeParent> bridge = new ImageBridgeParent(loop, aEndpoint.OtherPid()); loop->PostTask(NewRunnableMethod<Endpoint<PImageBridgeParent>&&>( bridge, &ImageBridgeParent::Bind, Move(aEndpoint)));
--- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -67,18 +67,16 @@ public: { return OtherPid(); } // PImageBridge virtual mozilla::ipc::IPCResult RecvImageBridgeThreadId(const PlatformThreadId& aThreadId) override; virtual mozilla::ipc::IPCResult RecvUpdate(EditArray&& aEdits, OpDestroyArray&& aToDestroy, const uint64_t& aFwdTransactionId) override; - virtual mozilla::ipc::IPCResult RecvUpdateNoSwap(EditArray&& aEdits, OpDestroyArray&& aToDestroy, - const uint64_t& aFwdTransactionId) override; virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData, const LayersBackend& aLayersBackend, const TextureFlags& aFlags, const uint64_t& aSerial) override; virtual bool DeallocPTextureParent(PTextureParent* actor) override; virtual mozilla::ipc::IPCResult RecvNewCompositable(const CompositableHandle& aHandle,
--- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -89,22 +89,16 @@ LayerTransactionParent::RecvShutdown() void LayerTransactionParent::Destroy() { mDestroyed = true; mCompositables.clear(); } -mozilla::ipc::IPCResult -LayerTransactionParent::RecvUpdateNoSwap(const TransactionInfo& txn) -{ - return RecvUpdate(txn); -} - class MOZ_STACK_CLASS AutoLayerTransactionParentAsyncMessageSender { public: explicit AutoLayerTransactionParentAsyncMessageSender(LayerTransactionParent* aLayerTransaction, const InfallibleTArray<OpDestroy>* aDestroyActors = nullptr) : mLayerTransaction(aLayerTransaction) , mActorsToDestroy(aDestroyActors) {
--- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -108,18 +108,16 @@ public: protected: virtual mozilla::ipc::IPCResult RecvShutdown() override; virtual mozilla::ipc::IPCResult RecvPaintTime(const uint64_t& aTransactionId, const TimeDuration& aPaintTime) override; virtual mozilla::ipc::IPCResult RecvUpdate(const TransactionInfo& aInfo) override; - virtual mozilla::ipc::IPCResult RecvUpdateNoSwap(const TransactionInfo& aInfo) override; - virtual mozilla::ipc::IPCResult RecvSetLayerObserverEpoch(const uint64_t& aLayerObserverEpoch) override; virtual mozilla::ipc::IPCResult RecvNewCompositable(const CompositableHandle& aHandle, const TextureInfo& aInfo) override; virtual mozilla::ipc::IPCResult RecvReleaseLayer(const LayerHandle& aHandle) override; virtual mozilla::ipc::IPCResult RecvReleaseCompositable(const CompositableHandle& aHandle) override; virtual mozilla::ipc::IPCResult RecvClearCachedResources() override; virtual mozilla::ipc::IPCResult RecvForceComposite() override;
--- a/gfx/layers/ipc/PImageBridge.ipdl +++ b/gfx/layers/ipc/PImageBridge.ipdl @@ -33,19 +33,17 @@ sync protocol PImageBridge child: async ParentAsyncMessages(AsyncParentMessageData[] aMessages); async DidComposite(ImageCompositeNotification[] aNotifications); parent: async ImageBridgeThreadId(PlatformThreadId aTreahdId); - sync Update(CompositableOperation[] ops, OpDestroy[] toDestroy, uint64_t fwdTransactionId); - - async UpdateNoSwap(CompositableOperation[] ops, OpDestroy[] toDestroy, uint64_t fwdTransactionId); + async Update(CompositableOperation[] ops, OpDestroy[] toDestroy, uint64_t fwdTransactionId); // First step of the destruction sequence. This puts ImageBridge // in a state in which it can't send asynchronous messages // so as to not race with the channel getting closed. // In the child side, the Closing the channel does not happen right after WillClose, // it is scheduled in the ImageBridgeChild's message queue in order to ensure // that all of the messages from the parent side have been received and processed // before sending closing the channel.
--- a/gfx/layers/ipc/PLayerTransaction.ipdl +++ b/gfx/layers/ipc/PLayerTransaction.ipdl @@ -47,24 +47,20 @@ union MaybeTransform { * there is one) or the UI process otherwise. */ sync protocol PLayerTransaction { manager PCompositorBridge; parent: // The isFirstPaint flag can be used to indicate that this is the first update // for a particular document. - sync Update(TransactionInfo txn); + async Update(TransactionInfo txn); async PaintTime(uint64_t id, TimeDuration paintTime); - // We don't need to send a sync transaction if - // no transaction operate require a swap. - async UpdateNoSwap(TransactionInfo txn); - async SetLayerObserverEpoch(uint64_t layerObserverEpoch); // Create a new Compositable. async NewCompositable(CompositableHandle handle, TextureInfo info); // Release an object that is no longer in use. async ReleaseLayer(LayerHandle layer); async ReleaseCompositable(CompositableHandle compositable);
--- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -55,17 +55,16 @@ typedef nsTArray<Edit> EditVector; typedef nsTHashtable<nsPtrHashKey<ShadowableLayer>> ShadowableLayerSet; typedef nsTArray<OpDestroy> OpDestroyVector; class Transaction { public: Transaction() : mTargetRotation(ROTATION_0) - , mSwapRequired(false) , mOpen(false) , mRotationChanged(false) {} void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation, dom::ScreenOrientationInternal aOrientation) { mOpen = true; @@ -75,34 +74,25 @@ public: // aRotation is 0, but we should be OK because for the first transaction // we should only compose if it is non-empty. See the caller(s) of // RotationChanged. mRotationChanged = true; } mTargetRotation = aRotation; mTargetOrientation = aOrientation; } - void MarkSyncTransaction() - { - mSwapRequired = true; - } void AddEdit(const Edit& aEdit) { MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mCset.AppendElement(aEdit); } void AddEdit(const CompositableOperation& aEdit) { AddEdit(Edit(aEdit)); } - void AddPaint(const CompositableOperation& aPaint) - { - AddNoSwapPaint(Edit(aPaint)); - mSwapRequired = true; - } void AddNoSwapPaint(const CompositableOperation& aPaint) { MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mPaints.AppendElement(Edit(aPaint)); } void AddMutant(ShadowableLayer* aLayer) { @@ -117,17 +107,16 @@ public: void End() { mCset.Clear(); mPaints.Clear(); mMutants.Clear(); mSimpleMutants.Clear(); mDestroyedActors.Clear(); mOpen = false; - mSwapRequired = false; mRotationChanged = false; } bool Empty() const { return mCset.IsEmpty() && mPaints.IsEmpty() && mMutants.IsEmpty() && mSimpleMutants.IsEmpty() && @@ -143,17 +132,16 @@ public: EditVector mCset; nsTArray<CompositableOperation> mPaints; OpDestroyVector mDestroyedActors; ShadowableLayerSet mMutants; ShadowableLayerSet mSimpleMutants; gfx::IntRect mTargetBounds; ScreenRotation mTargetRotation; dom::ScreenOrientationInternal mTargetOrientation; - bool mSwapRequired; private: bool mOpen; bool mRotationChanged; // disabled Transaction(const Transaction&); Transaction& operator=(const Transaction&); @@ -707,32 +695,21 @@ ShadowLayerForwarder::EndTransaction(con if (!GetTextureForwarder()->IsSameProcess()) { MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send...")); PlatformSyncBeforeUpdate(); } profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END); - if (mTxn->mSwapRequired) { - MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction...")); - RenderTraceScope rendertrace3("Forward Transaction", "000093"); - if (!mShadowManager->SendUpdate(info)) { - 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(info)) { - MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); - return false; - } + MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction...")); + RenderTraceScope rendertrace3("Forward Transaction", "000093"); + if (!mShadowManager->SendUpdate(info)) { + MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); + return false; } *aSent = true; mIsFirstPaint = false; mPaintSyncId = 0; MOZ_LAYERS_LOG(("[LayersForwarder] ... done")); return true; }
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp +++ b/gfx/layers/wr/WebRenderBridgeChild.cpp @@ -12,17 +12,16 @@ #include "mozilla/layers/ImageDataSerializer.h" #include "mozilla/layers/PTextureChild.h" namespace mozilla { namespace layers { WebRenderBridgeChild::WebRenderBridgeChild(const wr::PipelineId& aPipelineId) : mIsInTransaction(false) - , mSyncTransaction(false) , mIPCOpen(false) , mDestroyed(false) { } void WebRenderBridgeChild::Destroy() { @@ -74,17 +73,16 @@ WebRenderBridgeChild::DPEnd(bool aIsSync this->SendDPSyncEnd(mCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId); } else { this->SendDPEnd(mCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId); } mCommands.Clear(); mDestroyedActors.Clear(); mIsInTransaction = false; - mSyncTransaction = false; } uint64_t WebRenderBridgeChild::GetNextExternalImageId() { static uint32_t sNextID = 1; ++sNextID; MOZ_RELEASE_ASSERT(sNextID != UINT32_MAX);
--- a/gfx/layers/wr/WebRenderBridgeChild.h +++ b/gfx/layers/wr/WebRenderBridgeChild.h @@ -48,21 +48,16 @@ public: /** * Clean this up, finishing with SendShutDown() which will cause __delete__ * to be sent from the parent side. */ void Destroy(); bool IPCOpen() const { return mIPCOpen && !mDestroyed; } bool IsDestroyed() const { return mDestroyed; } - void MarkSyncTransaction() - { - mSyncTransaction = true; - } - private: friend class CompositorBridgeChild; ~WebRenderBridgeChild() {} uint64_t GetNextExternalImageId(); // CompositableForwarder @@ -101,17 +96,16 @@ private: } bool AddOpDestroy(const OpDestroy& aOp); nsTArray<WebRenderCommand> mCommands; nsTArray<OpDestroy> mDestroyedActors; nsDataHashtable<nsUint64HashKey, CompositableClient*> mCompositables; bool mIsInTransaction; - bool mSyncTransaction; bool mIPCOpen; bool mDestroyed; }; } // namespace layers } // namespace mozilla