Commit 912f6332 authored by Frank Liberato's avatar Frank Liberato Committed by Commit Bot

Allow profile changes in D3D11VideoDecoder.

Also removes "Allow copy" finch param.  Code now uses "enabled" path.

Bug: 1147960, 1022246
Change-Id: Ie3e7fcb85b2ed2a4ef67e41b0777aec137521bf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533039
Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
Auto-Submit: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarTed Meyer <tmathmeyer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827025}
parent 723f1140
......@@ -319,11 +319,6 @@ const base::Feature kD3D11VideoDecoderIgnoreWorkarounds{
const base::Feature kD3D11VideoDecoderVP9Profile2{
"D3D11VideoDecoderEnableVP9Profile2", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable D3D11VideoDecoder to copy pictures based on workarounds, rather
// than binding them.
const base::Feature kD3D11VideoDecoderCopyPictures{
"D3D11VideoDecoderCopyPictures", base::FEATURE_DISABLED_BY_DEFAULT};
// Tell D3D11VideoDecoder not to switch the D3D11 device to multi-threaded mode.
// This is to help us track down IGD crashes.
const base::Feature kD3D11VideoDecoderSkipMultithreaded{
......
......@@ -114,7 +114,6 @@ MEDIA_EXPORT extern const base::Feature kD3D11PrintCodecOnCrash;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoder;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderIgnoreWorkarounds;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderVP9Profile2;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderCopyPictures;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderSkipMultithreaded;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderAlwaysCopy;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderAllowOverlay;
......
......@@ -77,6 +77,7 @@ class MEDIA_EXPORT VideoDecoderConfig {
VideoCodec codec() const { return codec_; }
VideoCodecProfile profile() const { return profile_; }
void set_profile(VideoCodecProfile profile) { profile_ = profile; }
AlphaMode alpha_mode() const { return alpha_mode_; }
// Difference between encoded and display orientation.
......
......@@ -91,4 +91,13 @@ TEST(VideoDecoderConfigTest, Invalid_AspectRatioDenominatorVeryLarge) {
EXPECT_FALSE(config.IsValidConfig());
}
TEST(VideoDecoderConfigTest, SetProfile) {
VideoDecoderConfig config(
kCodecVP9, VP9PROFILE_PROFILE0, VideoDecoderConfig::AlphaMode::kIsOpaque,
VideoColorSpace(), kNoTransformation, kCodedSize, kVisibleRect,
kNaturalSize, EmptyExtraData(), EncryptionScheme::kUnencrypted);
config.set_profile(VP9PROFILE_PROFILE2);
EXPECT_EQ(config.profile(), VP9PROFILE_PROFILE2);
}
} // namespace media
......@@ -595,13 +595,9 @@ void D3D11VideoDecoder::DoDecode() {
return;
CreatePictureBuffers();
} else if (result == media::AcceleratedVideoDecoder::kConfigChange) {
// TODO(liberato): I think we support this now, as long as it's the same
// decoder. Should update |config_| though.
if (profile_ != accelerated_video_decoder_->GetProfile()) {
// TODO(crbug.com/1022246): Handle profile change.
LOG(ERROR) << "Profile change is not supported";
NotifyError("Profile change is not supported");
return;
profile_ = accelerated_video_decoder_->GetProfile();
config_.set_profile(profile_);
}
// Before the first frame, we get a config change that we should ignore.
// We only want to take action if this is a mid-stream config change. We
......@@ -912,25 +908,6 @@ D3D11VideoDecoder::GetSupportedVideoDecoderConfigs(
GetD3D11DeviceCB get_d3d11_device_cb) {
const std::string uma_name("Media.D3D11.WasVideoSupported");
// This workaround accounts for almost half of all startup results, and it's
// unclear that it's relevant here. If it's off, or if we're allowed to copy
// pictures in case binding isn't allowed, then proceed with init.
// NOTE: experimentation showed that, yes, it does actually matter.
if (!base::FeatureList::IsEnabled(kD3D11VideoDecoderCopyPictures)) {
// Must allow zero-copy of nv12 textures.
if (!gpu_preferences.enable_zero_copy_dxgi_video) {
UMA_HISTOGRAM_ENUMERATION(uma_name,
NotSupportedReason::kZeroCopyNv12Required);
return {};
}
if (gpu_workarounds.disable_dxgi_zero_copy_video) {
UMA_HISTOGRAM_ENUMERATION(uma_name,
NotSupportedReason::kZeroCopyVideoRequired);
return {};
}
}
if (!base::FeatureList::IsEnabled(kD3D11VideoDecoderIgnoreWorkarounds)) {
// Allow all of d3d11 to be turned off by workaround.
if (gpu_workarounds.disable_d3d11_video_decoder) {
......
......@@ -350,22 +350,6 @@ TEST_F(D3D11VideoDecoderTest, DoesNotSupportEncryptionWithoutFlag) {
StatusCode::kDecoderInitializeNeverCompleted);
}
TEST_F(D3D11VideoDecoderTest, DoesNotSupportZeroCopyPreference) {
gpu_preferences_.enable_zero_copy_dxgi_video = false;
CreateDecoder();
InitializeDecoder(
TestVideoConfig::NormalCodecProfile(kCodecH264, H264PROFILE_MAIN),
StatusCode::kDecoderInitializeNeverCompleted);
}
TEST_F(D3D11VideoDecoderTest, DoesNotSupportZeroCopyWorkaround) {
gpu_workarounds_.disable_dxgi_zero_copy_video = true;
CreateDecoder();
InitializeDecoder(
TestVideoConfig::NormalCodecProfile(kCodecH264, H264PROFILE_MAIN),
StatusCode::kDecoderInitializeNeverCompleted);
}
TEST_F(D3D11VideoDecoderTest, IgnoreWorkaroundsIgnoresWorkaround) {
// k...IgnoreWorkarounds should enable the decoder even if it's turned off
// for gpu workarounds.
......
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