Backed out changeset d05ac327b65e (bug 1626822) for bustages at gfxPlatform.cpp. CLOSED TREE

This commit is contained in:
Brindusan Cristian 2020-04-14 03:12:33 +03:00
parent 090d7a16dc
commit 2ad9b58e73
5 changed files with 16 additions and 60 deletions

View File

@ -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));
}

View File

@ -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 =

View File

@ -112,7 +112,6 @@ class RenderCompositorANGLE : public RenderCompositor {
bool SutdownEGLLibraryIfNecessary();
RefPtr<ID3D11Query> GetD3D11Query();
void ReleaseNativeCompositorResources();
HWND GetCompositorHwnd();
EGLConfig mEGLConfig;
EGLSurface mEGLSurface;

View File

@ -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

View File

@ -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);