From b9bf533f001cd9a1326bc67fa515cbc667c22365 Mon Sep 17 00:00:00 2001 From: Akarshan Biswas Date: Sat, 26 Oct 2019 10:06:30 +0530 Subject: [PATCH] Move offending function to chromeos only --- media/gpu/vaapi/vaapi_video_decode_accelerator.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/gpu/vaapi/vaapi_video_decode_accelerator.cc b/media/gpu/vaapi/vaapi_video_decode_accelerator.cc index baaf2ae468d..89a47206416 100644 --- a/media/gpu/vaapi/vaapi_video_decode_accelerator.cc +++ b/media/gpu/vaapi/vaapi_video_decode_accelerator.cc @@ -51,32 +51,34 @@ namespace media { namespace { // Returns the preferred VA_RT_FORMAT for the given |profile|. unsigned int GetVaFormatForVideoCodecProfile(VideoCodecProfile profile) { if (profile == VP9PROFILE_PROFILE2 || profile == VP9PROFILE_PROFILE3) return VA_RT_FORMAT_YUV420_10BPP; return VA_RT_FORMAT_YUV420; } +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) // Returns true if the CPU is an Intel Gemini Lake or later (including Kaby // Lake) Cpu platform id's are referenced from the following file in kernel // source arch/x86/include/asm/intel-family.h bool IsGeminiLakeOrLater() { constexpr int kPentiumAndLaterFamily = 0x06; constexpr int kGeminiLakeModelId = 0x7A; static base::CPU cpuid; static bool is_geminilake_or_later = cpuid.family() == kPentiumAndLaterFamily && cpuid.model() >= kGeminiLakeModelId; return is_geminilake_or_later; } +#endif } // namespace #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ do { \ if (!(result)) { \ LOG(ERROR) << log; \ NotifyError(error_code); \ return ret; \ } \ @@ -1221,35 +1223,38 @@ VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() { // http://crrev.com/c/1363807/9/media/gpu/h264_decoder.cc#1449. if (profile_ >= H264PROFILE_MIN && profile_ <= H264PROFILE_MAX) return BufferAllocationMode::kReduced; return BufferAllocationMode::kSuperReduced; #else // TODO(crbug.com/912295): Enable a better BufferAllocationMode for IMPORT // |output_mode_| as well. if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT) return BufferAllocationMode::kNormal; +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) + // Move this to chromeOs only as it is causing problem in some intel linux drivers // On Gemini Lake, Kaby Lake and later we can pass to libva the client's // PictureBuffers to decode onto, which skips the use of the Vpp unit and its // associated format reconciliation copy, avoiding all internal buffer // allocations. // TODO(crbug.com/911754): Enable for VP9 Profile 2. if (IsGeminiLakeOrLater() && (profile_ == VP9PROFILE_PROFILE0 || profile_ == VP8PROFILE_ANY || (profile_ >= H264PROFILE_MIN && profile_ <= H264PROFILE_MAX))) { // Add one to the reference frames for the one being currently egressed, and // an extra allocation for both |client_| and |decoder_|, see // crrev.com/c/1576560. if (profile_ == VP8PROFILE_ANY) num_extra_pics_ = 3; return BufferAllocationMode::kNone; } +#endif // For H.264 on older devices, another +1 is experimentally needed for // high-to-high resolution changes. // TODO(mcasas): Figure out why and why only H264, see crbug.com/912295 and // http://crrev.com/c/1363807/9/media/gpu/h264_decoder.cc#1449. if (profile_ >= H264PROFILE_MIN && profile_ <= H264PROFILE_MAX) return BufferAllocationMode::kReduced; // If we're here, we have to use the Vpp unit and allocate buffers for // |decoder_|; usually we'd have to allocate the |decoder_|s -- 2.25.4