From 2ad9b58e73f445391f17acefbe982e79cffd5018 Mon Sep 17 00:00:00 2001 From: Brindusan Cristian Date: Tue, 14 Apr 2020 03:12:33 +0300 Subject: [PATCH] Backed out changeset d05ac327b65e (bug 1626822) for bustages at gfxPlatform.cpp. CLOSED TREE --- gfx/thebes/gfxPlatform.cpp | 31 +++++++------------ .../RenderCompositorANGLE.cpp | 26 +++------------- .../RenderCompositorANGLE.h | 1 - modules/libpref/init/StaticPrefList.yaml | 17 ---------- modules/libpref/init/all.js | 1 + 5 files changed, 16 insertions(+), 60 deletions(-) diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index dd182749cce6..ff06f1097a75 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -1023,14 +1023,7 @@ void gfxPlatform::Init() { // the (rare) cases where they're used. Note that the GPU process where // WebRender runs doesn't initialize gfxPlatform and performs explicit // initialization of the bits it needs. - if (!UseWebRender() -#ifdef NIGHTLY_BUILD - || (UseWebRender() && XRE_IsParentProcess() && - !gfxConfig::IsEnabled(Feature::GPU_PROCESS) && - StaticPrefs:: - gfx_webrender_enabled_no_gpu_process_with_angle_win_AtStartup()) -#endif - ) { + if (!UseWebRender()) { gPlatform->EnsureDevicesInitialized(); } gPlatform->InitOMTPConfig(); @@ -2959,6 +2952,15 @@ void gfxPlatform::InitWebRenderConfig() { NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBRENDER_NEED_HWCOMP")); } + // WebRender relies on the GPU process when on Windows +#ifdef XP_WIN + if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) { + featureWebRender.ForceDisable( + FeatureStatus::UnavailableNoGpuProcess, "GPU Process is disabled", + NS_LITERAL_CSTRING("FEATURE_FAILURE_GPU_PROCESS_DISABLED")); + } +#endif + if (InSafeMode()) { featureWebRender.ForceDisable( FeatureStatus::UnavailableInSafeMode, "Safe-mode is enabled", @@ -2966,22 +2968,11 @@ void gfxPlatform::InitWebRenderConfig() { } #ifdef XP_WIN - if (StaticPrefs::gfx_webrender_force_angle_AtStartup()) { + if (Preferences::GetBool("gfx.webrender.force-angle", false)) { if (!gfxConfig::IsEnabled(Feature::D3D11_HW_ANGLE)) { featureWebRender.ForceDisable( FeatureStatus::UnavailableNoAngle, "ANGLE is disabled", NS_LITERAL_CSTRING("FEATURE_FAILURE_ANGLE_DISABLED")); - } else if ( - !gfxConfig::IsEnabled(Feature::GPU_PROCESS) -# ifdef NIGHTLY_BUILD - && !StaticPrefs:: - gfx_webrender_enabled_no_gpu_process_with_angle_win_AtStartup() -# endif - ) { - // WebRender with ANGLE relies on the GPU process when on Windows - featureWebRender.ForceDisable( - FeatureStatus::UnavailableNoGpuProcess, "GPU Process is disabled", - NS_LITERAL_CSTRING("FEATURE_FAILURE_GPU_PROCESS_DISABLED")); } else { gfxVars::SetUseWebRenderANGLE(gfxConfig::IsEnabled(Feature::WEBRENDER)); } diff --git a/gfx/webrender_bindings/RenderCompositorANGLE.cpp b/gfx/webrender_bindings/RenderCompositorANGLE.cpp index 59eaa6fb63f7..78c7e2791df6 100644 --- a/gfx/webrender_bindings/RenderCompositorANGLE.cpp +++ b/gfx/webrender_bindings/RenderCompositorANGLE.cpp @@ -162,7 +162,7 @@ bool RenderCompositorANGLE::Initialize() { // Create DCLayerTree when DirectComposition is used. if (gfx::gfxVars::UseWebRenderDCompWin()) { - HWND compositorHwnd = GetCompositorHwnd(); + HWND compositorHwnd = mWidget->AsWindows()->GetCompositorHwnd(); if (compositorHwnd) { mDCLayerTree = DCLayerTree::Create(gl, mEGLConfig, mDevice, compositorHwnd); @@ -191,26 +191,6 @@ bool RenderCompositorANGLE::Initialize() { return true; } -HWND RenderCompositorANGLE::GetCompositorHwnd() { - HWND hwnd = 0; - - if (XRE_IsGPUProcess()) { - hwnd = mWidget->AsWindows()->GetCompositorHwnd(); - } -#ifdef NIGHTLY_BUILD - else if ( - StaticPrefs:: - gfx_webrender_enabled_no_gpu_process_with_angle_win_AtStartup()) { - MOZ_ASSERT(XRE_IsParentProcess()); - - // When GPU process does not exist, we do not need to use compositor window. - hwnd = mWidget->AsWindows()->GetHwnd(); - } -#endif - - return hwnd; -} - bool RenderCompositorANGLE::CreateSwapChain() { MOZ_ASSERT(!UseCompositor()); @@ -322,7 +302,7 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible( return; } - HWND hwnd = GetCompositorHwnd(); + HWND hwnd = mWidget->AsWindows()->GetCompositorHwnd(); if (!hwnd) { // When DirectComposition or DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL is used, // compositor window needs to exist. @@ -333,6 +313,8 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible( return; } + MOZ_ASSERT(XRE_IsGPUProcess()); + // When compositor is enabled, CompositionSurface is used for rendering. // It does not support triple buffering. bool useTripleBuffering = diff --git a/gfx/webrender_bindings/RenderCompositorANGLE.h b/gfx/webrender_bindings/RenderCompositorANGLE.h index a2fcb3cc4cae..299505110ce0 100644 --- a/gfx/webrender_bindings/RenderCompositorANGLE.h +++ b/gfx/webrender_bindings/RenderCompositorANGLE.h @@ -112,7 +112,6 @@ class RenderCompositorANGLE : public RenderCompositor { bool SutdownEGLLibraryIfNecessary(); RefPtr GetD3D11Query(); void ReleaseNativeCompositorResources(); - HWND GetCompositorHwnd(); EGLConfig mEGLConfig; EGLSurface mEGLSurface; diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index ff1b8166cdc9..eb8913d8af4c 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -4009,23 +4009,6 @@ mirror: once do_not_use_directly: true -#ifdef XP_WIN -- name: gfx.webrender.force-angle - type: bool - value: true - mirror: once -#endif - -# WebRender is not enabled when there is no GPU process on window when -# WebRender uses ANGLE. It is for avoiding that WebGL and WebRender use ANGLE -# at once. But there is a case that we want to enable WebRender for testing. -#if defined(NIGHTLY_BUILD) && defined(XP_WIN) -- name: gfx.webrender.enabled-no-gpu-process-with-angle-win - type: bool - value: false - mirror: once -#endif - - name: gfx.webrender.blob-images type: RelaxedAtomicBool value: true diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 0126881d7b16..ba7ee1b16aa0 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -653,6 +653,7 @@ pref("gfx.font_rendering.graphite.enabled", true); #endif #ifdef XP_WIN + pref("gfx.webrender.force-angle", true); pref("gfx.webrender.flip-sequential", false); pref("gfx.webrender.dcomp-win.enabled", true); pref("gfx.webrender.triple-buffering.enabled", true);