[go: up one dir, main page]

Merge M76: "Use DXGI_FORMAT_P010 when querying VP9 10 bit D3D11 support."

DXGI_FORMAT_NV12 is not supported (despite CheckVideoDecoderFormat()
saying it is). We must test using DXGI_FORMAT_P010.

BUG=937108
TEST=GetVideoDecoderConfigCount() > 0.
R=​sunnyps

(cherry picked from commit 0d34c44bf3dffb64d11094cb4b029111e991c08f)

Change-Id: I04fd47c49b7d79541ef423b7570965ec6cb72d82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637944
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#665375}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663187
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/branch-heads/3809@{#420}
Cr-Branched-From: d82dec1a818f378c464ba307ddd9c92133eac355-refs/heads/master@{#665002}
diff --git a/media/gpu/windows/dxva_video_decode_accelerator_win.cc b/media/gpu/windows/dxva_video_decode_accelerator_win.cc
index 4bd4b2f..0bb051f 100644
--- a/media/gpu/windows/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/windows/dxva_video_decode_accelerator_win.cc
@@ -241,12 +241,13 @@
 // on the given |video_device|.
 bool IsResolutionSupportedForDevice(const gfx::Size& resolution_to_test,
                                     const GUID& decoder_guid,
-                                    ID3D11VideoDevice* video_device) {
+                                    ID3D11VideoDevice* video_device,
+                                    DXGI_FORMAT format) {
   D3D11_VIDEO_DECODER_DESC desc = {
       decoder_guid,                 // Guid
       resolution_to_test.width(),   // SampleWidth
       resolution_to_test.height(),  // SampleHeight
-      DXGI_FORMAT_NV12              // OutputFormat
+      format                        // OutputFormat
   };
 
   // We've chosen the least expensive test for identifying if a given resolution
@@ -273,7 +274,8 @@
     const gfx::Size& default_max,
     ID3D11VideoDevice* video_device,
     const std::vector<GUID>& valid_guids,
-    const std::vector<gfx::Size>& resolutions_to_test) {
+    const std::vector<gfx::Size>& resolutions_to_test,
+    DXGI_FORMAT format = DXGI_FORMAT_NV12) {
   TRACE_EVENT0("gpu,startup", "GetMaxResolutionsForGUIDs");
   ResolutionPair result(default_max, gfx::Size());
 
@@ -300,16 +302,20 @@
                         }));
 
   for (const auto& res : resolutions_to_test) {
-    if (!IsResolutionSupportedForDevice(res, decoder_guid, video_device))
+    if (!IsResolutionSupportedForDevice(res, decoder_guid, video_device,
+                                        format)) {
       break;
+    }
     result.first = res;
   }
 
   // The max supported portrait resolution should be just be a w/h flip of the
   // max supported landscape resolution.
   gfx::Size flipped(result.first.height(), result.first.width());
-  if (IsResolutionSupportedForDevice(flipped, decoder_guid, video_device))
+  if (IsResolutionSupportedForDevice(flipped, decoder_guid, video_device,
+                                     format)) {
     result.second = flipped;
+  }
 
   return result;
 }
@@ -1447,7 +1453,8 @@
               {D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2},
               {gfx::Size(4096, 2160), gfx::Size(4096, 2304),
                gfx::Size(7680, 4320), gfx::Size(8192, 4320),
-               gfx::Size(8192, 8192)});
+               gfx::Size(8192, 8192)},
+              DXGI_FORMAT_P010);
         }
       }
     }