Bug 1342450 - Extract a MOZ_ENABLE_WEBRENDER from MOZ_BUILD_WEBRENDER so that we build but disable by default. r=rhunt,froydnj,ted
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 22 Mar 2017 17:38:09 -0400
changeset 349103 7e4575ad9ce7126773dc7dadc7774f55719a60a0
parent 349102 2e6a7c83e474948334868a557253743e5bd03753
child 349104 9d9e9c6020bd55e99c0168017825310caf76b0a8
push id31542
push usercbook@mozilla.com
push dateThu, 23 Mar 2017 12:44:24 +0000
treeherdermozilla-central@2e95b7e18fcf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt, froydnj, ted
bugs1342450
milestone55.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 1342450 - Extract a MOZ_ENABLE_WEBRENDER from MOZ_BUILD_WEBRENDER so that we build but disable by default. r=rhunt,froydnj,ted This adds back a MOZ_ENABLE_WEBRENDER define, which only controls whether or not WebRender is enabled at runtime. The default behaviour is changed so that: - if the user specifies --disable-webrender in the mozconfig, WebRender is neither built nor enabled - if the user specifies --enable-webrender in the mozconfig, WebRender is built and enabled - if the user specifies --enable-webrender=build in the mozconfig, WebRender is built but not enabled, except on Android where it is neither built nor enabled - if the user doesn't specify any of the above, the default behaviour is: - on nightly/local builds, the same as --enable-webrender=build - on other channels (e.g. aurora), the same as --disable-webrender The net effect is that local/Nightly-automation builds will have WebRender built-in but not enabled where possible (i.e. not Android). However the user can override this behaviour via mozconfig options to either not build WebRender at all, or to enable it in addition to building it. MozReview-Commit-ID: IM7DdSHkIB
gfx/thebes/gfxPlatform.cpp
modules/libpref/init/all.js
modules/libpref/moz.build
toolkit/moz.configure
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2284,22 +2284,23 @@ gfxPlatform::InitCompositorAccelerationP
   }
 }
 
 void
 gfxPlatform::InitWebRenderConfig()
 {
   FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
 
-  featureWebRender.EnableByDefault();
-
-  if (!Preferences::GetBool("gfx.webrender.enabled", false)) {
-    featureWebRender.UserDisable(
-      "User disabled WebRender",
-      NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBRENDER_DISABLED"));
+  featureWebRender.DisableByDefault(
+      FeatureStatus::OptIn,
+      "WebRender is an opt-in feature",
+      NS_LITERAL_CSTRING("FEATURE_FAILURE_DEFAULT_OFF"));
+
+  if (Preferences::GetBool("gfx.webrender.enabled", false)) {
+    featureWebRender.UserEnable("Enabled by pref");
   }
 
   // WebRender relies on the GPU process when on Windows
 #ifdef XP_WIN
   if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
     featureWebRender.ForceDisable(
       FeatureStatus::Unavailable,
       "GPU Process is disabled",
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -813,17 +813,21 @@ 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);
 
+#ifdef MOZ_ENABLE_WEBRENDER
 pref("gfx.webrender.enabled", true);
+#else
+pref("gfx.webrender.enabled", false);
+#endif
 
 pref("accessibility.browsewithcaret", false);
 pref("accessibility.warn_on_browsewithcaret", true);
 
 pref("accessibility.browsewithcaret_shortcut.enabled", true);
 
 #ifndef XP_MACOSX
 // Tab focus model bit field:
@@ -5634,13 +5638,13 @@ pref("dom.moduleScripts.enabled", false)
 pref("dom.timeout.max_consecutive_callbacks", 5);
 
 #ifdef FUZZING
 pref("fuzzing.enabled", false);
 #endif
 
 // Set advanced layers preferences here.
 pref("layers.advanced.border-layers", false);
-#ifdef MOZ_BUILD_WEBRENDER
+#ifdef MOZ_ENABLE_WEBRENDER
 pref("layers.advanced.caret-layers", true);
 #else
 pref("layers.advanced.caret-layers", false);
 #endif
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
@@ -40,12 +40,14 @@ SOURCES += [
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
 DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
+if CONFIG['MOZ_ENABLE_WEBRENDER']:
+    DEFINES['MOZ_ENABLE_WEBRENDER'] = True
 
 FINAL_TARGET_PP_FILES += [
     'greprefs.js',
 ]
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -688,22 +688,47 @@ option('--with-servo', env='SERVO_TARGET
 
 @depends_if('--with-servo')
 def servo_target_dir(value):
     return value[0]
 
 set_config('SERVO_TARGET_DIR', servo_target_dir)
 
 # WebRender integration
-option('--enable-webrender', help='Include WebRender')
+option('--enable-webrender', nargs='?', choices=('build',),
+       help='Include WebRender in the build and/or enable it at runtime')
+
+@depends('--enable-webrender', milestone, target)
+def webrender(value, milestone, target):
+    build_webrender = None
+    enable_webrender = None
 
-set_config('MOZ_BUILD_WEBRENDER',
-           depends_if('--enable-webrender')(lambda _: True))
-set_define('MOZ_BUILD_WEBRENDER',
-           depends_if('--enable-webrender')(lambda _: True))
+    if target.os == 'Android':
+        # we can't yet build WebRender on Android, see bug 1323612.
+        pass
+    elif value.origin == 'default':
+        # if nothing is specified, default to just building on Nightly
+        build_webrender = milestone.is_nightly
+    elif value == 'build':
+        # if explicitly set to 'build', then we build but don't enable
+        build_webrender = True
+    elif bool(value):
+        # if set to true, then build and enable
+        build_webrender = True
+        enable_webrender = True
+
+    # in all other cases, don't build it or enable it (defaults are fine)
+    return namespace(
+        build = build_webrender,
+        enable = enable_webrender,
+    )
+
+set_config('MOZ_BUILD_WEBRENDER', delayed_getattr(webrender, 'build'))
+set_define('MOZ_BUILD_WEBRENDER', delayed_getattr(webrender, 'build'))
+set_config('MOZ_ENABLE_WEBRENDER', delayed_getattr(webrender, 'enable'))
 
 # Printing
 # ==============================================================
 @depends(target)
 def ios_disable_printing(target):
     if target.os == 'iOS':
         return False