mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
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:
parent
2a66c81472
commit
a085fa5430
9 changed files with 17 additions and 74 deletions
|
|
@ -72,11 +72,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool AccelerateLayersByDefault() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
gfxImageFormat mOffscreenFormat;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -132,10 +132,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AccelerateLayersByDefault() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef GL_PROVIDER_GLX
|
||||
already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -4505,7 +4505,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);
|
||||
|
|
@ -4514,18 +4523,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue