diff --git a/gfx/config/gfxVars.h b/gfx/config/gfxVars.h index 694bbeb76323..37352d050b3d 100644 --- a/gfx/config/gfxVars.h +++ b/gfx/config/gfxVars.h @@ -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()) \ diff --git a/gfx/layers/LayersTypes.cpp b/gfx/layers/LayersTypes.cpp index 62be26755ad1..c36511e8c445 100644 --- a/gfx/layers/LayersTypes.cpp +++ b/gfx/layers/LayersTypes.cpp @@ -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"; } diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 996c57dbcc20..7ff572e51c72 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -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)) { diff --git a/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp b/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp index 299625665445..3e338a461b83 100644 --- a/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp +++ b/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp @@ -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(nullptr, nullptr, nullptr, aSurface, this); } diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 8f19afdfbab5..8adfa1306010 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1237,7 +1237,7 @@ already_AddRefed 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);