mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1622360 - Downgrade mStateManagers. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D74185
This commit is contained in:
parent
919613a9ac
commit
e4338bab1c
@ -662,7 +662,7 @@ struct DIGroup {
|
||||
mInvalidRect.width, mInvalidRect.height);
|
||||
|
||||
RenderRootStateManager* rootManager =
|
||||
aWrManager->GetRenderRootStateManager(aBuilder.GetRenderRoot());
|
||||
aWrManager->GetRenderRootStateManager();
|
||||
bool empty = aStartItem == aEndItem;
|
||||
if (empty) {
|
||||
ClearImageKey(rootManager, true);
|
||||
@ -1170,8 +1170,7 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
|
||||
GP("Inner group size change\n");
|
||||
groupData->mFollowingGroup.ClearItems();
|
||||
groupData->mFollowingGroup.ClearImageKey(
|
||||
aCommandBuilder->mManager->GetRenderRootStateManager(
|
||||
aBuilder.GetRenderRoot()));
|
||||
aCommandBuilder->mManager->GetRenderRootStateManager());
|
||||
}
|
||||
groupData->mFollowingGroup.mGroupBounds = currentGroup->mGroupBounds;
|
||||
groupData->mFollowingGroup.mAppUnitsPerDevPixel =
|
||||
@ -1201,8 +1200,7 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
|
||||
// Note: this call to CreateWebRenderCommands can recurse back into
|
||||
// this function.
|
||||
RenderRootStateManager* manager =
|
||||
aCommandBuilder->mManager->GetRenderRootStateManager(
|
||||
aBuilder.GetRenderRoot());
|
||||
aCommandBuilder->mManager->GetRenderRootStateManager();
|
||||
bool createdWRCommands = item->CreateWebRenderCommands(
|
||||
aBuilder, aResources, aSc, manager, mDisplayListBuilder);
|
||||
sIndent--;
|
||||
@ -1366,9 +1364,8 @@ static mozilla::gfx::IntRect ScaleToNearestPixelsOffset(
|
||||
return rect;
|
||||
}
|
||||
|
||||
RenderRootStateManager* WebRenderCommandBuilder::GetRenderRootStateManager(
|
||||
wr::RenderRoot aRenderRoot) {
|
||||
return mManager->GetRenderRootStateManager(aRenderRoot);
|
||||
RenderRootStateManager* WebRenderCommandBuilder::GetRenderRootStateManager() {
|
||||
return mManager->GetRenderRootStateManager();
|
||||
}
|
||||
|
||||
void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
||||
@ -1464,8 +1461,7 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
||||
}
|
||||
|
||||
group.ClearItems();
|
||||
group.ClearImageKey(
|
||||
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()));
|
||||
group.ClearImageKey(mManager->GetRenderRootStateManager());
|
||||
}
|
||||
|
||||
ScrollableLayerGuid::ViewID scrollId = ScrollableLayerGuid::NULL_SCROLL_ID;
|
||||
@ -1629,8 +1625,7 @@ void WebRenderCommandBuilder::CreateWebRenderCommands(
|
||||
}
|
||||
|
||||
aItem->SetPaintRect(aItem->GetBuildingRect());
|
||||
RenderRootStateManager* manager =
|
||||
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot());
|
||||
RenderRootStateManager* manager = mManager->GetRenderRootStateManager();
|
||||
|
||||
// Note: this call to CreateWebRenderCommands can recurse back into
|
||||
// this function if the |item| is a wrapper for a sublist.
|
||||
@ -2305,10 +2300,8 @@ WebRenderCommandBuilder::GenerateFallbackData(
|
||||
PixelCastJustification::LayerIsImage))) {
|
||||
return nullptr;
|
||||
}
|
||||
TakeExternalSurfaces(
|
||||
recorder, fallbackData->mExternalSurfaces,
|
||||
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()),
|
||||
aResources);
|
||||
TakeExternalSurfaces(recorder, fallbackData->mExternalSurfaces,
|
||||
mManager->GetRenderRootStateManager(), aResources);
|
||||
fallbackData->SetBlobImageKey(key);
|
||||
fallbackData->SetFonts(fonts);
|
||||
} else {
|
||||
@ -2556,10 +2549,8 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
|
||||
maskData->ClearImageKey();
|
||||
maskData->mBlobKey = Some(key);
|
||||
maskData->mFonts = fonts;
|
||||
TakeExternalSurfaces(
|
||||
recorder, maskData->mExternalSurfaces,
|
||||
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()),
|
||||
aResources);
|
||||
TakeExternalSurfaces(recorder, maskData->mExternalSurfaces,
|
||||
mManager->GetRenderRootStateManager(), aResources);
|
||||
if (maskIsComplete) {
|
||||
maskData->mItemRect = itemRect;
|
||||
maskData->mMaskOffset = maskOffset;
|
||||
|
@ -138,7 +138,7 @@ class WebRenderCommandBuilder final {
|
||||
RefPtr<WebRenderUserData>& data = userDataTable->GetOrInsert(
|
||||
WebRenderUserDataKey(aItem->GetPerFrameKey(), T::Type()));
|
||||
if (!data) {
|
||||
data = new T(GetRenderRootStateManager(aRenderRoot), aItem);
|
||||
data = new T(GetRenderRootStateManager(), aItem);
|
||||
mWebRenderUserDatas.PutEntry(data);
|
||||
if (aOutIsRecycled) {
|
||||
*aOutIsRecycled = false;
|
||||
@ -170,7 +170,7 @@ class WebRenderCommandBuilder final {
|
||||
WebRenderLayerManager* mManager;
|
||||
|
||||
private:
|
||||
RenderRootStateManager* GetRenderRootStateManager(wr::RenderRoot aRenderRoot);
|
||||
RenderRootStateManager* GetRenderRootStateManager();
|
||||
void CreateWebRenderCommands(nsDisplayItem* aItem,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
|
@ -42,10 +42,8 @@ WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
|
||||
mWebRenderCommandBuilder(this),
|
||||
mLastDisplayListSize(0) {
|
||||
MOZ_COUNT_CTOR(WebRenderLayerManager);
|
||||
for (auto renderRoot : wr::kRenderRoots) {
|
||||
mStateManagers[renderRoot].mRenderRoot = renderRoot;
|
||||
mStateManagers[renderRoot].mLayerManager = this;
|
||||
}
|
||||
mStateManager.mRenderRoot = wr::RenderRoot::Default;
|
||||
mStateManager.mLayerManager = this;
|
||||
|
||||
if (XRE_IsContentProcess() &&
|
||||
StaticPrefs::gfx_webrender_enable_item_cache_AtStartup()) {
|
||||
@ -105,9 +103,7 @@ void WebRenderLayerManager::DoDestroy(bool aIsSync) {
|
||||
|
||||
LayerManager::Destroy();
|
||||
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
stateManager.Destroy();
|
||||
}
|
||||
mStateManager.Destroy();
|
||||
|
||||
if (WrBridge()) {
|
||||
WrBridge()->Destroy(aIsSync);
|
||||
@ -250,24 +246,19 @@ bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
|
||||
GetCompositorBridgeChild()->EndCanvasTransaction();
|
||||
|
||||
AutoTArray<RenderRootUpdates, wr::kRenderRootCount> renderRootUpdates;
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
auto renderRoot = stateManager.GetRenderRoot();
|
||||
MOZ_ASSERT(renderRoot == wr::RenderRoot::Default);
|
||||
if (stateManager.mAsyncResourceUpdates ||
|
||||
!mPendingScrollUpdates.IsEmpty() ||
|
||||
WrBridge()->HasWebRenderParentCommands(renderRoot)) {
|
||||
auto updates = renderRootUpdates.AppendElement();
|
||||
updates->mRenderRoot = renderRoot;
|
||||
updates->mPaintSequenceNumber = mPaintSequenceNumber;
|
||||
if (stateManager.mAsyncResourceUpdates) {
|
||||
stateManager.mAsyncResourceUpdates->Flush(updates->mResourceUpdates,
|
||||
updates->mSmallShmems,
|
||||
updates->mLargeShmems);
|
||||
}
|
||||
updates->mScrollUpdates = std::move(mPendingScrollUpdates);
|
||||
for (auto it = updates->mScrollUpdates.Iter(); !it.Done(); it.Next()) {
|
||||
nsLayoutUtils::NotifyPaintSkipTransaction(/*scroll id=*/it.Key());
|
||||
}
|
||||
if (mStateManager.mAsyncResourceUpdates || !mPendingScrollUpdates.IsEmpty() ||
|
||||
WrBridge()->HasWebRenderParentCommands(wr::RenderRoot::Default)) {
|
||||
auto updates = renderRootUpdates.AppendElement();
|
||||
updates->mRenderRoot = wr::RenderRoot::Default;
|
||||
updates->mPaintSequenceNumber = mPaintSequenceNumber;
|
||||
if (mStateManager.mAsyncResourceUpdates) {
|
||||
mStateManager.mAsyncResourceUpdates->Flush(updates->mResourceUpdates,
|
||||
updates->mSmallShmems,
|
||||
updates->mLargeShmems);
|
||||
}
|
||||
updates->mScrollUpdates = std::move(mPendingScrollUpdates);
|
||||
for (auto it = updates->mScrollUpdates.Iter(); !it.Done(); it.Next()) {
|
||||
nsLayoutUtils::NotifyPaintSkipTransaction(/*scroll id=*/it.Key());
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,23 +373,20 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
|
||||
refreshStart = mTransactionStart;
|
||||
}
|
||||
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
wr::RenderRoot renderRoot = stateManager.GetRenderRoot();
|
||||
if (stateManager.mAsyncResourceUpdates) {
|
||||
if (!resourceUpdates.HasSubQueue(renderRoot) ||
|
||||
resourceUpdates.SubQueue(renderRoot).IsEmpty()) {
|
||||
resourceUpdates.SubQueue(renderRoot)
|
||||
.ReplaceResources(
|
||||
std::move(stateManager.mAsyncResourceUpdates.ref()));
|
||||
} else {
|
||||
WrBridge()->UpdateResources(stateManager.mAsyncResourceUpdates.ref(),
|
||||
stateManager.GetRenderRoot());
|
||||
}
|
||||
stateManager.mAsyncResourceUpdates.reset();
|
||||
if (mStateManager.mAsyncResourceUpdates) {
|
||||
if (!resourceUpdates.HasSubQueue(wr::RenderRoot::Default) ||
|
||||
resourceUpdates.SubQueue(wr::RenderRoot::Default).IsEmpty()) {
|
||||
resourceUpdates.SubQueue(wr::RenderRoot::Default)
|
||||
.ReplaceResources(
|
||||
std::move(mStateManager.mAsyncResourceUpdates.ref()));
|
||||
} else {
|
||||
WrBridge()->UpdateResources(mStateManager.mAsyncResourceUpdates.ref(),
|
||||
mStateManager.GetRenderRoot());
|
||||
}
|
||||
stateManager.DiscardImagesInTransaction(
|
||||
resourceUpdates.SubQueue(renderRoot));
|
||||
mStateManager.mAsyncResourceUpdates.reset();
|
||||
}
|
||||
mStateManager.DiscardImagesInTransaction(
|
||||
resourceUpdates.SubQueue(wr::RenderRoot::Default));
|
||||
|
||||
for (auto renderRoot : wr::kRenderRoots) {
|
||||
if (resourceUpdates.HasSubQueue(renderRoot)) {
|
||||
@ -450,9 +438,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
|
||||
// Discard animations after calling WrBridge()->EndTransaction().
|
||||
// It updates mWrEpoch in WebRenderBridgeParent. The updated mWrEpoch is
|
||||
// necessary for deleting animations at the correct time.
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
stateManager.DiscardCompositorAnimations();
|
||||
}
|
||||
mStateManager.DiscardCompositorAnimations();
|
||||
|
||||
mTransactionStart = TimeStamp();
|
||||
|
||||
@ -544,17 +530,13 @@ void WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize) {
|
||||
|
||||
void WebRenderLayerManager::DiscardImages() {
|
||||
wr::IpcResourceUpdateQueue resources(WrBridge());
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
auto& subqueue = resources.SubQueue(stateManager.GetRenderRoot());
|
||||
stateManager.DiscardImagesInTransaction(subqueue);
|
||||
WrBridge()->UpdateResources(subqueue, stateManager.GetRenderRoot());
|
||||
}
|
||||
auto& subqueue = resources.SubQueue(wr::RenderRoot::Default);
|
||||
mStateManager.DiscardImagesInTransaction(subqueue);
|
||||
WrBridge()->UpdateResources(subqueue, wr::RenderRoot::Default);
|
||||
}
|
||||
|
||||
void WebRenderLayerManager::DiscardLocalImages() {
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
stateManager.DiscardLocalImages();
|
||||
}
|
||||
mStateManager.DiscardLocalImages();
|
||||
}
|
||||
|
||||
void WebRenderLayerManager::SetLayersObserverEpoch(LayersObserverEpoch aEpoch) {
|
||||
@ -610,9 +592,7 @@ void WebRenderLayerManager::ClearCachedResources(Layer* aSubtree) {
|
||||
WrBridge()->BeginClearCachedResources();
|
||||
mWebRenderCommandBuilder.ClearCachedResources();
|
||||
DiscardImages();
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
stateManager.ClearCachedResources();
|
||||
}
|
||||
mStateManager.ClearCachedResources();
|
||||
WrBridge()->EndClearCachedResources();
|
||||
}
|
||||
|
||||
@ -735,16 +715,12 @@ WebRenderLayerManager::CreatePersistentBufferProvider(
|
||||
}
|
||||
|
||||
void WebRenderLayerManager::ClearAsyncAnimations() {
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
stateManager.ClearAsyncAnimations();
|
||||
}
|
||||
mStateManager.ClearAsyncAnimations();
|
||||
}
|
||||
|
||||
void WebRenderLayerManager::WrReleasedImages(
|
||||
const nsTArray<wr::ExternalImageKeyPair>& aPairs) {
|
||||
for (auto& stateManager : mStateManagers) {
|
||||
stateManager.WrReleasedImages(aPairs);
|
||||
}
|
||||
mStateManager.WrReleasedImages(aPairs);
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
@ -176,10 +176,7 @@ class WebRenderLayerManager final : public LayerManager {
|
||||
void StopFrameTimeRecording(uint32_t aStartIndex,
|
||||
nsTArray<float>& aFrameIntervals) override;
|
||||
|
||||
RenderRootStateManager* GetRenderRootStateManager(
|
||||
wr::RenderRoot aRenderRoot) {
|
||||
return &mStateManagers[aRenderRoot];
|
||||
}
|
||||
RenderRootStateManager* GetRenderRootStateManager() { return &mStateManager; }
|
||||
|
||||
virtual void PayloadPresented() override;
|
||||
|
||||
@ -229,7 +226,7 @@ class WebRenderLayerManager final : public LayerManager {
|
||||
WebRenderCommandBuilder mWebRenderCommandBuilder;
|
||||
|
||||
size_t mLastDisplayListSize;
|
||||
wr::RenderRootArray<RenderRootStateManager> mStateManagers;
|
||||
RenderRootStateManager mStateManager;
|
||||
DisplayItemCache mDisplayItemCache;
|
||||
};
|
||||
|
||||
|
@ -224,10 +224,8 @@ static void PurgeWRGlyphAtlas() {
|
||||
uint32_t handle = (uint32_t)(uintptr_t)gWRGlyphAtlas[i]->GetUserData(
|
||||
reinterpret_cast<UserDataKey*>(manager));
|
||||
if (handle) {
|
||||
wr::RenderRoot renderRoot = wr::RenderRoot::Default;
|
||||
manager->GetRenderRootStateManager(renderRoot)
|
||||
->AddImageKeyForDiscard(
|
||||
wr::ImageKey{manager->WrBridge()->GetNamespace(), handle});
|
||||
manager->GetRenderRootStateManager()->AddImageKeyForDiscard(
|
||||
wr::ImageKey{manager->WrBridge()->GetNamespace(), handle});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user