Commit 0d352cd9 authored by Ted Meyer's avatar Ted Meyer Committed by Commit Bot

Add UMA stat for D3D11 init failure reasons

A histogram called Media.D3D11.WasVideoSupported is being added to track
how many videos actually being played are capable of using the d3d11
decoder, or if they are not supported, then for what reason

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ibb57f34644b66211afbf4bba4776124e8bafa6d3
Reviewed-on: https://chromium-review.googlesource.com/1117895
Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572081}
parent ff13ec20
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/metrics/histogram_macros.h"
#include "media/base/bind_to_current_loop.h" #include "media/base/bind_to_current_loop.h"
#include "media/base/decoder_buffer.h" #include "media/base/decoder_buffer.h"
#include "media/base/video_codecs.h" #include "media/base/video_codecs.h"
...@@ -170,6 +171,11 @@ void D3D11VideoDecoder::SetCreateDeviceCallbackForTesting( ...@@ -170,6 +171,11 @@ void D3D11VideoDecoder::SetCreateDeviceCallbackForTesting(
create_device_func_ = std::move(callback); create_device_func_ = std::move(callback);
} }
void D3D11VideoDecoder::SetWasSupportedReason(
D3D11VideoNotSupportedReason enum_value) {
UMA_HISTOGRAM_ENUMERATION("Media.D3D11.WasVideoSupported", enum_value);
}
bool D3D11VideoDecoder::IsPotentiallySupported( bool D3D11VideoDecoder::IsPotentiallySupported(
const VideoDecoderConfig& config) { const VideoDecoderConfig& config) {
// TODO(liberato): All of this could be moved into MojoVideoDecoder, so that // TODO(liberato): All of this could be moved into MojoVideoDecoder, so that
...@@ -182,31 +188,38 @@ bool D3D11VideoDecoder::IsPotentiallySupported( ...@@ -182,31 +188,38 @@ bool D3D11VideoDecoder::IsPotentiallySupported(
HRESULT hr = create_device_func_.Run( HRESULT hr = create_device_func_.Run(
nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, levels, ARRAYSIZE(levels), nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, levels, ARRAYSIZE(levels),
D3D11_SDK_VERSION, nullptr, nullptr, nullptr); D3D11_SDK_VERSION, nullptr, nullptr, nullptr);
if (FAILED(hr)) { if (FAILED(hr)) {
SetWasSupportedReason(
D3D11VideoNotSupportedReason::kInsufficientD3D11FeatureLevel);
DVLOG(2) << "Insufficient D3D11 feature level"; DVLOG(2) << "Insufficient D3D11 feature level";
return false; return false;
} }
// Must be H264. // Must be H264.
// TODO(tmathmeyer): vp9 should be supported.
const bool is_h264 = config.profile() >= H264PROFILE_MIN && const bool is_h264 = config.profile() >= H264PROFILE_MIN &&
config.profile() <= H264PROFILE_MAX; config.profile() <= H264PROFILE_MAX;
if (!is_h264) { if (is_h264) {
if (config.profile() == H264PROFILE_HIGH10PROFILE) {
// Must use NV12, which excludes HDR.
SetWasSupportedReason(D3D11VideoNotSupportedReason::kProfileNotSupported);
DVLOG(2) << "High 10 profile is not supported.";
return false;
}
} else {
DVLOG(2) << "Profile is not H264."; DVLOG(2) << "Profile is not H264.";
return false; return false;
} }
// Must use NV12, which excludes HDR.
if (config.profile() == H264PROFILE_HIGH10PROFILE) {
DVLOG(2) << "High 10 profile is not supported.";
return false;
}
// TODO(liberato): dxva checks IsHDR() in the target colorspace, but we don't // TODO(liberato): dxva checks IsHDR() in the target colorspace, but we don't
// have the target colorspace. It's commented as being for vpx, though, so // have the target colorspace. It's commented as being for vpx, though, so
// we skip it here for now. // we skip it here for now.
// Must use the validating decoder. // Must use the validating decoder.
// TODO(tmathmeyer): support passthrough decoder. No logging to UMA since
// this condition should go away soon.
if (gpu_preferences_.use_passthrough_cmd_decoder) { if (gpu_preferences_.use_passthrough_cmd_decoder) {
DVLOG(2) << "Must use validating decoder."; DVLOG(2) << "Must use validating decoder.";
return false; return false;
...@@ -214,15 +227,18 @@ bool D3D11VideoDecoder::IsPotentiallySupported( ...@@ -214,15 +227,18 @@ bool D3D11VideoDecoder::IsPotentiallySupported(
// Must allow zero-copy of nv12 textures. // Must allow zero-copy of nv12 textures.
if (!gpu_preferences_.enable_zero_copy_dxgi_video) { if (!gpu_preferences_.enable_zero_copy_dxgi_video) {
SetWasSupportedReason(D3D11VideoNotSupportedReason::kZeroCopyNv12Required);
DVLOG(2) << "Must allow zero-copy NV12."; DVLOG(2) << "Must allow zero-copy NV12.";
return false; return false;
} }
if (gpu_workarounds_.disable_dxgi_zero_copy_video) { if (gpu_workarounds_.disable_dxgi_zero_copy_video) {
SetWasSupportedReason(D3D11VideoNotSupportedReason::kZeroCopyVideoRequired);
DVLOG(2) << "Must allow zero-copy video."; DVLOG(2) << "Must allow zero-copy video.";
return false; return false;
} }
SetWasSupportedReason(D3D11VideoNotSupportedReason::kVideoIsSupported);
return true; return true;
} }
......
...@@ -75,6 +75,29 @@ class MEDIA_GPU_EXPORT D3D11VideoDecoder : public VideoDecoder { ...@@ -75,6 +75,29 @@ class MEDIA_GPU_EXPORT D3D11VideoDecoder : public VideoDecoder {
const gpu::GpuDriverBugWorkarounds& gpu_workarounds, const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
std::unique_ptr<D3D11VideoDecoderImpl> impl); std::unique_ptr<D3D11VideoDecoderImpl> impl);
enum class D3D11VideoNotSupportedReason {
kVideoIsSupported = 0,
// D3D11 version 11.1 required.
kInsufficientD3D11FeatureLevel = 1,
// The video profile for a supported codec is not supported.
kProfileNotSupported = 2,
// GPU options: require zero copy.
kZeroCopyNv12Required = 3,
// GPU options: require zero copy.
kZeroCopyVideoRequired = 4,
// For UMA. Must be the last entry. It should be initialized to the
// numerically largest value above; if you add more entries, then please
// update this to the last one.
kMaxValue = kZeroCopyVideoRequired
};
void SetWasSupportedReason(D3D11VideoNotSupportedReason enum_value);
// The implementation, which we trampoline to the impl thread. // The implementation, which we trampoline to the impl thread.
// This must be freed on the impl thread. // This must be freed on the impl thread.
std::unique_ptr<D3D11VideoDecoderImpl> impl_; std::unique_ptr<D3D11VideoDecoderImpl> impl_;
......
...@@ -8863,6 +8863,24 @@ Called by update_net_error_codes.py.--> ...@@ -8863,6 +8863,24 @@ Called by update_net_error_codes.py.-->
<int value="14" label="D3D11CreateDevice returned DXGI_ERROR_DEVICE_HUNG"/> <int value="14" label="D3D11CreateDevice returned DXGI_ERROR_DEVICE_HUNG"/>
</enum> </enum>
<enum name="D3D11VideoNotSupportedReason">
<int value="0" label="kVideoIsSupported">
Video is not disqualified from potential playback.
</int>
<int value="1" label="kInsufficientD3D11FeatureLevel">
D3D11 is not 11.1 or later.
</int>
<int value="2" label="kProfileNotSupported">
A supported video codec is using the an unsupported profile.
</int>
<int value="3" label="kZeroCopyNv12Required">
The GPU is not configured to allow zero copy for nv12.
</int>
<int value="4" label="kZeroCopyVideoRequired">
The GPU is not configured to allow zero copy for videos.
</int>
</enum>
<enum name="D3D12FeatureLevel"> <enum name="D3D12FeatureLevel">
<int value="0" label="D3D_FEATURE_LEVEL_UNKNOWN"/> <int value="0" label="D3D_FEATURE_LEVEL_UNKNOWN"/>
<int value="1" label="D3D_FEATURE_LEVEL_12_0"/> <int value="1" label="D3D_FEATURE_LEVEL_12_0"/>
...@@ -39573,6 +39573,17 @@ uploading your change for review. ...@@ -39573,6 +39573,17 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="Media.D3D11.WasVideoSupported"
enum="D3D11VideoNotSupportedReason" expires_after="M70">
<owner>liberato@chromium.org</owner>
<owner>sandersd@chromium.org</owner>
<owner>tmathmeyer@chromium.org</owner>
<summary>
This enum measures whether or not d3d11 is supported and if not, what the
reason is.
</summary>
</histogram>
<histogram name="Media.DetectedAudioCodec" enum="FFmpegCodecs"> <histogram name="Media.DetectedAudioCodec" enum="FFmpegCodecs">
<obsolete> <obsolete>
Deprecated Sep 15 2015 in favor of Media.DetectedAudioCodecHash Deprecated Sep 15 2015 in favor of Media.DetectedAudioCodecHash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment