Bug 1547351 - Automatically set content process render root r=kats

This implements the idea of automatically setting a content proc's
render root based on the render root enclosing the iframe that
points to it. There was a bit of cleanup in here that was a bit
tricky to extract from the core patch revolving around how we
use the Api(...) helper. This was to avoid the situation where
we use the Api(...) helper before our render root is initialized,
when we don't actually have to. I.e., when we just want the root
WebRenderAPI in all cases.

An alternative to this approach could be to fully built out the
WebRender transactions and just queue those up to be sent. However,
transaction building has various side effects which are committed
before the transaction is actually sent, so we would have to build
out some scheme for deferring those as well. This seemed simpler.

Patch primarily written by :dthayer

Differential Revision: https://phabricator.services.mozilla.com/D37078

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexis Beingessner 2019-07-12 14:14:22 +00:00
Родитель ea4cbb8501
Коммит 6126cdbed2
11 изменённых файлов: 477 добавлений и 126 удалений

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

@ -293,7 +293,6 @@ class BasePopup {
if (this.extension.remote) {
browser.setAttribute("remote", "true");
browser.setAttribute("remoteType", E10SUtils.EXTENSION_REMOTE_TYPE);
browser.setAttribute("renderroot", "content");
}
// We only need flex sizing for the sake of the slide-in sub-views of the

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

@ -49,14 +49,13 @@ parent:
async DeleteCompositorAnimations(uint64_t[] aIds);
async SetDisplayList(RenderRootDisplayListData[] displayLists,
OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
IdNamespace aIdNamespace, bool containsSVGGroup,
bool containsSVGGroup,
VsyncId vsyncId, TimeStamp vsyncStartTime,
TimeStamp refreshStartTime, TimeStamp txnStartTime, nsCString txnURL, TimeStamp fwdTime,
CompositionPayload[] payloads);
async EmptyTransaction(FocusTarget focusTarget, uint32_t aPaintSequenceNumber,
async EmptyTransaction(FocusTarget focusTarget,
RenderRootUpdates[] renderRootUpdates,
OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
IdNamespace aIdNamespace,
VsyncId vsyncId, TimeStamp vsyncStartTime,
TimeStamp refreshStartTime, TimeStamp txnStartTime,
nsCString txnURL, TimeStamp fwdTime,

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

@ -14,11 +14,13 @@ namespace ipc {
void IPDLParamTraits<mozilla::layers::RenderRootDisplayListData>::Write(
IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) {
WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot);
WriteIPDLParam(aMsg, aActor, aParam.mIdNamespace);
WriteIPDLParam(aMsg, aActor, aParam.mRect);
WriteIPDLParam(aMsg, aActor, aParam.mCommands);
WriteIPDLParam(aMsg, aActor, aParam.mContentSize);
WriteIPDLParam(aMsg, aActor, std::move(aParam.mDL));
WriteIPDLParam(aMsg, aActor, aParam.mDLDesc);
WriteIPDLParam(aMsg, aActor, aParam.mRemotePipelineIds);
WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates);
WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems);
WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems));
@ -29,11 +31,13 @@ bool IPDLParamTraits<mozilla::layers::RenderRootDisplayListData>::Read(
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
paramType* aResult) {
if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mIdNamespace) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRect) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mContentSize) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDL) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLDesc) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRemotePipelineIds) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) &&
@ -51,6 +55,7 @@ void IPDLParamTraits<mozilla::layers::RenderRootUpdates>::Write(
WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems);
WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems));
WriteIPDLParam(aMsg, aActor, aParam.mScrollUpdates);
WriteIPDLParam(aMsg, aActor, aParam.mPaintSequenceNumber);
}
bool IPDLParamTraits<mozilla::layers::RenderRootUpdates>::Read(
@ -61,7 +66,8 @@ bool IPDLParamTraits<mozilla::layers::RenderRootUpdates>::Read(
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollUpdates)) {
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollUpdates) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mPaintSequenceNumber)) {
return true;
}
return false;

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

