Bug 1683653 - Disable OMTP for users with less than 2 GB of virtual memory. r=jrmuizel, a=RyanVM
authorAndrew Osmond <aosmond@mozilla.com>
Thu, 14 Jan 2021 19:51:00 +0000
changeset 627406 a2ed4a64e27ad80288dba88d9bd6c331d6e47ba4
parent 627405 854247b3a4ebc2bdb2a8674e2aaaec547ef4702f
child 627407 dc65d4fdd35de931e991c3f5283300789caf81c4
push id15031
push userryanvm@gmail.com
push dateFri, 15 Jan 2021 19:25:13 +0000
treeherdermozilla-beta@38febe1e15c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, RyanVM
bugs1683653
milestone85.0
Bug 1683653 - Disable OMTP for users with less than 2 GB of virtual memory. r=jrmuizel, a=RyanVM 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
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
layout/reftests/box-shadow/reftest.list
layout/reftests/text-stroke/reftest.list
testing/web-platform/meta/css/CSS2/backgrounds/background-position-001.xht.ini
testing/web-platform/meta/css/CSS2/backgrounds/background-position-002.xht.ini
testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-012.html.ini
testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-014.html.ini
testing/web-platform/meta/css/css-fill-stroke/paint-order-001.tentative.html.ini
testing/web-platform/meta/css/css-will-change/will-change-transform-zero-size-child-overflow-visible.html.ini
testing/web-platform/meta/svg/shapes/reftests/pathlength-001.svg.ini
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -474,16 +474,18 @@ void gfxPlatform::OnMemoryPressure(layer
     if (manager) {
       manager->SendNotifyMemoryPressure();
     }
   }
 }
 
 gfxPlatform::gfxPlatform()
     : mHasVariationFontSupport(false),
+      mTotalPhysicalMemory(~0),
+      mTotalVirtualMemory(~0),
       mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo),
       mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo),
       mTilesInfoCollector(this, &gfxPlatform::GetTilesSupportInfo),
       mFrameStatsCollector(this, &gfxPlatform::GetFrameStats),
       mCMSInfoCollector(this, &gfxPlatform::GetCMSSupportInfo),
       mDisplayInfoCollector(this, &gfxPlatform::GetDisplayInfo),
       mCompositorBackend(layers::LayersBackend::LAYERS_NONE),
       mScreenDepth(0),
