Add Telemetry environment and failure tracking for Advanced Layers. (bug 1365879 part 23, r=milan, data_r=bsmedberg)
☠☠ backed out by b6153802d9d3 ☠ ☠
authorDavid Anderson <danderson@mozilla.com>
Thu, 22 Jun 2017 21:12:20 -0700
changeset 414457 35129e4e204baebf5b1fff37f48dbe08f492d2dc
parent 414456 be62d3eb3b3b125a4421277a8819c8b192416c23
child 414458 ab715ee9ef99b92f8a47035f8b2538893a413c41
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan, data_r
bugs1365879
milestone56.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
Add Telemetry environment and failure tracking for Advanced Layers. (bug 1365879 part 23, r=milan, data_r=bsmedberg)
gfx/thebes/DeviceManagerDx.cpp
toolkit/components/telemetry/Scalars.yaml
toolkit/components/telemetry/docs/data/environment.rst
widget/GfxInfoBase.cpp
widget/nsIGfxInfo.idl
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerDx.cpp
@@ -14,16 +14,17 @@
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/GPUParent.h"
 #include "mozilla/gfx/GraphicsMessages.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/layers/CompositorThread.h"
 #include "mozilla/layers/DeviceAttachmentsD3D11.h"
 #include "mozilla/layers/MLGDeviceD3D11.h"
 #include "nsIGfxInfo.h"
+#include "nsString.h"
 #include <d3d11.h>
 #include <ddraw.h>
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #include "nsPrintfCString.h"
 #endif
 
@@ -647,16 +648,26 @@ DisableAdvancedLayers(FeatureStatus aSta
   }
 
   al.SetFailed(aStatus, aMessage.get(), aFailureId);
 
   FeatureFailure info(aStatus, aMessage, aFailureId);
   if (GPUParent* gpu = GPUParent::GetSingleton()) {
     gpu->SendUpdateFeature(Feature::ADVANCED_LAYERS, info);
   }
+
+  if (aFailureId.Length()) {
+    nsString failureId = NS_ConvertUTF8toUTF16(aFailureId.get());
+    Telemetry::ScalarAdd(Telemetry::ScalarID::GFX_ADVANCED_LAYERS_FAILURE_ID, failureId, 1);
+  }
+
+  // Notify TelemetryEnvironment.jsm.
+  if (RefPtr<nsIObserverService> obs = mozilla::services::GetObserverService()) {
+    obs->NotifyObservers(nullptr, "gfx-features-ready", nullptr);
+  }
 }
 
 void
 DeviceManagerDx::CreateMLGDevice()
 {
   MOZ_ASSERT(layers::CompositorThreadHolder::IsInCompositorThread());
 
   RefPtr<ID3D11Device> d3d11Device = GetCompositorDevice();
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -649,16 +649,34 @@ telemetry.discarded:
     expires: "never"
     kind: uint
     notification_emails:
       - telemetry-client-dev@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - 'all_childs'
 
+# The following section contains graphics-related scalars.
+gfx.advanced.layers:
+  failure_id:
+    bug_numbers:
+      - 1365879
+    description: >
+      Each key is a failure for initializing Advanced Layers, and each value
+      is the number of times that failure was recorded. The failure codes
+      are unique strings present in MLGDeviceD3D11::Initialize, such that
+      a failure can be traced back to a specific Direct3D API call.
+    keyed: true
+    kind: uint
+    expires: "61"
+    notification_emails:
+      - gfx-telemetry-alerts@mozilla.com
+    record_in_processes:
+      - 'main'
+
 # The following section is for probes testing the Telemetry system. They will not be
 # submitted in pings and are only used for testing.
 telemetry.test:
   unsigned_int_kind:
     bug_numbers:
       - 1276190
     description: >
       This is a test uint type with a really long description, maybe spanning even multiple
--- a/toolkit/components/telemetry/docs/data/environment.rst
+++ b/toolkit/components/telemetry/docs/data/environment.rst
@@ -192,16 +192,19 @@ Structure:
               },
               d2d: { // This feature is Windows-only.
                 status: <string>,
                 version: <string>,      // Either "1.0" or "1.1".
               },
               gpuProcess: { // Out-of-process compositing ("GPU process") feature
                 status: <string>, // "Available" means currently in use
               },
