mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 1378355 - Extract gfxPlatform wrappers for MaxAllocSize and MaxTextureSize. r=bas
This allows us to reuse the minimum bound guards on the pref values in other places that want to use the prefs. MozReview-Commit-ID: 7XKuM5u1GB8 --HG-- extra : rebase_source : 9cf85c7cbe2e8511ad2db59e7bf7ba6e8db79883
This commit is contained in:
parent
1fd7214235
commit
78bfd54626
@ -215,17 +215,6 @@ Factory::Init(const Config& aConfig)
|
||||
MOZ_ASSERT(!sConfig);
|
||||
sConfig = new Config(aConfig);
|
||||
|
||||
// Make sure we don't completely break rendering because of a typo in the
|
||||
// pref or whatnot.
|
||||
const int32_t kMinAllocPref = 10000000;
|
||||
const int32_t kMinSizePref = 2048;
|
||||
if (sConfig->mMaxAllocSize < kMinAllocPref) {
|
||||
sConfig->mMaxAllocSize = kMinAllocPref;
|
||||
}
|
||||
if (sConfig->mMaxTextureSize < kMinSizePref) {
|
||||
sConfig->mMaxTextureSize = kMinSizePref;
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_FREETYPE
|
||||
mFTLock = new Mutex("Factory::mFTLock");
|
||||
#endif
|
||||
|
@ -848,6 +848,24 @@ gfxPlatform::IsDXInterop2Blocked()
|
||||
return status != nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
|
||||
/* static */ int32_t
|
||||
gfxPlatform::MaxTextureSize()
|
||||
{
|
||||
// Make sure we don't completely break rendering because of a typo in the
|
||||
// pref or whatnot.
|
||||
const int32_t kMinSizePref = 2048;
|
||||
return std::max(kMinSizePref, gfxPrefs::MaxTextureSizeDoNotUseDirectly());
|
||||
}
|
||||
|
||||
/* static */ int32_t
|
||||
gfxPlatform::MaxAllocSize()
|
||||
{
|
||||
// Make sure we don't completely break rendering because of a typo in the
|
||||
// pref or whatnot.
|
||||
const int32_t kMinAllocPref = 10000000;
|
||||
return std::max(kMinAllocPref, gfxPrefs::MaxAllocSizeDoNotUseDirectly());
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
gfxPlatform::InitMoz2DLogging()
|
||||
{
|
||||
@ -856,8 +874,8 @@ gfxPlatform::InitMoz2DLogging()
|
||||
|
||||
mozilla::gfx::Config cfg;
|
||||
cfg.mLogForwarder = fwd;
|
||||
cfg.mMaxTextureSize = gfxPrefs::MaxTextureSize();
|
||||
cfg.mMaxAllocSize = gfxPrefs::MaxAllocSize();
|
||||
cfg.mMaxTextureSize = gfxPlatform::MaxTextureSize();
|
||||
cfg.mMaxAllocSize = gfxPlatform::MaxAllocSize();
|
||||
|
||||
gfx::Factory::Init(cfg);
|
||||
}
|
||||
|
@ -189,6 +189,8 @@ public:
|
||||
*/
|
||||
static void InitNullMetadata();
|
||||
|
||||
static int32_t MaxTextureSize();
|
||||
static int32_t MaxAllocSize();
|
||||
static void InitMoz2DLogging();
|
||||
|
||||
static bool IsHeadless();
|
||||
|
@ -448,8 +448,10 @@ private:
|
||||
// The maximums here are quite conservative, we can tighten them if problems show up.
|
||||
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);
|
||||
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);
|
||||
// Use gfxPlatform::MaxAllocSize instead of the pref directly
|
||||
DECL_GFX_PREF(Once, "gfx.max-alloc-size", MaxAllocSizeDoNotUseDirectly, int32_t, (int32_t)500000000);
|
||||
// Use gfxPlatform::MaxTextureSize instead of the pref directly
|
||||
DECL_GFX_PREF(Once, "gfx.max-texture-size", MaxTextureSizeDoNotUseDirectly, int32_t, (int32_t)32767);
|
||||
DECL_GFX_PREF(Live, "gfx.partialpresent.force", PartialPresent, int32_t, 0);
|
||||
DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled", PerfWarnings, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.SurfaceTexture.detach.enabled", SurfaceTextureDetachEnabled, bool, true);
|
||||
|
Loading…
Reference in New Issue
Block a user