Issue #1360 - Part 1: Simplify layers acceleration prefs.

This gets rid of platform-dependent hard-coded defaults, but keeps
build-time blocking if there is no GL provider (in which case layers
acceleration almost certainly won't work because it needs a GL
compositor and would likely crash without)

New prefs are
- layers.acceleration.enabled to enable HWA
- layers.acceleration.force to force it enabled (requires .enabled to be
  set as well)

This is the platform part of this issue. The rest will be front-end work
(Preference UI integration and pref migration)
This commit is contained in:
wolfbeast 2020-01-25 21:26:24 +01:00 committed by Roy Tam
commit a085fa5430
9 changed files with 17 additions and 74 deletions

View file

@ -571,40 +571,6 @@ gfxPlatform::Init()
}
}
// Drop a note in the crash report if we end up forcing an option that could
// destabilize things. New items should be appended at the end (of an existing
// or in a new section), so that we don't have to know the version to interpret
// these cryptic strings.
{
nsAutoCString forcedPrefs;
// D2D prefs
forcedPrefs.AppendPrintf("FP(D%d%d",
gfxPrefs::Direct2DDisabled(),
gfxPrefs::Direct2DForceEnabled());
// Layers prefs
forcedPrefs.AppendPrintf("-L%d%d%d%d",
gfxPrefs::LayersAMDSwitchableGfxEnabled(),
gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly(),
gfxPrefs::LayersAccelerationForceEnabledDoNotUseDirectly(),
gfxPrefs::LayersD3D11ForceWARP());
// WebGL prefs
forcedPrefs.AppendPrintf("-W%d%d%d%d%d%d%d%d",
gfxPrefs::WebGLANGLEForceD3D11(),
gfxPrefs::WebGLANGLEForceWARP(),
gfxPrefs::WebGLDisabled(),
gfxPrefs::WebGLDisableANGLE(),
gfxPrefs::WebGLDXGLEnabled(),
gfxPrefs::WebGLForceEnabled(),
gfxPrefs::WebGLForceLayersReadback(),
gfxPrefs::WebGLForceMSAA());
// Prefs that don't fit into any of the other sections
forcedPrefs.AppendPrintf("-T%d%d%d%d) ",
gfxPrefs::AndroidRGB16Force(),
gfxPrefs::CanvasAzureAccelerated(),
gfxPrefs::DisableGralloc(),
gfxPrefs::ForceShmemTiles());
}
InitMoz2DLogging();
gGfxPlatformPrefsLock = new Mutex("gfxPlatform::gGfxPlatformPrefsLock");
@ -2171,7 +2137,7 @@ gfxPlatform::InitCompositorAccelerationPrefs()
FeatureStatus::Blocked,
"Acceleration blocked by platform"))
{
if (gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly()) {
if (!gfxPrefs::LayersAccelerationEnabledDoNotUseDirectly()) {
feature.UserDisable("Disabled by pref",
NS_LITERAL_CSTRING("FEATURE_FAILURE_COMP_PREF"));
} else if (acceleratedEnv && *acceleratedEnv == '0') {
@ -2185,8 +2151,9 @@ gfxPlatform::InitCompositorAccelerationPrefs()
}
// This has specific meaning elsewhere, so we always record it.
if (gfxPrefs::LayersAccelerationForceEnabledDoNotUseDirectly()) {
feature.UserForceEnable("Force-enabled by pref");
if (gfxPrefs::LayersAccelerationEnabledDoNotUseDirectly() &&
gfxPrefs::LayersAccelerationForceEnabledDoNotUseDirectly()) {
feature.UserForceEnable("Force-enabled by prefs");
}
// Safe mode trumps everything.