Commit e95b4797 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Chromium LUCI CQ

media/gpu/vaapiWrapper: Don't use hw decoder with hybrid driver for smaller resolutions

The performance of the decoder with the intel hybrid driver [1]
is worse than a sw decoder especially when multiple decoders run
simultaneously. For instance, a video call app (e.g. Meet) likely
requires us to decode more than 10 smaller resolution videos.
The user experience is better by using sw decoders than the hw
decoder in these cases.
This CL selects sw decoder for QVGA and smaller resolutions by
setting the minimum supported resolution of the hw decoder to
321x241. This dimension is selected from the fact that the
resolutions of videos in tile layout in Google Meet are QVGA.

[1] https://github.com/intel/intel-hybrid-driver

Bug: b:171041334
Test: tast run webrtc.*
Test: SW decoder is used in https://appr.tc/?vsc=vp9&vrc=vp9&video=minWidth=320,maxWidth=320,minHeight=240,maxHeight=240
Change-Id: I9b19878aae57587bab921481d7dca5087d7f538b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494521
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832616}
parent 6beabfbd
......@@ -252,6 +252,25 @@ namespace {
// VAEntrypoint is an enumeration starting from 1, but has no "invalid" value.
constexpr VAEntrypoint kVAEntrypointInvalid = static_cast<VAEntrypoint>(0);
// Returns true if the SoC has a Gen8 GPU. CPU model ID's are referenced from
// the following file in the kernel source: arch/x86/include/asm/intel-family.h.
bool IsGen8Gpu() {
constexpr int kPentiumAndLaterFamily = 0x06;
constexpr int kBroadwellCoreModelId = 0x3D;
constexpr int kBroadwellGT3EModelId = 0x47;
constexpr int kBroadwellXModelId = 0x4F;
constexpr int kBroadwellXeonDModelId = 0x56;
constexpr int kBraswellModelId = 0x4C;
static const base::NoDestructor<base::CPU> cpuid;
static const bool is_gen8_gpu = cpuid->family() == kPentiumAndLaterFamily &&
(cpuid->model() == kBroadwellCoreModelId ||
cpuid->model() == kBroadwellGT3EModelId ||
cpuid->model() == kBroadwellXModelId ||
cpuid->model() == kBroadwellXeonDModelId ||
cpuid->model() == kBraswellModelId);
return is_gen8_gpu;
}
// Returns true if the SoC has a Gen9 GPU. CPU model ID's are referenced from
// the following file in the kernel source: arch/x86/include/asm/intel-family.h.
bool IsGen9Gpu() {
......@@ -287,6 +306,17 @@ bool IsGen95Gpu() {
return is_gen95_gpu;
}
// Returns true if the intel hybrid driver is used for decoding |va_profile|.
// https://github.com/intel/intel-hybrid-driver
// Note that since the hybrid driver runs as a part of the i965 driver,
// vaQueryVendorString() returns "Intel i965 driver".
bool IsUsingHybridDriverForDecoding(VAProfile va_profile) {
// Note that Skylake (not gen8) also needs the hybrid decoder for VP9
// decoding. However, it is disabled today on ChromeOS
// (see crrev.com/c/390511).
return va_profile == VAProfileVP9Profile0 && IsGen8Gpu();
}
// Returns true if the SoC is considered a low power one, i.e. it's an Intel
// Pentium, Celeron, or a Core Y-series. See go/intel-socs-101 or
// https://www.intel.com/content/www/us/en/processors/processor-numbers.html.
......@@ -1116,6 +1146,22 @@ bool VASupportedProfiles::FillProfileInfo_Locked(
<< profile_info->min_resolution.ToString() << " for "
<< vaProfileStr(va_profile);
}
} else if (entrypoint == VAEntrypointVLD &&
IsUsingHybridDriverForDecoding(va_profile)) {
// Using the hybrid driver for accelerated decoding of frames smaller than
// a certain size is less efficient than using a software decoder. This
// minimum resolution is selected from the fact that the resolutions of
// videos in tile layout in Google Meet are QVGA.
constexpr gfx::Size kMinDecodeResolutionForHybridDecoder(320 + 1,
240 + 1);
if (!gfx::Rect(profile_info->min_resolution)
.Contains(gfx::Rect(kMinDecodeResolutionForHybridDecoder))) {
profile_info->min_resolution.SetToMax(
kMinDecodeResolutionForHybridDecoder);
DVLOG(2) << "Setting the minimum supported decoding resolution to "
<< profile_info->min_resolution.ToString() << " for "
<< vaProfileStr(va_profile);
}
}
}
......
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