Bug 1668302 - Expose SWGL state to TextureFactoryIdentifier. r=jrmuizel

This is mostly preparing for the future state where we might have SWGL WR mixed with real hardware webrender, and want a way to lookup the state per-compositor.

Differential Revision: https://phabricator.services.mozilla.com/D92009
This commit is contained in:
Matt Woodrow 2020-10-01 22:19:15 +00:00
Родитель d01e76fc58
Коммит a63466e44e
5 изменённых файлов: 14 добавлений и 6 удалений

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

@ -37,6 +37,7 @@ bool GpuDecoderModule::Supports(const TrackInfo& aTrackInfo,
static inline bool IsRemoteAcceleratedCompositor(KnowsCompositor* aKnows) {
TextureFactoryIdentifier ident = aKnows->GetTextureFactoryIdentifier();
return ident.mParentBackend != LayersBackend::LAYERS_BASIC &&
!ident.mUsingSoftwareWebRender &&
ident.mParentProcessType == GeckoProcessType_GPU;
}

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

@ -185,6 +185,7 @@ struct TextureFactoryIdentifier {
bool mSupportsPartialUploads;
bool mSupportsComponentAlpha;
bool mUsingAdvancedLayers;
bool mUsingSoftwareWebRender;
SyncHandle mSyncHandle;
explicit TextureFactoryIdentifier(
@ -207,6 +208,7 @@ struct TextureFactoryIdentifier {
mSupportsPartialUploads(aSupportsPartialUploads),
mSupportsComponentAlpha(aSupportsComponentAlpha),
mUsingAdvancedLayers(false),
mUsingSoftwareWebRender(false),
mSyncHandle(aSyncHandle) {}
bool operator==(const TextureFactoryIdentifier& aOther) const {
@ -222,6 +224,7 @@ struct TextureFactoryIdentifier {
mSupportsPartialUploads == aOther.mSupportsPartialUploads &&
mSupportsComponentAlpha == aOther.mSupportsComponentAlpha &&
mUsingAdvancedLayers == aOther.mUsingAdvancedLayers &&
mUsingSoftwareWebRender == aOther.mUsingSoftwareWebRender &&
mSyncHandle == aOther.mSyncHandle;
}
};

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

@ -472,6 +472,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier> {
WriteParam(aMsg, aParam.mSupportsPartialUploads);
WriteParam(aMsg, aParam.mSupportsComponentAlpha);
WriteParam(aMsg, aParam.mUsingAdvancedLayers);
WriteParam(aMsg, aParam.mUsingSoftwareWebRender);
WriteParam(aMsg, aParam.mSyncHandle);
}
@ -489,6 +490,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier> {
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
ReadParam(aMsg, aIter, &aResult->mSupportsComponentAlpha) &&
ReadParam(aMsg, aIter, &aResult->mUsingAdvancedLayers) &&
ReadParam(aMsg, aIter, &aResult->mUsingSoftwareWebRender) &&
ReadParam(aMsg, aIter, &aResult->mSyncHandle);
return result;
}

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

@ -2450,11 +2450,13 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvReleaseCompositable(
TextureFactoryIdentifier WebRenderBridgeParent::GetTextureFactoryIdentifier() {
MOZ_ASSERT(mApi);
return TextureFactoryIdentifier(
LayersBackend::LAYERS_WR, XRE_GetProcessType(), mApi->GetMaxTextureSize(),
false, mApi->GetUseANGLE(), mApi->GetUseDComp(),
mAsyncImageManager->UseCompositorWnd(), false, false, false,
mApi->GetSyncHandle());
TextureFactoryIdentifier ident(LayersBackend::LAYERS_WR, XRE_GetProcessType(),
mApi->GetMaxTextureSize(), false,
mApi->GetUseANGLE(), mApi->GetUseDComp(),
mAsyncImageManager->UseCompositorWnd(), false,
false, false, mApi->GetSyncHandle());
ident.mUsingSoftwareWebRender = gfx::gfxVars::UseSoftwareWebRender();
return ident;
}
wr::Epoch WebRenderBridgeParent::GetNextWrEpoch() {

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

@ -158,7 +158,7 @@ CompositorBridgeChild* WebRenderLayerManager::GetCompositorBridgeChild() {
}
void WebRenderLayerManager::GetBackendName(nsAString& name) {
if (gfx::gfxVars::UseSoftwareWebRender()) {
if (WrBridge()->GetTextureFactoryIdentifier().mUsingSoftwareWebRender) {
name.AssignLiteral("WebRender (Software)");
} else {
name.AssignLiteral("WebRender");