Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef GFX_PREFS_H
7 : #define GFX_PREFS_H
8 :
9 : #include <cmath> // for M_PI
10 : #include <stdint.h>
11 : #include <string>
12 : #include "mozilla/Assertions.h"
13 : #include "mozilla/gfx/LoggingConstants.h"
14 : #include "nsTArray.h"
15 :
16 : // First time gfxPrefs::GetSingleton() needs to be called on the main thread,
17 : // before any of the methods accessing the values are used, but after
18 : // the Preferences system has been initialized.
19 :
20 : // The static methods to access the preference value are safe to call
21 : // from any thread after that first call.
22 :
23 : // To register a preference, you need to add a line in this file using
24 : // the DECL_GFX_PREF macro.
25 : //
26 : // Update argument controls whether we read the preference value and save it
27 : // or connect with a callback. See UpdatePolicy enum below.
28 : // Pref is the string with the preference name.
29 : // Name argument is the name of the static function to create.
30 : // Type is the type of the preference - bool, int32_t, uint32_t.
31 : // Default is the default value for the preference.
32 : //
33 : // For example this line in the .h:
34 : // DECL_GFX_PREF(Once,"layers.dump",LayersDump,bool,false);
35 : // means that you can call
36 : // bool var = gfxPrefs::LayersDump();
37 : // from any thread, but that you will only get the preference value of
38 : // "layers.dump" as it was set at the start of the session (subject to
39 : // note 2 below). If the value was not set, the default would be false.
40 : //
41 : // In another example, this line in the .h:
42 : // DECL_GFX_PREF(Live,"gl.msaa-level",MSAALevel,uint32_t,2);
43 : // means that every time you call
44 : // uint32_t var = gfxPrefs::MSAALevel();
45 : // from any thread, you will get the most up to date preference value of
46 : // "gl.msaa-level". If the value is not set, the default would be 2.
47 :
48 : // Note 1: Changing a preference from Live to Once is now as simple
49 : // as changing the Update argument. If your code worked before, it will
50 : // keep working, and behave as if the user never changes the preference.
51 : // Things are a bit more complicated and perhaps even dangerous when
52 : // going from Once to Live, or indeed setting a preference to be Live
53 : // in the first place, so be careful. You need to be ready for the
54 : // values changing mid execution, and if you're using those preferences
55 : // in any setup and initialization, you may need to do extra work.
56 :
57 : // Note 2: Prefs can be set by using the corresponding Set method. For
58 : // example, if the accessor is Foo() then calling SetFoo(...) will update
59 : // the preference and also change the return value of subsequent Foo() calls.
60 : // This is true even for 'Once' prefs which otherwise do not change if the
61 : // pref is updated after initialization. Changing gfxPrefs values in content
62 : // processes will not affect the result in other processes. Changing gfxPrefs
63 : // values in the GPU process is not supported at all.
64 :
65 : #define DECL_GFX_PREF(Update, Prefname, Name, Type, Default) \
66 : public: \
67 : static Type Name() { MOZ_ASSERT(SingletonExists()); return GetSingleton().mPref##Name.mValue; } \
68 : static void Set##Name(Type aVal) { MOZ_ASSERT(SingletonExists()); \
69 : GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal); } \
70 : static const char* Get##Name##PrefName() { return Prefname; } \
71 : static Type Get##Name##PrefDefault() { return Default; } \
72 : static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) { \
73 : MOZ_ASSERT(SingletonExists()); \
74 : GetSingleton().mPref##Name.SetChangeCallback(aCallback); } \
75 : private: \
76 : PrefTemplate<UpdatePolicy::Update, Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
77 :
78 : // This declares an "override" pref, which is exposed as a "bool" pref by the API,
79 : // but is internally stored as a tri-state int pref with three possible values:
80 : // - A value of 0 means that it has been force-disabled, and is exposed as a
81 : // false-valued bool.
82 : // - A value of 1 means that it has been force-enabled, and is exposed as a
83 : // true-valued bool.
84 : // - A value of 2 (the default) means that it returns the provided BaseValue
85 : // as a boolean. The BaseValue may be a constant expression or a function.
86 : // If the prefs defined with this macro are listed in prefs files (e.g. all.js),
87 : // then they must be listed with an int value (default to 2, but you can use 0
88 : // or 1 if you want to force it on or off).
89 : #define DECL_OVERRIDE_PREF(Update, Prefname, Name, BaseValue) \
90 : public: \
91 : static bool Name() { MOZ_ASSERT(SingletonExists()); \
92 : int32_t val = GetSingleton().mPref##Name.mValue; \
93 : return val == 2 ? !!(BaseValue) : !!val; } \
94 : static void Set##Name(bool aVal) { MOZ_ASSERT(SingletonExists()); \
95 : GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal ? 1 : 0); } \
96 : static const char* Get##Name##PrefName() { return Prefname; } \
97 : static int32_t Get##Name##PrefDefault() { return 2; } \
98 : static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) { \
99 : MOZ_ASSERT(SingletonExists()); \
100 : GetSingleton().mPref##Name.SetChangeCallback(aCallback); } \
101 : private: \
102 : PrefTemplate<UpdatePolicy::Update, int32_t, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
103 :
104 : namespace mozilla {
105 : namespace gfx {
106 : class GfxPrefValue; // defined in PGPU.ipdl
107 : } // namespace gfx
108 : } // namespace mozilla
109 :
110 : class gfxPrefs;
111 : class gfxPrefs final
112 : {
113 : typedef mozilla::gfx::GfxPrefValue GfxPrefValue;
114 :
115 : private:
116 : // Enums for the update policy.
117 : enum class UpdatePolicy {
118 : Skip, // Set the value to default, skip any Preferences calls
119 : Once, // Evaluate the preference once, unchanged during the session
120 : Live // Evaluate the preference and set callback so it stays current/live
121 : };
122 :
123 : public:
124 : class Pref
125 : {
126 : public:
127 1032 : Pref() : mChangeCallback(nullptr)
128 : {
129 1032 : mIndex = sGfxPrefList->Length();
130 1032 : sGfxPrefList->AppendElement(this);
131 1032 : }
132 :
133 0 : size_t Index() const { return mIndex; }
134 : void OnChange();
135 :
136 : typedef void (*ChangeCallback)(const GfxPrefValue&);
137 : void SetChangeCallback(ChangeCallback aCallback);
138 :
139 : virtual const char* Name() const = 0;
140 :
141 : // Returns true if the value is default, false if changed.
142 : virtual bool HasDefaultValue() const = 0;
143 :
144 : // Returns the pref value as a discriminated union.
145 : virtual void GetLiveValue(GfxPrefValue* aOutValue) const = 0;
146 :
147 : // Returns the pref value as a discriminated union.
148 : virtual void GetCachedValue(GfxPrefValue* aOutValue) const = 0;
149 :
150 : // Change the cached value. GfxPrefValue must be a compatible type.
151 : virtual void SetCachedValue(const GfxPrefValue& aOutValue) = 0;
152 :
153 : protected:
154 : void FireChangeCallback();
155 :
156 : private:
157 : size_t mIndex;
158 : ChangeCallback mChangeCallback;
159 : };
160 :
161 0 : static const nsTArray<Pref*>& all() {
162 0 : return *sGfxPrefList;
163 : }
164 :
165 : private:
166 : // We split out a base class to reduce the number of virtual function
167 : // instantiations that we do, which saves code size.
168 : template<class T>
169 : class TypedPref : public Pref
170 : {
171 : public:
172 1032 : explicit TypedPref(T aValue)
173 1032 : : mValue(aValue)
174 1032 : {}
175 :
176 0 : void GetCachedValue(GfxPrefValue* aOutValue) const override {
177 0 : CopyPrefValue(&mValue, aOutValue);
178 0 : }
179 0 : void SetCachedValue(const GfxPrefValue& aOutValue) override {
180 : // This is only used in non-XPCOM processes.
181 0 : MOZ_ASSERT(!IsPrefsServiceAvailable());
182 :
183 : T newValue;
184 0 : CopyPrefValue(&aOutValue, &newValue);
185 :
186 0 : if (mValue != newValue) {
187 0 : mValue = newValue;
188 0 : FireChangeCallback();
189 : }
190 0 : }
191 :
192 : protected:
193 4 : T GetLiveValueByName(const char* aPrefName) const {
194 4 : if (IsPrefsServiceAvailable()) {
195 4 : return PrefGet(aPrefName, mValue);
196 : }
197 0 : return mValue;
198 : }
199 :
200 : public:
201 : T mValue;
202 : };
203 :
204 : // Since we cannot use const char*, use a function that returns it.
205 : template <UpdatePolicy Update, class T, T Default(void), const char* Prefname(void)>
206 : class PrefTemplate final : public TypedPref<T>
207 : {
208 : typedef TypedPref<T> BaseClass;
209 : public:
210 1032 : PrefTemplate()
211 1032 : : BaseClass(Default())
212 : {
213 : // If not using the Preferences service, values are synced over IPC, so
214 : // there's no need to register us as a Preferences observer.
215 1032 : if (IsPrefsServiceAvailable()) {
216 1032 : Register(Update, Prefname());
217 : }
218 : // By default we only watch changes in the parent process, to communicate
219 : // changes to the GPU process.
220 1032 : if (IsParentProcess() && Update == UpdatePolicy::Live) {
221 256 : WatchChanges(Prefname(), this);
222 : }
223 1032 : }
224 0 : ~PrefTemplate() {
225 0 : if (IsParentProcess() && Update == UpdatePolicy::Live) {
226 0 : UnwatchChanges(Prefname(), this);
227 : }
228 0 : }
229 1032 : void Register(UpdatePolicy aUpdate, const char* aPreference)
230 : {
231 1032 : AssertMainThread();
232 1032 : switch (aUpdate) {
233 : case UpdatePolicy::Skip:
234 0 : break;
235 : case UpdatePolicy::Once:
236 264 : this->mValue = PrefGet(aPreference, this->mValue);
237 264 : break;
238 : case UpdatePolicy::Live:
239 768 : PrefAddVarCache(&this->mValue, aPreference, this->mValue);
240 768 : break;
241 : default:
242 0 : MOZ_CRASH("Incomplete switch");
243 : }
244 1032 : }
245 0 : void Set(UpdatePolicy aUpdate, const char* aPref, T aValue)
246 : {
247 0 : AssertMainThread();
248 0 : PrefSet(aPref, aValue);
249 0 : switch (aUpdate) {
250 : case UpdatePolicy::Skip:
251 : case UpdatePolicy::Live:
252 0 : break;
253 : case UpdatePolicy::Once:
254 0 : this->mValue = PrefGet(aPref, this->mValue);
255 0 : break;
256 : default:
257 0 : MOZ_CRASH("Incomplete switch");
258 : }
259 0 : }
260 2 : const char *Name() const override {
261 2 : return Prefname();
262 : }
263 4 : void GetLiveValue(GfxPrefValue* aOutValue) const override {
264 4 : T value = GetLiveValue();
265 4 : CopyPrefValue(&value, aOutValue);
266 4 : }
267 : // When using the Preferences service, the change callback can be triggered
268 : // *before* our cached value is updated, so we expose a method to grab the
269 : // true live value.
270 4 : T GetLiveValue() const {
271 4 : return BaseClass::GetLiveValueByName(Prefname());
272 : }
273 0 : bool HasDefaultValue() const override {
274 0 : return this->mValue == Default();
275 : }
276 : };
277 :
278 : // This is where DECL_GFX_PREF for each of the preferences should go.
279 : // We will keep these in an alphabetical order to make it easier to see if
280 : // a method accessing a pref already exists. Just add yours in the list.
281 :
282 7 : DECL_GFX_PREF(Live, "accessibility.browsewithcaret", AccessibilityBrowseWithCaret, bool, false);
283 :
284 : // The apz prefs are explained in AsyncPanZoomController.cpp
285 63 : DECL_GFX_PREF(Live, "apz.allow_checkerboarding", APZAllowCheckerboarding, bool, true);
286 7 : DECL_GFX_PREF(Live, "apz.allow_immediate_handoff", APZAllowImmediateHandoff, bool, true);
287 10 : DECL_GFX_PREF(Live, "apz.allow_zooming", APZAllowZooming, bool, false);
288 7 : DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle", APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
289 7 : DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold", APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
290 7 : DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle", APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
291 7 : DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle", APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
292 7 : DECL_GFX_PREF(Live, "apz.axis_lock.mode", APZAxisLockMode, int32_t, 0);
293 7 : DECL_GFX_PREF(Live, "apz.content_response_timeout", APZContentResponseTimeout, int32_t, 400);
294 9 : DECL_GFX_PREF(Live, "apz.danger_zone_x", APZDangerZoneX, int32_t, 50);
295 9 : DECL_GFX_PREF(Live, "apz.danger_zone_y", APZDangerZoneY, int32_t, 100);
296 73 : DECL_GFX_PREF(Live, "apz.disable_for_scroll_linked_effects", APZDisableForScrollLinkedEffects, bool, false);
297 7 : DECL_GFX_PREF(Live, "apz.displayport_expiry_ms", APZDisplayPortExpiryTime, uint32_t, 15000);
298 11 : DECL_GFX_PREF(Live, "apz.drag.enabled", APZDragEnabled, bool, false);
299 7 : DECL_GFX_PREF(Live, "apz.drag.initial.enabled", APZDragInitiationEnabled, bool, false);
300 9 : DECL_GFX_PREF(Live, "apz.enlarge_displayport_when_clipped", APZEnlargeDisplayPortWhenClipped, bool, false);
301 7 : DECL_GFX_PREF(Live, "apz.fling_accel_base_mult", APZFlingAccelBaseMultiplier, float, 1.0f);
302 7 : DECL_GFX_PREF(Live, "apz.fling_accel_interval_ms", APZFlingAccelInterval, int32_t, 500);
303 7 : DECL_GFX_PREF(Live, "apz.fling_accel_supplemental_mult", APZFlingAccelSupplementalMultiplier, float, 1.0f);
304 7 : DECL_GFX_PREF(Live, "apz.fling_accel_min_velocity", APZFlingAccelMinVelocity, float, 1.5f);
305 7 : DECL_GFX_PREF(Once, "apz.fling_curve_function_x1", APZCurveFunctionX1, float, 0.0f);
306 7 : DECL_GFX_PREF(Once, "apz.fling_curve_function_x2", APZCurveFunctionX2, float, 1.0f);
307 7 : DECL_GFX_PREF(Once, "apz.fling_curve_function_y1", APZCurveFunctionY1, float, 0.0f);
308 7 : DECL_GFX_PREF(Once, "apz.fling_curve_function_y2", APZCurveFunctionY2, float, 1.0f);
309 7 : DECL_GFX_PREF(Live, "apz.fling_curve_threshold_inches_per_ms", APZCurveThreshold, float, -1.0f);
310 7 : DECL_GFX_PREF(Live, "apz.fling_friction", APZFlingFriction, float, 0.002f);
311 7 : DECL_GFX_PREF(Live, "apz.fling_min_velocity_threshold", APZFlingMinVelocityThreshold, float, 0.5f);
312 7 : DECL_GFX_PREF(Live, "apz.fling_stop_on_tap_threshold", APZFlingStopOnTapThreshold, float, 0.05f);
313 7 : DECL_GFX_PREF(Live, "apz.fling_stopped_threshold", APZFlingStoppedThreshold, float, 0.01f);
314 171 : DECL_GFX_PREF(Live, "apz.frame_delay.enabled", APZFrameDelayEnabled, bool, false);
315 7 : DECL_GFX_PREF(Live, "apz.highlight_checkerboarded_areas", APZHighlightCheckerboardedAreas, bool, false);
316 64 : DECL_GFX_PREF(Once, "apz.keyboard.enabled", APZKeyboardEnabled, bool, false);
317 7 : DECL_GFX_PREF(Live, "apz.max_velocity_inches_per_ms", APZMaxVelocity, float, -1.0f);
318 6 : DECL_GFX_PREF(Once, "apz.max_velocity_queue_size", APZMaxVelocityQueueSize, uint32_t, 5);
319 11 : DECL_GFX_PREF(Live, "apz.min_skate_speed", APZMinSkateSpeed, float, 1.0f);
320 149 : DECL_GFX_PREF(Live, "apz.minimap.enabled", APZMinimap, bool, false);
321 7 : DECL_GFX_PREF(Live, "apz.minimap.visibility.enabled", APZMinimapVisibilityEnabled, bool, false);
322 7 : DECL_GFX_PREF(Live, "apz.one_touch_pinch.enabled", APZOneTouchPinchEnabled, bool, true);
323 7 : DECL_GFX_PREF(Live, "apz.overscroll.enabled", APZOverscrollEnabled, bool, false);
324 7 : DECL_GFX_PREF(Live, "apz.overscroll.min_pan_distance_ratio", APZMinPanDistanceRatio, float, 1.0f);
325 7 : DECL_GFX_PREF(Live, "apz.overscroll.spring_friction", APZOverscrollSpringFriction, float, 0.015f);
326 7 : DECL_GFX_PREF(Live, "apz.overscroll.spring_stiffness", APZOverscrollSpringStiffness, float, 0.001f);
327 7 : DECL_GFX_PREF(Live, "apz.overscroll.stop_distance_threshold", APZOverscrollStopDistanceThreshold, float, 5.0f);
328 7 : DECL_GFX_PREF(Live, "apz.overscroll.stop_velocity_threshold", APZOverscrollStopVelocityThreshold, float, 0.01f);
329 7 : DECL_GFX_PREF(Live, "apz.overscroll.stretch_factor", APZOverscrollStretchFactor, float, 0.5f);
330 7 : DECL_GFX_PREF(Live, "apz.paint_skipping.enabled", APZPaintSkipping, bool, true);
331 49 : DECL_GFX_PREF(Live, "apz.peek_messages.enabled", APZPeekMessages, bool, true);
332 1113 : DECL_GFX_PREF(Live, "apz.printtree", APZPrintTree, bool, false);
333 42 : DECL_GFX_PREF(Live, "apz.record_checkerboarding", APZRecordCheckerboarding, bool, false);
334 7 : DECL_GFX_PREF(Live, "apz.test.fails_with_native_injection", APZTestFailsWithNativeInjection, bool, false);
335 118 : DECL_GFX_PREF(Live, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false);
336 7 : DECL_GFX_PREF(Live, "apz.touch_move_tolerance", APZTouchMoveTolerance, float, 0.0);
337 7 : DECL_GFX_PREF(Live, "apz.touch_start_tolerance", APZTouchStartTolerance, float, 1.0f/4.5f);
338 9 : DECL_GFX_PREF(Live, "apz.velocity_bias", APZVelocityBias, float, 0.0f);
339 7 : DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms", APZVelocityRelevanceTime, uint32_t, 150);
340 7 : DECL_GFX_PREF(Live, "apz.x_skate_highmem_adjust", APZXSkateHighMemAdjust, float, 0.0f);
341 7 : DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier", APZXSkateSizeMultiplier, float, 1.5f);
342 9 : DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier", APZXStationarySizeMultiplier, float, 3.0f);
343 7 : DECL_GFX_PREF(Live, "apz.y_skate_highmem_adjust", APZYSkateHighMemAdjust, float, 0.0f);
344 7 : DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier", APZYSkateSizeMultiplier, float, 2.5f);
345 9 : DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier", APZYStationarySizeMultiplier, float, 3.5f);
346 7 : DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms", APZZoomAnimationDuration, int32_t, 250);
347 7 : DECL_GFX_PREF(Live, "apz.scale_repaint_delay_ms", APZScaleRepaintDelay, int32_t, 500);
348 :
349 7 : DECL_GFX_PREF(Live, "browser.ui.scroll-toolbar-threshold", ToolbarScrollThreshold, int32_t, 10);
350 7 : DECL_GFX_PREF(Live, "browser.ui.zoom.force-user-scalable", ForceUserScalable, bool, false);
351 7 : DECL_GFX_PREF(Live, "browser.viewport.desktopWidth", DesktopViewportWidth, int32_t, 980);
352 :
353 7 : DECL_GFX_PREF(Live, "dom.ipc.plugins.asyncdrawing.enabled", PluginAsyncDrawingEnabled, bool, false);
354 11 : DECL_GFX_PREF(Live, "dom.meta-viewport.enabled", MetaViewportEnabled, bool, false);
355 13 : DECL_GFX_PREF(Once, "dom.vr.enabled", VREnabled, bool, false);
356 7 : DECL_GFX_PREF(Live, "dom.vr.autoactivate.enabled", VRAutoActivateEnabled, bool, false);
357 7 : DECL_GFX_PREF(Live, "dom.vr.controller_trigger_threshold", VRControllerTriggerThreshold, float, 0.1f);
358 7 : DECL_GFX_PREF(Live, "dom.vr.navigation.timeout", VRNavigationTimeout, int32_t, 1000);
359 6 : DECL_GFX_PREF(Once, "dom.vr.oculus.enabled", VROculusEnabled, bool, true);
360 7 : DECL_GFX_PREF(Live, "dom.vr.oculus.present.timeout", VROculusPresentTimeout, int32_t, 10000);
361 7 : DECL_GFX_PREF(Live, "dom.vr.oculus.quit.timeout", VROculusQuitTimeout, int32_t, 30000);
362 9 : DECL_GFX_PREF(Once, "dom.vr.openvr.enabled", VROpenVREnabled, bool, false);
363 9 : DECL_GFX_PREF(Once, "dom.vr.osvr.enabled", VROSVREnabled, bool, false);
364 7 : DECL_GFX_PREF(Live, "dom.vr.poseprediction.enabled", VRPosePredictionEnabled, bool, true);
365 7 : DECL_GFX_PREF(Live, "dom.vr.require-gesture", VRRequireGesture, bool, true);
366 7 : DECL_GFX_PREF(Live, "dom.vr.puppet.enabled", VRPuppetEnabled, bool, false);
367 7 : DECL_GFX_PREF(Live, "dom.vr.puppet.submitframe", VRPuppetSubmitFrame, uint32_t, 0);
368 7 : DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled", PointerEventsEnabled, bool, false);
369 7 : DECL_GFX_PREF(Live, "dom.w3c_touch_events.enabled", TouchEventsEnabled, int32_t, 0);
370 :
371 7 : DECL_GFX_PREF(Live, "general.smoothScroll", SmoothScrollEnabled, bool, true);
372 7 : DECL_GFX_PREF(Live, "general.smoothScroll.currentVelocityWeighting",
373 : SmoothScrollCurrentVelocityWeighting, float, 0.25);
374 7 : DECL_GFX_PREF(Live, "general.smoothScroll.durationToIntervalRatio",
375 : SmoothScrollDurationToIntervalRatio, int32_t, 200);
376 7 : DECL_GFX_PREF(Live, "general.smoothScroll.lines", LineSmoothScrollEnabled, bool, true);
377 7 : DECL_GFX_PREF(Live, "general.smoothScroll.lines.durationMaxMS",
378 : LineSmoothScrollMaxDurationMs, int32_t, 150);
379 7 : DECL_GFX_PREF(Live, "general.smoothScroll.lines.durationMinMS",
380 : LineSmoothScrollMinDurationMs, int32_t, 150);
381 7 : DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel", WheelSmoothScrollEnabled, bool, true);
382 7 : DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMaxMS",
383 : WheelSmoothScrollMaxDurationMs, int32_t, 400);
384 7 : DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMinMS",
385 : WheelSmoothScrollMinDurationMs, int32_t, 200);
386 7 : DECL_GFX_PREF(Live, "general.smoothScroll.other.durationMaxMS",
387 : OtherSmoothScrollMaxDurationMs, int32_t, 150);
388 7 : DECL_GFX_PREF(Live, "general.smoothScroll.other.durationMinMS",
389 : OtherSmoothScrollMinDurationMs, int32_t, 150);
390 7 : DECL_GFX_PREF(Live, "general.smoothScroll.pages", PageSmoothScrollEnabled, bool, true);
391 7 : DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMaxMS",
392 : PageSmoothScrollMaxDurationMs, int32_t, 150);
393 7 : DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMinMS",
394 : PageSmoothScrollMinDurationMs, int32_t, 150);
395 7 : DECL_GFX_PREF(Live, "general.smoothScroll.pixels", PixelSmoothScrollEnabled, bool, true);
396 7 : DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMaxMS",
397 : PixelSmoothScrollMaxDurationMs, int32_t, 150);
398 7 : DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMinMS",
399 : PixelSmoothScrollMinDurationMs, int32_t, 150);
400 7 : DECL_GFX_PREF(Live, "general.smoothScroll.stopDecelerationWeighting",
401 : SmoothScrollStopDecelerationWeighting, float, 0.4f);
402 :
403 9 : DECL_GFX_PREF(Once, "gfx.android.rgb16.force", AndroidRGB16Force, bool, false);
404 : #if defined(ANDROID)
405 : DECL_GFX_PREF(Once, "gfx.apitrace.enabled", UseApitrace, bool, false);
406 : #endif
407 : #if defined(RELEASE_OR_BETA)
408 : // "Skip" means this is locked to the default value in beta and release.
409 : DECL_GFX_PREF(Skip, "gfx.blocklist.all", BlocklistAll, int32_t, 0);
410 : #else
411 56 : DECL_GFX_PREF(Once, "gfx.blocklist.all", BlocklistAll, int32_t, 0);
412 : #endif
413 7 : DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_calls", CanvasAutoAccelerateMinCalls, int32_t, 4);
414 7 : DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_frames", CanvasAutoAccelerateMinFrames, int32_t, 30);
415 7 : DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_seconds", CanvasAutoAccelerateMinSeconds, float, 5.0f);
416 10 : DECL_GFX_PREF(Live, "gfx.canvas.azure.accelerated", CanvasAzureAccelerated, bool, false);
417 6 : DECL_GFX_PREF(Once, "gfx.canvas.azure.accelerated.limit", CanvasAzureAcceleratedLimit, int32_t, 0);
418 : // 0x7fff is the maximum supported xlib surface size and is more than enough for canvases.
419 7 : DECL_GFX_PREF(Live, "gfx.canvas.max-size", MaxCanvasSize, int32_t, 0x7fff);
420 6 : DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);
421 6 : DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
422 6 : DECL_GFX_PREF(Once, "gfx.canvas.skiagl.dynamic-cache", CanvasSkiaGLDynamicCache, bool, false);
423 :
424 9 : DECL_GFX_PREF(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
425 9 : DECL_GFX_PREF(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
426 : // The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
427 38 : DECL_GFX_PREF(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
428 123 : DECL_GFX_PREF(Live, "gfx.content.always-paint", AlwaysPaint, bool, false);
429 : // Size in megabytes
430 9 : DECL_GFX_PREF(Once, "gfx.content.skia-font-cache-size", SkiaContentFontCacheSize, int32_t, 10);
431 :
432 6 : DECL_GFX_PREF(Once, "gfx.device-reset.limit", DeviceResetLimitCount, int32_t, 10);
433 6 : DECL_GFX_PREF(Once, "gfx.device-reset.threshold-ms", DeviceResetThresholdMilliseconds, int32_t, -1);
434 :
435 9 : DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
436 9 : DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
437 7 : DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device", Direct3D11ReuseDecoderDevice, int32_t, -1);
438 7 : DECL_GFX_PREF(Live, "gfx.direct3d11.allow-intel-mutex", Direct3D11AllowIntelMutex, bool, true);
439 7 : DECL_GFX_PREF(Live, "gfx.direct3d11.use-double-buffering", Direct3D11UseDoubleBuffering, bool, false);
440 7 : DECL_GFX_PREF(Live, "gfx.downloadable_fonts.keep_variation_tables", KeepVariationTables, bool, false);
441 7 : DECL_GFX_PREF(Live, "gfx.downloadable_fonts.otl_validation", ValidateOTLTables, bool, true);
442 61 : DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
443 6 : DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
444 121 : DECL_GFX_PREF(Live, "gfx.layerscope.enabled", LayerScopeEnabled, bool, false);
445 7 : DECL_GFX_PREF(Live, "gfx.layerscope.port", LayerScopePort, int32_t, 23456);
446 : // Note that "gfx.logging.level" is defined in Logging.h.
447 15 : DECL_GFX_PREF(Live, "gfx.logging.level", GfxLoggingLevel, int32_t, mozilla::gfx::LOG_DEFAULT);
448 9 : DECL_GFX_PREF(Once, "gfx.logging.crash.length", GfxLoggingCrashLength, uint32_t, 16);
449 135 : DECL_GFX_PREF(Live, "gfx.logging.painted-pixel-count.enabled",GfxLoggingPaintedPixelCountEnabled, bool, false);
450 : // The maximums here are quite conservative, we can tighten them if problems show up.
451 6 : DECL_GFX_PREF(Once, "gfx.logging.texture-usage.enabled", GfxLoggingTextureUsageEnabled, bool, false);
452 6 : DECL_GFX_PREF(Once, "gfx.logging.peak-texture-usage.enabled",GfxLoggingPeakTextureUsageEnabled, bool, false);
453 : // Use gfxPlatform::MaxAllocSize instead of the pref directly
454 9 : DECL_GFX_PREF(Once, "gfx.max-alloc-size", MaxAllocSizeDoNotUseDirectly, int32_t, (int32_t)500000000);
455 : // Use gfxPlatform::MaxTextureSize instead of the pref directly
456 165 : DECL_GFX_PREF(Once, "gfx.max-texture-size", MaxTextureSizeDoNotUseDirectly, int32_t, (int32_t)32767);
457 7 : DECL_GFX_PREF(Live, "gfx.partialpresent.force", PartialPresent, int32_t, 0);
458 7 : DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled", PerfWarnings, bool, false);
459 7 : DECL_GFX_PREF(Live, "gfx.SurfaceTexture.detach.enabled", SurfaceTextureDetachEnabled, bool, true);
460 7 : DECL_GFX_PREF(Live, "gfx.testing.device-reset", DeviceResetForTesting, int32_t, 0);
461 7 : DECL_GFX_PREF(Live, "gfx.testing.device-fail", DeviceFailForTesting, bool, false);
462 27 : DECL_GFX_PREF(Once, "gfx.text.disable-aa", DisableAllTextAA, bool, false);
463 7 : DECL_GFX_PREF(Live, "gfx.ycbcr.accurate-conversion", YCbCrAccurateConversion, bool, false);
464 :
465 : // Disable surface sharing due to issues with compatible FBConfigs on
466 : // NVIDIA drivers as described in bug 1193015.
467 7 : DECL_GFX_PREF(Live, "gfx.use-glx-texture-from-pixmap", UseGLXTextureFromPixmap, bool, false);
468 :
469 6 : DECL_GFX_PREF(Once, "gfx.use-iosurface-textures", UseIOSurfaceTextures, bool, false);
470 :
471 : // These times should be in milliseconds
472 6 : DECL_GFX_PREF(Once, "gfx.touch.resample.delay-threshold", TouchResampleVsyncDelayThreshold, int32_t, 20);
473 6 : DECL_GFX_PREF(Once, "gfx.touch.resample.max-predict", TouchResampleMaxPredict, int32_t, 8);
474 6 : DECL_GFX_PREF(Once, "gfx.touch.resample.min-delta", TouchResampleMinDelta, int32_t, 2);
475 6 : DECL_GFX_PREF(Once, "gfx.touch.resample.old-touch-threshold",TouchResampleOldTouchThreshold, int32_t, 17);
476 6 : DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust", TouchVsyncSampleAdjust, int32_t, 5);
477 :
478 36 : DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms", CollectScrollTransforms, bool, false);
479 129 : DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count", CompositorUnobserveCount, int32_t, 10);
480 7 : DECL_OVERRIDE_PREF(Live, "gfx.webrender.omta.enabled", WebRenderOMTAEnabled, gfxPrefs::OverrideBase_WebRender());
481 9 : DECL_GFX_PREF(Live, "gfx.webrender.profiler.enabled", WebRenderProfilerEnabled, bool, false);
482 51 : DECL_GFX_PREF(Live, "gfx.webrender.layers-free", WebRenderLayersFree, bool, false);
483 7 : DECL_GFX_PREF(Live, "gfx.webrendest.enabled", WebRendestEnabled, bool, false);
484 : // Use vsync events generated by hardware
485 6 : DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);
486 6 : DECL_GFX_PREF(Once, "gfx.screen-mirroring.enabled", ScreenMirroringEnabled, bool, false);
487 :
488 7 : DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist", IgnoreDXInterop2Blacklist, bool, false);
489 7 : DECL_GFX_PREF(Live, "gl.msaa-level", MSAALevel, uint32_t, 2);
490 : #if defined(XP_MACOSX)
491 : DECL_GFX_PREF(Live, "gl.multithreaded", GLMultithreaded, bool, false);
492 : #endif
493 7 : DECL_GFX_PREF(Live, "gl.require-hardware", RequireHardwareGL, bool, false);
494 7 : DECL_GFX_PREF(Live, "gl.use-tls-is-current", UseTLSIsCurrent, int32_t, 0);
495 :
496 9 : DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024);
497 9 : DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500);
498 48 : DECL_GFX_PREF(Live, "image.decode-immediately.enabled", ImageDecodeImmediatelyEnabled, bool, false);
499 99 : DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
500 7 : DECL_GFX_PREF(Live, "image.infer-src-animation.threshold-ms", ImageInferSrcAnimationThresholdMS, uint32_t, 2000);
501 9 : DECL_GFX_PREF(Once, "image.mem.decode_bytes_at_a_time", ImageMemDecodeBytesAtATime, uint32_t, 200000);
502 48 : DECL_GFX_PREF(Live, "image.mem.discardable", ImageMemDiscardable, bool, false);
503 42 : DECL_GFX_PREF(Once, "image.mem.animated.discardable", ImageMemAnimatedDiscardable, bool, false);
504 21 : DECL_GFX_PREF(Live, "image.mem.shared", ImageMemShared, bool, false);
505 9 : DECL_GFX_PREF(Once, "image.mem.surfacecache.discard_factor", ImageMemSurfaceCacheDiscardFactor, uint32_t, 1);
506 9 : DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb", ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
507 9 : DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
508 9 : DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor", ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
509 9 : DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
510 :
511 9 : DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabledDoNotUseDirectly, bool, false);
512 508 : DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
513 7 : DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
514 7 : DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
515 13 : DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
516 162 : DECL_OVERRIDE_PREF(Live, "layers.advanced.background-color", LayersAllowBackgroundColorLayers, gfxPrefs::OverrideBase_WebRender());
517 199 : DECL_OVERRIDE_PREF(Live, "layers.advanced.background-image", LayersAllowBackgroundImage, gfxPrefs::OverrideBase_WebRendest());
518 832 : DECL_GFX_PREF(Live, "layers.advanced.basic-layer.enabled", LayersAdvancedBasicLayerEnabled, bool, false);
519 186 : DECL_OVERRIDE_PREF(Live, "layers.advanced.border-layers", LayersAllowBorderLayers, gfxPrefs::OverrideBase_WebRendest());
520 31 : DECL_OVERRIDE_PREF(Live, "layers.advanced.boxshadow-inset-layers", LayersAllowInsetBoxShadow, gfxPrefs::OverrideBase_WebRender());
521 55 : DECL_OVERRIDE_PREF(Live, "layers.advanced.boxshadow-outer-layers", LayersAllowOuterBoxShadow, gfxPrefs::OverrideBase_WebRender());
522 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.bullet-layers", LayersAllowBulletLayers, gfxPrefs::OverrideBase_WebRender());
523 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.button-foreground-layers", LayersAllowButtonForegroundLayers, gfxPrefs::OverrideBase_WebRender());
524 9 : DECL_OVERRIDE_PREF(Live, "layers.advanced.canvas-background-color", LayersAllowCanvasBackgroundColorLayers, gfxPrefs::OverrideBase_WebRender());
525 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.caret-layers", LayersAllowCaretLayers, gfxPrefs::OverrideBase_WebRender());
526 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.columnRule-layers", LayersAllowColumnRuleLayers, gfxPrefs::OverrideBase_WebRender());
527 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.displaybuttonborder-layers", LayersAllowDisplayButtonBorder, gfxPrefs::OverrideBase_WebRender());
528 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.filter-layers", LayersAllowFilterLayers, gfxPrefs::OverrideBase_WebRender());
529 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.image-layers", LayersAllowImageLayers, gfxPrefs::OverrideBase_WebRender());
530 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.outline-layers", LayersAllowOutlineLayers, gfxPrefs::OverrideBase_WebRender());
531 33 : DECL_OVERRIDE_PREF(Live, "layers.advanced.solid-color", LayersAllowSolidColorLayers, gfxPrefs::OverrideBase_WebRender());
532 7 : DECL_OVERRIDE_PREF(Live, "layers.advanced.table", LayersAllowTable, gfxPrefs::OverrideBase_WebRendest());
533 80 : DECL_OVERRIDE_PREF(Live, "layers.advanced.text-layers", LayersAllowTextLayers, gfxPrefs::OverrideBase_WebRendest());
534 9 : DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
535 655 : DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
536 6 : DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
537 7 : DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);
538 83 : DECL_GFX_PREF(Once, "layers.bufferrotation.enabled", BufferRotationEnabled, bool, true);
539 7 : DECL_GFX_PREF(Live, "layers.child-process-shutdown", ChildProcessShutdown, bool, true);
540 : #ifdef MOZ_GFX_OPTIMIZE_MOBILE
541 : // If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
542 : // and ignore the preference.
543 : DECL_GFX_PREF(Skip, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, false);
544 : #else
545 : // If MOZ_GFX_OPTIMIZE_MOBILE is not defined, we actually take the
546 : // preference value, defaulting to true.
547 6 : DECL_GFX_PREF(Once, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, true);
548 : #endif
549 7 : DECL_GFX_PREF(Live, "layers.composer2d.enabled", Composer2DCompositionEnabled, bool, false);
550 9 : DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
551 7 : DECL_GFX_PREF(Live, "layers.deaa.enabled", LayersDEAAEnabled, bool, false);
552 36 : DECL_GFX_PREF(Live, "layers.draw-bigimage-borders", DrawBigImageBorders, bool, false);
553 36 : DECL_GFX_PREF(Live, "layers.draw-borders", DrawLayerBorders, bool, false);
554 36 : DECL_GFX_PREF(Live, "layers.draw-tile-borders", DrawTileBorders, bool, false);
555 148 : DECL_GFX_PREF(Live, "layers.draw-layer-info", DrawLayerInfo, bool, false);
556 34 : DECL_GFX_PREF(Live, "layers.dump", LayersDump, bool, false);
557 7 : DECL_GFX_PREF(Live, "layers.dump-texture", LayersDumpTexture, bool, false);
558 : #ifdef MOZ_DUMP_PAINTING
559 51 : DECL_GFX_PREF(Live, "layers.dump-client-layers", DumpClientLayers, bool, false);
560 2983 : DECL_GFX_PREF(Live, "layers.dump-decision", LayersDumpDecision, bool, false);
561 36 : DECL_GFX_PREF(Live, "layers.dump-host-layers", DumpHostLayers, bool, false);
562 : #endif
563 :
564 : // 0 is "no change" for contrast, positive values increase it, negative values
565 : // decrease it until we hit mid gray at -1 contrast, after that it gets weird.
566 34 : DECL_GFX_PREF(Live, "layers.effect.contrast", LayersEffectContrast, float, 0.0f);
567 34 : DECL_GFX_PREF(Live, "layers.effect.grayscale", LayersEffectGrayscale, bool, false);
568 34 : DECL_GFX_PREF(Live, "layers.effect.invert", LayersEffectInvert, bool, false);
569 287 : DECL_GFX_PREF(Once, "layers.enable-tiles", LayersTilesEnabled, bool, false);
570 36 : DECL_GFX_PREF(Live, "layers.flash-borders", FlashLayerBorders, bool, false);
571 9 : DECL_GFX_PREF(Once, "layers.force-shmem-tiles", ForceShmemTiles, bool, false);
572 6 : DECL_GFX_PREF(Once, "layers.gpu-process.allow-software", GPUProcessAllowSoftware, bool, false);
573 7 : DECL_GFX_PREF(Once, "layers.gpu-process.enabled", GPUProcessEnabled, bool, false);
574 7 : DECL_GFX_PREF(Once, "layers.gpu-process.force-enabled", GPUProcessForceEnabled, bool, false);
575 6 : DECL_GFX_PREF(Once, "layers.gpu-process.ipc_reply_timeout_ms", GPUProcessIPCReplyTimeoutMs, int32_t, 10000);
576 7 : DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts", GPUProcessMaxRestarts, int32_t, 1);
577 : // Note: This pref will only be used if it is less than layers.gpu-process.max_restarts.
578 7 : DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts_with_decoder", GPUProcessMaxRestartsWithDecoder, int32_t, 0);
579 6 : DECL_GFX_PREF(Once, "layers.gpu-process.startup_timeout_ms", GPUProcessTimeoutMs, int32_t, 5000);
580 1294 : DECL_GFX_PREF(Live, "layers.low-precision-buffer", UseLowPrecisionBuffer, bool, false);
581 7 : DECL_GFX_PREF(Live, "layers.low-precision-opacity", LowPrecisionOpacity, float, 1.0f);
582 7 : DECL_GFX_PREF(Live, "layers.low-precision-resolution", LowPrecisionResolution, float, 0.25f);
583 246 : DECL_GFX_PREF(Live, "layers.max-active", MaxActiveLayers, int32_t, -1);
584 6 : DECL_GFX_PREF(Once, "layers.mlgpu.dev-enabled", AdvancedLayersEnabledDoNotUseDirectly, bool, false);
585 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-buffer-cache", AdvancedLayersEnableBufferCache, bool, true);
586 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-buffer-sharing", AdvancedLayersEnableBufferSharing, bool, true);
587 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-clear-view", AdvancedLayersEnableClearView, bool, true);
588 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-cpu-occlusion", AdvancedLayersEnableCPUOcclusion, bool, true);
589 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-depth-buffer", AdvancedLayersEnableDepthBuffer, bool, false);
590 7 : DECL_GFX_PREF(Live, "layers.mlgpu.enable-invalidation", AdvancedLayersUseInvalidation, bool, true);
591 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-on-windows7", AdvancedLayersEnableOnWindows7, bool, false);
592 6 : DECL_GFX_PREF(Once, "layers.mlgpu.enable-container-resizing", AdvancedLayersEnableContainerResizing, bool, true);
593 6 : DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
594 37 : DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
595 7 : DECL_GFX_PREF(Live, "layers.omtp.force-sync", LayersOMTPForceSync, bool, true);
596 7 : DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0);
597 6 : DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
598 9 : DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaint, bool, false);
599 7 : DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false);
600 7 : DECL_GFX_PREF(Live, "layers.single-tile.enabled", LayersSingleTileEnabled, bool, true);
601 6 : DECL_GFX_PREF(Once, "layers.stereo-video.enabled", StereoVideoEnabled, bool, false);
602 7 : DECL_GFX_PREF(Live, "layers.force-synchronous-resize", LayersForceSynchronousResize, bool, false);
603 :
604 : // We allow for configurable and rectangular tile size to avoid wasting memory on devices whose
605 : // screen size does not align nicely to the default tile size. Although layers can be any size,
606 : // they are often the same size as the screen, especially for width.
607 7 : DECL_GFX_PREF(Once, "layers.tile-width", LayersTileWidth, int32_t, 256);
608 7 : DECL_GFX_PREF(Once, "layers.tile-height", LayersTileHeight, int32_t, 256);
609 6 : DECL_GFX_PREF(Once, "layers.tile-initial-pool-size", LayersTileInitialPoolSize, uint32_t, (uint32_t)50);
610 6 : DECL_GFX_PREF(Once, "layers.tile-pool-unused-size", LayersTilePoolUnusedSize, uint32_t, (uint32_t)10);
611 6 : DECL_GFX_PREF(Once, "layers.tile-pool-shrink-timeout", LayersTilePoolShrinkTimeout, uint32_t, (uint32_t)50);
612 6 : DECL_GFX_PREF(Once, "layers.tile-pool-clear-timeout", LayersTilePoolClearTimeout, uint32_t, (uint32_t)5000);
613 7 : DECL_GFX_PREF(Once, "layers.tiles.adjust", LayersTilesAdjust, bool, true);
614 6 : DECL_GFX_PREF(Once, "layers.tiles.edge-padding", TileEdgePaddingEnabled, bool, true);
615 7 : DECL_GFX_PREF(Live, "layers.tiles.fade-in.enabled", LayerTileFadeInEnabled, bool, false);
616 7 : DECL_GFX_PREF(Live, "layers.tiles.fade-in.duration-ms", LayerTileFadeInDuration, uint32_t, 250);
617 7 : DECL_GFX_PREF(Live, "layers.transaction.warning-ms", LayerTransactionWarning, uint32_t, 200);
618 147 : DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
619 6 : DECL_GFX_PREF(Once, "layers.use-image-offscreen-surfaces", UseImageOffscreenSurfaces, bool, true);
620 12 : DECL_GFX_PREF(Live, "layers.draw-mask-debug", DrawMaskLayer, bool, false);
621 :
622 7 : DECL_GFX_PREF(Live, "layers.geometry.opengl.enabled", OGLLayerGeometry, bool, false);
623 95 : DECL_GFX_PREF(Live, "layers.geometry.basic.enabled", BasicLayerGeometry, bool, false);
624 7 : DECL_GFX_PREF(Live, "layers.geometry.d3d11.enabled", D3D11LayerGeometry, bool, false);
625 :
626 7 : DECL_GFX_PREF(Live, "layout.animation.prerender.partial", PartiallyPrerenderAnimatedContent, bool, false);
627 7 : DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-x", AnimationPrerenderViewportRatioLimitX, float, 1.125f);
628 7 : DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-y", AnimationPrerenderViewportRatioLimitY, float, 1.125f);
629 7 : DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-x", AnimationPrerenderAbsoluteLimitX, uint32_t, 4096);
630 7 : DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-y", AnimationPrerenderAbsoluteLimitY, uint32_t, 4096);
631 :
632 7 : DECL_GFX_PREF(Live, "layout.css.scroll-behavior.damping-ratio", ScrollBehaviorDampingRatio, float, 1.0f);
633 7 : DECL_GFX_PREF(Live, "layout.css.scroll-behavior.enabled", ScrollBehaviorEnabled, bool, true);
634 7 : DECL_GFX_PREF(Live, "layout.css.scroll-behavior.spring-constant", ScrollBehaviorSpringConstant, float, 250.0f);
635 7 : DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-max-velocity", ScrollSnapPredictionMaxVelocity, int32_t, 2000);
636 7 : DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f);
637 7 : DECL_GFX_PREF(Live, "layout.css.scroll-snap.proximity-threshold", ScrollSnapProximityThreshold, int32_t, 200);
638 12 : DECL_GFX_PREF(Live, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
639 442 : DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
640 442 : DECL_GFX_PREF(Live, "layout.display-list.dump-content", LayoutDumpDisplayListContent, bool, false);
641 3427 : DECL_GFX_PREF(Live, "layout.event-regions.enabled", LayoutEventRegionsEnabledDoNotUseDirectly, bool, false);
642 11 : DECL_GFX_PREF(Once, "layout.frame_rate", LayoutFrameRate, int32_t, -1);
643 7 : DECL_GFX_PREF(Live, "layout.min-active-layer-size", LayoutMinActiveLayerSize, int, 64);
644 90 : DECL_GFX_PREF(Once, "layout.paint_rects_separately", LayoutPaintRectsSeparately, bool, true);
645 :
646 : // This and code dependent on it should be removed once containerless scrolling looks stable.
647 569 : DECL_GFX_PREF(Once, "layout.scroll.root-frame-containers", LayoutUseContainersForRootFrames, bool, true);
648 : // This pref is to be set by test code only.
649 7 : DECL_GFX_PREF(Live, "layout.scrollbars.always-layerize-track", AlwaysLayerizeScrollbarTrackTestOnly, bool, false);
650 127 : DECL_GFX_PREF(Live, "layout.smaller-painted-layers", LayoutSmallerPaintedLayers, bool, false);
651 :
652 6 : DECL_GFX_PREF(Once, "media.hardware-video-decoding.force-enabled",
653 : HardwareVideoDecodingForceEnabled, bool, false);
654 : #ifdef XP_WIN
655 : DECL_GFX_PREF(Live, "media.windows-media-foundation.allow-d3d11-dxva", PDMWMFAllowD3D11, bool, true);
656 : DECL_GFX_PREF(Live, "media.windows-media-foundation.max-dxva-videos", PDMWMFMaxDXVAVideos, uint32_t, 8);
657 : DECL_GFX_PREF(Live, "media.windows-media-foundation.use-nv12-format", PDMWMFUseNV12Format, bool, true);
658 : DECL_GFX_PREF(Once, "media.windows-media-foundation.use-sync-texture", PDMWMFUseSyncTexture, bool, true);
659 : DECL_GFX_PREF(Live, "media.wmf.low-latency.enabled", PDMWMFLowLatencyEnabled, bool, false);
660 : DECL_GFX_PREF(Live, "media.wmf.skip-blacklist", PDMWMFSkipBlacklist, bool, false);
661 : #endif
662 :
663 : // These affect how line scrolls from wheel events will be accelerated.
664 7 : DECL_GFX_PREF(Live, "mousewheel.acceleration.factor", MouseWheelAccelerationFactor, int32_t, -1);
665 7 : DECL_GFX_PREF(Live, "mousewheel.acceleration.start", MouseWheelAccelerationStart, int32_t, -1);
666 :
667 : // This affects whether events will be routed through APZ or not.
668 7 : DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.enabled",
669 : MouseWheelHasRootScrollDeltaOverride, bool, false);
670 7 : DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.horizontal.factor",
671 : MouseWheelRootScrollHorizontalFactor, int32_t, 0);
672 7 : DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.vertical.factor",
673 : MouseWheelRootScrollVerticalFactor, int32_t, 0);
674 7 : DECL_GFX_PREF(Live, "mousewheel.transaction.ignoremovedelay",MouseWheelIgnoreMoveDelayMs, int32_t, (int32_t)100);
675 7 : DECL_GFX_PREF(Live, "mousewheel.transaction.timeout", MouseWheelTransactionTimeoutMs, int32_t, (int32_t)1500);
676 :
677 34 : DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
678 :
679 6 : DECL_GFX_PREF(Once, "slider.snapMultiplier", SliderSnapMultiplier, int32_t, 0);
680 :
681 7 : DECL_GFX_PREF(Live, "test.events.async.enabled", TestEventsAsyncEnabled, bool, false);
682 7 : DECL_GFX_PREF(Live, "test.mousescroll", MouseScrollTestingEnabled, bool, false);
683 :
684 7 : DECL_GFX_PREF(Live, "toolkit.scrollbox.horizontalScrollDistance", ToolkitHorizontalScrollDistance, int32_t, 5);
685 7 : DECL_GFX_PREF(Live, "toolkit.scrollbox.verticalScrollDistance", ToolkitVerticalScrollDistance, int32_t, 3);
686 :
687 7 : DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 500);
688 :
689 : // WebGL (for pref access from Worker threads)
690 7 : DECL_GFX_PREF(Live, "webgl.all-angle-options", WebGLAllANGLEOptions, bool, false);
691 10 : DECL_GFX_PREF(Live, "webgl.angle.force-d3d11", WebGLANGLEForceD3D11, bool, false);
692 7 : DECL_GFX_PREF(Live, "webgl.angle.try-d3d11", WebGLANGLETryD3D11, bool, false);
693 10 : DECL_GFX_PREF(Live, "webgl.angle.force-warp", WebGLANGLEForceWARP, bool, false);
694 7 : DECL_GFX_PREF(Live, "webgl.bypass-shader-validation", WebGLBypassShaderValidator, bool, true);
695 7 : DECL_GFX_PREF(Live, "webgl.can-lose-context-in-foreground", WebGLCanLoseContextInForeground, bool, true);
696 7 : DECL_GFX_PREF(Live, "webgl.default-no-alpha", WebGLDefaultNoAlpha, bool, false);
697 10 : DECL_GFX_PREF(Live, "webgl.disable-angle", WebGLDisableANGLE, bool, false);
698 7 : DECL_GFX_PREF(Live, "webgl.disable-wgl", WebGLDisableWGL, bool, false);
699 7 : DECL_GFX_PREF(Live, "webgl.disable-extensions", WebGLDisableExtensions, bool, false);
700 10 : DECL_GFX_PREF(Live, "webgl.dxgl.enabled", WebGLDXGLEnabled, bool, false);
701 7 : DECL_GFX_PREF(Live, "webgl.dxgl.needs-finish", WebGLDXGLNeedsFinish, bool, false);
702 :
703 7 : DECL_GFX_PREF(Live, "webgl.disable-fail-if-major-performance-caveat",
704 : WebGLDisableFailIfMajorPerformanceCaveat, bool, false);
705 7 : DECL_GFX_PREF(Live, "webgl.disable-DOM-blit-uploads",
706 : WebGLDisableDOMBlitUploads, bool, false);
707 :
708 10 : DECL_GFX_PREF(Live, "webgl.disabled", WebGLDisabled, bool, false);
709 :
710 7 : DECL_GFX_PREF(Live, "webgl.enable-draft-extensions", WebGLDraftExtensionsEnabled, bool, false);
711 7 : DECL_GFX_PREF(Live, "webgl.enable-privileged-extensions", WebGLPrivilegedExtensionsEnabled, bool, false);
712 7 : DECL_GFX_PREF(Live, "webgl.enable-webgl2", WebGL2Enabled, bool, true);
713 10 : DECL_GFX_PREF(Live, "webgl.force-enabled", WebGLForceEnabled, bool, false);
714 9 : DECL_GFX_PREF(Once, "webgl.force-layers-readback", WebGLForceLayersReadback, bool, false);
715 7 : DECL_GFX_PREF(Live, "webgl.force-index-validation", WebGLForceIndexValidation, bool, false);
716 7 : DECL_GFX_PREF(Live, "webgl.lose-context-on-memory-pressure", WebGLLoseContextOnMemoryPressure, bool, false);
717 7 : DECL_GFX_PREF(Live, "webgl.max-warnings-per-context", WebGLMaxWarningsPerContext, uint32_t, 32);
718 7 : DECL_GFX_PREF(Live, "webgl.min_capability_mode", WebGLMinCapabilityMode, bool, false);
719 10 : DECL_GFX_PREF(Live, "webgl.msaa-force", WebGLForceMSAA, bool, false);
720 7 : DECL_GFX_PREF(Live, "webgl.prefer-16bpp", WebGLPrefer16bpp, bool, false);
721 7 : DECL_GFX_PREF(Live, "webgl.restore-context-when-visible", WebGLRestoreWhenVisible, bool, true);
722 7 : DECL_GFX_PREF(Live, "webgl.allow-immediate-queries", WebGLImmediateQueries, bool, false);
723 7 : DECL_GFX_PREF(Live, "webgl.allow-fb-invalidation", WebGLFBInvalidation, bool, false);
724 :
725 7 : DECL_GFX_PREF(Live, "webgl.perf.max-warnings", WebGLMaxPerfWarnings, int32_t, 0);
726 7 : DECL_GFX_PREF(Live, "webgl.perf.max-acceptable-fb-status-invals", WebGLMaxAcceptableFBStatusInvals, int32_t, 0);
727 :
728 7 : DECL_GFX_PREF(Live, "webgl.webgl2-compat-mode", WebGL2CompatMode, bool, false);
729 7 : DECL_GFX_PREF(Live, "webrender.blob-images", WebRenderBlobImages, bool, false);
730 7 : DECL_GFX_PREF(Live, "webrender.highlight-painted-layers", WebRenderHighlightPaintedLayers, bool, false);
731 :
732 7 : DECL_GFX_PREF(Live, "widget.window-transforms.disabled", WindowTransformsDisabled, bool, false);
733 :
734 : // WARNING:
735 : // Please make sure that you've added your new preference to the list above in alphabetical order.
736 : // Please do not just append it to the end of the list.
737 :
738 : public:
739 : // Manage the singleton:
740 16453 : static gfxPrefs& GetSingleton()
741 : {
742 16453 : MOZ_ASSERT(!sInstanceHasBeenDestroyed, "Should never recreate a gfxPrefs instance!");
743 16453 : if (!sInstance) {
744 3 : sGfxPrefList = new nsTArray<Pref*>();
745 3 : sInstance = new gfxPrefs;
746 3 : sInstance->Init();
747 : }
748 16453 : MOZ_ASSERT(SingletonExists());
749 16453 : return *sInstance;
750 : }
751 : static void DestroySingleton();
752 : static bool SingletonExists();
753 :
754 : private:
755 : static gfxPrefs* sInstance;
756 : static bool sInstanceHasBeenDestroyed;
757 : static nsTArray<Pref*>* sGfxPrefList;
758 :
759 : private:
760 : // The constructor cannot access GetSingleton(), since sInstance (necessarily)
761 : // has not been assigned yet. Follow-up initialization that needs GetSingleton()
762 : // must be added to Init().
763 : void Init();
764 :
765 : static bool IsPrefsServiceAvailable();
766 : static bool IsParentProcess();
767 : // Creating these to avoid having to include Preferences.h in the .h
768 : static void PrefAddVarCache(bool*, const char*, bool);
769 : static void PrefAddVarCache(int32_t*, const char*, int32_t);
770 : static void PrefAddVarCache(uint32_t*, const char*, uint32_t);
771 : static void PrefAddVarCache(float*, const char*, float);
772 : static void PrefAddVarCache(std::string*, const char*, std::string);
773 : static bool PrefGet(const char*, bool);
774 : static int32_t PrefGet(const char*, int32_t);
775 : static uint32_t PrefGet(const char*, uint32_t);
776 : static float PrefGet(const char*, float);
777 : static std::string PrefGet(const char*, std::string);
778 : static void PrefSet(const char* aPref, bool aValue);
779 : static void PrefSet(const char* aPref, int32_t aValue);
780 : static void PrefSet(const char* aPref, uint32_t aValue);
781 : static void PrefSet(const char* aPref, float aValue);
782 : static void PrefSet(const char* aPref, std::string aValue);
783 : static void WatchChanges(const char* aPrefname, Pref* aPref);
784 : static void UnwatchChanges(const char* aPrefname, Pref* aPref);
785 : // Creating these to avoid having to include PGPU.h in the .h
786 : static void CopyPrefValue(const bool* aValue, GfxPrefValue* aOutValue);
787 : static void CopyPrefValue(const int32_t* aValue, GfxPrefValue* aOutValue);
788 : static void CopyPrefValue(const uint32_t* aValue, GfxPrefValue* aOutValue);
789 : static void CopyPrefValue(const float* aValue, GfxPrefValue* aOutValue);
790 : static void CopyPrefValue(const std::string* aValue, GfxPrefValue* aOutValue);
791 : static void CopyPrefValue(const GfxPrefValue* aValue, bool* aOutValue);
792 : static void CopyPrefValue(const GfxPrefValue* aValue, int32_t* aOutValue);
793 : static void CopyPrefValue(const GfxPrefValue* aValue, uint32_t* aOutValue);
794 : static void CopyPrefValue(const GfxPrefValue* aValue, float* aOutValue);
795 : static void CopyPrefValue(const GfxPrefValue* aValue, std::string* aOutValue);
796 :
797 : static void AssertMainThread();
798 :
799 : // Some wrapper functions for the DECL_OVERRIDE_PREF prefs' base values, so
800 : // that we don't to include all sorts of header files into this gfxPrefs.h
801 : // file.
802 : static bool OverrideBase_WebRender();
803 : static bool OverrideBase_WebRendest();
804 :
805 : gfxPrefs();
806 : ~gfxPrefs();
807 : gfxPrefs(const gfxPrefs&) = delete;
808 : gfxPrefs& operator=(const gfxPrefs&) = delete;
809 : };
810 :
811 : #undef DECL_GFX_PREF /* Don't need it outside of this file */
812 :
813 : #endif /* GFX_PREFS_H */
|