Bug 1726063 - Remove support for non-WR compositor initialization. r=jrmuizel,aosmond

Depends on D122796

Differential Revision: https://phabricator.services.mozilla.com/D122798
This commit is contained in:
Matt Woodrow 2021-08-17 23:19:44 +00:00
Родитель f8ba1239ca
Коммит 2cd0480476
7 изменённых файлов: 23 добавлений и 98 удалений

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

@ -2878,51 +2878,14 @@ bool BrowserChild::CreateRemoteLayerManager(
mozilla::layers::PCompositorBridgeChild* aCompositorChild) {
MOZ_ASSERT(aCompositorChild);
bool success = false;
if (mCompositorOptions->UseWebRender()) {
success = mPuppetWidget->CreateRemoteLayerManager(
[&](LayerManager* aLayerManager) -> bool {
MOZ_ASSERT(aLayerManager->AsWebRenderLayerManager());
nsCString error;
return aLayerManager->AsWebRenderLayerManager()->Initialize(
aCompositorChild, wr::AsPipelineId(mLayersId),
&mTextureFactoryIdentifier, error);
});
} else {
nsTArray<LayersBackend> ignored;
PLayerTransactionChild* shadowManager =
aCompositorChild->SendPLayerTransactionConstructor(ignored,
GetLayersId());
if (shadowManager &&
shadowManager->SendGetTextureFactoryIdentifier(
&mTextureFactoryIdentifier) &&
mTextureFactoryIdentifier.mParentBackend !=
LayersBackend::LAYERS_NONE) {
success = true;
}
if (!success) {
// Since no LayerManager is associated with the tab's widget, we will
// never have an opportunity to destroy the PLayerTransaction on the next
// device or compositor reset. Therefore, we make sure to forcefully close
// it here. Failure to do so will cause the next layer tree to fail to
// attach due since the compositor requires the old layer tree to be
// disassociated.
if (shadowManager) {
static_cast<LayerTransactionChild*>(shadowManager)->Destroy();
shadowManager = nullptr;
}
NS_WARNING("failed to allocate layer transaction");
} else {
success = mPuppetWidget->CreateRemoteLayerManager(
[&](LayerManager* aLayerManager) -> bool {
ShadowLayerForwarder* lf = aLayerManager->AsShadowForwarder();
lf->SetShadowManager(shadowManager);
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
return true;
});
}
}
return success;
return mPuppetWidget->CreateRemoteLayerManager(
[&](LayerManager* aLayerManager) -> bool {
MOZ_ASSERT(aLayerManager->AsWebRenderLayerManager());
nsCString error;
return aLayerManager->AsWebRenderLayerManager()->Initialize(
aCompositorChild, wr::AsPipelineId(mLayersId),
&mTextureFactoryIdentifier, error);
});
}
void BrowserChild::InitAPZState() {

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

@ -31,27 +31,21 @@ class CompositorOptions {
// This constructor needed for IPDL purposes, don't use it anywhere else.
CompositorOptions()
: mUseAPZ(false),
mUseWebRender(false),
mUseSoftwareWebRender(false),
mAllowSoftwareWebRenderD3D11(false),
mAllowSoftwareWebRenderOGL(false),
mUseAdvancedLayers(false),
mInitiallyPaused(false) {}
CompositorOptions(bool aUseAPZ, bool aUseWebRender,
bool aUseSoftwareWebRender)
CompositorOptions(bool aUseAPZ, bool aUseSoftwareWebRender)
: mUseAPZ(aUseAPZ),
mUseWebRender(aUseWebRender),
mUseSoftwareWebRender(aUseSoftwareWebRender),
mAllowSoftwareWebRenderD3D11(false),
mAllowSoftwareWebRenderOGL(false),
mUseAdvancedLayers(false),
mInitiallyPaused(false) {
MOZ_ASSERT_IF(aUseSoftwareWebRender, aUseWebRender);
}
mInitiallyPaused(false) {}
bool UseAPZ() const { return mUseAPZ; }
bool UseWebRender() const { return mUseWebRender; }
bool UseSoftwareWebRender() const { return mUseSoftwareWebRender; }
bool AllowSoftwareWebRenderD3D11() const {
return mAllowSoftwareWebRenderD3D11;
@ -79,7 +73,7 @@ class CompositorOptions {
}
bool operator==(const CompositorOptions& aOther) const {
return mUseAPZ == aOther.mUseAPZ && mUseWebRender == aOther.mUseWebRender &&
return mUseAPZ == aOther.mUseAPZ &&
mUseSoftwareWebRender == aOther.mUseSoftwareWebRender &&
mAllowSoftwareWebRenderD3D11 ==
aOther.mAllowSoftwareWebRenderD3D11 &&
@ -91,7 +85,6 @@ class CompositorOptions {
private:
bool mUseAPZ;
bool mUseWebRender;
bool mUseSoftwareWebRender;
bool mAllowSoftwareWebRenderD3D11;
bool mAllowSoftwareWebRenderOGL;

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

@ -383,16 +383,13 @@ void CompositorBridgeParent::Initialize() {
MOZ_ASSERT(!mApzcTreeManager);
MOZ_ASSERT(!mApzSampler);
MOZ_ASSERT(!mApzUpdater);
mApzcTreeManager =
new APZCTreeManager(mRootLayerTreeID, mOptions.UseWebRender());
mApzSampler = new APZSampler(mApzcTreeManager, mOptions.UseWebRender());
mApzUpdater = new APZUpdater(mApzcTreeManager, mOptions.UseWebRender());
mApzcTreeManager = new APZCTreeManager(mRootLayerTreeID, true);
mApzSampler = new APZSampler(mApzcTreeManager, true);
mApzUpdater = new APZUpdater(mApzcTreeManager, true);
}
if (mOptions.UseWebRender()) {
CompositorAnimationStorage* animationStorage = GetAnimationStorage();
mOMTASampler = new OMTASampler(animationStorage, mRootLayerTreeID);
}
CompositorAnimationStorage* animationStorage = GetAnimationStorage();
mOMTASampler = new OMTASampler(animationStorage, mRootLayerTreeID);
mPaused = mOptions.InitiallyPaused();
@ -410,10 +407,6 @@ void CompositorBridgeParent::Initialize() {
}
LayerScope::SetPixelScale(mScale.scale);
if (!mOptions.UseWebRender()) {
mCompositorScheduler = new CompositorVsyncScheduler(this, mWidget);
}
}
LayersId CompositorBridgeParent::RootLayerTreeId() {
@ -733,8 +726,7 @@ void CompositorBridgeParent::ResumeComposition() {
MonitorAutoLock lock(mResumeCompositionMonitor);
bool resumed =
mOptions.UseWebRender() ? mWrBridge->Resume() : mCompositor->Resume();
bool resumed = mWrBridge->Resume();
if (!resumed) {
#ifdef MOZ_WIDGET_ANDROID
// We can't get a surface. This could be because the activity changed
@ -1637,7 +1629,6 @@ static CompositorOptionsChangeKind ClassifyCompositorOptionsChange(
return CompositorOptionsChangeKind::eSupported;
}
if (aOld.UseAdvancedLayers() == aNew.UseAdvancedLayers() &&
aOld.UseWebRender() == aNew.UseWebRender() &&
aOld.InitiallyPaused() == aNew.InitiallyPaused()) {
// Only APZ enablement changed.
return CompositorOptionsChangeKind::eBestEffort;

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

@ -863,7 +863,6 @@ struct ParamTraits<mozilla::layers::CompositorOptions> {
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mUseAPZ);
WriteParam(aMsg, aParam.mUseWebRender);
WriteParam(aMsg, aParam.mUseSoftwareWebRender);
WriteParam(aMsg, aParam.mAllowSoftwareWebRenderD3D11);
WriteParam(aMsg, aParam.mAllowSoftwareWebRenderOGL);
@ -874,7 +873,6 @@ struct ParamTraits<mozilla::layers::CompositorOptions> {
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mUseAPZ) &&
ReadParam(aMsg, aIter, &aResult->mUseWebRender) &&
ReadParam(aMsg, aIter, &aResult->mUseSoftwareWebRender) &&
ReadParam(aMsg, aIter, &aResult->mAllowSoftwareWebRenderD3D11) &&
ReadParam(aMsg, aIter, &aResult->mAllowSoftwareWebRenderOGL) &&

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

@ -620,13 +620,8 @@ WindowRenderer* PuppetWidget::GetWindowRenderer() {
bool PuppetWidget::CreateRemoteLayerManager(
const std::function<bool(LayerManager*)>& aInitializeFunc) {
RefPtr<LayerManager> lm;
RefPtr<LayerManager> lm = new WebRenderLayerManager(this);
MOZ_ASSERT(mBrowserChild);
if (mBrowserChild->GetCompositorOptions().UseWebRender()) {
lm = new WebRenderLayerManager(this);
} else {
lm = new ClientLayerManager(this);
}
if (!aInitializeFunc(lm)) {
return false;

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

@ -1344,8 +1344,9 @@ already_AddRefed<LayerManager> nsBaseWidget::CreateCompositorSession(
} else {
enableWR = enableSWWR = false;
}
MOZ_RELEASE_ASSERT(enableWR);
bool enableAPZ = UseAPZ();
CompositorOptions options(enableAPZ, enableWR, enableSWWR);
CompositorOptions options(enableAPZ, enableSWWR);
#ifdef XP_WIN
if (supportsAcceleration) {
@ -1371,19 +1372,14 @@ already_AddRefed<LayerManager> nsBaseWidget::CreateCompositorSession(
options.SetInitiallyPaused(CompositorInitiallyPaused());
#endif
RefPtr<LayerManager> lm;
if (options.UseWebRender()) {
lm = new WebRenderLayerManager(this);
} else {
lm = new ClientLayerManager(this);
}
RefPtr<LayerManager> lm = new WebRenderLayerManager(this);
bool retry = false;
mCompositorSession = gpu->CreateTopLevelCompositor(
this, lm, GetDefaultScale(), options, UseExternalCompositingSurface(),
gfx::IntSize(aWidth, aHeight), &retry);
if (lm->AsWebRenderLayerManager() && mCompositorSession) {
if (mCompositorSession) {
TextureFactoryIdentifier textureFactoryIdentifier;
nsCString error;
lm->AsWebRenderLayerManager()->Initialize(
@ -1397,17 +1393,6 @@ already_AddRefed<LayerManager> nsBaseWidget::CreateCompositorSession(
gfx::GPUProcessManager::Get()->DisableWebRender(
wr::WebRenderError::INITIALIZE, error);
}
} else if (lm->AsClientLayerManager() && mCompositorSession) {
bool shouldAccelerate = ComputeShouldAccelerate();
TextureFactoryIdentifier textureFactoryIdentifier;
lm->AsClientLayerManager()->Initialize(
mCompositorSession->GetCompositorBridgeChild(), shouldAccelerate,
&textureFactoryIdentifier);
if (textureFactoryIdentifier.mParentBackend ==
LayersBackend::LAYERS_NONE) {
DestroyCompositor();
lm = nullptr;
}
}
// We need to retry in a loop because the act of failing to create the

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

@ -4109,7 +4109,7 @@ WindowRenderer* nsWindow::GetWindowRenderer() {
reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this)),
mTransparencyMode, mSizeMode);
// If we're not using the compositor, the options don't actually matter.
CompositorOptions options(false, false, false);
CompositorOptions options(false, false);
mBasicLayersSurface =
new InProcessWinCompositorWidget(initData, options, this);
mCompositorWidgetDelegate = mBasicLayersSurface;