diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-25 21:26:24 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:14:11 +0200 |
commit | 068372c618726edc5eb1a519c99fe438fbcbe944 (patch) | |
tree | 301fe19c18fba8ca5645f8e6a97c6f5fda48b08e | |
parent | a1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff) | |
download | UXP-068372c618726edc5eb1a519c99fe438fbcbe944.tar UXP-068372c618726edc5eb1a519c99fe438fbcbe944.tar.gz UXP-068372c618726edc5eb1a519c99fe438fbcbe944.tar.lz UXP-068372c618726edc5eb1a519c99fe438fbcbe944.tar.xz UXP-068372c618726edc5eb1a519c99fe438fbcbe944.zip |
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)
-rw-r--r-- | gfx/thebes/gfxAndroidPlatform.h | 5 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatform.cpp | 41 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatform.h | 2 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformGtk.h | 4 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformMac.cpp | 6 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformMac.h | 3 | ||||
-rw-r--r-- | gfx/thebes/gfxPrefs.h | 4 | ||||
-rw-r--r-- | gfx/thebes/gfxWindowsPlatform.h | 3 | ||||
-rw-r--r-- | modules/libpref/init/all.js | 23 |
9 files changed, 17 insertions, 74 deletions
diff --git a/gfx/thebes/gfxAndroidPlatform.h b/gfx/thebes/gfxAndroidPlatform.h index 30e7c89ba..8975d0ab9 100644 --- a/gfx/thebes/gfxAndroidPlatform.h +++ b/gfx/thebes/gfxAndroidPlatform.h @@ -72,11 +72,6 @@ public: return true; } -protected: - bool AccelerateLayersByDefault() override { - return true; - } - private: gfxImageFormat mOffscreenFormat; }; diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 50d1fcb46..4cd044f90 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -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. diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 68bb99ea4..642cf909f 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -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); diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h index 9959c0e13..22ed4b08f 100644 --- a/gfx/thebes/gfxPlatformGtk.h +++ b/gfx/thebes/gfxPlatformGtk.h @@ -132,10 +132,6 @@ public: return true; } - bool AccelerateLayersByDefault() override { - return true; - } - #ifdef GL_PROVIDER_GLX already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override; #endif diff --git a/gfx/thebes/gfxPlatformMac.cpp b/gfx/thebes/gfxPlatformMac.cpp index 79684dd19..75c5236a8 100644 --- a/gfx/thebes/gfxPlatformMac.cpp +++ b/gfx/thebes/gfxPlatformMac.cpp @@ -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, diff --git a/gfx/thebes/gfxPlatformMac.h b/gfx/thebes/gfxPlatformMac.h index 0807614f6..ea4c1a101 100644 --- a/gfx/thebes/gfxPlatformMac.h +++ b/gfx/thebes/gfxPlatformMac.h @@ -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; diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 1253fdb48..d02f15699 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -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); diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index 129365f82..b56dab338 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -226,9 +226,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; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index c5daf9213..ada4dbc5f 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4497,7 +4497,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); @@ -4506,18 +4515,6 @@ pref("layers.bench.enabled", false); pref("layers.gpu-process.dev.enabled", true); #endif -// Whether to force acceleration on, ignoring blacklists. -#ifdef ANDROID -// bug 838603 -- on Android, accidentally blacklisting OpenGL layers -// means a startup crash for everyone. -// 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); -#else -pref("layers.acceleration.force-enabled", false); -#endif - pref("layers.acceleration.draw-fps", false); // Enable DEAA antialiasing for transformed layers in the compositor |