Commit 43b04d3a authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

media/gpu: FIX disable-VP8 decoding on BDW -- for VA-API only

crrev.com/c/2398906 wired |disable_accelerated_vp8_decode| for the video
profile enumerations. This is usually correct, because ChromeOS devices
come with only one of those APIs, but some devices (namely guado, rikku
and buddy), are Chromeboxes with VA-API (because they are Intel) and
V4L2 (for a video acceleration chipset). In this case, the GPU driver
workaround should apply to the VA only.

This CL basically removes the profile filtering from the top level
profile enumerations in gpu_mojo_media_client.cc and
gpu_video_decode_accelerator_factory.cc, and pushes it down the class
callstack to VaapiWrapper.

Bug: 1126058, b/167923822, b/168645037
Change-Id: Ic435826303cb01d71f6554acba798b38c5f0b8fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419262Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808538}
parent 3df8b060
...@@ -45,13 +45,13 @@ VideoDecoderPipeline::CreateDecoderFunctions GetCreateDecoderFunctions() { ...@@ -45,13 +45,13 @@ VideoDecoderPipeline::CreateDecoderFunctions GetCreateDecoderFunctions() {
} // namespace } // namespace
// static // static
SupportedVideoDecoderConfigs SupportedVideoDecoderConfigs ChromeosVideoDecoderFactory::GetSupportedConfigs(
ChromeosVideoDecoderFactory::GetSupportedConfigs() { const gpu::GpuDriverBugWorkarounds& workarounds) {
SupportedVideoDecoderConfigs supported_configs; SupportedVideoDecoderConfigs supported_configs;
SupportedVideoDecoderConfigs configs; SupportedVideoDecoderConfigs configs;
#if BUILDFLAG(USE_VAAPI) #if BUILDFLAG(USE_VAAPI)
configs = VaapiVideoDecoder::GetSupportedConfigs(); configs = VaapiVideoDecoder::GetSupportedConfigs(workarounds);
supported_configs.insert(supported_configs.end(), configs.begin(), supported_configs.insert(supported_configs.end(), configs.begin(),
configs.end()); configs.end());
#endif // BUILDFLAG(USE_VAAPI) #endif // BUILDFLAG(USE_VAAPI)
......
...@@ -15,6 +15,10 @@ namespace base { ...@@ -15,6 +15,10 @@ namespace base {
class SequencedTaskRunner; class SequencedTaskRunner;
} // namespace base } // namespace base
namespace gpu {
class GpuDriverBugWorkarounds;
}
namespace media { namespace media {
class DmabufVideoFramePool; class DmabufVideoFramePool;
...@@ -24,7 +28,8 @@ class VideoFrameConverter; ...@@ -24,7 +28,8 @@ class VideoFrameConverter;
class MEDIA_GPU_EXPORT ChromeosVideoDecoderFactory { class MEDIA_GPU_EXPORT ChromeosVideoDecoderFactory {
public: public:
static SupportedVideoDecoderConfigs GetSupportedConfigs(); static SupportedVideoDecoderConfigs GetSupportedConfigs(
const gpu::GpuDriverBugWorkarounds& workarounds);
// Create VideoDecoder instance that allocates VideoFrame from |frame_pool| // Create VideoDecoder instance that allocates VideoFrame from |frame_pool|
// and converts the output VideoFrame |frame_converter|. // and converts the output VideoFrame |frame_converter|.
......
...@@ -68,17 +68,9 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( ...@@ -68,17 +68,9 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal(
vda_profiles, &capabilities.supported_profiles); vda_profiles, &capabilities.supported_profiles);
#endif #endif
#if BUILDFLAG(USE_VAAPI) #if BUILDFLAG(USE_VAAPI)
vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles(); vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles(workarounds);
GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
vda_profiles, &capabilities.supported_profiles); vda_profiles, &capabilities.supported_profiles);
if (workarounds.disable_accelerated_vp8_decode) {
base::EraseIf(
capabilities.supported_profiles,
[](const VideoDecodeAccelerator::SupportedProfile& supported_profile) {
return supported_profile.profile == VP8PROFILE_ANY;
});
}
#endif #endif
#elif defined(OS_MAC) #elif defined(OS_MAC)
capabilities.supported_profiles = capabilities.supported_profiles =
......
...@@ -161,6 +161,7 @@ source_set("common") { ...@@ -161,6 +161,7 @@ source_set("common") {
] ]
public_deps = [ public_deps = [
"//base", "//base",
"//gpu",
"//media", "//media",
"//media/gpu:common", "//media/gpu:common",
"//ui/gfx/geometry", "//ui/gfx/geometry",
...@@ -300,6 +301,7 @@ test("vaapi_unittest") { ...@@ -300,6 +301,7 @@ test("vaapi_unittest") {
":vaapi_utils_unittest", ":vaapi_utils_unittest",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//gpu",
"//media/gpu/test:helpers", "//media/gpu/test:helpers",
"//testing/gtest", "//testing/gtest",
] ]
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/test/launcher/unit_test_launcher.h" #include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "media/gpu/vaapi/vaapi_wrapper.h" #include "media/gpu/vaapi/vaapi_wrapper.h"
namespace media { namespace media {
...@@ -161,7 +162,8 @@ TEST_F(VaapiTest, VerifyNoVAProfileH264Baseline) { ...@@ -161,7 +162,8 @@ TEST_F(VaapiTest, VerifyNoVAProfileH264Baseline) {
TEST_F(VaapiTest, GetSupportedDecodeProfiles) { TEST_F(VaapiTest, GetSupportedDecodeProfiles) {
const auto va_info = RetrieveVAInfoOutput(); const auto va_info = RetrieveVAInfoOutput();
for (const auto& profile : VaapiWrapper::GetSupportedDecodeProfiles()) { for (const auto& profile : VaapiWrapper::GetSupportedDecodeProfiles(
gpu::GpuDriverBugWorkarounds())) {
const auto va_profile = ConvertToVAProfile(profile.profile); const auto va_profile = ConvertToVAProfile(profile.profile);
ASSERT_TRUE(va_profile.has_value()); ASSERT_TRUE(va_profile.has_value());
......
...@@ -1190,9 +1190,10 @@ void VaapiVideoDecodeAccelerator::RecycleVASurface( ...@@ -1190,9 +1190,10 @@ void VaapiVideoDecodeAccelerator::RecycleVASurface(
// static // static
VideoDecodeAccelerator::SupportedProfiles VideoDecodeAccelerator::SupportedProfiles
VaapiVideoDecodeAccelerator::GetSupportedProfiles() { VaapiVideoDecodeAccelerator::GetSupportedProfiles(
const gpu::GpuDriverBugWorkarounds& workarounds) {
VideoDecodeAccelerator::SupportedProfiles profiles = VideoDecodeAccelerator::SupportedProfiles profiles =
VaapiWrapper::GetSupportedDecodeProfiles(); VaapiWrapper::GetSupportedDecodeProfiles(workarounds);
// VaVDA never supported VP9 Profile 2, but VaapiWrapper does. Filter it out. // VaVDA never supported VP9 Profile 2, but VaapiWrapper does. Filter it out.
base::EraseIf(profiles, [](const auto& profile) { base::EraseIf(profiles, [](const auto& profile) {
return profile.profile == VP9PROFILE_PROFILE2; return profile.profile == VP9PROFILE_PROFILE2;
......
...@@ -40,6 +40,10 @@ namespace gl { ...@@ -40,6 +40,10 @@ namespace gl {
class GLImage; class GLImage;
} }
namespace gpu {
class GpuDriverBugWorkarounds;
}
namespace media { namespace media {
class AcceleratedVideoDecoder; class AcceleratedVideoDecoder;
...@@ -88,7 +92,8 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator ...@@ -88,7 +92,8 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator
const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner)
override; override;
static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles(); static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles(
const gpu::GpuDriverBugWorkarounds& workarounds);
// DecodeSurfaceHandler implementation. // DecodeSurfaceHandler implementation.
scoped_refptr<VASurface> CreateSurface() override; scoped_refptr<VASurface> CreateSurface() override;
......
...@@ -73,9 +73,10 @@ std::unique_ptr<DecoderInterface> VaapiVideoDecoder::Create( ...@@ -73,9 +73,10 @@ std::unique_ptr<DecoderInterface> VaapiVideoDecoder::Create(
} }
// static // static
SupportedVideoDecoderConfigs VaapiVideoDecoder::GetSupportedConfigs() { SupportedVideoDecoderConfigs VaapiVideoDecoder::GetSupportedConfigs(
const gpu::GpuDriverBugWorkarounds& workarounds) {
return ConvertFromSupportedProfiles( return ConvertFromSupportedProfiles(
VaapiWrapper::GetSupportedDecodeProfiles(), false); VaapiWrapper::GetSupportedDecodeProfiles(workarounds), false);
} }
VaapiVideoDecoder::VaapiVideoDecoder( VaapiVideoDecoder::VaapiVideoDecoder(
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/gpu_memory_buffer.h"
namespace gpu {
class GpuDriverBugWorkarounds;
}
namespace media { namespace media {
class AcceleratedVideoDecoder; class AcceleratedVideoDecoder;
...@@ -48,7 +52,8 @@ class VaapiVideoDecoder : public DecoderInterface, ...@@ -48,7 +52,8 @@ class VaapiVideoDecoder : public DecoderInterface,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner, scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
base::WeakPtr<DecoderInterface::Client> client); base::WeakPtr<DecoderInterface::Client> client);
static SupportedVideoDecoderConfigs GetSupportedConfigs(); static SupportedVideoDecoderConfigs GetSupportedConfigs(
const gpu::GpuDriverBugWorkarounds& workarounds);
// DecoderInterface implementation. // DecoderInterface implementation.
void Initialize(const VideoDecoderConfig& config, void Initialize(const VideoDecoderConfig& config,
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
// Auto-generated for dlopen libva libraries // Auto-generated for dlopen libva libraries
#include "media/gpu/vaapi/va_stubs.h" #include "media/gpu/vaapi/va_stubs.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "third_party/libyuv/include/libyuv.h" #include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/buffer_format_util.h" #include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/buffer_types.h" #include "ui/gfx/buffer_types.h"
...@@ -1279,14 +1280,22 @@ VaapiWrapper::GetSupportedEncodeProfiles() { ...@@ -1279,14 +1280,22 @@ VaapiWrapper::GetSupportedEncodeProfiles() {
// static // static
VideoDecodeAccelerator::SupportedProfiles VideoDecodeAccelerator::SupportedProfiles
VaapiWrapper::GetSupportedDecodeProfiles() { VaapiWrapper::GetSupportedDecodeProfiles(
const gpu::GpuDriverBugWorkarounds& workarounds) {
VideoDecodeAccelerator::SupportedProfiles profiles; VideoDecodeAccelerator::SupportedProfiles profiles;
for (const auto& media_to_va_profile_map_entry : kMediaToVAProfileMap) { for (const auto& media_to_va_profile_map_entry : kMediaToVAProfileMap) {
const VideoCodecProfile media_profile = media_to_va_profile_map_entry.first; const VideoCodecProfile media_profile = media_to_va_profile_map_entry.first;
if (media_profile == VP8PROFILE_ANY &&
workarounds.disable_accelerated_vp8_decode) {
continue;
}
const VAProfile va_profile = ProfileToVAProfile(media_profile, kDecode); const VAProfile va_profile = ProfileToVAProfile(media_profile, kDecode);
if (va_profile == VAProfileNone) if (va_profile == VAProfileNone)
continue; continue;
const VASupportedProfiles::ProfileInfo* profile_info = const VASupportedProfiles::ProfileInfo* profile_info =
VASupportedProfiles::Get().IsProfileSupported(kDecode, va_profile); VASupportedProfiles::Get().IsProfileSupported(kDecode, va_profile);
if (!profile_info) if (!profile_info)
......
...@@ -44,6 +44,10 @@ class NativePixmapDmaBuf; ...@@ -44,6 +44,10 @@ class NativePixmapDmaBuf;
class Rect; class Rect;
} }
namespace gpu {
class GpuDriverBugWorkarounds;
}
namespace media { namespace media {
constexpr unsigned int kInvalidVaRtFormat = 0u; constexpr unsigned int kInvalidVaRtFormat = 0u;
...@@ -150,7 +154,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper ...@@ -150,7 +154,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper
static VideoEncodeAccelerator::SupportedProfiles GetSupportedEncodeProfiles(); static VideoEncodeAccelerator::SupportedProfiles GetSupportedEncodeProfiles();
// Return the supported video decode profiles. // Return the supported video decode profiles.
static VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles(); static VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles(
const gpu::GpuDriverBugWorkarounds& workarounds);
// Return true when decoding using |va_profile| is supported. // Return true when decoding using |va_profile| is supported.
static bool IsDecodeSupported(VAProfile va_profile); static bool IsDecodeSupported(VAProfile va_profile);
......
...@@ -189,16 +189,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() { ...@@ -189,16 +189,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
if (ShouldUseChromeOSDirectVideoDecoder(gpu_preferences_)) { if (ShouldUseChromeOSDirectVideoDecoder(gpu_preferences_)) {
if (!cros_supported_configs_) { if (!cros_supported_configs_) {
cros_supported_configs_ = cros_supported_configs_ =
ChromeosVideoDecoderFactory::GetSupportedConfigs(); ChromeosVideoDecoderFactory::GetSupportedConfigs(gpu_workarounds_);
}
if (cros_supported_configs_.has_value() &&
gpu_workarounds_.disable_accelerated_vp8_decode) {
base::EraseIf(*cros_supported_configs_,
[](const SupportedVideoDecoderConfig& config) {
return VP8PROFILE_MIN <= config.profile_min &&
config.profile_max <= VP8PROFILE_MAX;
});
} }
supported_config_map[VideoDecoderImplementation::kDefault] = supported_config_map[VideoDecoderImplementation::kDefault] =
......
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