зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f8ba1239ca
Коммит
2cd0480476
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче