Bug 1683653 - Disable OMTP for users with less than 2 GB of virtual memory. r=jrmuizel

Also disable for users with 64-bit Firefox with 1-2 cores, and less than
2 GB of physical memory. It was already disabled for 32-bit Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D101052
This commit is contained in:
Andrew Osmond 2021-01-07 20:11:39 +00:00
Родитель 369f7fe13c
Коммит 0c8376f87e
2 изменённых файлов: 28 добавлений и 14 удалений

Просмотреть файл

@ -476,6 +476,8 @@ void gfxPlatform::OnMemoryPressure(layers::MemoryPressureReason aWhy) {
gfxPlatform::gfxPlatform()
: mHasVariationFontSupport(false),
mTotalPhysicalMemory(~0),
mTotalVirtualMemory(~0),
mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo),
mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo),
mTilesInfoCollector(this, &gfxPlatform::GetTilesSupportInfo),
@ -496,7 +498,16 @@ gfxPlatform::gfxPlatform()
InitBackendPrefs(GetBackendPrefs());
mTotalSystemMemory = PR_GetPhysicalMemorySize();
#ifdef XP_WIN
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
if (GlobalMemoryStatusEx(&status)) {
mTotalPhysicalMemory = status.ullTotalPhys;
mTotalVirtualMemory = status.ullTotalVirtual;
}
#else
mTotalPhysicalMemory = PR_GetPhysicalMemorySize();
#endif
VRManager::ManagerInit();
}
@ -2901,18 +2912,20 @@ void gfxPlatform::InitOMTPConfig() {
Preferences::GetBool("layers.omtp.enabled", false,
PrefValueKind::Default));
if (sizeof(void*) <= sizeof(uint32_t)) {
int32_t cpuCores = PR_GetNumberOfProcessors();
const uint64_t kMinSystemMemory = 2147483648; // 2 GB
if (cpuCores <= 2) {
omtp.ForceDisable(FeatureStatus::Broken,
"OMTP is not supported on 32-bit with <= 2 cores",
"FEATURE_FAILURE_OMTP_32BIT_CORES"_ns);
} else if (mTotalSystemMemory < kMinSystemMemory) {
omtp.ForceDisable(FeatureStatus::Broken,
"OMTP is not supported on 32-bit with < 2 GB RAM",
"FEATURE_FAILURE_OMTP_32BIT_MEM"_ns);
}
int32_t cpuCores = PR_GetNumberOfProcessors();
const uint64_t kMinSystemMemory = 2147483648; // 2 GB
if (cpuCores <= 2) {
omtp.ForceDisable(FeatureStatus::Broken,
"OMTP is not supported with <= 2 cores",
"FEATURE_FAILURE_OMTP_FEW_CORES"_ns);
} else if (mTotalPhysicalMemory < kMinSystemMemory) {
omtp.ForceDisable(FeatureStatus::Broken,
"OMTP is not supported with < 2 GB RAM",
"FEATURE_FAILURE_OMTP_LOW_PMEM"_ns);
} else if (mTotalVirtualMemory < kMinSystemMemory) {
omtp.ForceDisable(FeatureStatus::Broken,
"OMTP is not supported with < 2 GB VMEM",
"FEATURE_FAILURE_OMTP_LOW_VMEM"_ns);
}
if (mContentBackend == BackendType::CAIRO) {

Просмотреть файл

@ -931,7 +931,8 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
// max number of entries in word cache
int32_t mWordCacheMaxEntries;
uint64_t mTotalSystemMemory;
uint64_t mTotalPhysicalMemory;
uint64_t mTotalVirtualMemory;
// Hardware vsync source. Only valid on parent process
RefPtr<mozilla::gfx::VsyncSource> mVsyncSource;