Simplify and streamline HWA on various OSes.

master
Fedor 2020-03-12 20:41:33 +03:00
parent c52b6e9fe5
commit cd5cc91f9d
24 changed files with 85 additions and 100 deletions

View File

@ -1201,7 +1201,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 21;
const UI_VERSION = 22;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
let currentUIVersion = 0;
try {
@ -1455,6 +1455,19 @@ BrowserGlue.prototype = {
} catch(e) { }
}
}
if (currentUIVersion < 22) {
if (Services.prefs.prefHasUserValue("layers.acceleration.disabled")) {
let HWADisabled = Service.prefs.getBoolPref("layers.acceleration.disabled");
Services.prefs.setBoolPref("layers.acceleration.enabled", !HWADisabled);
Services.prefs.setBoolPref("gfx.direct2d.disabled", HWADisabled);
}
if (Services.prefs.getBoolPref("layers.acceleration.force-enabled", false)) {
Services.prefs.setBoolPref("layers.acceleration.force", true);
}
Services.prefs.clearUserPref("layers.acceleration.disabled");
Services.prefs.clearUserPref("layers.acceleration.force-enabled");
}
// Clear out dirty storage
if (this._dirty)

View File

@ -54,6 +54,8 @@ var gAdvancedPane = {
this.updateActualCacheSize();
this.updateActualAppCacheSize();
this.updateHWADisplay();
// Notify observers that the UI is now ready
Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
},
@ -159,12 +161,21 @@ var gAdvancedPane = {
updateHardwareAcceleration: function()
{
#ifdef XP_WIN
var fromPref = document.getElementById("layers.acceleration.disabled");
var fromPref = document.getElementById("layers.acceleration.enabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;
toPref.value = !fromPref.value;
#endif
this.updateHWADisplay();
},
updateHWADisplay: function()
{
#ifdef XP_LINUX
let HWA = document.getElementById("layers.acceleration.enabled");
document.getElementById("forceHWAccel").disabled = !HWA.value;
#endif
},
// DATA CHOICES TAB
/**

View File

@ -31,8 +31,9 @@
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
<preference id="layers.acceleration.disabled" name="layers.acceleration.disabled" type="bool" inverted="true"
<preference id="layers.acceleration.enabled" name="layers.acceleration.enabled" type="bool"
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
<preference id="layers.acceleration.force" name="layers.acceleration.force" type="bool"/>
#ifdef XP_WIN
<preference id="gfx.direct2d.disabled" name="gfx.direct2d.disabled" type="bool" inverted="true"/>
#endif
@ -150,10 +151,6 @@
label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/>
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.disabled"/>
<checkbox id="checkSpelling"
label="&checkSpelling.label;"
accesskey="&checkSpelling.accesskey;"
@ -162,6 +159,21 @@
preference="layout.spellcheckDefault"/>
</groupbox>
<!-- Hardware Acceleration -->
<groupbox id="browsingGroup" align="start">
<caption label="&HWAccel.label;"/>
<label>&restartRequired.label;</label>
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.enabled"/>
#ifdef XP_LINUX
<checkbox id="forceHWAccel" class="indent"
label="&forceHWAccel.label;"
preference="layers.acceleration.force"/>
#endif
</groupbox>
#ifdef HAVE_SHELL_SERVICE
<!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="vertical">

View File

@ -21,10 +21,13 @@
<!ENTITY useAutoScroll.accesskey "a">
<!ENTITY useSmoothScrolling.label "Use smooth scrolling">
<!ENTITY useSmoothScrolling.accesskey "m">
<!ENTITY allowHWAccel.label "Use hardware acceleration when available">
<!ENTITY allowHWAccel.accesskey "r">
<!ENTITY checkSpelling.label "Check my spelling as I type">
<!ENTITY checkSpelling.accesskey "t">
<!ENTITY HWAccel.label "Hardware Acceleration (HWA)">
<!ENTITY restartRequired.label "Changes to these settings require a browser restart.">
<!ENTITY allowHWAccel.label "Use hardware acceleration when available">
<!ENTITY allowHWAccel.accesskey "r">
<!ENTITY forceHWAccel.label "Force hardware acceleration">
<!ENTITY systemDefaults.label "System Defaults">
<!ENTITY alwaysCheckDefault.label "Always check to see if &brandShortName; is the default browser on startup"><!--XXX-->

View File

@ -72,11 +72,6 @@ public:
return true;
}
protected:
bool AccelerateLayersByDefault() override {
return true;
}
private:
gfxImageFormat mOffscreenFormat;
};

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.
@ -2208,7 +2175,11 @@ gfxPlatform::CanUseHardwareVideoDecoding()
bool
gfxPlatform::AccelerateLayersByDefault()
{
#if defined(MOZ_GL_PROVIDER) || defined(MOZ_WIDGET_UIKIT)
// Note: add any new platform defines here that should get HWA by default.
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_UIKIT)
return true;
#elif defined(MOZ_GL_PROVIDER)
// GL provider manually declared
return true;
#else
return false;

View File

@ -698,7 +698,7 @@ protected:
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource();
// Returns whether or not layers should be accelerated by default on this platform.
virtual bool AccelerateLayersByDefault();
bool AccelerateLayersByDefault();
// Returns a prioritized list of available compositor backends for acceleration.
virtual void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends);

View File

@ -132,10 +132,6 @@ public:
return true;
}
bool AccelerateLayersByDefault() override {
return true;
}
#ifdef GL_PROVIDER_GLX
already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
#endif

View File

@ -372,12 +372,6 @@ gfxPlatformMac::ReadAntiAliasingThreshold()
return threshold;
}
bool
gfxPlatformMac::AccelerateLayersByDefault()
{
return true;
}
// This is the renderer output callback function, called on the vsync thread
static CVReturn VsyncCallback(CVDisplayLinkRef aDisplayLink,
const CVTimeStamp* aNow,

View File

@ -81,9 +81,6 @@ public:
// lower threshold on font anti-aliasing
uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
protected:
bool AccelerateLayersByDefault() override;
private:
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;

View File

@ -448,11 +448,11 @@ private:
DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
DECL_GFX_PREF(Live, "image.webp.enabled", ImageWebPEnabled, bool, true);
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabledDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.enabled", LayersAccelerationEnabledDoNotUseDirectly, bool, true);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.force", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "layers.allow-d3d9-fallback", LayersAllowD3D9Fallback, bool, false);
DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);

View File

@ -231,9 +231,6 @@ public:
bool SupportsPluginDirectDXGIDrawing();
protected:
bool AccelerateLayersByDefault() override {
return true;
}
void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends) override;
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;

View File

@ -448,7 +448,7 @@ load 876092.html
load 876221.html
load 897852.html
asserts(4-6) asserts-if(Android&&!asyncPan,2) load 898913.html # bug 847368
pref(layers.acceleration.disabled,true) pref(layers.force-active,true) load 919434.html
pref(layers.acceleration.enabled,false) pref(layers.force-active,true) load 919434.html
load 926728.html
load 930381.html
load 931450.html

View File

@ -323,7 +323,8 @@ class DesktopArgumentsParser(ReftestArgumentsParser):
def _prefs_gpu(self):
if mozinfo.os != "win":
return ["layers.acceleration.force-enabled=true"]
return ["layers.acceleration.enabled=true",
"layers.acceleration.force=true"]
return []
def validate(self, options, reftest):

View File

@ -287,11 +287,6 @@ class RefTest(object):
prefs['browser.tabs.remote.autostart'] = True
prefs['extensions.e10sBlocksEnabling'] = False
# Bug 1262954: For winXP + e10s disable acceleration
if platform.system() in ("Windows", "Microsoft") and \
'5.1' in platform.version() and options.e10s:
prefs['layers.acceleration.disabled'] = True
# Bug 1300355: Disable canvas cache for win7 as it uses
# too much memory and causes OOMs.
if platform.system() in ("Windows", "Microsoft") and \

View File

@ -4504,7 +4504,16 @@ pref("network.tcp.keepalive.probe_count", 4);
#endif
// Whether to disable acceleration for all widgets.
pref("layers.acceleration.disabled", false);
#if defined(XP_UNIX) && !defined(XP_MACOSX)
// On Linux this is disabled by default for known issues with "free" drivers
pref("layers.acceleration.enabled", false);
#else
pref("layers.acceleration.enabled", true);
#endif
// Whether to force acceleration on, ignoring blacklists.
// This requires layers.acceleration.enabled to be set to true
pref("layers.acceleration.force", false);
// Preference that when switched at runtime will run a series of benchmarks
// and output the result to stderr.
pref("layers.bench.enabled", false);
@ -4520,9 +4529,9 @@ pref("layers.gpu-process.dev.enabled", true);
// Temporarily force-enable GL compositing. This is default-disabled
// deep within the bowels of the widgetry system. Remove me when GL
// compositing isn't default disabled in widget/android.
pref("layers.acceleration.force-enabled", true);
pref("layers.acceleration.force", true);
#else
pref("layers.acceleration.force-enabled", false);
pref("layers.acceleration.force", false);
#endif
pref("layers.acceleration.draw-fps", false);

View File

@ -1678,11 +1678,6 @@ toolbar#nav-bar {
prefs.update(self.extraPrefs(options.extraPrefs))
# Bug 1262954: For windows XP + e10s disable acceleration
if platform.system() in ("Windows", "Microsoft") and \
'5.1' in platform.version() and options.e10s:
prefs['layers.acceleration.disabled'] = True
# interpolate preferences
interpolation = {
"server": "%s:%s" %

View File

@ -222,7 +222,8 @@ config = {
},
"reftest-no-accel": {
"options": ["--suite=reftest",
"--setpref=layers.acceleration.force-enabled=disabled"],
"--setpref=layers.acceleration.enabled=disabled",
"--setpref=layers.acceleration.force=disabled"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]},
},
"all_xpcshell_suites": {

View File

@ -204,7 +204,7 @@ config = {
"reftest-no-accel": {
"options": ["--suite=reftest",
"--setpref=gfx.direct2d.disabled=true",
"--setpref=layers.acceleration.disabled=true"],
"--setpref=layers.acceleration.enabled=false"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]
},
},

View File

@ -204,7 +204,7 @@ config = {
"reftest-no-accel": {
"options": ["--suite=reftest",
"--setpref=gfx.direct2d.disabled=true",
"--setpref=layers.acceleration.disabled=true"],
"--setpref=layers.acceleration.enabled=false"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]
},
},

View File

@ -556,8 +556,8 @@ class basic_compositor_video(PageloaderTest):
sps_profile_interval = 1
sps_profile_entries = 2000000
preferences = {'full-screen-api.allow-trusted-requests-only': False,
'layers.acceleration.force-enabled': False,
'layers.acceleration.disabled': True,
'layers.acceleration.force': False,
'layers.acceleration.enabled': False,
'layout.frame_rate': 0,
'docshell.event_starvation_delay_hint': 1,
'full-screen-api.warning.timeout': 500,

View File

@ -64,7 +64,7 @@ class TTest(object):
# Bug 1262954: winxp + e10s, disable hwaccel
if self.platform_type == "win_" and browser_config['e10s']:
prefs = browser_config['preferences']
prefs['layers.acceleration.disabled'] = True
prefs['layers.acceleration.enabled'] = False
with FFSetup(browser_config, test_config) as setup:
return self._runTest(browser_config, test_config, setup)

View File

@ -60,11 +60,11 @@ RUN_REFTEST_B2G = rm -f ./$@.log && $(PYTHON) _tests/reftest/runreftestb2g.py \
ifeq ($(OS_ARCH),WINNT) #{
# GPU-rendered shadow layers are unsupported here
OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true --setpref=layers.acceleration.disabled=true
OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true --setpref=layers.acceleration.enabled=false
GPU_RENDERING =
else
OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true
GPU_RENDERING = --setpref=layers.acceleration.force-enabled=true
GPU_RENDERING = --setpref=layers.acceleration.enabled=true --setpref=layers.acceleration.force=true
endif #}
reftest: TEST_PATH?=layout/reftests/reftest.list

View File

@ -142,11 +142,6 @@ class FirefoxBrowser(Browser):
if self.e10s:
self.profile.set_preferences({"browser.tabs.remote.autostart": True})
# Bug 1262954: winxp + e10s, disable hwaccel
if (self.e10s and platform.system() in ("Windows", "Microsoft") and
'5.1' in platform.version()):
self.profile.set_preferences({"layers.acceleration.disabled": True})
if self.ca_certificate_path is not None:
self.setup_ssl()