@ -11,6 +11,7 @@
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/WebRenderScrollData.h"
#include "mozilla/Variant.h"
namespace mozilla {
@ -18,11 +19,13 @@ namespace layers {
struct RenderRootDisplayListData {
wr::RenderRoot mRenderRoot;
wr::IdNamespace mIdNamespace;
LayoutDeviceRect mRect;
nsTArray<WebRenderParentCommand> mCommands;
wr::LayoutSize mContentSize;
Maybe<mozilla::ipc::ByteBuf> mDL;
wr::BuiltDisplayListDescriptor mDLDesc;
nsTArray<wr::PipelineId> mRemotePipelineIds;
nsTArray<OpUpdateResource> mResourceUpdates;
nsTArray<RefCountedShmem> mSmallShmems;
nsTArray<mozilla::ipc::Shmem> mLargeShmems;
@ -36,8 +39,19 @@ struct RenderRootUpdates {
nsTArray<RefCountedShmem> mSmallShmems;
nsTArray<mozilla::ipc::Shmem> mLargeShmems;
ScrollUpdatesMap mScrollUpdates;
uint32_t mPaintSequenceNumber;
};
struct ResourceUpdates {
nsTArray<OpUpdateResource> mResourceUpdates;
nsTArray<RefCountedShmem> mSmallShmems;
nsTArray<mozilla::ipc::Shmem> mLargeShmems;
};
typedef Variant<RenderRootDisplayListData, RenderRootUpdates, ResourceUpdates,
FocusTarget>
RenderRootDeferredData;
} // namespace layers
namespace ipc {

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

@ -122,6 +122,7 @@ void WebRenderBridgeChild::EndTransaction(
(XRE_IsParentProcess() &&
StaticPrefs::gfx_webrender_split_render_roots()));
renderRoot.mCommands = std::move(mParentCommands[renderRoot.mRenderRoot]);
renderRoot.mIdNamespace = mIdNamespace;
}
nsTArray<CompositionPayload> payloads;
@ -129,11 +130,10 @@ void WebRenderBridgeChild::EndTransaction(
mManager->TakeCompositionPayloads(payloads);
}
this->SendSetDisplayList(std::move(aRenderRoots), mDestroyedActors,
GetFwdTransactionId(), aTransactionId, mIdNamespace,
aContainsSVGGroup, aVsyncId, aVsyncStartTime,
aRefreshStartTime, aTxnStartTime, aTxnURL, fwdTime,
payloads);
this->SendSetDisplayList(
std::move(aRenderRoots), mDestroyedActors, GetFwdTransactionId(),
aTransactionId, aContainsSVGGroup, aVsyncId, aVsyncStartTime,
aRefreshStartTime, aTxnStartTime, aTxnURL, fwdTime, payloads);
// With multiple render roots, we may not have sent all of our
// mParentCommands, so go ahead and go through our mParentCommands and ensure
@ -146,8 +146,8 @@ void WebRenderBridgeChild::EndTransaction(
void WebRenderBridgeChild::EndEmptyTransaction(
const FocusTarget& aFocusTarget,
nsTArray<RenderRootUpdates>& aRenderRootUpdates,
uint32_t aPaintSequenceNumber, TransactionId aTransactionId,
const mozilla::VsyncId& aVsyncId, const mozilla::TimeStamp& aVsyncStartTime,
TransactionId aTransactionId, const mozilla::VsyncId& aVsyncId,
const mozilla::TimeStamp& aVsyncStartTime,
const mozilla::TimeStamp& aRefreshStartTime,
const mozilla::TimeStamp& aTxnStartTime, const nsCString& aTxnURL) {
MOZ_ASSERT(!mDestroyed);
@ -168,10 +168,9 @@ void WebRenderBridgeChild::EndEmptyTransaction(
}
this->SendEmptyTransaction(
aFocusTarget, aPaintSequenceNumber, std::move(aRenderRootUpdates),
mDestroyedActors, GetFwdTransactionId(), aTransactionId, mIdNamespace,
aVsyncId, aVsyncStartTime, aRefreshStartTime, aTxnStartTime, aTxnURL,
fwdTime, payloads);
aFocusTarget, std::move(aRenderRootUpdates), mDestroyedActors,
GetFwdTransactionId(), aTransactionId, aVsyncId, aVsyncStartTime,
aRefreshStartTime, aTxnStartTime, aTxnURL, fwdTime, payloads);
// With multiple render roots, we may not have sent all of our
// mParentCommands, so go ahead and go through our mParentCommands and ensure

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

@ -82,7 +82,6 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
const nsCString& aTxtURL);
void EndEmptyTransaction(const FocusTarget& aFocusTarget,
nsTArray<RenderRootUpdates>& aRenderRootUpdates,
uint32_t aPaintSequenceNumber,
TransactionId aTransactionId,
const mozilla::VsyncId& aVsyncId,
const mozilla::TimeStamp& aVsyncStartTime,

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

@ -306,7 +306,6 @@ WebRenderBridgeParent::WebRenderBridgeParent(
mWrEpoch{0},
mIdNamespace(aApis[0]->GetNamespace()),
mRenderRootRectMutex("WebRenderBridgeParent::mRenderRootRectMutex"),
mRenderRoot(wr::RenderRoot::Default),
mPaused(false),
mDestroyed(false),
mReceivedDisplayList(false),
@ -320,9 +319,9 @@ WebRenderBridgeParent::WebRenderBridgeParent(
mCompositorScheduler = new CompositorVsyncScheduler(this, mWidget);
}
if (!IsRootWebRenderBridgeParent() &&
StaticPrefs::gfx_webrender_split_render_roots()) {
mRenderRoot = wr::RenderRoot::Content;
if (IsRootWebRenderBridgeParent() ||
!StaticPrefs::gfx_webrender_split_render_roots()) {
mRenderRoot = Some(wr::RenderRoot::Default);
}
for (auto& api : aApis) {
@ -339,19 +338,204 @@ WebRenderBridgeParent::WebRenderBridgeParent(const wr::PipelineId& aPipelineId)
mWrEpoch{0},
mIdNamespace{0},
mRenderRootRectMutex("WebRenderBridgeParent::mRenderRootRectMutex"),
mRenderRoot(wr::RenderRoot::Default),
mPaused(false),
mDestroyed(true),
mReceivedDisplayList(false),
mIsFirstPaint(false),
mSkippedComposite(false) {}
WebRenderBridgeParent::~WebRenderBridgeParent() {
if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
root->RemoveDeferredPipeline(mPipelineId);
}
}
bool WebRenderBridgeParent::RenderRootIsValid(wr::RenderRoot aRenderRoot) {
if (StaticPrefs::gfx_webrender_split_render_roots() &&
IsRootWebRenderBridgeParent()) {
return aRenderRoot <= wr::kHighestRenderRoot;
} else {
return aRenderRoot == wr::RenderRoot::Default;
}
}
void WebRenderBridgeParent::RemoveDeferredPipeline(wr::PipelineId aPipelineId) {
MOZ_ASSERT(IsRootWebRenderBridgeParent());
mPipelineRenderRoots.remove(wr::AsUint64(aPipelineId));
if (auto p = mPipelineDeferredUpdates.lookup(wr::AsUint64(aPipelineId))) {
RefPtr<WebRenderBridgeParent> self = this;
for (auto& variant : p->value()) {
variant.match(
[=](RenderRootDisplayListData& x) {
wr::IpcResourceUpdateQueue::ReleaseShmems(self, x.mSmallShmems);
wr::IpcResourceUpdateQueue::ReleaseShmems(self, x.mLargeShmems);
},
[=](RenderRootUpdates& x) {
wr::IpcResourceUpdateQueue::ReleaseShmems(self, x.mSmallShmems);
wr::IpcResourceUpdateQueue::ReleaseShmems(self, x.mLargeShmems);
},
[=](ResourceUpdates& x) {
wr::IpcResourceUpdateQueue::ReleaseShmems(self, x.mSmallShmems);
wr::IpcResourceUpdateQueue::ReleaseShmems(self, x.mLargeShmems);
},
[=](FocusTarget& x) {});
}
mPipelineDeferredUpdates.remove(p);
}
}
/* static */
WebRenderBridgeParent* WebRenderBridgeParent::CreateDestroyed(
const wr::PipelineId& aPipelineId) {
return new WebRenderBridgeParent(aPipelineId);
}
void WebRenderBridgeParent::PushDeferredPipelineData(
RenderRootDeferredData&& aDeferredData) {
MOZ_ASSERT(!IsRootWebRenderBridgeParent());
if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
uint64_t key = wr::AsUint64(mPipelineId);
auto p = root->mPipelineDeferredUpdates.lookupForAdd(key);
if (!p) {
bool added = root->mPipelineDeferredUpdates.add(
p, key, nsTArray<RenderRootDeferredData>());
if (NS_WARN_IF(!added)) {
return;
}
}
p->value().AppendElement(std::move(aDeferredData));
}
}
bool WebRenderBridgeParent::HandleDeferredPipelineData(
nsTArray<RenderRootDeferredData>& aDeferredData,
const TimeStamp& aTxnStartTime) {
MOZ_ASSERT(!IsRootWebRenderBridgeParent());
for (auto& entry : aDeferredData) {
bool success = entry.match(
[&](RenderRootDisplayListData& data) {
// We ensure this with RenderRootIsValid before calling
// PushDeferredPipelineData:
MOZ_ASSERT(data.mRenderRoot == wr::RenderRoot::Default);
wr::Epoch wrEpoch = GetNextWrEpoch();
bool validTransaction = data.mIdNamespace == mIdNamespace;
if (!ProcessRenderRootDisplayListData(data,
wrEpoch,
aTxnStartTime,
validTransaction,
false)){
return false;
}
wr::IpcResourceUpdateQueue::ReleaseShmems(this, data.mSmallShmems);
wr::IpcResourceUpdateQueue::ReleaseShmems(this, data.mLargeShmems);
return true;
},
[&](RenderRootUpdates& data) {
// We ensure this with RenderRootIsValid before calling
// PushDeferredPipelineData:
MOZ_ASSERT(data.mRenderRoot == wr::RenderRoot::Default);
bool scheduleComposite;
if (!ProcessEmptyTransactionUpdates(data, &scheduleComposite)) {
return false;
}
if (scheduleComposite) {
ScheduleGenerateFrame(Nothing());
}
wr::IpcResourceUpdateQueue::ReleaseShmems(this, data.mSmallShmems);
wr::IpcResourceUpdateQueue::ReleaseShmems(this, data.mLargeShmems);
return true;
},
[&](ResourceUpdates& data) {
wr::TransactionBuilder txn;
txn.SetLowPriority(!IsRootWebRenderBridgeParent());
if (!UpdateResources(data.mResourceUpdates, data.mSmallShmems,
data.mLargeShmems, txn)) {
return false;
}
Api(wr::RenderRoot::Default)->SendTransaction(txn);
wr::IpcResourceUpdateQueue::ReleaseShmems(this, data.mSmallShmems);
wr::IpcResourceUpdateQueue::ReleaseShmems(this, data.mLargeShmems);
return true;
},
[&](FocusTarget& data) {
UpdateAPZFocusState(data);
return true;
});
if (!success) {
return false;
}
}
aDeferredData.Clear();
return true;
}
bool WebRenderBridgeParent::MaybeHandleDeferredPipelineDataForPipeline(
wr::RenderRoot aRenderRoot, wr::PipelineId aPipelineId,
const TimeStamp& aTxnStartTime) {
MOZ_ASSERT(IsRootWebRenderBridgeParent());
uint64_t key = wr::AsUint64(aPipelineId);
auto p = mPipelineRenderRoots.lookupForAdd(key);
if (!p) {
if (!mPipelineRenderRoots.add(p, key, aRenderRoot)) {
return false;
}
CompositorBridgeParent::LayerTreeState* lts =
CompositorBridgeParent::GetIndirectShadowTree(
wr::AsLayersId(aPipelineId));
if (!lts) {
return true;
}
RefPtr<WebRenderBridgeParent> wrbp = lts->mWrBridge;
if (!wrbp) {
return true;
}
MOZ_ASSERT(wrbp->mRenderRoot.refOr(aRenderRoot) == aRenderRoot);
wrbp->mRenderRoot = Some(aRenderRoot);
if (auto p = mPipelineDeferredUpdates.lookup(key)) {
wrbp->HandleDeferredPipelineData(p->value(), aTxnStartTime);
mPipelineDeferredUpdates.remove(p);
for (auto iter = wrbp->mChildPipelines.iter(); !iter.done(); iter.next()) {
if (!MaybeHandleDeferredPipelineDataForPipeline(
aRenderRoot,
wr::AsPipelineId(iter.get()),
aTxnStartTime)) {
return false;
}
}
}
}
return true;
}
bool WebRenderBridgeParent::MaybeHandleDeferredPipelineData(
wr::RenderRoot aRenderRoot, const nsTArray<wr::PipelineId>& aPipelineIds,
const TimeStamp& aTxnStartTime) {
MOZ_ASSERT(IsRootWebRenderBridgeParent());
if (!StaticPrefs::gfx_webrender_split_render_roots()) {
return true;
}
for (wr::PipelineId pipelineId : aPipelineIds) {
if (!MaybeHandleDeferredPipelineDataForPipeline(aRenderRoot, pipelineId,
aTxnStartTime)) {
return false;
}
}
return true;
}
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEnsureConnected(
TextureFactoryIdentifier* aTextureFactoryIdentifier,
MaybeIdNamespace* aMaybeIdNamespace) {
@ -366,6 +550,17 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEnsureConnected(
*aTextureFactoryIdentifier = GetTextureFactoryIdentifier();
*aMaybeIdNamespace = Some(mIdNamespace);
if (!mRenderRoot) {
RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent();
if (!root) {
return IPC_FAIL(this, "Root WRBP is missing (shutting down?)");
}
auto p = root->mPipelineRenderRoots.lookup(wr::AsUint64(mPipelineId));
if (p) {
mRenderRoot.emplace(p->value());
}
}
return IPC_OK();
}
@ -738,7 +933,18 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvUpdateResources(
return IPC_OK();
}
MOZ_RELEASE_ASSERT(aRenderRoot <= wr::kHighestRenderRoot);
if (!RenderRootIsValid(aRenderRoot)) {
return IPC_FAIL(this, "Received an invalid renderRoot");
}
if (!mRenderRoot) {
PushDeferredPipelineData(AsVariant(ResourceUpdates{
std::move(aResourceUpdates),
std::move(aSmallShmems),
std::move(aLargeShmems),
}));
return IPC_OK();
}
wr::TransactionBuilder txn;
txn.SetLowPriority(!IsRootWebRenderBridgeParent());
@ -834,13 +1040,18 @@ WebRenderBridgeParent::GetRootWebRenderBridgeParent() const {
}
void WebRenderBridgeParent::UpdateAPZFocusState(const FocusTarget& aFocus) {
if (!mRenderRoot) {
PushDeferredPipelineData(AsVariant(aFocus));
return;
}
CompositorBridgeParent* cbp = GetRootCompositorBridgeParent();
if (!cbp) {
return;
}
LayersId rootLayersId = cbp->RootLayerTreeId();
if (RefPtr<APZUpdater> apz = cbp->GetAPZUpdater()) {
apz->UpdateFocusState(rootLayersId, WRRootId(GetLayersId(), mRenderRoot),
apz->UpdateFocusState(rootLayersId, WRRootId(GetLayersId(), *mRenderRoot),
aFocus);
}
}
@ -964,14 +1175,57 @@ bool WebRenderBridgeParent::SetDisplayList(
return true;
}
bool WebRenderBridgeParent::ProcessRenderRootDisplayListData(
RenderRootDisplayListData& aDisplayList,
wr::Epoch aWrEpoch,
const TimeStamp& aTxnStartTime,
bool aValidTransaction,
bool aObserveLayersUpdate) {
wr::TransactionBuilder txn;
Maybe<wr::AutoTransactionSender> sender;
// Note that this needs to happen before the display list transaction is
// sent to WebRender, so that the UpdateHitTestingTree call is guaranteed to
// be in the updater queue at the time that the scene swap completes.
if (aDisplayList.mScrollData) {
UpdateAPZScrollData(aWrEpoch, std::move(aDisplayList.mScrollData.ref()),
aDisplayList.mRenderRoot);
}
MOZ_ASSERT(aDisplayList.mRenderRoot == wr::RenderRoot::Default ||
IsRootWebRenderBridgeParent());
auto renderRoot = aDisplayList.mRenderRoot;
txn.SetLowPriority(!IsRootWebRenderBridgeParent());
if (aValidTransaction) {
MOZ_ASSERT(aDisplayList.mIdNamespace == mIdNamespace);
sender.emplace(Api(renderRoot), &txn);
}
if (NS_WARN_IF(!ProcessWebRenderParentCommands(aDisplayList.mCommands, txn,
renderRoot))) {
return false;
}
if (aDisplayList.mDL &&
!SetDisplayList(renderRoot, aDisplayList.mRect, aDisplayList.mContentSize,
std::move(aDisplayList.mDL.ref()), aDisplayList.mDLDesc,
aDisplayList.mResourceUpdates, aDisplayList.mSmallShmems,
aDisplayList.mLargeShmems, aTxnStartTime, txn, aWrEpoch,
aValidTransaction, aObserveLayersUpdate)) {
return false;
}
return true;
}
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
nsTArray<RenderRootDisplayListData>&& aDisplayLists,
nsTArray<OpDestroy>&& aToDestroy, const uint64_t& aFwdTransactionId,
const TransactionId& aTransactionId, const wr::IdNamespace& aIdNamespace,
const bool& aContainsSVGGroup, const VsyncId& aVsyncId,
const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
const TimeStamp& aFwdTime, nsTArray<CompositionPayload>&& aPayloads) {
const TransactionId& aTransactionId, const bool& aContainsSVGGroup,
const VsyncId& aVsyncId, const TimeStamp& aVsyncStartTime,
const TimeStamp& aRefreshStartTime, const TimeStamp& aTxnStartTime,
const nsCString& aTxnURL, const TimeStamp& aFwdTime,
nsTArray<CompositionPayload>&& aPayloads) {
if (mDestroyed) {
for (const auto& op : aToDestroy) {
DestroyActor(op);
@ -980,9 +1234,13 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
}
// Guard against malicious content processes
MOZ_RELEASE_ASSERT(aDisplayLists.Length() > 0);
if (aDisplayLists.Length() == 0) {
return IPC_FAIL(this, "Must send at least one RenderRootDisplayListData.");
}
for (auto& displayList : aDisplayLists) {
MOZ_RELEASE_ASSERT(displayList.mRenderRoot <= wr::kHighestRenderRoot);
if (!RenderRootIsValid(displayList.mRenderRoot)) {
return IPC_FAIL(this, "Received an invalid renderRoot");
}
}
if (!IsRootWebRenderBridgeParent()) {
@ -1002,7 +1260,6 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
mAsyncImageManager->SetCompositionTime(TimeStamp::Now());
mReceivedDisplayList = true;
bool observeLayersUpdate = ShouldParentObserveEpoch();
// The IsFirstPaint() flag should be the same for all the non-empty
// scrolldata across all the renderroot display lists in a given
@ -1026,47 +1283,52 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
}
}
// aScrollData is moved into this function but that is not reflected by the
// function signature due to the way the IPDL generator works. We remove the
// const so that we can move this structure all the way to the desired
// destination.
// Also note that this needs to happen before the display list transaction is
// sent to WebRender, so that the UpdateHitTestingTree call is guaranteed to
// be in the updater queue at the time that the scene swap completes.
if (!mRenderRoot) {
// Only non-root WRBPs will ever have an unresolved mRenderRoot
MOZ_ASSERT(!IsRootWebRenderBridgeParent());
if (aDisplayLists.Length() != 1) {
return IPC_FAIL(this, "Well-behaved content processes must only send a DL for a single renderRoot");
}
PushDeferredPipelineData(AsVariant(std::move(aDisplayLists[0])));
aDisplayLists.Clear();
}
for (auto& displayList : aDisplayLists) {
if (displayList.mScrollData) {
UpdateAPZScrollData(wrEpoch, std::move(displayList.mScrollData.ref()),
displayList.mRenderRoot);
if (IsRootWebRenderBridgeParent()) {
if (!MaybeHandleDeferredPipelineData(
displayList.mRenderRoot,
displayList.mRemotePipelineIds,
aTxnStartTime)) {
return IPC_FAIL(this, "Failed processing deferred pipeline data");
}
} else {
RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent();
if (!root) {
return IPC_FAIL(this, "Root WRBP is missing (shutting down?)");
}
for (auto pipelineId : displayList.mRemotePipelineIds) {
auto id = wr::AsUint64(pipelineId);
if (!root->mPipelineRenderRoots.put(id, *mRenderRoot) ||
!mChildPipelines.put(id)) {
return IPC_FAIL(this, "Failed to add child pipeline id.");
}
}
}
}
bool validTransaction = aIdNamespace == mIdNamespace;
bool validTransaction = aDisplayLists.Length() > 0 &&
aDisplayLists[0].mIdNamespace == mIdNamespace;
bool observeLayersUpdate = ShouldParentObserveEpoch();
wr::RenderRootArray<wr::TransactionBuilder> txns;
wr::RenderRootArray<Maybe<wr::AutoTransactionSender>> senders;
for (auto& displayList : aDisplayLists) {
MOZ_ASSERT(displayList.mRenderRoot == wr::RenderRoot::Default ||
IsRootWebRenderBridgeParent());
auto renderRoot = displayList.mRenderRoot;
auto& txn = txns[renderRoot];
txn.SetLowPriority(!IsRootWebRenderBridgeParent());
if (validTransaction) {
senders[renderRoot].emplace(Api(renderRoot), &txn);
}
if (NS_WARN_IF(!ProcessWebRenderParentCommands(displayList.mCommands, txn,
renderRoot))) {
return IPC_FAIL(this, "Invalid parent command found");
}
if (displayList.mDL &&
!SetDisplayList(renderRoot, displayList.mRect, displayList.mContentSize,
std::move(displayList.mDL.ref()), displayList.mDLDesc,
displayList.mResourceUpdates, displayList.mSmallShmems,
displayList.mLargeShmems, aTxnStartTime, txn, wrEpoch,
validTransaction, observeLayersUpdate)) {
return IPC_FAIL(this, "Failed call to SetDisplayList");
if (!ProcessRenderRootDisplayListData(
displayList,
wrEpoch,
aTxnStartTime,
validTransaction,
observeLayersUpdate)) {
return IPC_FAIL(this, "Failed to process RenderRootDisplayListData.");
}
}
@ -1105,8 +1367,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList(
}
bool WebRenderBridgeParent::ProcessEmptyTransactionUpdates(
RenderRootUpdates& aUpdates, uint32_t aPaintSequenceNumber,
bool* aScheduleComposite) {
RenderRootUpdates& aUpdates, bool* aScheduleComposite) {
*aScheduleComposite = false;
wr::TransactionBuilder txn;
txn.SetLowPriority(!IsRootWebRenderBridgeParent());
@ -1116,7 +1377,7 @@ bool WebRenderBridgeParent::ProcessEmptyTransactionUpdates(
if (!aUpdates.mScrollUpdates.empty()) {
UpdateAPZScrollOffsets(std::move(aUpdates.mScrollUpdates),
aPaintSequenceNumber, aUpdates.mRenderRoot);
aUpdates.mPaintSequenceNumber, aUpdates.mRenderRoot);
}
// Update WrEpoch for UpdateResources() and ProcessWebRenderParentCommands().
@ -1171,14 +1432,13 @@ bool WebRenderBridgeParent::ProcessEmptyTransactionUpdates(
}
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEmptyTransaction(
const FocusTarget& aFocusTarget, const uint32_t& aPaintSequenceNumber,
const FocusTarget& aFocusTarget,
nsTArray<RenderRootUpdates>&& aRenderRootUpdates,
nsTArray<OpDestroy>&& aToDestroy, const uint64_t& aFwdTransactionId,
const TransactionId& aTransactionId, const wr::IdNamespace& aIdNamespace,
const VsyncId& aVsyncId, const TimeStamp& aVsyncStartTime,
const TimeStamp& aRefreshStartTime, const TimeStamp& aTxnStartTime,
const nsCString& aTxnURL, const TimeStamp& aFwdTime,
nsTArray<CompositionPayload>&& aPayloads) {
const TransactionId& aTransactionId, const VsyncId& aVsyncId,
const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
const TimeStamp& aFwdTime, nsTArray<CompositionPayload>&& aPayloads) {
if (mDestroyed) {
for (const auto& op : aToDestroy) {
DestroyActor(op);
@ -1188,7 +1448,9 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEmptyTransaction(
// Guard against malicious content processes
for (auto& update : aRenderRootUpdates) {
MOZ_RELEASE_ASSERT(update.mRenderRoot <= wr::kHighestRenderRoot);
if (!RenderRootIsValid(update.mRenderRoot)) {
return IPC_FAIL(this, "Received an invalid renderRoot");
}
}
if (!IsRootWebRenderBridgeParent()) {
@ -1203,16 +1465,26 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEmptyTransaction(
AutoWebRenderBridgeParentAsyncMessageSender autoAsyncMessageSender(
this, &aToDestroy);
if (!mRenderRoot && aRenderRootUpdates.Length() > 0) {
// Only non-root WRBPs will ever have an unresolved mRenderRoot
MOZ_ASSERT(!IsRootWebRenderBridgeParent());
if (aRenderRootUpdates.Length() != 1) {
return IPC_FAIL(this, "Well-behaved content processes must only send a DL for a single renderRoot");
}
PushDeferredPipelineData(AsVariant(std::move(aRenderRootUpdates[0])));
aRenderRootUpdates.Clear();
}
UpdateAPZFocusState(aFocusTarget);
bool scheduleAnyComposite = false;
for (auto& update : aRenderRootUpdates) {
MOZ_ASSERT(update.mRenderRoot == wr::RenderRoot::Default ||
IsRootWebRenderBridgeParent());
bool scheduleComposite = false;
if (!ProcessEmptyTransactionUpdates(update, aPaintSequenceNumber,
&scheduleComposite)) {
if (!ProcessEmptyTransactionUpdates(update, &scheduleComposite)) {
return IPC_FAIL(this, "Failed to process empty transaction update.");
}
scheduleAnyComposite = scheduleAnyComposite || scheduleComposite;
@ -1372,7 +1644,7 @@ void WebRenderBridgeParent::FlushSceneBuilds() {
// to block until all the inflight transactions have been processed. This
// flush message blocks until all previously sent scenes have been built
// and received by the render backend thread.
Api(wr::RenderRoot::Default)->FlushSceneBuilder();
mApis[wr::RenderRoot::Default]->FlushSceneBuilder();
// The post-swap hook for async-scene-building calls the
// ScheduleRenderOnCompositorThread function from the scene builder thread,
// which then triggers a call to ScheduleGenerateFrame() on the compositor
@ -1412,7 +1684,7 @@ void WebRenderBridgeParent::FlushFramePresentation() {
// this effectively blocks on the render backend and renderer threads,
// following the same codepath that WebRender takes to render and composite
// a frame.
Api(wr::RenderRoot::Default)->WaitFlushed();
mApis[wr::RenderRoot::Default]->WaitFlushed();
}
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvGetSnapshot(
@ -1467,9 +1739,9 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvGetSnapshot(
FlushSceneBuilds();
FlushFrameGeneration();
Api(wr::RenderRoot::Default)
->Readback(start, size, bufferTexture->GetFormat(),
Range<uint8_t>(buffer, buffer_size));
mApis[wr::RenderRoot::Default]->Readback(start, size,
bufferTexture->GetFormat(),
Range<uint8_t>(buffer, buffer_size));
return IPC_OK();
}
@ -1605,16 +1877,22 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvClearCachedResources() {
if (renderRoot == wr::RenderRoot::Default ||
(IsRootWebRenderBridgeParent() &&
StaticPrefs::gfx_webrender_split_render_roots())) {
// Clear resources
wr::TransactionBuilder txn;
txn.SetLowPriority(true);
txn.ClearDisplayList(GetNextWrEpoch(), mPipelineId);
txn.Notify(wr::Checkpoint::SceneBuilt,
MakeUnique<ScheduleObserveLayersUpdate>(
mCompositorBridge, GetLayersId(),
mChildLayersObserverEpoch, false));
Api(renderRoot)->SendTransaction(txn);
if (mRenderRoot) {
// Clear resources
wr::TransactionBuilder txn;
txn.SetLowPriority(true);
txn.ClearDisplayList(GetNextWrEpoch(), mPipelineId);
txn.Notify(wr::Checkpoint::SceneBuilt,
MakeUnique<ScheduleObserveLayersUpdate>(
mCompositorBridge, GetLayersId(),
mChildLayersObserverEpoch, false));
Api(renderRoot)->SendTransaction(txn);
} else {
if (RefPtr<WebRenderBridgeParent> root =
GetRootWebRenderBridgeParent()) {
root->RemoveDeferredPipeline(mPipelineId);
}
}
}
}
// Schedule generate frame to clean up Pipeline
@ -1704,7 +1982,7 @@ void WebRenderBridgeParent::ScheduleForcedGenerateFrame() {
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvCapture() {
if (!mDestroyed) {
Api(wr::RenderRoot::Default)->Capture();
mApis[wr::RenderRoot::Default]->Capture();
}
return IPC_OK();
}
@ -1792,7 +2070,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetAsyncScrollOffset(
return IPC_OK();
}
mCompositorBridge->SetTestAsyncScrollOffset(
WRRootId(GetLayersId(), mRenderRoot), aScrollId, CSSPoint(aX, aY));
WRRootId(GetLayersId(), *mRenderRoot), aScrollId, CSSPoint(aX, aY));
return IPC_OK();
}
@ -1801,7 +2079,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetAsyncZoom(
if (mDestroyed) {
return IPC_OK();
}
mCompositorBridge->SetTestAsyncZoom(WRRootId(GetLayersId(), mRenderRoot),
mCompositorBridge->SetTestAsyncZoom(WRRootId(GetLayersId(), *mRenderRoot),
aScrollId,
LayerToParentLayerScale(aZoom));
return IPC_OK();
@ -1811,13 +2089,13 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvFlushApzRepaints() {
if (mDestroyed) {
return IPC_OK();
}
mCompositorBridge->FlushApzRepaints(WRRootId(GetLayersId(), mRenderRoot));
mCompositorBridge->FlushApzRepaints(WRRootId(GetLayersId(), *mRenderRoot));
return IPC_OK();
}
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvGetAPZTestData(
APZTestData* aOutData) {
mCompositorBridge->GetAPZTestData(WRRootId(GetLayersId(), mRenderRoot),
mCompositorBridge->GetAPZTestData(WRRootId(GetLayersId(), *mRenderRoot),
aOutData);
return IPC_OK();
}
@ -1901,7 +2179,7 @@ void WebRenderBridgeParent::CompositeToTarget(VsyncId aId,
}
if (mSkippedComposite || wr::RenderThread::Get()->TooManyPendingFrames(
Api(wr::RenderRoot::Default)->GetId())) {
mApis[wr::RenderRoot::Default]->GetId())) {
// Render thread is busy, try next time.
mSkippedComposite = true;
mSkippedCompositeId = aId;
@ -2008,11 +2286,11 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
SetAPZSampleTime();
wr::RenderThread::Get()->IncPendingFrameCount(
Api(wr::RenderRoot::Default)->GetId(), aId, start, framesGenerated);
mApis[wr::RenderRoot::Default]->GetId(), aId, start, framesGenerated);
#if defined(ENABLE_FRAME_LATENCY_LOG)
auto startTime = TimeStamp::Now();
Api(wr::RenderRoot::Default)->SetFrameStartTime(startTime);
mApis[wr::RenderRoot::Default]->SetFrameStartTime(startTime);
#endif
MOZ_ASSERT(framesGenerated > 0);
@ -2162,7 +2440,7 @@ TransactionId WebRenderBridgeParent::FlushTransactionIdsForEpoch(
transactionId.mSkippedComposites, transactionId.mTxnURL));
wr::RenderThread::Get()->NotifySlowFrame(
Api(wr::RenderRoot::Default)->GetId());
mApis[wr::RenderRoot::Default]->GetId());
}
}
@ -2252,7 +2530,7 @@ void WebRenderBridgeParent::Pause() {
return;
}
Api(wr::RenderRoot::Default)->Pause();
mApis[wr::RenderRoot::Default]->Pause();
#endif
mPaused = true;
}
@ -2264,7 +2542,7 @@ bool WebRenderBridgeParent::Resume() {
return false;
}
if (!Api(wr::RenderRoot::Default)->Resume()) {
if (!mApis[wr::RenderRoot::Default]->Resume()) {
return false;
}
#endif
@ -2402,10 +2680,10 @@ TextureFactoryIdentifier WebRenderBridgeParent::GetTextureFactoryIdentifier() {
return TextureFactoryIdentifier(
LayersBackend::LAYERS_WR, XRE_GetProcessType(),
Api(wr::RenderRoot::Default)->GetMaxTextureSize(), false,
Api(wr::RenderRoot::Default)->GetUseANGLE(),
Api(wr::RenderRoot::Default)->GetUseDComp(), false, false, false,
Api(wr::RenderRoot::Default)->GetSyncHandle());
mApis[wr::RenderRoot::Default]->GetMaxTextureSize(), false,
mApis[wr::RenderRoot::Default]->GetUseANGLE(),
mApis[wr::RenderRoot::Default]->GetUseDComp(), false, false, false,
mApis[wr::RenderRoot::Default]->GetSyncHandle());
}
wr::Epoch WebRenderBridgeParent::GetNextWrEpoch() {

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

@ -19,6 +19,7 @@
#include "mozilla/layers/PWebRenderBridgeParent.h"
#include "mozilla/layers/UiCompositorControllerParent.h"
#include "mozilla/layers/WebRenderCompositionRecorder.h"
#include "mozilla/HashTable.h"
#include "mozilla/Maybe.h"
#include "mozilla/Result.h"
#include "mozilla/UniquePtr.h"
@ -123,21 +124,20 @@ class WebRenderBridgeParent final
mozilla::ipc::IPCResult RecvSetDisplayList(
nsTArray<RenderRootDisplayListData>&& aDisplayLists,
nsTArray<OpDestroy>&& aToDestroy, const uint64_t& aFwdTransactionId,
const TransactionId& aTransactionId, const wr::IdNamespace& aIdNamespace,
const bool& aContainsSVGGroup, const VsyncId& aVsyncId,
const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
const TimeStamp& aFwdTime,
nsTArray<CompositionPayload>&& aPayloads) override;
mozilla::ipc::IPCResult RecvEmptyTransaction(
const FocusTarget& aFocusTarget, const uint32_t& aPaintSequenceNumber,
nsTArray<RenderRootUpdates>&& aRenderRootUpdates,
nsTArray<OpDestroy>&& aToDestroy, const uint64_t& aFwdTransactionId,
const TransactionId& aTransactionId, const wr::IdNamespace& aIdNamespace,
const TransactionId& aTransactionId, const bool& aContainsSVGGroup,
const VsyncId& aVsyncId, const TimeStamp& aVsyncStartTime,
const TimeStamp& aRefreshStartTime, const TimeStamp& aTxnStartTime,
const nsCString& aTxnURL, const TimeStamp& aFwdTime,
nsTArray<CompositionPayload>&& aPayloads) override;
mozilla::ipc::IPCResult RecvEmptyTransaction(
const FocusTarget& aFocusTarget,
nsTArray<RenderRootUpdates>&& aRenderRootUpdates,
nsTArray<OpDestroy>&& aToDestroy, const uint64_t& aFwdTransactionId,
const TransactionId& aTransactionId, const VsyncId& aVsyncId,
const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
const TimeStamp& aFwdTime,
nsTArray<CompositionPayload>&& aPayloads) override;
mozilla::ipc::IPCResult RecvSetFocusTarget(
const FocusTarget& aFocusTarget) override;
mozilla::ipc::IPCResult RecvParentCommands(
@ -270,6 +270,29 @@ class WebRenderBridgeParent final
*/
void ForceIsFirstPaint() { mIsFirstPaint = true; }
void PushDeferredPipelineData(RenderRootDeferredData&& aDeferredData);
/**
* If we attempt to process information for a particular pipeline before we
* can determine what RenderRoot it belongs to, then we defer that data until
* we can. This handles processing that deferred data.
*/
bool MaybeHandleDeferredPipelineData(
wr::RenderRoot aRenderRoot, const nsTArray<wr::PipelineId>& aPipelineIds,
const TimeStamp& aTxnStartTime);
/**
* See MaybeHandleDeferredPipelineData - this is the implementation of that for
* a single pipeline.
*/
bool MaybeHandleDeferredPipelineDataForPipeline(
wr::RenderRoot aRenderRoot, wr::PipelineId aPipelineId,
const TimeStamp& aTxnStartTime);
bool HandleDeferredPipelineData(
nsTArray<RenderRootDeferredData>& aDeferredData,
const TimeStamp& aTxnStartTime);
bool IsRootWebRenderBridgeParent() const;
LayersId GetLayersId() const;
WRRootId GetWRRootId() const;
@ -281,14 +304,14 @@ class WebRenderBridgeParent final
class ScheduleSharedSurfaceRelease;
explicit WebRenderBridgeParent(const wr::PipelineId& aPipelineId);
virtual ~WebRenderBridgeParent() = default;
virtual ~WebRenderBridgeParent();
wr::WebRenderAPI* Api(wr::RenderRoot aRenderRoot) {
if (IsRootWebRenderBridgeParent()) {
return mApis[aRenderRoot];
} else {
MOZ_ASSERT(aRenderRoot == wr::RenderRoot::Default);
return mApis[mRenderRoot];
return mApis[*mRenderRoot];
}
}
@ -303,14 +326,25 @@ class WebRenderBridgeParent final
return aRenderRoot;
} else {
MOZ_ASSERT(aRenderRoot == wr::RenderRoot::Default);
return mRenderRoot;
return *mRenderRoot;
}
}
// Returns whether a given render root is valid for this WRBP to receive as
// input from the WRBC.
bool RenderRootIsValid(wr::RenderRoot aRenderRoot);
void RemoveDeferredPipeline(wr::PipelineId aPipelineId);
bool ProcessEmptyTransactionUpdates(RenderRootUpdates& aUpdates,
uint32_t aPaintSequenceNumber,
bool* aScheduleComposite);
bool ProcessRenderRootDisplayListData(RenderRootDisplayListData& aDisplayList,
wr::Epoch aWrEpoch,
const TimeStamp& aTxnStartTime,
bool aValidTransaction,
bool aObserveLayersUpdate);
bool SetDisplayList(wr::RenderRoot aRenderRoot, const LayoutDeviceRect& aRect,
const wr::LayoutSize& aContentSize, ipc::ByteBuf&& aDL,
const wr::BuiltDisplayListDescriptor& aDLDesc,
@ -462,6 +496,24 @@ class WebRenderBridgeParent final
// need to be able to null these out in a thread-safe way from
// ClearResources, and there's no way to do that with an nsTArray.
wr::RenderRootArray<RefPtr<wr::WebRenderAPI>> mApis;
// This is a map from pipeline id to render root, that tracks the render
// roots of all subpipelines (including nested subpipelines, e.g. in the
// Fission case) attached to this WebRenderBridgeParent. This is only
// populated on the root WRBP. It is used to resolve the render root for the
// subpipelines, since they may not know where they are attached in the
// parent display list and therefore may not know their render root.
HashMap<uint64_t, wr::RenderRoot> mPipelineRenderRoots;
// This is a hashset of child pipelines for this WRBP. This allows us to
// iterate through all the children of a non-root WRBP and add them to
// the root's mPipelineRenderRoots, and potentially resolve any of their
// deferred updates.
HashSet<uint64_t> mChildPipelines;
// This is a map from pipeline id to a list of deferred data. This is only
// populated on the root WRBP. The data contained within is deferred because
// the sub-WRBP that received it did not know which renderroot it belonged
// to. Once that is resolved by the root WRBP getting the right display list
// update, the deferred data is processed.
HashMap<uint64_t, nsTArray<RenderRootDeferredData>> mPipelineDeferredUpdates;
RefPtr<AsyncImagePipelineManager> mAsyncImageManager;
RefPtr<CompositorVsyncScheduler> mCompositorScheduler;
RefPtr<CompositorAnimationStorage> mAnimStorage;
@ -496,7 +548,7 @@ class WebRenderBridgeParent final
Mutex mRenderRootRectMutex;
wr::NonDefaultRenderRootArray<ScreenRect> mRenderRootRects;
wr::RenderRoot mRenderRoot;
Maybe<wr::RenderRoot> mRenderRoot;
bool mPaused;
bool mDestroyed;
bool mReceivedDisplayList;

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

@ -255,6 +255,7 @@ bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
WrBridge()->HasWebRenderParentCommands(renderRoot)) {
auto updates = renderRootUpdates.AppendElement();
updates->mRenderRoot = renderRoot;
updates->mPaintSequenceNumber = mPaintSequenceNumber;
if (stateManager.mAsyncResourceUpdates) {
stateManager.mAsyncResourceUpdates->Flush(updates->mResourceUpdates,
updates->mSmallShmems,
@ -269,7 +270,7 @@ bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
Maybe<wr::IpcResourceUpdateQueue> nothing;
WrBridge()->EndEmptyTransaction(mFocusTarget, renderRootUpdates,
mPaintSequenceNumber, mLatestTransactionId,
mLatestTransactionId,
mTransactionIdAllocator->GetVsyncId(),
mTransactionIdAllocator->GetVsyncStart(),
refreshStart, mTransactionStart, mURL);

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

@ -813,6 +813,8 @@ void DisplayListBuilder::Finalize(
&aOutTransaction.mDLDesc, &dl.inner);
aOutTransaction.mDL.emplace(dl.inner.data, dl.inner.length,
dl.inner.capacity);
aOutTransaction.mRemotePipelineIds =
std::move(SubBuilder(aOutTransaction.mRenderRoot).mRemotePipelineIds);
dl.inner.capacity = 0;
dl.inner.data = nullptr;
}
@ -1101,6 +1103,7 @@ void DisplayListBuilder::PushIFrame(const wr::LayoutRect& aBounds,
bool aIsBackfaceVisible,
PipelineId aPipeline,
bool aIgnoreMissingPipeline) {
mRemotePipelineIds.AppendElement(aPipeline);
wr_dp_push_iframe(mWrState, aBounds, MergeClipLeaf(aBounds),
aIsBackfaceVisible, &mCurrentSpaceAndClipChain, aPipeline,
aIgnoreMissingPipeline);

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

@ -635,6 +635,7 @@ class DisplayListBuilder final {
wr::PipelineId mPipelineId;
wr::LayoutSize mContentSize;
nsTArray<wr::PipelineId> mRemotePipelineIds;
RenderRoot mRenderRoot;
bool mSendSubBuilderDisplayList;