Bug 1393392 P3 - a help funtion to record telemetry data; draft
authorKaku Kuo <kaku@mozilla.com>
Mon, 21 Aug 2017 16:11:19 +0800
changeset 652788 836313a64e44de102b1416bd82960fc98f62e739
parent 652787 88e897bc04ca65eef21fc831153ceac9da52120c
child 652789 daee2761899ef11cb062a2c1ff404487686be061
push id76152
push userbmo:kaku@mozilla.com
push dateFri, 25 Aug 2017 07:50:59 +0000
bugs1393392
milestone57.0a1
Bug 1393392 P3 - a help funtion to record telemetry data; MozReview-Commit-ID: ISb2CFLkbEi
gfx/ipc/GPUProcessManager.cpp
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -46,16 +46,55 @@
 #endif
 
 #if defined(MOZ_WIDGET_ANDROID)
 #include "mozilla/widget/AndroidUiThread.h"
 #include "mozilla/layers/UiCompositorControllerChild.h"
 #endif // defined(MOZ_WIDGET_ANDROID)
 
 namespace mozilla {
+
+static void
+ReportUnblacklistingTelemetry(bool isGPUProcessCrashed,
+                              bool isHWDecodingOnGPUProcess,
+                              const nsCString& aD3D11BlacklistedDriver,
+                              const nsCString& aD3D9BlacklistedDriver)
+{
+#ifdef XP_WIN
+  const nsCString& blacklistedDLL = !aD3D11BlacklistedDriver.IsEmpty()
+                                    ? aD3D11BlacklistedDriver
+                                    : aD3D9BlacklistedDriver;
+
+  if (!blacklistedDLL.IsEmpty()) {
+    const uint32_t type = [isHWDecodingOnGPUProcess, isGPUProcessCrashed]() {
+      if (isHWDecodingOnGPUProcess) {
+        if (!isGPUProcessCrashed) {
+          return 0;
+        }
+        else {
+          return 1;
+        }
+      }
+      else {
+        if (!isGPUProcessCrashed) {
+          return 2;
+        }
+        else {
+          return 3;
+        }
+      }
+    }();
+
+    Telemetry::Accumulate(Telemetry::VIDEO_UNBLACKINGLISTING_DXVA_DRIVER_RUNTIME_STATUS,
+                          blacklistedDLL,
+                          type);
+  }
+#endif // XP_WIN
+}
+
 namespace gfx {
 
 using namespace mozilla::layers;
 
 enum class FallbackType : uint32_t
 {
   NONE = 0,
   DECODINGDISABLED,