Bug 1697335 - Fallback from WebRender (Software D3D11) to WebRender (Software) when ID3D11Texture2D allocation of tile fails r=aosmond

Differential Revision: https://phabricator.services.mozilla.com/D107766
This commit is contained in:
sotaro 2021-03-10 05:22:45 +00:00
Родитель b3ae95374e
Коммит fd5cd0584c
5 изменённых файлов: 18 добавлений и 3 удалений

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

@ -58,6 +58,7 @@ class gfxVarReceiver;
_(WebRenderDebugFlags, int32_t, 0) \
_(WebRenderBatchingLookback, int32_t, 10) \
_(UseSoftwareWebRender, bool, false) \
_(AllowSoftwareWebRenderD3D11, bool, false) \
_(ScreenDepth, int32_t, 0) \
_(GREDirectory, nsString, nsString()) \
_(ProfDirectory, nsString, nsString()) \

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

@ -39,7 +39,7 @@ const char* GetLayersBackendName(LayersBackend aBackend) {
MOZ_ASSERT(gfx::gfxVars::UseWebRender());
if (gfx::gfxVars::UseSoftwareWebRender()) {
#ifdef XP_WIN
if (StaticPrefs::gfx_webrender_software_d3d11_AtStartup() &&
if (gfx::gfxVars::AllowSoftwareWebRenderD3D11() &&
gfx::gfxConfig::IsEnabled(gfx::Feature::D3D11_COMPOSITING)) {
return "webrender_software_d3d11";
}

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

@ -2705,6 +2705,9 @@ void gfxPlatform::InitWebRenderConfig() {
if (gfxConfig::IsEnabled(Feature::WEBRENDER_DCOMP_PRESENT)) {
gfxVars::SetUseWebRenderDCompWin(true);
}
if (StaticPrefs::gfx_webrender_software_d3d11_AtStartup()) {
gfxVars::SetAllowSoftwareWebRenderD3D11(true);
}
if (Preferences::GetBool("gfx.webrender.dcomp-video-overlay-win", false)) {
if (IsWin10AnniversaryUpdateOrLater() &&
gfxConfig::IsEnabled(Feature::WEBRENDER_COMPOSITOR)) {
@ -3313,7 +3316,7 @@ bool gfxPlatform::FallbackFromAcceleration(FeatureStatus aStatus,
// Before we disable D3D11 and HW_COMPOSITING, we should check if we can
// fallback from WebRender to Software WebRender + D3D11 compositing.
if (StaticPrefs::gfx_webrender_fallback_software_d3d11_AtStartup() &&
StaticPrefs::gfx_webrender_software_d3d11_AtStartup() &&
gfxVars::AllowSoftwareWebRenderD3D11() &&
gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE) &&
gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING) &&
gfxVars::UseWebRender() && !gfxVars::UseSoftwareWebRender()) {
@ -3323,6 +3326,15 @@ bool gfxPlatform::FallbackFromAcceleration(FeatureStatus aStatus,
return true;
}
if (StaticPrefs::gfx_webrender_fallback_software_d3d11_AtStartup() &&
gfxVars::AllowSoftwareWebRenderD3D11() &&
gfxVars::UseSoftwareWebRender()) {
// Fallback from Software WebRender + D3D11 to Software WebRender.
gfxCriticalNote << "Fallback SW-WR + D3D11 to SW-WR";
gfxVars::SetAllowSoftwareWebRenderD3D11(false);
return true;
}
// We aren't using Software WebRender + D3D11 compositing, so turn off the
// D3D11 and D2D.
if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {

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

@ -379,6 +379,7 @@ RenderCompositorD3D11SWGL::CreateStagingTexture(const gfx::IntSize aSize) {
MOZ_ASSERT(SUCCEEDED(hr));
if (!cpuTexture) {
gfxCriticalNote << "Failed to create StagingTexture: " << aSize;
RenderThread::Get()->HandleWebRenderError(WebRenderError::NEW_SURFACE);
}
return cpuTexture.forget();
}
@ -415,6 +416,7 @@ RenderCompositorD3D11SWGL::DoCreateTile(Surface* aSurface) {
MOZ_ASSERT(SUCCEEDED(hr));
if (!texture) {
gfxCriticalNote << "Failed to allocate Texture2D: " << aSurface->TileSize();
RenderThread::Get()->HandleWebRenderError(WebRenderError::NEW_SURFACE);
return MakeUnique<TileD3D11>(nullptr, nullptr, nullptr, aSurface, this);
}

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

@ -1237,7 +1237,7 @@ already_AddRefed<LayerManager> nsBaseWidget::CreateCompositorSession(
#ifdef XP_WIN
if (supportsAcceleration) {
options.SetAllowSoftwareWebRenderD3D11(
StaticPrefs::gfx_webrender_software_d3d11_AtStartup());
gfx::gfxVars::AllowSoftwareWebRenderD3D11());
}
#elif defined(MOZ_WIDGET_ANDROID)
MOZ_ASSERT(supportsAcceleration);