Bug 1350962 - Log WebRender status into the app notes of crash reports. r?milan draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 27 Mar 2017 11:44:01 -0400
changeset 551878 192aae46c7556b7430ce7d4d7056b56d71e10968
parent 551789 9577ddeaafd85554c2a855f385a87472a089d5c0
child 621659 f230fa0c7889a027fdfc2454b008ec7f87b85388
push id51179
push userkgupta@mozilla.com
push dateMon, 27 Mar 2017 15:44:18 +0000
reviewersmilan
bugs1350962
milestone55.0a1
Bug 1350962 - Log WebRender status into the app notes of crash reports. r?milan This will add "WR?" if the pref is not set to true, or "WR!" if the pref is set to true (which indicates the user flipped it), followed by "WR+" or "WR-" which indicates whether or not WebRender is enabled. MozReview-Commit-ID: F3h5UowCxij
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2291,20 +2291,23 @@ 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 (Preferences::GetBool("gfx.webrender.enabled", false)) {
+  bool prefEnabled = Preferences::GetBool("gfx.webrender.enabled", false);
+  if (prefEnabled) {
     featureWebRender.UserEnable("Enabled by pref");
   }
 
+  ScopedGfxFeatureReporter reporter("WR", prefEnabled);
+
   // 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",
       NS_LITERAL_CSTRING("FEATURE_FAILURE_GPU_PROCESS_DISABLED"));
   }
@@ -2320,17 +2323,20 @@ gfxPlatform::InitWebRenderConfig()
 #ifndef MOZ_BUILD_WEBRENDER
   featureWebRender.ForceDisable(
     FeatureStatus::Unavailable,
     "Build doesn't include WebRender",
     NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_WEBRENDER"));
 #endif
 
   // gfxFeature is not usable in the GPU process, so we use gfxVars to transmit this feature
-  gfxVars::SetUseWebRender(gfxConfig::IsEnabled(Feature::WEBRENDER));
+  if (gfxConfig::IsEnabled(Feature::WEBRENDER)) {
+    gfxVars::SetUseWebRender(true);
+    reporter.SetSuccessful();
+  }
 }
 
 bool
 gfxPlatform::CanUseHardwareVideoDecoding()
 {
   // this function is called from the compositor thread, so it is not
   // safe to init the prefs etc. from here.
   MOZ_ASSERT(sLayersAccelerationPrefsInitialized);