Bug 1432515 - Restrict gfx.webrender.{all,enabled} to nightly, and only allow enabling via .all.qualified on beta and release. r=milan
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 09 May 2018 15:24:38 -0400
changeset 417805 a9d2c77dfa141c6bc77d389f2850ab02ea56ed7f
parent 417804 0693ec09dd681c54f3e0c8c64ec4dbc4916d10a1
child 417806 c593385aff7ad655aadf7fa9f988c3ba0df685a2
push id103165
push userebalazs@mozilla.com
push dateFri, 11 May 2018 09:45:25 +0000
treeherdermozilla-inbound@59a49b12b268 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1432515
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1432515 - Restrict gfx.webrender.{all,enabled} to nightly, and only allow enabling via .all.qualified on beta and release. r=milan This ensures that only people with qualified hardware can flip prefs to enable WebRender on beta and release. Nightly users will still be able enable WebRender on unqualified hardware. MozReview-Commit-ID: E5sgzZhuX4p
gfx/thebes/gfxPlatform.cpp
modules/libpref/init/all.js
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2501,18 +2501,26 @@ gfxPlatform::WebRenderEnvvarEnabled()
   const char* env = PR_GetEnv("MOZ_WEBRENDER");
   return (env && *env == '1');
 }
 
 void
 gfxPlatform::InitWebRenderConfig()
 {
   bool prefEnabled = WebRenderPrefEnabled();
-
-  ScopedGfxFeatureReporter reporter("WR", prefEnabled);
+  bool envvarEnabled = WebRenderEnvvarEnabled();
+
+  // On Nightly:
+  //   WR? WR+   => means WR was enabled via gfx.webrender.all.qualified
+  //   WR! WR+   => means WR was enabled via gfx.webrender.{all,enabled} or envvar
+  // On Beta/Release:
+  //   WR? WR+   => means WR was enabled via gfx.webrender.all.qualified on qualified hardware
+  //   WR! WR+   => means WR was enabled via envvar, possibly on unqualified hardware.
+  // In all cases WR- means WR was not enabled, for one of many possible reasons.
+  ScopedGfxFeatureReporter reporter("WR", prefEnabled || envvarEnabled);
   if (!XRE_IsParentProcess()) {
     // The parent process runs through all the real decision-making code
     // later in this function. For other processes we still want to report
     // the state of the feature for crash reports.
     if (gfxVars::UseWebRender()) {
       reporter.SetSuccessful();
     }
     return;
@@ -2520,20 +2528,29 @@ gfxPlatform::InitWebRenderConfig()
 
   FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
 
   featureWebRender.DisableByDefault(
       FeatureStatus::OptIn,
       "WebRender is an opt-in feature",
       NS_LITERAL_CSTRING("FEATURE_FAILURE_DEFAULT_OFF"));
 
-  if (prefEnabled) {
+  // envvar works everywhere; we need this for testing in CI. Sadly this allows
+  // beta/release to enable it on unqualified hardware, but at least this is
+  // harder for the average person than flipping a pref.
+  if (envvarEnabled) {
+    featureWebRender.UserEnable("Force enabled by envvar");
+
+  // gfx.webrender.enabled and gfx.webrender.all only work on nightly
+#ifdef NIGHTLY_BUILD
+  } else if (prefEnabled) {
     featureWebRender.UserEnable("Force enabled by pref");
-  } else if (WebRenderEnvvarEnabled()) {
-    featureWebRender.UserEnable("Force enabled by envvar");
+#endif
+
+  // gfx.webrender.all.qualified works on all channels
   } else if (gfxPrefs::WebRenderAllQualified()) {
     nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
     nsCString discardFailureId;
     int32_t status;
     if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRENDER,
                                                discardFailureId, &status))) {
       if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
         featureWebRender.UserEnable("Qualified enabled by pref ");
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -843,22 +843,35 @@ pref("gfx.work-around-driver-bugs", true
 pref("gfx.draw-color-bars", false);
 
 pref("gfx.logging.painted-pixel-count.enabled", false);
 pref("gfx.logging.texture-usage.enabled", false);
 pref("gfx.logging.peak-texture-usage.enabled", false);
 
 pref("gfx.ycbcr.accurate-conversion", false);
 
+// On Nightly, we expose two prefs: gfx.webrender.all and gfx.webrender.enabled.
+// The first enables WR+additional features, and the second just enables WR.
+// For developer convenience, building with --enable-webrender=true or just
+// --enable-webrender will set gfx.webrender.enabled to true by default.
+// On non-Nightly, we ignore these prefs.
+//
+// On both Nightly and non-Nightly, we have a pref gfx.webrender.all.qualified
+// which is not exposed via about:config. That pref enables WR but only on
+// qualified hardware. This is the pref we'll eventually flip to deploy WebRender
+// to the target population.
+#ifdef NIGHTLY_BUILD
 pref("gfx.webrender.all", false);
 #ifdef MOZ_ENABLE_WEBRENDER
 pref("gfx.webrender.enabled", true);
 #else
 pref("gfx.webrender.enabled", false);
 #endif
+#endif
+
 #ifdef XP_WIN
 pref("gfx.webrender.force-angle", true);
 pref("gfx.webrender.dcomp-win.enabled", true);
 pref("gfx.webrender.program-binary", true);
 #endif
 
 #ifdef XP_MACOSX
 pref("gfx.compositor.glcontext.opaque", false);