Bug 1392143 - P2. Disable hardware decoding for small videos. r=mattwoodrow
☠☠ backed out by b206bbf564fb ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 06 Sep 2017 17:02:21 +0200
changeset 429067 b1627a3a5d7794782936464743993f335624b523
parent 429066 40e16e34df00f79a1bf23d7550d62ac01b3ea262
child 429068 ff3a335e711188c57ca887f1b4c50edef96c53ca
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1392143
milestone57.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 1392143 - P2. Disable hardware decoding for small videos. r=mattwoodrow As the H264 SanityTest uses a 132x132 videos to determine if the hardware decoder is working, we always use the software decoder for smaller videos. MozReview-Commit-ID: 8VbZTiJO9mA
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
toolkit/components/gfx/SanityTest.js
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -598,18 +598,26 @@ WMFVideoMFTManager::Init()
   }
 
   return success;
 }
 
 bool
 WMFVideoMFTManager::InitInternal()
 {
+  // The H264 SanityTest uses a 132x132 videos to determine if DXVA can be used.
+  // so we want to use the software decoder for videos with lower resolutions.
+  static const int MIN_H264_HW_WIDTH = 132;
+  static const int MIN_H264_HW_HEIGHT = 132;
+
   mUseHwAccel = false; // default value; changed if D3D setup succeeds.
-  bool useDxva = InitializeDXVA();
+  bool useDxva = (mStreamType != H264 ||
+                  (mVideoInfo.ImageRect().width > MIN_H264_HW_WIDTH &&
+                   mVideoInfo.ImageRect().height > MIN_H264_HW_HEIGHT)) &&
+                 InitializeDXVA();
 
   RefPtr<MFTDecoder> decoder;
 
   HRESULT hr;
   if (mStreamType == VP9 && useDxva && mCheckForAMDDecoder &&
       gfxPrefs::PDMWMFAMDVP9DecoderEnabled()) {
     if ((decoder = LoadAMDVP9Decoder())) {
       mAMDVP9InUse = true;
--- a/toolkit/components/gfx/SanityTest.js
+++ b/toolkit/components/gfx/SanityTest.js
@@ -101,16 +101,18 @@ function takeWindowSnapshot(win, ctx) {
 // Verify that all the 4 coloured squares of the video
 // render as expected (with a tolerance of 64 to allow for
 // yuv->rgb differences between platforms).
 //
 // The video is 132*132, and is split into quadrants of
 // different colours. The top left of the video is 8,72
 // and we test a pixel 33,33 into each quadrant to avoid
 // blending differences at the edges.
+// If those values are ever changed, make sure to update
+// WMFVideoMFTManager::CanUseDXVA accordingly.
 //
 // We allow massive amounts of fuzz for the colours since
 // it can depend hugely on the yuv -> rgb conversion, and
 // we don't want to fail unnecessarily.
 function verifyVideoRendering(ctx) {
   return testPixel(ctx, 41, 105, 255, 255, 255, 255, 64) &&
     testPixel(ctx, 107, 105, 0, 255, 0, 255, 64) &&
     testPixel(ctx, 41, 171, 0, 0, 255, 255, 64) &&