Commit bcd396ea authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

media/gpu/vaapi: disable hw VP8 encoding on all Intel Gen 9.5 devices

Hw VP8 Encoding on Intel Gen9.5 devices is disabled for Celeron/Pentium
SKUs but sadly it seems that the same GPU hang is observed in Core
devices (b/139695266, b/158696760).

This CL extends the current blacklisting to all devices with a Gen9.5
GPU, so that said hang can be _temporarily_ avoided.

It also refactors a bit the code to identify if a given SoC has a GPU
of either Gen9 or Gen9.5.

Bug: b:158655609, b:139695266
Change-Id: Id4ebf705e2949fe0715480be0428215d9eae4c75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253158Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780299}
parent c79716d3
...@@ -145,64 +145,39 @@ namespace media { ...@@ -145,64 +145,39 @@ namespace media {
namespace { namespace {
// Returns true if the SoC has a Gen9 or 9.5 GPU. Gen9 GPUs are found in Sky // Returns true if the SoC has a Gen9 GPU. CPU model ID's are referenced from
// Lake, Apollo Lake whereas Gen 9.5 GPUs are found in Kaby Lake, Amber Lake, // the following file in the kernel source: arch/x86/include/asm/intel-family.h.
// Whiskey Lake, Comet Lake and Gemini Lake. Amber Lake, Whiskey Lake and Comet bool IsGen9Gpu() {
// Lake CPU IDs are the same as Kaby Lake L model. CPU model ID's are referenced
// from the following file in the kernel source
// arch/x86/include/asm/intel-family.h.
bool IsGen9OrGen95Gpu() {
constexpr int kPentiumAndLaterFamily = 0x06; constexpr int kPentiumAndLaterFamily = 0x06;
constexpr int kSkyLakeModelId = 0x5E; constexpr int kSkyLakeModelId = 0x5E;
constexpr int kSkyLake_LModelId = 0x4E; constexpr int kSkyLake_LModelId = 0x4E;
constexpr int kApolloLakeModelId = 0x5c; constexpr int kApolloLakeModelId = 0x5c;
constexpr int kKabyLake_LModelId = 0x8E; // CML CPU ID is the same as KBL L.
constexpr int kKabyLakeModelId = 0x9E;
constexpr int kGeminiLakeModelId = 0x7A;
static base::NoDestructor<base::CPU> cpuid; static base::NoDestructor<base::CPU> cpuid;
static const bool is_gen9_or_gen95_gpu = static const bool is_gen9_gpu = cpuid->family() == kPentiumAndLaterFamily &&
cpuid->family() == kPentiumAndLaterFamily &&
(cpuid->model() == kSkyLakeModelId || (cpuid->model() == kSkyLakeModelId ||
cpuid->model() == kSkyLake_LModelId || cpuid->model() == kSkyLake_LModelId ||
cpuid->model() == kApolloLakeModelId || cpuid->model() == kApolloLakeModelId);
cpuid->model() == kKabyLake_LModelId || return is_gen9_gpu;
cpuid->model() == kKabyLakeModelId ||
cpuid->model() == kGeminiLakeModelId);
return is_gen9_or_gen95_gpu;
} }
// Returns true if the SoC is a Kaby Lake Pentium. // Returns true if the SoC has a 9.5 GPU. CPU model IDs are referenced from the
// CPU model IDs are referenced from the following file in the kernel source // following file in the kernel source: arch/x86/include/asm/intel-family.h.
// arch/x86/include/asm/intel-family.h. bool IsGen95Gpu() {
bool IsKBLPentiumCPU() {
constexpr int kPentiumAndLaterFamily = 0x06; constexpr int kPentiumAndLaterFamily = 0x06;
constexpr int kKabyLakeModelId = 0x9E; constexpr int kKabyLakeModelId = 0x9E;
static base::NoDestructor<base::CPU> cpuid; // Amber Lake, Whiskey Lake and some Comet Lake CPU IDs are the same as KBL L.
static const bool is_kbl_pentium_cpu =
cpuid->family() == kPentiumAndLaterFamily &&
cpuid->model() == kKabyLakeModelId &&
base::Contains(cpuid->cpu_brand(), "Pentium");
return is_kbl_pentium_cpu;
}
// Returns true if the SoC is a Comet Lake Pentium or Celeron.
// CPU model IDs are referenced from the following file in the kernel source
// arch/x86/include/asm/intel-family.h.
bool IsCMLPentiumOrCeleronCPU() {
constexpr int kPentiumAndLaterFamily = 0x06;
// Amber Lake, Whiskey Lake and Comet Lake CPU IDs are the same as KBL L.
constexpr int kKabyLake_LModelId = 0x8E; constexpr int kKabyLake_LModelId = 0x8E;
constexpr int kGeminiLakeModelId = 0x7A;
constexpr int kCometLakeModelId = 0xA5; constexpr int kCometLakeModelId = 0xA5;
constexpr int kCometLake_LModelId = 0xA6; constexpr int kCometLake_LModelId = 0xA6;
static base::NoDestructor<base::CPU> cpuid; static base::NoDestructor<base::CPU> cpuid;
static const bool is_cml_pentium_cpu = static const bool is_gen95_gpu = cpuid->family() == kPentiumAndLaterFamily &&
cpuid->family() == kPentiumAndLaterFamily && (cpuid->model() == kKabyLakeModelId ||
(cpuid->model() == kKabyLake_LModelId || cpuid->model() == kKabyLake_LModelId ||
cpuid->model() == kGeminiLakeModelId ||
cpuid->model() == kCometLakeModelId || cpuid->model() == kCometLakeModelId ||
cpuid->model() == kCometLake_LModelId) && cpuid->model() == kCometLake_LModelId);
(base::Contains(cpuid->cpu_brand(), "Pentium") || return is_gen95_gpu;
base::Contains(cpuid->cpu_brand(), "Celeron"));
return is_cml_pentium_cpu;
} }
bool IsModeEncoding(VaapiWrapper::CodecMode mode) { bool IsModeEncoding(VaapiWrapper::CodecMode mode) {
...@@ -307,21 +282,15 @@ bool IsBlackListedDriver(const std::string& va_vendor_string, ...@@ -307,21 +282,15 @@ bool IsBlackListedDriver(const std::string& va_vendor_string,
return true; return true;
} }
// TODO(crbug.com/811912): Remove once VP9 encoding is to be enabled by // TODO(crbug.com/811912): Remove once VP9 encoding is enabled by default.
// default.
if (va_profile == VAProfileVP9Profile0 && if (va_profile == VAProfileVP9Profile0 &&
!base::FeatureList::IsEnabled(kVaapiVP9Encoder)) { !base::FeatureList::IsEnabled(kVaapiVP9Encoder)) {
return true; return true;
} }
// TODO(b/158655609): Pentium/Celeron CML-U devices hang up when VP8 encoding // TODO(b/158655609): Several Gen 9.5 GPU devices suffer from a GPU hang when
// in some power saving states. Blacklist them temporarily. // VP8 encoding in some power saving states. Blacklist them temporarily.
if (IsCMLPentiumOrCeleronCPU() && va_profile == VAProfileVP8Version0_3) if (IsGen95Gpu() && va_profile == VAProfileVP8Version0_3)
return true;
// TODO(b/158655609): Pentium KBL-U devices hang up when VP8 encoding in some
// power saving states. Blacklist them temporarily.
if (IsKBLPentiumCPU() && va_profile == VAProfileVP8Version0_3)
return true; return true;
return false; return false;
...@@ -1160,7 +1129,7 @@ bool IsLowPowerEncSupported(VAProfile va_profile) { ...@@ -1160,7 +1129,7 @@ bool IsLowPowerEncSupported(VAProfile va_profile) {
return false; return false;
} }
if (IsGen9OrGen95Gpu() && if ((IsGen95Gpu() || IsGen9Gpu()) &&
!base::FeatureList::IsEnabled(kVaapiLowPowerEncoderGen9x)) { !base::FeatureList::IsEnabled(kVaapiLowPowerEncoderGen9x)) {
return false; return false;
} }
......
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