Bug 1393392 P4 - report telemetry when we shutdown a remote HW decoder; draft
authorKaku Kuo <kaku@mozilla.com>
Tue, 29 Aug 2017 15:51:22 +0800
changeset 655503 7b8279f83631e21045120474c6bf02497c227950
parent 655502 c8979c276fb273fa8c23896ad9cf1947ea578387
child 728848 1c803cc039d94d1db8ccd7d9b929a1c1fe3fb820
push id76889
push userbmo:kaku@mozilla.com
push dateWed, 30 Aug 2017 02:43:58 +0000
bugs1393392
milestone57.0a1
Bug 1393392 P4 - report telemetry when we shutdown a remote HW decoder; MozReview-Commit-ID: HEgv9s3JsXB
dom/media/ipc/VideoDecoderChild.cpp
--- a/dom/media/ipc/VideoDecoderChild.cpp
+++ b/dom/media/ipc/VideoDecoderChild.cpp
@@ -1,29 +1,48 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "VideoDecoderChild.h"
 #include "VideoDecoderManagerChild.h"
 #include "mozilla/layers/TextureClient.h"
+#include "mozilla/Telemetry.h"
 #include "base/thread.h"
 #include "MediaInfo.h"
 #include "ImageContainer.h"
 #include "GPUVideoImage.h"
 
 namespace mozilla {
 namespace dom {
 
 using base::Thread;
 using namespace ipc;
 using namespace layers;
 using namespace gfx;
 
+#ifdef XP_WIN
+static void
+ReportUnblacklistingTelemetry(bool isGPUProcessCrashed,
+                              const nsCString& aD3D11BlacklistedDriver,
+                              const nsCString& aD3D9BlacklistedDriver)
+{
+  const nsCString& blacklistedDLL = !aD3D11BlacklistedDriver.IsEmpty()
+                                    ? aD3D11BlacklistedDriver
+                                    : aD3D9BlacklistedDriver;
+
+  if (!blacklistedDLL.IsEmpty()) {
+    Telemetry::Accumulate(Telemetry::VIDEO_UNBLACKINGLISTING_DXVA_DRIVER_RUNTIME_STATUS,
+                          blacklistedDLL,
+                          isGPUProcessCrashed ? 1 : 0);
+  }
+}
+#endif // XP_WIN
+
 VideoDecoderChild::VideoDecoderChild()
   : mThread(VideoDecoderManagerChild::GetManagerThread())
   , mCanSend(false)
   , mInitialized(false)
   , mIsHardwareAccelerated(false)
   , mConversion(MediaDataDecoder::ConversionRequired::kNeedNone)
   , mNeedNewDecoder(false)
 {
@@ -139,16 +158,22 @@ VideoDecoderChild::ActorDestroy(ActorDes
           mNeedNewDecoder = true;
         } else {
           ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER,
                                            __func__);
         }
       }));
   }
   mCanSend = false;
+
+#ifdef XP_WIN
+  ReportUnblacklistingTelemetry(aWhy == AbnormalShutdown,
+                                mBlacklistedD3D11Driver,
+                                mBlacklistedD3D9Driver);
+#endif // XP_WIN
 }
 
 bool
 VideoDecoderChild::InitIPDL(const VideoInfo& aVideoInfo,
                             const layers::TextureFactoryIdentifier& aIdentifier)
 {
   RefPtr<VideoDecoderManagerChild> manager =
     VideoDecoderManagerChild::GetSingleton();