+              advancedLayers: { // Advanced Layers compositing. Only present if D3D11 enabled.
+                status: <string>,    // See the status codes above.
+              },
             },
           },
       },
       addons: {
         activeAddons: { // the currently enabled addons
           <addon id>: {
             blocklisted: <bool>,
             description: <string>, // null if not available
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -165,16 +165,19 @@ GetPrefNameForFeature(int32_t aFeature)
       name = BLACKLIST_PREF_BRANCH "webrtc.hw.acceleration.decode";
       break;
     case nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION:
       name = BLACKLIST_PREF_BRANCH "canvas2d.acceleration";
       break;
     case nsIGfxInfo::FEATURE_WEBGL2:
       name = BLACKLIST_PREF_BRANCH "webgl2";
       break;
+    case nsIGfxInfo::FEATURE_ADVANCED_LAYERS:
+      name = BLACKLIST_PREF_BRANCH "layers.advanced";
+      break;
     case nsIGfxInfo::FEATURE_VP8_HW_DECODE:
     case nsIGfxInfo::FEATURE_VP9_HW_DECODE:
     case nsIGfxInfo::FEATURE_DX_INTEROP2:
     case nsIGfxInfo::FEATURE_GPU_PROCESS:
       // We don't provide prefs for these features.
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
@@ -1364,18 +1367,26 @@ GfxInfoBase::BuildFeatureStateLog(JSCont
 
   return true;
 }
 
 void
 GfxInfoBase::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
 {
   JS::Rooted<JSObject*> obj(aCx);
+
   gfx::FeatureStatus gpuProcess = gfxConfig::GetValue(Feature::GPU_PROCESS);
   InitFeatureObject(aCx, aObj, "gpuProcess", FEATURE_GPU_PROCESS, Some(gpuProcess), &obj);
+
+  // Only include AL if the platform attempted to use it.
+  gfx::FeatureStatus advancedLayers = gfxConfig::GetValue(Feature::ADVANCED_LAYERS);
+  if (advancedLayers != FeatureStatus::Unused) {
+    InitFeatureObject(aCx, aObj, "advancedLayers", FEATURE_ADVANCED_LAYERS,
+                      Some(advancedLayers), &obj);
+  }
 }
 
 bool
 GfxInfoBase::InitFeatureObject(JSContext* aCx,
                                JS::Handle<JSObject*> aContainer,
                                const char* aName,
                                int32_t aFeature,
                                const Maybe<mozilla::gfx::FeatureStatus>& aFeatureStatus,
--- a/widget/nsIGfxInfo.idl
+++ b/widget/nsIGfxInfo.idl
@@ -119,16 +119,18 @@ interface nsIGfxInfo : nsISupports
   /* Whether hardware VP9 decoding is supported, starting in 48. */
   const long FEATURE_VP9_HW_DECODE = 18;
   /* Whether NV_dx_interop2 is supported, starting in 50. */
   const long FEATURE_DX_INTEROP2 = 19;
   /* Whether the GPU process is supported, starting in 52. */
   const long FEATURE_GPU_PROCESS = 20;
   /* Whether the WebGL2 is supported, starting in 54 */
   const long FEATURE_WEBGL2 = 21;
+  /* Whether Advanced Layers is supported, starting in 56 */
+  const long FEATURE_ADVANCED_LAYERS = 22;
   /* the maximum feature value. */
   const long FEATURE_MAX_VALUE = FEATURE_WEBGL2;
 
   /*
    * A set of return values from GetFeatureStatus
    */
 
   /* The driver is safe to the best of our knowledge */