@@ -494,17 +496,26 @@ gfxPlatform::gfxPlatform()
   mWordCacheCharLimit = UNINITIALIZED_VALUE;
   mWordCacheMaxEntries = UNINITIALIZED_VALUE;
   mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
   mOpenTypeSVGEnabled = UNINITIALIZED_VALUE;
   mBidiNumeralOption = UNINITIALIZED_VALUE;
 
   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();
 }
 
 gfxPlatform* gfxPlatform::GetPlatform() {
   if (!gPlatform) {
     MOZ_RELEASE_ASSERT(!XRE_IsContentProcess(),
                        "Content Process should have called InitChild() before "
@@ -2906,28 +2917,30 @@ void gfxPlatform::InitOMTPConfig() {
     }
     return;
   }
 
   omtp.SetDefaultFromPref("layers.omtp.enabled", true,
                           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) {
     omtp.ForceDisable(FeatureStatus::Broken,
                       "OMTP is not supported when using cairo",
                       "FEATURE_FAILURE_COMP_PREF"_ns);
   }
 
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -922,17 +922,18 @@ class gfxPlatform : public mozilla::laye
   bool mHasNativeColrFontSupport = false;
 
   // max character limit for words in word cache
   int32_t mWordCacheCharLimit;
 
   // 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;
 
   RefPtr<mozilla::gfx::DrawTarget> mScreenReferenceDrawTarget;
 
  private:
   /**
--- a/layout/reftests/box-shadow/reftest.list
+++ b/layout/reftests/box-shadow/reftest.list
@@ -10,17 +10,17 @@ random != boxshadow-blur-2.html boxshado
 == tableboxshadow-tdshadow.html tableboxshadow-tdshadow-ref.html
 == boxshadow-rounding.html boxshadow-rounding-ref.html
 # One uses old path, one uses WR box shadow.
 == boxshadow-button.html boxshadow-button-ref.html
 fuzzy-if(OSX==1010,0-1,0-24) fuzzy-if(d2d,0-16,0-999) fuzzy-if(skiaContent,0-14,0-179) fuzzy-if(webrender&&swgl,1-1,714-714) == boxshadow-large-border-radius.html boxshadow-large-border-radius-ref.html # Bug 1209649
 
 == boxshadow-fileupload.html boxshadow-fileupload-ref.html
 fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-98,0-152) fuzzy-if(skiaContent,0-13,0-28) fuzzy-if(webrender,19-19,47-47) == boxshadow-inner-basic.html boxshadow-inner-basic-ref.svg
-fuzzy-if(skiaContent,0-1,0-17) random-if(layersGPUAccelerated) == boxshadow-mixed.html boxshadow-mixed-ref.html
+fuzzy-if(skiaContent,0-1,0-18) random-if(layersGPUAccelerated) == boxshadow-mixed.html boxshadow-mixed-ref.html
 fuzzy-if(skiaContent,0-1,0-17) == boxshadow-mixed-2.html boxshadow-mixed-2-ref.html
 random-if(d2d) fuzzy-if(skiaContent,0-1,0-212) fuzzy-if(webrender,0-127,0-3528) == boxshadow-rounded-spread.html boxshadow-rounded-spread-ref.html
 fuzzy-if(skiaContent,0-1,0-50) == chrome://reftest/content/box-shadow/boxshadow-dynamic.xhtml chrome://reftest/content/box-shadow/boxshadow-dynamic-ref.xhtml
 random-if(d2d) fuzzy-if(skiaContent,0-1,0-14) == boxshadow-onecorner.html boxshadow-onecorner-ref.html
 random-if(d2d) fuzzy-if(skiaContent,0-1,0-22) == boxshadow-twocorners.html boxshadow-twocorners-ref.html
 random-if(d2d) fuzzy-if(skiaContent,0-1,0-36) == boxshadow-threecorners.html boxshadow-threecorners-ref.html
 fuzzy(0-2,0-440) == boxshadow-skiprect.html boxshadow-skiprect-ref.html
 == boxshadow-opacity.html boxshadow-opacity-ref.html
--- a/layout/reftests/text-stroke/reftest.list
+++ b/layout/reftests/text-stroke/reftest.list
@@ -1,9 +1,9 @@
 # basic tests for webkit-text-stroke
 # fuzzy is needed here for platform dependent backends
 # These fail on Linux without webrender due to lack of antialiasing of the HTML text stroke
-fuzzy(0-64,0-52) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-776) == webkit-text-stroke-property-001.html webkit-text-stroke-property-001-ref.html
-fuzzy(0-4,0-24) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-4,0-27) fuzzy-if(geckoview&&webrender,0-4,0-1476) == webkit-text-stroke-property-002.html webkit-text-stroke-property-002-ref.html
-fuzzy(0-48,0-28) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-528) == webkit-text-stroke-property-003.html webkit-text-stroke-property-003-ref.html
-fuzzy(0-64,0-33) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-575) fuzzy-if(geckoview&&webrender&&device,0-64,0-599) fuzzy-if(geckoview&&webrender&&emulator,96-96,58-58) == webkit-text-stroke-property-004.html webkit-text-stroke-property-004-ref.html
-fuzzy(0-64,0-47) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-860) == webkit-text-stroke-property-005.html webkit-text-stroke-property-005-ref.html
-fuzzy(0-71,0-10) fails-if(gtkWidget&&!webrender) == webkit-text-stroke-property-006.html webkit-text-stroke-property-006-ref.html
+fuzzy(0-64,0-52) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!webrender) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-776) == webkit-text-stroke-property-001.html webkit-text-stroke-property-001-ref.html
+fuzzy(0-4,0-24) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!webrender) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-4,0-27) fuzzy-if(geckoview&&webrender,0-4,0-1476) == webkit-text-stroke-property-002.html webkit-text-stroke-property-002-ref.html
+fuzzy(0-48,0-28) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!webrender) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-528) == webkit-text-stroke-property-003.html webkit-text-stroke-property-003-ref.html
+fuzzy(0-64,0-33) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!webrender) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-575) fuzzy-if(geckoview&&webrender&&device,0-64,0-599) fuzzy-if(geckoview&&webrender&&emulator,96-96,58-58) == webkit-text-stroke-property-004.html webkit-text-stroke-property-004-ref.html
+fuzzy(0-64,0-47) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!webrender) fails-if(gtkWidget&&!webrender) fuzzy-if(webrender,0-64,0-860) == webkit-text-stroke-property-005.html webkit-text-stroke-property-005-ref.html
+fuzzy(0-71,0-10) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!webrender) fails-if(gtkWidget&&!webrender) == webkit-text-stroke-property-006.html webkit-text-stroke-property-006-ref.html
--- a/testing/web-platform/meta/css/CSS2/backgrounds/background-position-001.xht.ini
+++ b/testing/web-platform/meta/css/CSS2/backgrounds/background-position-001.xht.ini
@@ -1,4 +1,4 @@
 [background-position-001.xht]
   expected:
-    if (os == "win") and not webrender: FAIL
+    if (os == "win") and (bits != 32) and not webrender: FAIL
     if (os == "mac") and not webrender: FAIL
--- a/testing/web-platform/meta/css/CSS2/backgrounds/background-position-002.xht.ini
+++ b/testing/web-platform/meta/css/CSS2/backgrounds/background-position-002.xht.ini
@@ -1,4 +1,4 @@
 [background-position-002.xht]
   expected:
-    if (os == "win") and not webrender: FAIL
+    if (os == "win") and (bits != 32) and not webrender: FAIL
     if (os == "mac") and not webrender: FAIL
--- a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-012.html.ini
+++ b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-012.html.ini
@@ -1,3 +1,3 @@
 [content-visibility-012.html]
   expected:
-    if (os == "win") and not webrender: FAIL
+    if (os == "win") and (bits != 32) and not webrender: FAIL
--- a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-014.html.ini
+++ b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-014.html.ini
@@ -1,3 +1,3 @@
 [content-visibility-014.html]
   expected:
-    if (os == "win") and not webrender: FAIL
+    if (os == "win") and (bits != 32) and not webrender: FAIL
--- a/testing/web-platform/meta/css/css-fill-stroke/paint-order-001.tentative.html.ini
+++ b/testing/web-platform/meta/css/css-fill-stroke/paint-order-001.tentative.html.ini
@@ -1,8 +1,9 @@
 [paint-order-001.tentative.html]
   disabled:
     if os == "android" and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1520847
   expected:
     if webrender and (os == 'android'): FAIL
-    if (os == "win"): FAIL
+    if webrender and (os == "win"): FAIL
+    if not webrender and (os == "win") and (bits != 32): FAIL
   fuzzy:
     if (os == "mac") and webrender: maxDifference=0-1;totalPixels=0-1054
--- a/testing/web-platform/meta/css/css-will-change/will-change-transform-zero-size-child-overflow-visible.html.ini
+++ b/testing/web-platform/meta/css/css-will-change/will-change-transform-zero-size-child-overflow-visible.html.ini
@@ -1,3 +1,3 @@
 [will-change-transform-zero-size-child-overflow-visible.html]
   expected:
-    if (os == "win") and not webrender: FAIL
+    if (os == "win") and (bits != 32) and not webrender: FAIL
--- a/testing/web-platform/meta/svg/shapes/reftests/pathlength-001.svg.ini
+++ b/testing/web-platform/meta/svg/shapes/reftests/pathlength-001.svg.ini
@@ -1,4 +1,5 @@
 [pathlength-001.svg]
   expected:
     if (os == "linux") and not webrender: PASS
+    if (os == "win") and (bits == 32) and not webrender: PASS
     FAIL