Use a simpler mechanism for tracking which ref layers need device resets. (bug 1333329 part 1, r=rhunt)

--HG--
extra : rebase_source : aa50c6c250b4815cd22b8616546acd6c55aa72ce
This commit is contained in:
David Anderson 2017-01-24 11:23:11 -08:00
Родитель 6af429ff8a
Коммит bcf2e3966b
8 изменённых файлов: 34 добавлений и 32 удалений

Просмотреть файл

@ -384,7 +384,7 @@ CompositorBridgeChild::RecvCompositorUpdated(const uint64_t& aLayersId,
if (!mCanSend) {
return IPC_OK();
}
SendAcknowledgeCompositorUpdate(aLayersId);
SendAcknowledgeCompositorUpdate(aLayersId, aSeqNo);
}
return IPC_OK();
}

Просмотреть файл

@ -182,7 +182,6 @@ CompositorBridgeParent::LayerTreeState::LayerTreeState()
, mCrossProcessParent(nullptr)
, mLayerTree(nullptr)
, mUpdatedPluginDataAvailable(false)
, mPendingCompositorUpdates(0)
{
}
@ -1824,9 +1823,9 @@ CompositorBridgeParent::ResetCompositorTask(const nsTArray<LayersBackend>& aBack
Unused << cpcp->SendCompositorUpdated(layersId, newIdentifier.value(), aSeqNo);
if (LayerTransactionParent* ltp = lts->mLayerTree) {
ltp->AddPendingCompositorUpdate();
ltp->SetPendingCompositorUpdate(aSeqNo);
}
lts->mPendingCompositorUpdates++;
lts->mPendingCompositorUpdate = Some(aSeqNo);
}
});
}

Просмотреть файл

