Commit 62a0b277 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/vaapi: Disable H264 HW encode and MJPEG decode on StoneyRidge

BUG=b:76445849, chromium:828119,  chromium:828482
TEST=jpeg_decode_accelerator_unittest and video_encode_accelerator_unittest on StoneyRidge device

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;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ifa61026390fe31e88e0929257a521745e9a72fad
Reviewed-on: https://chromium-review.googlesource.com/983334
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550049}
parent c777f75c
...@@ -29,6 +29,7 @@ int vaMaxNumProfiles(VADisplay dpy); ...@@ -29,6 +29,7 @@ int vaMaxNumProfiles(VADisplay dpy);
VAStatus vaQueryConfigEntrypoints (VADisplay dpy, VAProfile profile, VAEntrypoint *entrypoint_list, int *num_entrypoints); VAStatus vaQueryConfigEntrypoints (VADisplay dpy, VAProfile profile, VAEntrypoint *entrypoint_list, int *num_entrypoints);
VAStatus vaQueryConfigProfiles(VADisplay dpy, VAProfile *profile_list, int *num_profiles); VAStatus vaQueryConfigProfiles(VADisplay dpy, VAProfile *profile_list, int *num_profiles);
VAStatus vaQuerySurfaceAttributes(VADisplay dpy, VAConfigID config, VASurfaceAttrib *attrib_list, unsigned int *num_attribs); VAStatus vaQuerySurfaceAttributes(VADisplay dpy, VAConfigID config, VASurfaceAttrib *attrib_list, unsigned int *num_attribs);
const char* vaQueryVendorString(VADisplay dpy);
VAStatus vaRenderPicture(VADisplay dpy, VAContextID context, VABufferID *buffers, int num_buffers); VAStatus vaRenderPicture(VADisplay dpy, VAContextID context, VABufferID *buffers, int num_buffers);
VAStatus vaSetDisplayAttributes(VADisplay dpy, VADisplayAttribute *attr_list, int num_attributes); VAStatus vaSetDisplayAttributes(VADisplay dpy, VADisplayAttribute *attr_list, int num_attributes);
VAStatus vaSyncSurface(VADisplay dpy, VASurfaceID render_target); VAStatus vaSyncSurface(VADisplay dpy, VASurfaceID render_target);
......
...@@ -143,6 +143,42 @@ static const struct { ...@@ -143,6 +143,42 @@ static const struct {
{VP9PROFILE_PROFILE3, VAProfileVP9Profile3}, {VP9PROFILE_PROFILE3, VAProfileVP9Profile3},
}; };
static const struct {
std::string va_driver;
std::string cpu_family;
VaapiWrapper::CodecMode mode;
std::vector<VAProfile> va_profiles;
} kBlackListMap[]{
// TODO(hiroh): Remove once Chrome supports unpacked header.
// https://crbug.com/828482.
{"Mesa Gallium driver",
"AMD STONEY",
VaapiWrapper::CodecMode::kEncode,
{VAProfileH264Baseline, VAProfileH264Main, VAProfileH264High,
VAProfileH264ConstrainedBaseline}},
// TODO(hiroh): Remove once Chrome supports converting format.
// https://crbug.com/828119.
{"Mesa Gallium driver",
"AMD STONEY",
VaapiWrapper::CodecMode::kDecode,
{VAProfileJPEGBaseline}},
};
bool IsBlackListedDriver(const std::string& va_vendor_string,
VaapiWrapper::CodecMode mode,
VAProfile va_profile) {
for (const auto& info : kBlackListMap) {
if (info.mode == mode &&
base::StartsWith(va_vendor_string, info.va_driver,
base::CompareCase::SENSITIVE) &&
va_vendor_string.find(info.cpu_family) != std::string::npos &&
base::ContainsValue(info.va_profiles, va_profile)) {
return true;
}
}
return false;
}
// This class is a wrapper around its |va_display_| (and its associated // This class is a wrapper around its |va_display_| (and its associated
// |va_lock_|) to guarantee mutual exclusion and singleton behaviour. // |va_lock_|) to guarantee mutual exclusion and singleton behaviour.
class VADisplayState { class VADisplayState {
...@@ -161,6 +197,7 @@ class VADisplayState { ...@@ -161,6 +197,7 @@ class VADisplayState {
base::Lock* va_lock() { return &va_lock_; } base::Lock* va_lock() { return &va_lock_; }
VADisplay va_display() const { return va_display_; } VADisplay va_display() const { return va_display_; }
const std::string& va_vendor_string() const { return va_vendor_string_; }
void SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); } void SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); }
...@@ -184,6 +221,9 @@ class VADisplayState { ...@@ -184,6 +221,9 @@ class VADisplayState {
// True if vaInitialize() has been called successfully. // True if vaInitialize() has been called successfully.
bool va_initialized_; bool va_initialized_;
// String acquired by vaQueryVendorString().
std::string va_vendor_string_;
}; };
// static // static
...@@ -275,7 +315,12 @@ bool VADisplayState::InitializeOnce() { ...@@ -275,7 +315,12 @@ bool VADisplayState::InitializeOnce() {
} }
va_initialized_ = true; va_initialized_ = true;
DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version;
va_vendor_string_ = vaQueryVendorString(va_display_);
DLOG_IF(WARNING, va_vendor_string_.empty())
<< "Vendor string empty or error reading.";
DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " "
<< va_vendor_string_;
if (major_version != VA_MAJOR_VERSION || minor_version != VA_MINOR_VERSION) { if (major_version != VA_MAJOR_VERSION || minor_version != VA_MINOR_VERSION) {
LOG(ERROR) << "This build of Chromium requires VA-API version " LOG(ERROR) << "This build of Chromium requires VA-API version "
...@@ -391,7 +436,6 @@ class VASupportedProfiles { ...@@ -391,7 +436,6 @@ class VASupportedProfiles {
VAEntrypoint entrypoint, VAEntrypoint entrypoint,
std::vector<VAConfigAttrib>& required_attribs, std::vector<VAConfigAttrib>& required_attribs,
gfx::Size* resolution); gfx::Size* resolution);
std::vector<ProfileInfo> supported_profiles_[VaapiWrapper::kCodecModeMax]; std::vector<ProfileInfo> supported_profiles_[VaapiWrapper::kCodecModeMax];
// Pointer to VADisplayState's members |va_lock_| and its |va_display_|. // Pointer to VADisplayState's members |va_lock_| and its |va_display_|.
...@@ -436,7 +480,6 @@ VASupportedProfiles::VASupportedProfiles() ...@@ -436,7 +480,6 @@ VASupportedProfiles::VASupportedProfiles()
va_display_ = VADisplayState::Get()->va_display(); va_display_ = VADisplayState::Get()->va_display();
DCHECK(va_display_) << "VADisplayState hasn't been properly Initialize()d"; DCHECK(va_display_) << "VADisplayState hasn't been properly Initialize()d";
for (size_t i = 0; i < VaapiWrapper::kCodecModeMax; ++i) { for (size_t i = 0; i < VaapiWrapper::kCodecModeMax; ++i) {
supported_profiles_[i] = GetSupportedProfileInfosForCodecModeInternal( supported_profiles_[i] = GetSupportedProfileInfosForCodecModeInternal(
static_cast<VaapiWrapper::CodecMode>(i)); static_cast<VaapiWrapper::CodecMode>(i));
...@@ -460,6 +503,8 @@ VASupportedProfiles::GetSupportedProfileInfosForCodecModeInternal( ...@@ -460,6 +503,8 @@ VASupportedProfiles::GetSupportedProfileInfosForCodecModeInternal(
return supported_profile_infos; return supported_profile_infos;
base::AutoLock auto_lock(*va_lock_); base::AutoLock auto_lock(*va_lock_);
const std::string& va_vendor_string =
VADisplayState::Get()->va_vendor_string();
for (const auto& va_profile : va_profiles) { for (const auto& va_profile : va_profiles) {
VAEntrypoint entrypoint = GetVaEntryPoint(mode, va_profile); VAEntrypoint entrypoint = GetVaEntryPoint(mode, va_profile);
std::vector<VAConfigAttrib> required_attribs = std::vector<VAConfigAttrib> required_attribs =
...@@ -468,6 +513,9 @@ VASupportedProfiles::GetSupportedProfileInfosForCodecModeInternal( ...@@ -468,6 +513,9 @@ VASupportedProfiles::GetSupportedProfileInfosForCodecModeInternal(
continue; continue;
if (!AreAttribsSupported_Locked(va_profile, entrypoint, required_attribs)) if (!AreAttribsSupported_Locked(va_profile, entrypoint, required_attribs))
continue; continue;
if (IsBlackListedDriver(va_vendor_string, mode, va_profile))
continue;
ProfileInfo profile_info; ProfileInfo profile_info;
if (!GetMaxResolution_Locked(va_profile, entrypoint, required_attribs, if (!GetMaxResolution_Locked(va_profile, entrypoint, required_attribs,
&profile_info.max_resolution)) { &profile_info.max_resolution)) {
......
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