2014-02-13 21:38:40 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef GFX_PREFS_H
|
|
|
|
#define GFX_PREFS_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "mozilla/Assertions.h"
|
2014-09-06 04:07:52 +04:00
|
|
|
#include "mozilla/Constants.h" // for M_PI
|
2014-02-13 21:38:40 +04:00
|
|
|
#include "mozilla/TypedEnum.h"
|
|
|
|
|
2014-03-04 21:26:33 +04:00
|
|
|
// First time gfxPrefs::GetSingleton() needs to be called on the main thread,
|
2014-02-13 21:38:40 +04:00
|
|
|
// before any of the methods accessing the values are used, but after
|
|
|
|
// the Preferences system has been initialized.
|
|
|
|
|
|
|
|
// The static methods to access the preference value are safe to call
|
|
|
|
// from any thread after that first call.
|
|
|
|
|
|
|
|
// To register a preference, you need to add a line in this file using
|
2014-02-23 03:53:04 +04:00
|
|
|
// the DECL_GFX_PREF macro.
|
2014-02-13 21:38:40 +04:00
|
|
|
//
|
|
|
|
// Update argument controls whether we read the preference value and save it
|
|
|
|
// or connect with a callback. See UpdatePolicy enum below.
|
|
|
|
// Pref is the string with the preference name.
|
|
|
|
// Name argument is the name of the static function to create.
|
|
|
|
// Type is the type of the preference - bool, int32_t, uint32_t.
|
|
|
|
// Default is the default value for the preference.
|
|
|
|
//
|
|
|
|
// For example this line in the .h:
|
2014-02-23 03:53:04 +04:00
|
|
|
// DECL_GFX_PREF(Once,"layers.dump",LayersDump,bool,false);
|
2014-02-13 21:38:40 +04:00
|
|
|
// means that you can call
|
|
|
|
// bool var = gfxPrefs::LayersDump();
|
|
|
|
// from any thread, but that you will only get the preference value of
|
2014-07-11 16:25:12 +04:00
|
|
|
// "layers.dump" as it was set at the start of the session (subject to
|
|
|
|
// note 2 below). If the value was not set, the default would be false.
|
2014-02-13 21:38:40 +04:00
|
|
|
//
|
|
|
|
// In another example, this line in the .h:
|
2014-02-23 03:53:04 +04:00
|
|
|
// DECL_GFX_PREF(Live,"gl.msaa-level",MSAALevel,uint32_t,2);
|
2014-02-13 21:38:40 +04:00
|
|
|
// means that every time you call
|
|
|
|
// uint32_t var = gfxPrefs::MSAALevel();
|
|
|
|
// from any thread, you will get the most up to date preference value of
|
|
|
|
// "gl.msaa-level". If the value is not set, the default would be 2.
|
|
|
|
|
2014-07-11 16:25:12 +04:00
|
|
|
// Note 1: Changing a preference from Live to Once is now as simple
|
2014-02-13 21:38:40 +04:00
|
|
|
// as changing the Update argument. If your code worked before, it will
|
|
|
|
// keep working, and behave as if the user never changes the preference.
|
|
|
|
// Things are a bit more complicated and perhaps even dangerous when
|
|
|
|
// going from Once to Live, or indeed setting a preference to be Live
|
|
|
|
// in the first place, so be careful. You need to be ready for the
|
|
|
|
// values changing mid execution, and if you're using those preferences
|
|
|
|
// in any setup and initialization, you may need to do extra work.
|
|
|
|
|
2014-07-11 16:25:12 +04:00
|
|
|
// Note 2: Prefs can be set by using the corresponding Set method. For
|
|
|
|
// example, if the accessor is Foo() then calling SetFoo(...) will update
|
|
|
|
// the preference and also change the return value of subsequent Foo() calls.
|
|
|
|
// This is true even for 'Once' prefs which otherwise do not change if the
|
|
|
|
// pref is updated after initialization.
|
|
|
|
|
2014-02-23 03:53:04 +04:00
|
|
|
#define DECL_GFX_PREF(Update, Pref, Name, Type, Default) \
|
2014-02-13 21:38:40 +04:00
|
|
|
public: \
|
2014-03-04 21:26:33 +04:00
|
|
|
static Type Name() { MOZ_ASSERT(SingletonExists()); return GetSingleton().mPref##Name.mValue; } \
|
2014-07-11 16:25:12 +04:00
|
|
|
static void Set##Name(Type aVal) { MOZ_ASSERT(SingletonExists()); \
|
|
|
|
GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal); } \
|
2014-02-13 21:38:40 +04:00
|
|
|
private: \
|
|
|
|
static const char* Get##Name##PrefName() { return Pref; } \
|
2014-03-03 20:53:21 +04:00
|
|
|
static Type Get##Name##PrefDefault() { return Default; } \
|
|
|
|
PrefTemplate<UpdatePolicy::Update, Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
class gfxPrefs;
|
|
|
|
class gfxPrefs MOZ_FINAL
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
// Enums for the update policy.
|
|
|
|
MOZ_BEGIN_NESTED_ENUM_CLASS(UpdatePolicy)
|
|
|
|
Skip, // Set the value to default, skip any Preferences calls
|
|
|
|
Once, // Evaluate the preference once, unchanged during the session
|
|
|
|
Live // Evaluate the preference and set callback so it stays current/live
|
|
|
|
MOZ_END_NESTED_ENUM_CLASS(UpdatePolicy)
|
|
|
|
|
|
|
|
// Since we cannot use const char*, use a function that returns it.
|
2014-03-03 20:53:21 +04:00
|
|
|
template <MOZ_ENUM_CLASS_ENUM_TYPE(UpdatePolicy) Update, class T, T Default(void), const char* Pref(void)>
|
2014-02-13 21:38:40 +04:00
|
|
|
class PrefTemplate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PrefTemplate()
|
2014-03-03 20:53:21 +04:00
|
|
|
: mValue(Default())
|
2014-02-13 21:38:40 +04:00
|
|
|
{
|
|
|
|
Register(Update, Pref());
|
|
|
|
}
|
|
|
|
void Register(UpdatePolicy aUpdate, const char* aPreference)
|
|
|
|
{
|
2014-07-11 16:25:12 +04:00
|
|
|
AssertMainThread();
|
2014-02-13 21:38:40 +04:00
|
|
|
switch(aUpdate) {
|
|
|
|
case UpdatePolicy::Skip:
|
|
|
|
break;
|
|
|
|
case UpdatePolicy::Once:
|
|
|
|
mValue = PrefGet(aPreference, mValue);
|
|
|
|
break;
|
|
|
|
case UpdatePolicy::Live:
|
|
|
|
PrefAddVarCache(&mValue,aPreference, mValue);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_CRASH();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-07-11 16:25:12 +04:00
|
|
|
void Set(UpdatePolicy aUpdate, const char* aPref, T aValue)
|
|
|
|
{
|
|
|
|
AssertMainThread();
|
|
|
|
PrefSet(aPref, aValue);
|
|
|
|
switch (aUpdate) {
|
|
|
|
case UpdatePolicy::Skip:
|
|
|
|
case UpdatePolicy::Live:
|
|
|
|
break;
|
|
|
|
case UpdatePolicy::Once:
|
|
|
|
mValue = PrefGet(aPref, mValue);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_CRASH();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-02-13 21:38:40 +04:00
|
|
|
T mValue;
|
|
|
|
};
|
|
|
|
|
2014-02-23 03:53:04 +04:00
|
|
|
// This is where DECL_GFX_PREF for each of the preferences should go.
|
2014-02-13 21:38:40 +04:00
|
|
|
// We will keep these in an alphabetical order to make it easier to see if
|
|
|
|
// a method accessing a pref already exists. Just add yours in the list.
|
|
|
|
|
2014-03-31 09:05:38 +04:00
|
|
|
// The apz prefs are explained in AsyncPanZoomController.cpp
|
2014-08-13 00:05:22 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.allow_checkerboarding", APZAllowCheckerboarding, bool, true);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.asyncscroll.throttle", APZAsyncScrollThrottleTime, int32_t, 100);
|
|
|
|
DECL_GFX_PREF(Live, "apz.asyncscroll.timeout", APZAsyncScrollTimeout, int32_t, 300);
|
2014-09-06 04:07:52 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.mode", APZAxisLockMode, int32_t, 0);
|
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle", APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
|
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold", APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle", APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
|
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle", APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.content_response_timeout", APZContentResponseTimeout, int32_t, 300);
|
|
|
|
DECL_GFX_PREF(Live, "apz.cross_slide.enabled", APZCrossSlideEnabled, bool, false);
|
2014-06-24 04:54:32 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.danger_zone_x", APZDangerZoneX, int32_t, 50);
|
|
|
|
DECL_GFX_PREF(Live, "apz.danger_zone_y", APZDangerZoneY, int32_t, 100);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.enlarge_displayport_when_clipped", APZEnlargeDisplayPortWhenClipped, bool, false);
|
2014-04-29 17:45:13 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_accel_interval_ms", APZFlingAccelInterval, int32_t, 500);
|
|
|
|
DECL_GFX_PREF(Live, "apz.fling_accel_base_mult", APZFlingAccelBaseMultiplier, float, 1.0f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.fling_accel_supplemental_mult", APZFlingAccelSupplementalMultiplier, float, 1.0f);
|
2014-03-03 20:53:21 +04:00
|
|
|
DECL_GFX_PREF(Once, "apz.fling_friction", APZFlingFriction, float, 0.002f);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_repaint_interval", APZFlingRepaintInterval, int32_t, 75);
|
2014-06-27 02:37:44 +04:00
|
|
|
DECL_GFX_PREF(Once, "apz.fling_stop_on_tap_threshold", APZFlingStopOnTapThreshold, float, 0.05f);
|
2014-03-03 20:53:21 +04:00
|
|
|
DECL_GFX_PREF(Once, "apz.fling_stopped_threshold", APZFlingStoppedThreshold, float, 0.01f);
|
2014-03-14 23:55:07 +04:00
|
|
|
DECL_GFX_PREF(Once, "apz.max_velocity_inches_per_ms", APZMaxVelocity, float, -1.0f);
|
2014-03-03 20:53:21 +04:00
|
|
|
DECL_GFX_PREF(Once, "apz.max_velocity_queue_size", APZMaxVelocityQueueSize, uint32_t, 5);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.min_skate_speed", APZMinSkateSpeed, float, 1.0f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.num_paint_duration_samples", APZNumPaintDurationSamples, int32_t, 3);
|
2014-05-22 01:20:12 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.enabled", APZOverscrollEnabled, bool, false);
|
2014-06-05 23:16:14 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.fling_friction", APZOverscrollFlingFriction, float, 0.02f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.fling_stopped_threshold", APZOverscrollFlingStoppedThreshold, float, 0.4f);
|
2014-09-23 19:38:05 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.min_pan_distance_ratio", APZMinPanDistanceRatio, float, 1.0f);
|
2014-08-29 23:28:47 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.stretch_factor", APZOverscrollStretchFactor, float, 0.5f);
|
2014-06-03 21:59:35 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.snap_back.spring_stiffness", APZOverscrollSnapBackSpringStiffness, float, 0.6f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.snap_back.spring_friction", APZOverscrollSnapBackSpringFriction, float, 0.1f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.snap_back.mass", APZOverscrollSnapBackMass, float, 1000.0f);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.pan_repaint_interval", APZPanRepaintInterval, int32_t, 250);
|
2014-06-25 19:12:32 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.printtree", APZPrintTree, bool, false);
|
2014-07-10 22:52:40 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.smooth_scroll_repaint_interval", APZSmoothScrollRepaintInterval, int32_t, 75);
|
2014-04-02 20:40:00 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.subframe.enabled", APZSubframeEnabled, bool, false);
|
2014-05-29 20:51:28 +04:00
|
|
|
DECL_GFX_PREF(Once, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.touch_start_tolerance", APZTouchStartTolerance, float, 1.0f/4.5f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.use_paint_duration", APZUsePaintDuration, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "apz.velocity_bias", APZVelocityBias, float, 1.0f);
|
2014-05-27 19:45:03 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms", APZVelocityRelevanceTime, uint32_t, 150);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier", APZXSkateSizeMultiplier, float, 1.5f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier", APZXStationarySizeMultiplier, float, 3.0f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier", APZYSkateSizeMultiplier, float, 2.5f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier", APZYStationarySizeMultiplier, float, 3.5f);
|
2014-05-16 22:40:00 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms", APZZoomAnimationDuration, int32_t, 250);
|
2014-03-03 20:53:21 +04:00
|
|
|
|
2014-03-04 02:11:06 +04:00
|
|
|
DECL_GFX_PREF(Once, "gfx.android.rgb16.force", AndroidRGB16Force, bool, false);
|
2014-02-28 21:59:38 +04:00
|
|
|
#if defined(ANDROID)
|
|
|
|
DECL_GFX_PREF(Once, "gfx.apitrace.enabled", UseApitrace, bool, false);
|
|
|
|
#endif
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.canvas.azure.accelerated", CanvasAzureAccelerated, bool, false);
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.dynamic-cache", CanvasSkiaGLDynamicCache, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);
|
2014-02-27 06:53:32 +04:00
|
|
|
|
2014-03-06 01:25:09 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
|
|
|
|
// The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
|
|
|
|
DECL_GFX_PREF(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
|
|
|
|
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
|
2014-09-15 01:51:27 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.direct2d.use1_1", Direct2DUse1_1, bool, false);
|
2014-03-04 02:11:06 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.gralloc.fence-with-readpixels", GrallocFenceWithReadPixels, bool, false);
|
2014-02-28 21:59:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.layerscope.enabled", LayerScopeEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "gfx.layerscope.port", LayerScopePort, int32_t, 23456);
|
2014-05-08 02:09:41 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled", PerfWarnings, bool, false);
|
2014-02-23 03:53:04 +04:00
|
|
|
DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);
|
|
|
|
|
2014-05-09 00:49:01 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
|
|
|
|
|
2014-08-27 09:17:00 +04:00
|
|
|
// Use vsync events generated by hardware
|
|
|
|
DECL_GFX_PREF(Once, "gfx.frameuniformity.hw-vsync", FrameUniformityHWVsyncEnabled, bool, false);
|
2014-09-01 02:38:00 +04:00
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample", TouchResampling, bool, false);
|
|
|
|
// These times should be in nanoseconds
|
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.max-predict", TouchResampleMaxPredict, int32_t, 8000000);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust", TouchVsyncSampleAdjust, int32_t, 5000000);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.min-resample", TouchResampleMinTime, int32_t, 2000000);
|
2014-08-27 09:17:00 +04:00
|
|
|
|
2014-02-23 03:53:04 +04:00
|
|
|
DECL_GFX_PREF(Live, "gl.msaa-level", MSAALevel, uint32_t, 2);
|
|
|
|
|
2014-09-23 01:30:20 +04:00
|
|
|
DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500);
|
|
|
|
DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024);
|
|
|
|
DECL_GFX_PREF(Live, "image.high_quality_downscaling.enabled", ImageHQDownscalingEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "image.high_quality_downscaling.min_factor", ImageHQDownscalingMinFactor, uint32_t, 1000);
|
|
|
|
DECL_GFX_PREF(Live, "image.high_quality_upscaling.max_size", ImageHQUpscalingMaxSize, uint32_t, 20971520);
|
|
|
|
DECL_GFX_PREF(Live, "image.mem.decode_bytes_at_a_time", ImageMemDecodeBytesAtATime, uint32_t, 200000);
|
|
|
|
DECL_GFX_PREF(Live, "image.mem.decodeondraw", ImageMemDecodeOnDraw, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "image.mem.discardable", ImageMemDiscardable, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "image.mem.hard_limit_decoded_image_kb", ImageMemHardLimitDecodedImageKB, uint32_t, 0);
|
|
|
|
DECL_GFX_PREF(Live, "image.mem.max_decoded_image_kb", ImageMemMaxDecodedImageKB, uint32_t, 50*1024);
|
|
|
|
DECL_GFX_PREF(Live, "image.mem.max_ms_before_yield", ImageMemMaxMSBeforeYield, uint32_t, 400);
|
|
|
|
DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb", ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
|
|
|
|
DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
|
|
|
|
DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor", ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
|
|
|
|
DECL_GFX_PREF(Live, "image.mozsamplesize.enabled", ImageMozSampleSizeEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "image.multithreaded_decoding.enabled", ImageMTDecodingEnabled, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
|
|
|
|
|
2014-02-27 06:53:27 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabled, bool, false);
|
2014-03-04 21:26:33 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
|
2014-05-09 17:50:00 +04:00
|
|
|
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);
|
2014-02-27 06:53:27 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabled, bool, false);
|
2014-06-19 13:45:19 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.async-video.enabled", AsyncVideoEnabled, bool, true);
|
|
|
|
DECL_GFX_PREF(Once, "layers.async-video-oop.enabled", AsyncVideoOOPEnabled, bool, true);
|
2014-06-03 17:39:44 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabled, bool, false);
|
2014-05-21 21:29:49 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);
|
2014-02-27 06:53:27 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.bufferrotation.enabled", BufferRotationEnabled, bool, true);
|
|
|
|
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
|
|
|
// If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
|
|
|
|
// and ignore the preference.
|
|
|
|
DECL_GFX_PREF(Skip, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, false);
|
|
|
|
#else
|
|
|
|
// If MOZ_GFX_OPTIMIZE_MOBILE is not defined, we actually take the
|
|
|
|
// preference value, defaulting to true.
|
|
|
|
DECL_GFX_PREF(Once, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, true);
|
2014-02-27 06:52:54 +04:00
|
|
|
#endif
|
2014-02-27 06:53:31 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.draw-bigimage-borders", DrawBigImageBorders, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layers.draw-borders", DrawLayerBorders, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layers.draw-tile-borders", DrawTileBorders, bool, false);
|
2014-03-25 20:54:39 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.flash-borders", FlashLayerBorders, bool, false);
|
2014-03-12 06:27:33 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.draw-layer-info", DrawLayerInfo, bool, false);
|
2014-08-01 22:56:52 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.dump", LayersDump, bool, false);
|
2014-08-25 23:36:17 +04:00
|
|
|
|
|
|
|
// 0 is "no change" for contrast, positive values increase it, negative values
|
|
|
|
// decrease it until we hit mid gray at -1 contrast, after that it gets weird.
|
|
|
|
DECL_GFX_PREF(Live, "layers.effect.contrast", LayersEffectContrast, float, 0.0f);
|
|
|
|
DECL_GFX_PREF(Live, "layers.effect.grayscale", LayersEffectGrayscale, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layers.effect.invert", LayersEffectInvert, bool, false);
|
|
|
|
|
2014-09-17 21:55:23 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.enable-tiles", LayersTilesEnabledDoNotUseDirectly, bool, false);
|
2014-07-25 04:49:45 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.force-enable-tiles", LayersTilesForceEnabled, bool, false);
|
2014-03-08 01:34:04 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.force-per-tile-drawing", PerTileDrawing, bool, false);
|
2014-08-06 16:40:03 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.tiled-drawtarget.enabled", TiledDrawTargetEnabled, bool, false);
|
2014-04-04 21:42:44 +04:00
|
|
|
// We allow for configurable and rectangular tile size to avoid wasting memory on devices whose
|
|
|
|
// screen size does not align nicely to the default tile size. Although layers can be any size,
|
|
|
|
// they are often the same size as the screen, especially for width.
|
|
|
|
DECL_GFX_PREF(Once, "layers.tile-width", LayersTileWidth, int32_t, 256);
|
|
|
|
DECL_GFX_PREF(Once, "layers.tile-height", LayersTileHeight, int32_t, 256);
|
2014-07-25 23:49:47 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.tile-max-pool-size", LayersTileMaxPoolSize, uint32_t, (uint32_t)50);
|
|
|
|
DECL_GFX_PREF(Once, "layers.tile-shrink-pool-timeout", LayersTileShrinkPoolTimeout, uint32_t, (uint32_t)1000);
|
2014-03-08 01:34:04 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.overzealous-gralloc-unlocking", OverzealousGrallocUnlocking, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "layers.force-shmem-tiles", ForceShmemTiles, bool, false);
|
2014-02-27 06:53:31 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.frame-counter", DrawFrameCounter, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layers.low-precision-buffer", UseLowPrecisionBuffer, bool, false);
|
2014-05-21 20:06:02 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.low-precision-resolution", LowPrecisionResolution, float, 0.25f);
|
2014-06-23 20:00:18 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.low-precision-opacity", LowPrecisionOpacity, float, 1.0f);
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.enabled", LayersOffMainThreadCompositionEnabled, bool, false);
|
2014-02-27 06:52:54 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-enabled", LayersOffMainThreadCompositionForceEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.testing.enabled", LayersOffMainThreadCompositionTestingEnabled, bool, false);
|
2014-07-23 03:04:47 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.use-image-offscreen-surfaces", UseImageOffscreenSurfaces, bool, false);
|
2014-02-27 06:52:54 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0);
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
|
2014-02-27 06:53:31 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.progressive-paint", UseProgressiveTilePainting, bool, false);
|
2014-06-19 11:33:00 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
|
2014-02-27 06:52:54 +04:00
|
|
|
|
2014-06-12 21:50:54 +04:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.damping-ratio", ScrollBehaviorDampingRatio, float, 1.0f);
|
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.enabled", ScrollBehaviorEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.spring-constant", ScrollBehaviorSpringConstant, float, 250.0f);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Once, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
|
2014-02-27 06:52:54 +04:00
|
|
|
DECL_GFX_PREF(Once, "layout.frame_rate", LayoutFrameRate, int32_t, -1);
|
2014-05-04 04:35:47 +04:00
|
|
|
DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
|
2014-05-08 06:56:48 +04:00
|
|
|
DECL_GFX_PREF(Once, "layout.paint_rects_separately", LayoutPaintRectsSeparately, bool, true);
|
2014-02-27 06:52:54 +04:00
|
|
|
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
|
|
|
|
|
2014-03-11 20:10:50 +04:00
|
|
|
DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 500);
|
|
|
|
|
2014-02-28 21:59:37 +04:00
|
|
|
DECL_GFX_PREF(Once, "webgl.force-layers-readback", WebGLForceLayersReadback, bool, false);
|
|
|
|
|
2014-09-24 01:57:14 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.stereo-video.enabled", StereoVideoEnabled, bool, false);
|
2014-02-13 21:38:40 +04:00
|
|
|
public:
|
|
|
|
// Manage the singleton:
|
2014-03-04 21:26:33 +04:00
|
|
|
static gfxPrefs& GetSingleton()
|
2014-02-23 03:53:04 +04:00
|
|
|
{
|
2014-06-25 18:09:02 +04:00
|
|
|
MOZ_ASSERT(!sInstanceHasBeenDestroyed, "Should never recreate a gfxPrefs instance!");
|
2014-02-13 21:38:40 +04:00
|
|
|
if (!sInstance) {
|
|
|
|
sInstance = new gfxPrefs;
|
|
|
|
}
|
2014-06-25 18:09:02 +04:00
|
|
|
MOZ_ASSERT(SingletonExists());
|
2014-02-13 21:38:40 +04:00
|
|
|
return *sInstance;
|
|
|
|
}
|
2014-03-04 21:26:33 +04:00
|
|
|
static void DestroySingleton();
|
|
|
|
static bool SingletonExists();
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
static gfxPrefs* sInstance;
|
2014-06-25 18:09:02 +04:00
|
|
|
static bool sInstanceHasBeenDestroyed;
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Creating these to avoid having to include Preferences.h in the .h
|
|
|
|
static void PrefAddVarCache(bool*, const char*, bool);
|
|
|
|
static void PrefAddVarCache(int32_t*, const char*, int32_t);
|
|
|
|
static void PrefAddVarCache(uint32_t*, const char*, uint32_t);
|
2014-03-03 20:53:21 +04:00
|
|
|
static void PrefAddVarCache(float*, const char*, float);
|
2014-02-13 21:38:40 +04:00
|
|
|
static bool PrefGet(const char*, bool);
|
|
|
|
static int32_t PrefGet(const char*, int32_t);
|
|
|
|
static uint32_t PrefGet(const char*, uint32_t);
|
2014-03-03 20:53:21 +04:00
|
|
|
static float PrefGet(const char*, float);
|
2014-07-11 16:25:12 +04:00
|
|
|
static void PrefSet(const char* aPref, bool aValue);
|
|
|
|
static void PrefSet(const char* aPref, int32_t aValue);
|
|
|
|
static void PrefSet(const char* aPref, uint32_t aValue);
|
|
|
|
static void PrefSet(const char* aPref, float aValue);
|
|
|
|
|
|
|
|
static void AssertMainThread();
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
gfxPrefs();
|
|
|
|
~gfxPrefs();
|
|
|
|
gfxPrefs(const gfxPrefs&) MOZ_DELETE;
|
|
|
|
gfxPrefs& operator=(const gfxPrefs&) MOZ_DELETE;
|
|
|
|
};
|
|
|
|
|
2014-02-23 03:53:04 +04:00
|
|
|
#undef DECL_GFX_PREF /* Don't need it outside of this file */
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
#endif /* GFX_PREFS_H */
|