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
|
|
|
|
|
2015-11-28 07:49:55 +03:00
|
|
|
#include <cmath> // for M_PI
|
2014-02-13 21:38:40 +04:00
|
|
|
#include <stdint.h>
|
2016-11-23 04:38:02 +03:00
|
|
|
#include <string>
|
2014-02-13 21:38:40 +04:00
|
|
|
#include "mozilla/Assertions.h"
|
2016-06-27 09:33:18 +03:00
|
|
|
#include "mozilla/gfx/LoggingConstants.h"
|
2016-06-27 09:33:20 +03:00
|
|
|
#include "nsTArray.h"
|
2014-02-13 21:38:40 +04:00
|
|
|
|
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
|
2016-06-27 09:33:16 +03:00
|
|
|
// pref is updated after initialization. Changing gfxPrefs values in content
|
|
|
|
// processes will not affect the result in other processes. Changing gfxPrefs
|
|
|
|
// values in the GPU process is not supported at all.
|
2014-07-11 16:25:12 +04:00
|
|
|
|
2016-06-27 09:33:16 +03:00
|
|
|
#define DECL_GFX_PREF(Update, Prefname, 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; } \
|
2016-06-27 09:33:16 +03:00
|
|
|
static void Set##Name(Type aVal) { MOZ_ASSERT(SingletonExists()); \
|
2014-07-11 16:25:12 +04:00
|
|
|
GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal); } \
|
2016-06-27 09:33:16 +03:00
|
|
|
static const char* Get##Name##PrefName() { return Prefname; } \
|
2014-03-03 20:53:21 +04:00
|
|
|
static Type Get##Name##PrefDefault() { return Default; } \
|
2016-11-25 09:01:42 +03:00
|
|
|
static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) { \
|
|
|
|
MOZ_ASSERT(SingletonExists()); \
|
|
|
|
GetSingleton().mPref##Name.SetChangeCallback(aCallback); } \
|
2016-05-16 17:22:20 +03:00
|
|
|
private: \
|
2014-03-03 20:53:21 +04:00
|
|
|
PrefTemplate<UpdatePolicy::Update, Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
|
2014-02-13 21:38:40 +04:00
|
|
|
|
2016-06-27 09:33:20 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class GfxPrefValue; // defined in PGPU.ipdl
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-02-13 21:38:40 +04:00
|
|
|
class gfxPrefs;
|
2015-03-21 19:28:04 +03:00
|
|
|
class gfxPrefs final
|
2014-02-13 21:38:40 +04:00
|
|
|
{
|
2016-06-27 09:33:20 +03:00
|
|
|
typedef mozilla::gfx::GfxPrefValue GfxPrefValue;
|
|
|
|
|
2014-02-13 21:38:40 +04:00
|
|
|
private:
|
|
|
|
// Enums for the update policy.
|
2015-01-26 01:22:08 +03:00
|
|
|
enum class UpdatePolicy {
|
2014-02-13 21:38:40 +04:00
|
|
|
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
|
2015-01-26 01:22:08 +03:00
|
|
|
};
|
2014-02-13 21:38:40 +04:00
|
|
|
|
2016-06-27 09:33:16 +03:00
|
|
|
public:
|
|
|
|
class Pref
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Pref() : mChangeCallback(nullptr)
|
|
|
|
{
|
2016-06-27 09:33:20 +03:00
|
|
|
mIndex = sGfxPrefList->Length();
|
|
|
|
sGfxPrefList->AppendElement(this);
|
2016-06-27 09:33:16 +03:00
|
|
|
}
|
|
|
|
|
2016-06-27 09:33:20 +03:00
|
|
|
size_t Index() const { return mIndex; }
|
2016-06-27 09:33:16 +03:00
|
|
|
void OnChange();
|
|
|
|
|
2016-11-25 09:01:42 +03:00
|
|
|
typedef void (*ChangeCallback)(const GfxPrefValue&);
|
2016-06-27 09:33:16 +03:00
|
|
|
void SetChangeCallback(ChangeCallback aCallback);
|
|
|
|
|
|
|
|
virtual const char* Name() const = 0;
|
|
|
|
|
2016-06-27 09:33:20 +03:00
|
|
|
// Returns true if the value is default, false if changed.
|
|
|
|
virtual bool HasDefaultValue() const = 0;
|
|
|
|
|
2016-10-25 03:48:28 +03:00
|
|
|
// Returns the pref value as a discriminated union.
|
|
|
|
virtual void GetLiveValue(GfxPrefValue* aOutValue) const = 0;
|
|
|
|
|
2016-06-27 09:33:20 +03:00
|
|
|
// Returns the pref value as a discriminated union.
|
|
|
|
virtual void GetCachedValue(GfxPrefValue* aOutValue) const = 0;
|
|
|
|
|
|
|
|
// Change the cached value. GfxPrefValue must be a compatible type.
|
|
|
|
virtual void SetCachedValue(const GfxPrefValue& aOutValue) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void FireChangeCallback();
|
|
|
|
|
2016-06-27 09:33:16 +03:00
|
|
|
private:
|
2016-06-27 09:33:20 +03:00
|
|
|
size_t mIndex;
|
2016-06-27 09:33:16 +03:00
|
|
|
ChangeCallback mChangeCallback;
|
|
|
|
};
|
|
|
|
|
2016-06-27 09:33:20 +03:00
|
|
|
static const nsTArray<Pref*>& all() {
|
|
|
|
return *sGfxPrefList;
|
|
|
|
}
|
|
|
|
|
2016-06-27 09:33:16 +03:00
|
|
|
private:
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
// We split out a base class to reduce the number of virtual function
|
|
|
|
// instantiations that we do, which saves code size.
|
|
|
|
template<class T>
|
|
|
|
class TypedPref : public Pref
|
|
|
|
{
|
|
|
|
public:
|
2016-08-04 00:17:22 +03:00
|
|
|
explicit TypedPref(T aValue)
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
: mValue(aValue)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void GetCachedValue(GfxPrefValue* aOutValue) const override {
|
|
|
|
CopyPrefValue(&mValue, aOutValue);
|
|
|
|
}
|
|
|
|
void SetCachedValue(const GfxPrefValue& aOutValue) override {
|
|
|
|
// This is only used in non-XPCOM processes.
|
|
|
|
MOZ_ASSERT(!IsPrefsServiceAvailable());
|
|
|
|
|
|
|
|
T newValue;
|
|
|
|
CopyPrefValue(&aOutValue, &newValue);
|
|
|
|
|
|
|
|
if (mValue != newValue) {
|
|
|
|
mValue = newValue;
|
|
|
|
FireChangeCallback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2016-10-25 03:48:28 +03:00
|
|
|
T GetLiveValueByName(const char* aPrefName) const {
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
if (IsPrefsServiceAvailable()) {
|
|
|
|
return PrefGet(aPrefName, mValue);
|
|
|
|
}
|
|
|
|
return mValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
T mValue;
|
|
|
|
};
|
|
|
|
|
2014-02-13 21:38:40 +04:00
|
|
|
// Since we cannot use const char*, use a function that returns it.
|
2016-06-27 09:33:14 +03:00
|
|
|
template <UpdatePolicy Update, class T, T Default(void), const char* Prefname(void)>
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
class PrefTemplate final : public TypedPref<T>
|
2014-02-13 21:38:40 +04:00
|
|
|
{
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
typedef TypedPref<T> BaseClass;
|
2014-02-13 21:38:40 +04:00
|
|
|
public:
|
|
|
|
PrefTemplate()
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
: BaseClass(Default())
|
2014-02-13 21:38:40 +04:00
|
|
|
{
|
2016-06-27 09:33:14 +03:00
|
|
|
// If not using the Preferences service, values are synced over IPC, so
|
|
|
|
// there's no need to register us as a Preferences observer.
|
|
|
|
if (IsPrefsServiceAvailable()) {
|
|
|
|
Register(Update, Prefname());
|
|
|
|
}
|
2016-06-27 09:33:16 +03:00
|
|
|
// By default we only watch changes in the parent process, to communicate
|
|
|
|
// changes to the GPU process.
|
|
|
|
if (IsParentProcess() && Update == UpdatePolicy::Live) {
|
|
|
|
WatchChanges(Prefname(), this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~PrefTemplate() {
|
|
|
|
if (IsParentProcess() && Update == UpdatePolicy::Live) {
|
|
|
|
UnwatchChanges(Prefname(), this);
|
|
|
|
}
|
2014-02-13 21:38:40 +04:00
|
|
|
}
|
|
|
|
void Register(UpdatePolicy aUpdate, const char* aPreference)
|
|
|
|
{
|
2014-07-11 16:25:12 +04:00
|
|
|
AssertMainThread();
|
2016-06-27 09:33:14 +03:00
|
|
|
switch (aUpdate) {
|
2014-02-13 21:38:40 +04:00
|
|
|
case UpdatePolicy::Skip:
|
|
|
|
break;
|
|
|
|
case UpdatePolicy::Once:
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
this->mValue = PrefGet(aPreference, this->mValue);
|
2014-02-13 21:38:40 +04:00
|
|
|
break;
|
|
|
|
case UpdatePolicy::Live:
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
PrefAddVarCache(&this->mValue, aPreference, this->mValue);
|
2014-02-13 21:38:40 +04:00
|
|
|
break;
|
|
|
|
default:
|
2016-05-13 23:34:41 +03:00
|
|
|
MOZ_CRASH("Incomplete switch");
|
2014-02-13 21:38:40 +04:00
|
|
|
}
|
|
|
|
}
|
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:
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
this->mValue = PrefGet(aPref, this->mValue);
|
2014-07-11 16:25:12 +04:00
|
|
|
break;
|
|
|
|
default:
|
2016-05-13 23:34:41 +03:00
|
|
|
MOZ_CRASH("Incomplete switch");
|
2014-07-11 16:25:12 +04:00
|
|
|
}
|
|
|
|
}
|
2016-06-27 09:33:16 +03:00
|
|
|
const char *Name() const override {
|
|
|
|
return Prefname();
|
|
|
|
}
|
2016-10-25 03:48:28 +03:00
|
|
|
void GetLiveValue(GfxPrefValue* aOutValue) const override {
|
|
|
|
T value = GetLiveValue();
|
|
|
|
CopyPrefValue(&value, aOutValue);
|
|
|
|
}
|
2016-06-27 09:33:18 +03:00
|
|
|
// When using the Preferences service, the change callback can be triggered
|
|
|
|
// *before* our cached value is updated, so we expose a method to grab the
|
|
|
|
// true live value.
|
|
|
|
T GetLiveValue() const {
|
2016-10-25 03:48:28 +03:00
|
|
|
return BaseClass::GetLiveValueByName(Prefname());
|
2016-06-27 09:33:18 +03:00
|
|
|
}
|
2016-06-27 09:33:20 +03:00
|
|
|
bool HasDefaultValue() const override {
|
Bug 1290160 - reduce codesize required by gfxPrefs; r=milan
Every gfxPrefs::PrefTemplate template declares its own virtual function
overrides for functions declared in gfxPrefs::Pref. The compiler must
therefore create separate copies of each of these virtual functions when
it instantiates PrefTemplate. Since several of these virtual functions
only depend on the template parameter T, the type of the pref, many
instantiations of the functions are identical. The duplicate functions
would normally be merged by identical code folding performed in the
linker, but since these are virtual functions and therefore have their
addresses taken (to be stored in the class's vtable), the linker (at
least for the settings we use for identical code folding) cannot fold
duplicated functions together.
Therefore, we have to do the de-duplication ourselves, by creating an
intermediate templated base class that only depends on the type of the
pref. With this class, only three copies of each virtual function will
be created (one each for bools, floats, and ints). We sneak in
GetLiveValue() into this base class for another small codesize win, even
though it's not a virtual function.
2016-08-04 00:02:33 +03:00
|
|
|
return this->mValue == Default();
|
2016-06-27 09:33:20 +03:00
|
|
|
}
|
2014-02-13 21:38:40 +04:00
|
|
|
};
|
|
|
|
|
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);
|
2015-12-14 22:47:56 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.allow_immediate_handoff", APZAllowImmediateHandoff, bool, true);
|
2016-11-16 16:54:51 +03:00
|
|
|
DECL_GFX_PREF(Once, "apz.allow_with_webrender", APZAllowWithWebRender, bool, false);
|
2015-07-23 06:42:08 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.allow_zooming", APZAllowZooming, bool, false);
|
2014-09-06 04:07:52 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle", APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold", APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
|
2014-09-06 04:07:52 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle", APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
|
2015-03-21 17:33:25 +03:00
|
|
|
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.mode", APZAxisLockMode, int32_t, 0);
|
2016-06-15 03:30:13 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.content_response_timeout", APZContentResponseTimeout, int32_t, 400);
|
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);
|
2016-04-03 20:13:59 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.disable_for_scroll_linked_effects", APZDisableForScrollLinkedEffects, bool, false);
|
2016-02-04 03:13:35 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.displayport_expiry_ms", APZDisplayPortExpiryTime, uint32_t, 15000);
|
2015-09-28 21:44:36 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.drag.enabled", APZDragEnabled, bool, false);
|
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_base_mult", APZFlingAccelBaseMultiplier, float, 1.0f);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_accel_interval_ms", APZFlingAccelInterval, int32_t, 500);
|
2014-04-29 17:45:13 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_accel_supplemental_mult", APZFlingAccelSupplementalMultiplier, float, 1.0f);
|
2016-10-08 04:43:55 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_accel_min_velocity", APZFlingAccelMinVelocity, float, 1.5f);
|
2014-10-30 17:38:10 +03:00
|
|
|
DECL_GFX_PREF(Once, "apz.fling_curve_function_x1", APZCurveFunctionX1, float, 0.0f);
|
|
|
|
DECL_GFX_PREF(Once, "apz.fling_curve_function_x2", APZCurveFunctionX2, float, 1.0f);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "apz.fling_curve_function_y1", APZCurveFunctionY1, float, 0.0f);
|
2014-10-30 17:38:10 +03:00
|
|
|
DECL_GFX_PREF(Once, "apz.fling_curve_function_y2", APZCurveFunctionY2, float, 1.0f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.fling_curve_threshold_inches_per_ms", APZCurveThreshold, float, -1.0f);
|
2015-12-14 17:29:02 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_friction", APZFlingFriction, float, 0.002f);
|
2016-06-15 03:03:04 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_min_velocity_threshold", APZFlingMinVelocityThreshold, float, 0.5f);
|
2015-12-14 17:29:02 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.fling_stop_on_tap_threshold", APZFlingStopOnTapThreshold, float, 0.05f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.fling_stopped_threshold", APZFlingStoppedThreshold, float, 0.01f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.highlight_checkerboarded_areas", APZHighlightCheckerboardedAreas, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "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);
|
2015-07-23 18:29:22 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.minimap.enabled", APZMinimap, bool, false);
|
2016-03-19 04:38:57 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.minimap.visibility.enabled", APZMinimapVisibilityEnabled, bool, false);
|
2014-05-22 01:20:12 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.enabled", APZOverscrollEnabled, bool, false);
|
2014-09-23 19:38:05 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.min_pan_distance_ratio", APZMinPanDistanceRatio, float, 1.0f);
|
2014-10-31 19:06:31 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.spring_friction", APZOverscrollSpringFriction, float, 0.015f);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.spring_stiffness", APZOverscrollSpringStiffness, float, 0.001f);
|
2014-10-31 19:06:31 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.stop_distance_threshold", APZOverscrollStopDistanceThreshold, float, 5.0f);
|
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.stop_velocity_threshold", APZOverscrollStopVelocityThreshold, float, 0.01f);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.overscroll.stretch_factor", APZOverscrollStretchFactor, float, 0.5f);
|
2016-03-08 00:25:00 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.paint_skipping.enabled", APZPaintSkipping, bool, true);
|
2016-03-14 18:50:55 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.peek_messages.enabled", APZPeekMessages, bool, true);
|
2014-06-25 19:12:32 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.printtree", APZPrintTree, bool, false);
|
2016-01-16 00:19:58 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.record_checkerboarding", APZRecordCheckerboarding, bool, false);
|
2016-10-31 17:05:15 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.test.fails_with_native_injection", APZTestFailsWithNativeInjection, bool, false);
|
2015-07-09 02:18:28 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false);
|
2015-11-10 00:42:34 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.touch_move_tolerance", APZTouchMoveTolerance, float, 0.0);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.touch_start_tolerance", APZTouchStartTolerance, float, 1.0f/4.5f);
|
2016-06-21 21:46:34 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.velocity_bias", APZVelocityBias, float, 0.0f);
|
2014-05-27 19:45:03 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms", APZVelocityRelevanceTime, uint32_t, 150);
|
2015-11-19 02:48:19 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.x_skate_highmem_adjust", APZXSkateHighMemAdjust, float, 0.0f);
|
2015-12-08 22:46:58 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier", APZXSkateSizeMultiplier, float, 1.5f);
|
2014-03-31 09:05:38 +04:00
|
|
|
DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier", APZXStationarySizeMultiplier, float, 3.0f);
|
2015-11-19 02:48:19 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.y_skate_highmem_adjust", APZYSkateHighMemAdjust, float, 0.0f);
|
2015-12-08 22:46:58 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier", APZYSkateSizeMultiplier, float, 2.5f);
|
2014-03-31 09:05:38 +04:00
|
|
|
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);
|
2016-05-27 00:39:04 +03:00
|
|
|
DECL_GFX_PREF(Live, "apz.scale_repaint_delay_ms", APZScaleRepaintDelay, int32_t, 500);
|
2014-03-03 20:53:21 +04:00
|
|
|
|
2015-09-03 17:30:41 +03:00
|
|
|
DECL_GFX_PREF(Live, "browser.ui.zoom.force-user-scalable", ForceUserScalable, bool, false);
|
2015-08-24 20:45:45 +03:00
|
|
|
DECL_GFX_PREF(Live, "browser.viewport.desktopWidth", DesktopViewportWidth, int32_t, 980);
|
|
|
|
|
2015-12-02 22:31:16 +03:00
|
|
|
DECL_GFX_PREF(Live, "dom.ipc.plugins.asyncdrawing.enabled", PluginAsyncDrawingEnabled, bool, false);
|
2015-06-30 21:49:02 +03:00
|
|
|
DECL_GFX_PREF(Live, "dom.meta-viewport.enabled", MetaViewportEnabled, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "dom.vr.enabled", VREnabled, bool, false);
|
2015-04-13 06:05:36 +03:00
|
|
|
DECL_GFX_PREF(Once, "dom.vr.oculus.enabled", VROculusEnabled, bool, true);
|
2016-07-22 22:41:00 +03:00
|
|
|
DECL_GFX_PREF(Once, "dom.vr.openvr.enabled", VROpenVREnabled, bool, false);
|
2016-04-27 00:18:21 +03:00
|
|
|
DECL_GFX_PREF(Once, "dom.vr.osvr.enabled", VROSVREnabled, bool, false);
|
2016-02-16 23:53:33 +03:00
|
|
|
DECL_GFX_PREF(Live, "dom.vr.poseprediction.enabled", VRPosePredictionEnabled, bool, false);
|
2015-03-25 19:20:20 +03:00
|
|
|
DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled", PointerEventsEnabled, bool, false);
|
2015-12-11 19:51:53 +03:00
|
|
|
DECL_GFX_PREF(Live, "dom.w3c_touch_events.enabled", TouchEventsEnabled, int32_t, 0);
|
2015-03-21 17:33:25 +03:00
|
|
|
|
2015-04-02 09:42:40 +03:00
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll", SmoothScrollEnabled, bool, true);
|
2016-01-07 23:09:18 +03:00
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.currentVelocityWeighting",
|
|
|
|
SmoothScrollCurrentVelocityWeighting, float, 0.25);
|
2015-04-02 09:42:40 +03:00
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.durationToIntervalRatio",
|
|
|
|
SmoothScrollDurationToIntervalRatio, int32_t, 200);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel", WheelSmoothScrollEnabled, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMaxMS",
|
|
|
|
WheelSmoothScrollMaxDurationMs, int32_t, 400);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMinMS",
|
|
|
|
WheelSmoothScrollMinDurationMs, int32_t, 200);
|
2016-02-12 16:30:16 +03:00
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.pages", PageSmoothScrollEnabled, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMaxMS",
|
|
|
|
PageSmoothScrollMaxDurationMs, int32_t, 150);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMinMS",
|
|
|
|
PageSmoothScrollMinDurationMs, int32_t, 150);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.pixels", PixelSmoothScrollEnabled, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMaxMS",
|
|
|
|
PixelSmoothScrollMaxDurationMs, int32_t, 150);
|
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMinMS",
|
|
|
|
PixelSmoothScrollMinDurationMs, int32_t, 150);
|
2016-01-07 23:09:18 +03:00
|
|
|
DECL_GFX_PREF(Live, "general.smoothScroll.stopDecelerationWeighting",
|
|
|
|
SmoothScrollStopDecelerationWeighting, float, 0.4f);
|
2015-04-02 09:42:40 +03: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);
|
2015-05-28 18:54:07 +03:00
|
|
|
#endif
|
2016-10-08 12:14:49 +03:00
|
|
|
#if defined(RELEASE_OR_BETA)
|
2015-05-28 18:54:07 +03:00
|
|
|
// "Skip" means this is locked to the default value in beta and release.
|
|
|
|
DECL_GFX_PREF(Skip, "gfx.blocklist.all", BlocklistAll, int32_t, 0);
|
|
|
|
#else
|
|
|
|
DECL_GFX_PREF(Once, "gfx.blocklist.all", BlocklistAll, int32_t, 0);
|
2014-02-28 21:59:38 +04:00
|
|
|
#endif
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_calls", CanvasAutoAccelerateMinCalls, int32_t, 4);
|
2014-09-11 00:15:43 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_frames", CanvasAutoAccelerateMinFrames, int32_t, 30);
|
|
|
|
DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_seconds", CanvasAutoAccelerateMinSeconds, float, 5.0f);
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.canvas.azure.accelerated", CanvasAzureAccelerated, bool, false);
|
2017-02-01 02:13:39 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.azure.accelerated.limit", CanvasAzureAcceleratedLimit, int32_t, 0);
|
2015-04-22 13:06:53 +03:00
|
|
|
// 0x7fff is the maximum supported xlib surface size and is more than enough for canvases.
|
2015-04-22 13:37:56 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.canvas.max-size", MaxCanvasSize, int32_t, 0x7fff);
|
2014-02-27 06:53:32 +04:00
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.dynamic-cache", CanvasSkiaGLDynamicCache, bool, false);
|
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);
|
|
|
|
|
2016-11-10 05:57:04 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.device-reset.limit", DeviceResetLimitCount, int32_t, 10);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.device-reset.threshold-ms", DeviceResetThresholdMilliseconds, int32_t, -1);
|
|
|
|
|
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);
|
2016-11-04 03:28:28 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device", Direct3D11ReuseDecoderDevice, int32_t, -1);
|
2017-02-02 16:24:57 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.direct3d11.allow-intel-mutex", Direct3D11AllowIntelMutex, bool, true);
|
2017-02-20 21:00:54 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.downloadable_fonts.keep_variation_tables", KeepVariationTables, bool, false);
|
2017-02-16 20:16:09 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.downloadable_fonts.otl_validation", ValidateOTLTables, bool, true);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
|
2015-10-06 22:23:24 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
|
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);
|
2016-06-27 09:33:18 +03:00
|
|
|
// Note that "gfx.logging.level" is defined in Logging.h.
|
|
|
|
DECL_GFX_PREF(Live, "gfx.logging.level", GfxLoggingLevel, int32_t, mozilla::gfx::LOG_DEFAULT);
|
2016-02-11 21:04:20 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.logging.crash.length", GfxLoggingCrashLength, uint32_t, 16);
|
2016-04-20 00:07:57 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.logging.painted-pixel-count.enabled",GfxLoggingPaintedPixelCountEnabled, bool, false);
|
2015-11-18 18:59:11 +03:00
|
|
|
// The maximums here are quite conservative, we can tighten them if problems show up.
|
2016-01-27 18:37:44 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.logging.texture-usage.enabled", GfxLoggingTextureUsageEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.logging.peak-texture-usage.enabled",GfxLoggingPeakTextureUsageEnabled, bool, false);
|
2015-11-18 18:59:11 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.max-alloc-size", MaxAllocSize, int32_t, (int32_t)500000000);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.max-texture-size", MaxTextureSize, int32_t, (int32_t)32767);
|
2016-02-01 15:34:00 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.partialpresent.force", PartialPresent, int32_t, 0);
|
2014-05-08 02:09:41 +04:00
|
|
|
DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled", PerfWarnings, bool, false);
|
2015-08-21 20:21:58 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.SurfaceTexture.detach.enabled", SurfaceTextureDetachEnabled, bool, true);
|
2015-07-30 10:23:53 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.testing.device-reset", DeviceResetForTesting, int32_t, 0);
|
2015-07-30 10:27:06 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.testing.device-fail", DeviceFailForTesting, bool, false);
|
2016-09-16 22:11:35 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.text.disable-aa", DisableAllTextAA, bool, false);
|
2016-06-09 04:46:42 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.ycbcr.accurate-conversion", YCbCrAccurateConversion, bool, false);
|
2014-02-23 03:53:04 +04:00
|
|
|
|
2016-08-16 18:46:13 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.content.always-paint", AlwaysPaint, bool, false);
|
2016-01-06 02:04:42 +03:00
|
|
|
|
2016-02-03 21:05:24 +03:00
|
|
|
// Disable surface sharing due to issues with compatible FBConfigs on
|
|
|
|
// NVIDIA drivers as described in bug 1193015.
|
|
|
|
DECL_GFX_PREF(Live, "gfx.use-glx-texture-from-pixmap", UseGLXTextureFromPixmap, bool, false);
|
|
|
|
|
2016-06-27 18:25:13 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.use-iosurface-textures", UseIOSurfaceTextures, bool, false);
|
|
|
|
|
2015-03-21 17:33:25 +03:00
|
|
|
// These times should be in milliseconds
|
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.delay-threshold", TouchResampleVsyncDelayThreshold, int32_t, 20);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.max-predict", TouchResampleMaxPredict, int32_t, 8);
|
2015-08-19 08:02:21 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.min-delta", TouchResampleMinDelta, int32_t, 2);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.old-touch-threshold",TouchResampleOldTouchThreshold, int32_t, 17);
|
|
|
|
DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust", TouchVsyncSampleAdjust, int32_t, 5);
|
2014-05-09 00:49:01 +04:00
|
|
|
|
2016-11-23 04:40:54 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.vr.openvr-runtime", VROpenVRRuntime, std::string, "");
|
2015-06-08 19:53:41 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms", CollectScrollTransforms, bool, false);
|
2015-01-06 00:52:49 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count", CompositorUnobserveCount, int32_t, 10);
|
2016-11-29 05:06:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "gfx.webrender.profiler.enable", WebRenderProfilerEnabled, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
// Use vsync events generated by hardware
|
|
|
|
DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);
|
2015-08-08 23:50:47 +03:00
|
|
|
DECL_GFX_PREF(Once, "gfx.screen-mirroring.enabled", ScreenMirroringEnabled, bool, false);
|
2014-08-27 09:17:00 +04:00
|
|
|
|
2016-11-12 19:06:27 +03:00
|
|
|
DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist", IgnoreDXInterop2Blacklist, bool, false);
|
2014-02-23 03:53:04 +04:00
|
|
|
DECL_GFX_PREF(Live, "gl.msaa-level", MSAALevel, uint32_t, 2);
|
2015-11-11 00:14:24 +03:00
|
|
|
#if defined(XP_MACOSX)
|
|
|
|
DECL_GFX_PREF(Live, "gl.multithreaded", GLMultithreaded, bool, false);
|
|
|
|
#endif
|
2015-04-03 03:59:47 +03:00
|
|
|
DECL_GFX_PREF(Live, "gl.require-hardware", RequireHardwareGL, bool, false);
|
2014-02-23 03:53:04 +04:00
|
|
|
|
2014-09-23 01:30:20 +04:00
|
|
|
DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500);
|
2015-04-08 02:44:29 +03:00
|
|
|
DECL_GFX_PREF(Live, "image.decode-immediately.enabled", ImageDecodeImmediatelyEnabled, bool, false);
|
2015-03-17 23:56:50 +03:00
|
|
|
DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
|
2015-07-08 00:00:08 +03:00
|
|
|
DECL_GFX_PREF(Live, "image.infer-src-animation.threshold-ms", ImageInferSrcAnimationThresholdMS, uint32_t, 2000);
|
2015-01-16 02:11:36 +03:00
|
|
|
DECL_GFX_PREF(Once, "image.mem.decode_bytes_at_a_time", ImageMemDecodeBytesAtATime, uint32_t, 200000);
|
2014-09-23 01:30:20 +04:00
|
|
|
DECL_GFX_PREF(Live, "image.mem.discardable", ImageMemDiscardable, bool, false);
|
2017-02-08 23:48:59 +03:00
|
|
|
DECL_GFX_PREF(Live, "image.mem.shared", ImageMemShared, bool, false);
|
2014-11-27 00:22:10 +03:00
|
|
|
DECL_GFX_PREF(Once, "image.mem.surfacecache.discard_factor", ImageMemSurfaceCacheDiscardFactor, uint32_t, 1);
|
2014-09-23 01:30:20 +04:00
|
|
|
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);
|
2015-01-16 02:11:36 +03:00
|
|
|
DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
|
2014-09-23 01:30:20 +04:00
|
|
|
|
2016-04-29 07:52:54 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabledDoNotUseDirectly, 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);
|
2016-04-29 07:52:54 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
|
2016-11-24 08:11:30 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.advanced.border-layers", LayersAllowBorderLayers, bool, false);
|
2016-11-24 08:11:29 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.advanced.text-layers", LayersAllowTextLayers, bool, false);
|
2017-01-24 11:53:42 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.advanced.bullet-layers", LayersAllowBulletLayers, bool, false);
|
2017-02-15 00:49:27 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.advanced.caret-layers", LayersAllowCaretLayers, bool, false);
|
2017-02-16 21:23:22 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.advanced.boxshadow-outer-layers", LayersAllowOuterBoxShadow, bool, false);
|
2016-04-25 20:53:52 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.allow-d3d9-fallback", LayersAllowD3D9Fallback, bool, false);
|
2015-10-20 22:58:11 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
|
2015-06-04 23:51:10 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
|
2015-03-29 07:58:52 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, 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);
|
2016-07-20 23:55:07 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.child-process-shutdown", ChildProcessShutdown, bool, true);
|
2014-02-27 06:53:27 +04:00
|
|
|
#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
|
2015-04-15 16:39:44 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.composer2d.enabled", Composer2DCompositionEnabled, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
|
2014-12-18 03:28:45 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.deaa.enabled", LayersDEAAEnabled, bool, false);
|
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-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-11-29 01:41:47 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.dump-texture", LayersDumpTexture, bool, false);
|
2014-12-31 23:21:58 +03:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2015-02-04 01:18:44 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.dump-client-layers", DumpClientLayers, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.dump-decision", LayersDumpDecision, bool, false);
|
2015-02-04 01:18:44 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.dump-host-layers", DumpHostLayers, bool, false);
|
2014-12-31 23:21:58 +03:00
|
|
|
#endif
|
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-12-19 22:48:33 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.enable-tiles", LayersTilesEnabled, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.flash-borders", FlashLayerBorders, bool, false);
|
2014-03-08 01:34:04 +04:00
|
|
|
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);
|
2017-01-17 10:51:24 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.gpu-process.enabled", GPUProcessEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "layers.gpu-process.force-enabled", GPUProcessForceEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Once, "layers.gpu-process.timeout_ms", GPUProcessTimeoutMs, int32_t, 5000);
|
|
|
|
DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts", GPUProcessMaxRestarts, int32_t, 0);
|
2014-02-27 06:53:31 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.low-precision-buffer", UseLowPrecisionBuffer, bool, false);
|
2014-06-23 20:00:18 +04:00
|
|
|
DECL_GFX_PREF(Live, "layers.low-precision-opacity", LowPrecisionOpacity, float, 1.0f);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.low-precision-resolution", LowPrecisionResolution, float, 0.25f);
|
2016-03-04 20:13:57 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.max-active", MaxActiveLayers, int32_t, -1);
|
2016-04-05 17:55:17 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
|
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);
|
2016-08-12 00:21:17 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaint, bool, false);
|
2016-07-20 23:55:07 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layers.single-tile.enabled", LayersSingleTileEnabled, bool, true);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.stereo-video.enabled", StereoVideoEnabled, bool, false);
|
|
|
|
|
|
|
|
// 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);
|
2016-07-19 05:58:26 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.tile-initial-pool-size", LayersTileInitialPoolSize, uint32_t, (uint32_t)50);
|
2016-07-29 01:52:38 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.tile-pool-unused-size", LayersTilePoolUnusedSize, uint32_t, (uint32_t)10);
|
2016-07-29 21:14:09 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.tile-pool-shrink-timeout", LayersTilePoolShrinkTimeout, uint32_t, (uint32_t)50);
|
|
|
|
DECL_GFX_PREF(Once, "layers.tile-pool-clear-timeout", LayersTilePoolClearTimeout, uint32_t, (uint32_t)5000);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.tiles.adjust", LayersTilesAdjust, bool, true);
|
2015-07-12 12:11:30 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.tiles.edge-padding", TileEdgePaddingEnabled, bool, true);
|
2016-04-26 17:05:14 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.tiles.fade-in.enabled", LayerTileFadeInEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "layers.tiles.fade-in.duration-ms", LayerTileFadeInDuration, uint32_t, 250);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.transaction.warning-ms", LayerTransactionWarning, uint32_t, 200);
|
2014-06-19 11:33:00 +04:00
|
|
|
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
|
2016-01-21 16:12:51 +03:00
|
|
|
DECL_GFX_PREF(Once, "layers.use-image-offscreen-surfaces", UseImageOffscreenSurfaces, bool, true);
|
2016-11-04 06:13:00 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.draw-mask-debug", DrawMaskLayer, bool, false);
|
2016-12-07 02:39:01 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.geometry.opengl.enabled", OGLLayerGeometry, bool, false);
|
2017-01-10 21:48:44 +03:00
|
|
|
DECL_GFX_PREF(Live, "layers.geometry.basic.enabled", BasicLayerGeometry, bool, false);
|
2014-02-27 06:52:54 +04:00
|
|
|
|
2016-12-14 22:31:20 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.animation.prerender.partial", PartiallyPrerenderAnimatedContent, bool, false);
|
2016-12-10 04:23:42 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-x", AnimationPrerenderViewportRatioLimitX, float, 1.125f);
|
|
|
|
DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-y", AnimationPrerenderViewportRatioLimitY, float, 1.125f);
|
|
|
|
DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-x", AnimationPrerenderAbsoluteLimitX, uint32_t, 4096);
|
|
|
|
DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-y", AnimationPrerenderAbsoluteLimitY, uint32_t, 4096);
|
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);
|
2016-08-24 18:54:05 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.enabled", ScrollBehaviorEnabled, bool, true);
|
2014-06-12 21:50:54 +04:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.spring-constant", ScrollBehaviorSpringConstant, float, 250.0f);
|
2015-02-20 02:43:14 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-max-velocity", ScrollSnapPredictionMaxVelocity, int32_t, 2000);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f);
|
2016-03-19 04:15:45 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.scroll-snap.proximity-threshold", ScrollSnapProximityThreshold, int32_t, 200);
|
2016-06-01 20:13:14 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
|
2014-05-04 04:35:47 +04:00
|
|
|
DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
|
2016-04-06 06:29:57 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.display-list.dump-content", LayoutDumpDisplayListContent, bool, false);
|
2015-04-23 08:25:00 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.event-regions.enabled", LayoutEventRegionsEnabledDoNotUseDirectly, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "layout.frame_rate", LayoutFrameRate, int32_t, -1);
|
2017-02-09 21:00:32 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.min-active-layer-size", LayoutMinActiveLayerSize, int, 64);
|
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-12-18 02:37:28 +03:00
|
|
|
// This and code dependent on it should be removed once containerless scrolling looks stable.
|
|
|
|
DECL_GFX_PREF(Once, "layout.scroll.root-frame-containers", LayoutUseContainersForRootFrames, bool, true);
|
2016-11-24 08:11:30 +03:00
|
|
|
DECL_GFX_PREF(Live, "layout.smaller-painted-layers", LayoutSmallerPaintedLayers, bool, false);
|
2015-03-11 23:56:56 +03:00
|
|
|
|
2016-07-20 23:55:07 +03:00
|
|
|
DECL_GFX_PREF(Once, "media.hardware-video-decoding.force-enabled",
|
|
|
|
HardwareVideoDecodingForceEnabled, bool, false);
|
2016-11-02 23:57:18 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
DECL_GFX_PREF(Live, "media.windows-media-foundation.allow-d3d11-dxva", PDMWMFAllowD3D11, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "media.windows-media-foundation.max-dxva-videos", PDMWMFMaxDXVAVideos, uint32_t, 8);
|
|
|
|
DECL_GFX_PREF(Live, "media.wmf.low-latency.enabled", PDMWMFLowLatencyEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "media.wmf.skip-blacklist", PDMWMFSkipBlacklist, bool, false);
|
|
|
|
#endif
|
2016-07-20 23:55:07 +03:00
|
|
|
|
2015-12-02 00:45:49 +03:00
|
|
|
// These affect how line scrolls from wheel events will be accelerated.
|
|
|
|
DECL_GFX_PREF(Live, "mousewheel.acceleration.factor", MouseWheelAccelerationFactor, int32_t, -1);
|
|
|
|
DECL_GFX_PREF(Live, "mousewheel.acceleration.start", MouseWheelAccelerationStart, int32_t, -1);
|
|
|
|
|
2015-03-11 23:56:56 +03:00
|
|
|
// This affects whether events will be routed through APZ or not.
|
2015-03-26 04:36:41 +03:00
|
|
|
DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.enabled",
|
|
|
|
MouseWheelHasRootScrollDeltaOverride, bool, false);
|
2016-09-20 05:22:26 +03:00
|
|
|
DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.horizontal.factor",
|
|
|
|
MouseWheelRootScrollHorizontalFactor, int32_t, 0);
|
|
|
|
DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.vertical.factor",
|
|
|
|
MouseWheelRootScrollVerticalFactor, int32_t, 0);
|
2015-03-22 10:42:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "mousewheel.transaction.ignoremovedelay",MouseWheelIgnoreMoveDelayMs, int32_t, (int32_t)100);
|
2015-03-22 10:36:13 +03:00
|
|
|
DECL_GFX_PREF(Live, "mousewheel.transaction.timeout", MouseWheelTransactionTimeoutMs, int32_t, (int32_t)1500);
|
2015-03-21 17:33:25 +03:00
|
|
|
|
|
|
|
DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
|
2015-03-25 01:00:52 +03:00
|
|
|
|
|
|
|
DECL_GFX_PREF(Live, "test.events.async.enabled", TestEventsAsyncEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "test.mousescroll", MouseScrollTestingEnabled, bool, false);
|
|
|
|
|
2015-03-21 17:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 500);
|
2015-10-12 06:21:03 +03:00
|
|
|
|
|
|
|
// WebGL (for pref access from Worker threads)
|
|
|
|
DECL_GFX_PREF(Live, "webgl.all-angle-options", WebGLAllANGLEOptions, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.angle.force-d3d11", WebGLANGLEForceD3D11, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.angle.try-d3d11", WebGLANGLETryD3D11, bool, false);
|
2016-04-06 23:47:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.angle.force-warp", WebGLANGLEForceWARP, bool, false);
|
2015-10-12 06:21:03 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.bypass-shader-validation", WebGLBypassShaderValidator, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.can-lose-context-in-foreground", WebGLCanLoseContextInForeground, bool, true);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.default-no-alpha", WebGLDefaultNoAlpha, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.disable-angle", WebGLDisableANGLE, bool, false);
|
2016-06-21 06:33:25 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.disable-wgl", WebGLDisableWGL, bool, false);
|
2015-10-12 06:21:03 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.disable-extensions", WebGLDisableExtensions, bool, false);
|
2016-03-11 00:17:46 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.dxgl.enabled", WebGLDXGLEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.dxgl.needs-finish", WebGLDXGLNeedsFinish, bool, false);
|
2015-10-12 06:21:03 +03:00
|
|
|
|
2015-05-21 18:51:49 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.disable-fail-if-major-performance-caveat",
|
|
|
|
WebGLDisableFailIfMajorPerformanceCaveat, bool, false);
|
2015-11-25 07:15:29 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.disable-DOM-blit-uploads",
|
|
|
|
WebGLDisableDOMBlitUploads, bool, false);
|
|
|
|
|
2015-10-12 06:21:03 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.disabled", WebGLDisabled, bool, false);
|
|
|
|
|
|
|
|
DECL_GFX_PREF(Live, "webgl.enable-draft-extensions", WebGLDraftExtensionsEnabled, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.enable-privileged-extensions", WebGLPrivilegedExtensionsEnabled, bool, false);
|
2016-08-01 22:43:37 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.enable-webgl2", WebGL2Enabled, bool, true);
|
2015-10-12 06:21:03 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.force-enabled", WebGLForceEnabled, bool, false);
|
2015-10-05 18:28:25 +03:00
|
|
|
DECL_GFX_PREF(Once, "webgl.force-layers-readback", WebGLForceLayersReadback, bool, false);
|
2015-10-12 06:21:03 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.lose-context-on-memory-pressure", WebGLLoseContextOnMemoryPressure, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.max-warnings-per-context", WebGLMaxWarningsPerContext, uint32_t, 32);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.min_capability_mode", WebGLMinCapabilityMode, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.msaa-force", WebGLForceMSAA, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.prefer-16bpp", WebGLPrefer16bpp, bool, false);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.restore-context-when-visible", WebGLRestoreWhenVisible, bool, true);
|
2015-12-19 01:05:42 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.allow-immediate-queries", WebGLImmediateQueries, bool, false);
|
2016-12-01 05:46:06 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.allow-fb-invalidation", WebGLFBInvalidation, bool, false);
|
2015-03-21 17:33:25 +03:00
|
|
|
|
2017-01-12 04:10:48 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.max-perf-warnings", WebGLMaxPerfWarnings, int32_t, 0);
|
|
|
|
DECL_GFX_PREF(Live, "webgl.max-acceptable-fb-status-invals", WebGLMaxAcceptableFBStatusInvals, int32_t, 0);
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
DECL_GFX_PREF(Live, "webgl.webgl2-compat-mode", WebGL2CompatMode, bool, false);
|
|
|
|
|
2015-03-21 17:33:25 +03:00
|
|
|
// WARNING:
|
|
|
|
// Please make sure that you've added your new preference to the list above in alphabetical order.
|
|
|
|
// Please do not just append it to the end of the list.
|
|
|
|
|
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) {
|
2016-06-27 09:33:20 +03:00
|
|
|
sGfxPrefList = new nsTArray<Pref*>();
|
2014-02-13 21:38:40 +04:00
|
|
|
sInstance = new gfxPrefs;
|
2016-06-27 09:33:18 +03:00
|
|
|
sInstance->Init();
|
2014-02-13 21:38:40 +04:00
|
|
|
}
|
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;
|
2016-06-27 09:33:20 +03:00
|
|
|
static nsTArray<Pref*>* sGfxPrefList;
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
private:
|
2016-06-27 09:33:18 +03:00
|
|
|
// The constructor cannot access GetSingleton(), since sInstance (necessarily)
|
|
|
|
// has not been assigned yet. Follow-up initialization that needs GetSingleton()
|
|
|
|
// must be added to Init().
|
|
|
|
void Init();
|
|
|
|
|
2016-06-27 09:33:14 +03:00
|
|
|
static bool IsPrefsServiceAvailable();
|
2016-06-27 09:33:16 +03:00
|
|
|
static bool IsParentProcess();
|
2014-02-13 21:38:40 +04:00
|
|
|
// 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);
|
2016-11-23 04:38:02 +03:00
|
|
|
static void PrefAddVarCache(std::string*, const char*, std::string);
|
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);
|
2016-11-23 04:38:02 +03:00
|
|
|
static std::string PrefGet(const char*, std::string);
|
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);
|
2016-11-23 04:38:02 +03:00
|
|
|
static void PrefSet(const char* aPref, std::string aValue);
|
2016-06-27 09:33:16 +03:00
|
|
|
static void WatchChanges(const char* aPrefname, Pref* aPref);
|
|
|
|
static void UnwatchChanges(const char* aPrefname, Pref* aPref);
|
2016-06-27 09:33:20 +03:00
|
|
|
// Creating these to avoid having to include PGPU.h in the .h
|
|
|
|
static void CopyPrefValue(const bool* aValue, GfxPrefValue* aOutValue);
|
|
|
|
static void CopyPrefValue(const int32_t* aValue, GfxPrefValue* aOutValue);
|
|
|
|
static void CopyPrefValue(const uint32_t* aValue, GfxPrefValue* aOutValue);
|
|
|
|
static void CopyPrefValue(const float* aValue, GfxPrefValue* aOutValue);
|
2016-11-23 04:38:02 +03:00
|
|
|
static void CopyPrefValue(const std::string* aValue, GfxPrefValue* aOutValue);
|
2016-06-27 09:33:20 +03:00
|
|
|
static void CopyPrefValue(const GfxPrefValue* aValue, bool* aOutValue);
|
|
|
|
static void CopyPrefValue(const GfxPrefValue* aValue, int32_t* aOutValue);
|
|
|
|
static void CopyPrefValue(const GfxPrefValue* aValue, uint32_t* aOutValue);
|
|
|
|
static void CopyPrefValue(const GfxPrefValue* aValue, float* aOutValue);
|
2016-11-23 04:38:02 +03:00
|
|
|
static void CopyPrefValue(const GfxPrefValue* aValue, std::string* aOutValue);
|
2014-07-11 16:25:12 +04:00
|
|
|
|
|
|
|
static void AssertMainThread();
|
2014-02-13 21:38:40 +04:00
|
|
|
|
|
|
|
gfxPrefs();
|
|
|
|
~gfxPrefs();
|
2015-01-07 02:35:02 +03:00
|
|
|
gfxPrefs(const gfxPrefs&) = delete;
|
|
|
|
gfxPrefs& operator=(const gfxPrefs&) = delete;
|
2014-02-13 21:38:40 +04:00
|
|
|
};
|
|
|
|
|
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 */
|