@ -189,7 +189,7 @@ public:
virtual mozilla::ipc::IPCResult RecvFlushRendering() override;
virtual mozilla::ipc::IPCResult RecvForcePresent() override;
virtual mozilla::ipc::IPCResult RecvAcknowledgeCompositorUpdate(const uint64_t& aLayersId) override {
virtual mozilla::ipc::IPCResult RecvAcknowledgeCompositorUpdate(const uint64_t&, const uint64_t&) override {
MOZ_ASSERT_UNREACHABLE("This message is only sent cross-process");
return IPC_OK();
}
@ -357,9 +357,11 @@ public:
nsTArray<PluginWindowData> mPluginData;
bool mUpdatedPluginDataAvailable;
// Number of times the compositor has been reset without having been
// acknowledged by the child.
uint32_t mPendingCompositorUpdates;
// Most recent device reset sequence number that has not been acknowledged;
// this is needed in case a device reset occurs in between allocating a
// RefLayer id on the parent, and allocating a PLayerTransaction on the
// child.
Maybe<uint64_t> mPendingCompositorUpdate;
CompositorController* GetCompositorController() const;
MetricsSharingController* CrossProcessSharingController() const;

Просмотреть файл

@ -87,7 +87,9 @@ CrossProcessCompositorBridgeParent::AllocPLayerTransactionParent(
LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId);
p->AddIPDLReference();
sIndirectLayerTrees[aId].mLayerTree = p;
p->SetPendingCompositorUpdates(state->mPendingCompositorUpdates);
if (state->mPendingCompositorUpdate) {
p->SetPendingCompositorUpdate(state->mPendingCompositorUpdate.value());
}
return p;
}
@ -410,16 +412,18 @@ CrossProcessCompositorBridgeParent::GetCompositionManager(LayerTransactionParent
}
mozilla::ipc::IPCResult
CrossProcessCompositorBridgeParent::RecvAcknowledgeCompositorUpdate(const uint64_t& aLayersId)
CrossProcessCompositorBridgeParent::RecvAcknowledgeCompositorUpdate(const uint64_t& aLayersId,
const uint64_t& aSeqNo)
{
MonitorAutoLock lock(*sIndirectLayerTreesLock);
CompositorBridgeParent::LayerTreeState& state = sIndirectLayerTrees[aLayersId];
if (LayerTransactionParent* ltp = state.mLayerTree) {
ltp->AcknowledgeCompositorUpdate();
ltp->AcknowledgeCompositorUpdate(aSeqNo);
}
if (state.mPendingCompositorUpdate == Some(aSeqNo)) {
state.mPendingCompositorUpdate = Nothing();
}
MOZ_ASSERT(state.mPendingCompositorUpdates > 0);
state.mPendingCompositorUpdates--;
return IPC_OK();
}
@ -452,7 +456,7 @@ CrossProcessCompositorBridgeParent::AllocPTextureParent(const SurfaceDescriptor&
TextureFlags flags = aFlags;
if (!state || state->mPendingCompositorUpdates) {
if (!state || state->mPendingCompositorUpdate) {
// The compositor was recreated, and we're receiving layers updates for a
// a layer manager that will soon be discarded or invalidated. We can't
// return null because this will mess up deserialization later and we'll

Просмотреть файл

@ -115,7 +115,9 @@ public:
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) override;
virtual mozilla::ipc::IPCResult RecvRemotePluginsReady() override { return IPC_FAIL_NO_REASON(this); }
virtual mozilla::ipc::IPCResult RecvAcknowledgeCompositorUpdate(const uint64_t& aLayersId) override;
virtual mozilla::ipc::IPCResult RecvAcknowledgeCompositorUpdate(
const uint64_t& aLayersId,
const uint64_t& aSeqNo) override;
void DidComposite(uint64_t aId,
TimeStamp& aCompositeStart,

Просмотреть файл

@ -59,7 +59,6 @@ LayerTransactionParent::LayerTransactionParent(HostLayerManager* aManager,
, mChildEpoch(0)
, mParentEpoch(0)
, mPendingTransaction(0)
, mPendingCompositorUpdates(0)
, mDestroyed(false)
, mIPCOpen(false)
{
@ -575,7 +574,7 @@ LayerTransactionParent::RecvUpdate(const TransactionInfo& aInfo,
case Edit::TOpAttachCompositable: {
const OpAttachCompositable& op = edit.get_OpAttachCompositable();
RefPtr<CompositableHost> host = FindCompositable(op.compositable());
if (mPendingCompositorUpdates) {
if (mPendingCompositorUpdate) {
// Do not attach compositables from old layer trees. Return true since
// content cannot handle errors.
return IPC_OK();
@ -590,7 +589,7 @@ LayerTransactionParent::RecvUpdate(const TransactionInfo& aInfo,
}
case Edit::TOpAttachAsyncCompositable: {
const OpAttachAsyncCompositable& op = edit.get_OpAttachAsyncCompositable();
if (mPendingCompositorUpdates) {
if (mPendingCompositorUpdate) {
// Do not attach compositables from old layer trees. Return true since
// content cannot handle errors.
return IPC_OK();

Просмотреть файл

@ -97,17 +97,13 @@ public:
return OtherPid();
}
void AddPendingCompositorUpdate() {
mPendingCompositorUpdates++;
void SetPendingCompositorUpdate(uint64_t aNumber) {
mPendingCompositorUpdate = Some(aNumber);
}
void SetPendingCompositorUpdates(uint32_t aCount) {
// Only called after construction.
MOZ_ASSERT(mPendingCompositorUpdates == 0);
mPendingCompositorUpdates = aCount;
}
void AcknowledgeCompositorUpdate() {
MOZ_ASSERT(mPendingCompositorUpdates > 0);
mPendingCompositorUpdates--;
void AcknowledgeCompositorUpdate(uint64_t aNumber) {
if (mPendingCompositorUpdate == Some(aNumber)) {
mPendingCompositorUpdate = Nothing();
}
}
protected:
@ -200,9 +196,9 @@ private:
uint64_t mPendingTransaction;
// Number of compositor updates we're waiting for the child to
// acknowledge.
uint32_t mPendingCompositorUpdates;
// Not accepting layers updates until we receive an acknowledgement with this
// generation number.
Maybe<uint64_t> mPendingCompositorUpdate;
// When the widget/frame/browser stuff in this process begins its
// destruction process, we need to Disconnect() all the currently

Просмотреть файл

@ -162,7 +162,7 @@ parent:
// Confirmation that the child has invalidated all its layers, and will not
// request layers against an old compositor.
async AcknowledgeCompositorUpdate(uint64_t id);
async AcknowledgeCompositorUpdate(uint64_t aLayersId, uint64_t aSeqNo);
// Child sends the parent a request for fill ratio numbers.
async RequestOverfill();