Commit 4318ab50 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu: Reorder V4L2 and VAAPI hw dec/enc initialization order

V4L2(S)VDA, V4L2SVD and V4L2VEA are available if chrome is built
with USE_V4L2_CODEC. VAAPIVD, VAAPIVDA and VAAPIVEA are available
if chrome is built with USE_VAAPI. If they are available, chrome
always attempts to initialize and use them for video decoding and
encoding.

V4L2 API's hw codecs are not available in x86 boards in general.
VA API's hw codecs are not available in arm boards in general.
In other hands, V4L2 API and VA-API hw codecs' initialization are
redundant on x86 and arm boards, respectively. The one exception
is a x86 board that equips kepler, on which v4l2 hw codecs is
available.

Because of the above, the current status of those flags are
USE_VAAPI=false, USE_V4L2_CODEC=true on CrOS ARM boards, and
USE_VAAPI=true, USE_V4L2_CODEC=true on CrOS x86 boards. The
current initialization step is V4L2 instances first and VAAPI
ones second. In summary, the initialization flow is as follows;
[ARM]
V4L2 (success or failure)
[x86(Intel and AMD)]
V4L2 (failure all the time) -> VAAPI (success or failure)
[x86+kepler]
V4L2 (success for codecs supported by kepler) -> VAAPI (success or failure)

This CL swaps the V4L2 and VAAPI initialization order. The
initialization flow is changed as follows;
[ARM]
V4L2 (success or failure)
[x86(Intel and AMD)]
VAAPI (success), or
VAAPI (failure) -> V4L2 (failure all the time)
[x86+kepler]
VAAPI (success), or
VAAPI (failure) -> V4L2 (success for codecs supported by kepler), or
VAAPI (success) -> V4L2 (failure)

The redundant V4L2 instance initialization on x86 boards is omitted.

Note that we will not build v4l2 code for x86 devices without kepler.
See crrev.com/c/1948018 and crrev.com/c/1948378.

Bug: 1030376
Test: VDA tests and VEA tests on atlas and kevin
Change-Id: I7313a27ec4ccb1f1640023bf41c285c01e8e905b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947872
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721827}
parent 281bcaf4
......@@ -29,13 +29,13 @@ namespace {
base::queue<VideoDecoderPipeline::CreateVDFunc> GetCreateVDFunctions(
VideoDecoderPipeline::CreateVDFunc cur_create_vd_func) {
static constexpr VideoDecoderPipeline::CreateVDFunc kCreateVDFuncs[] = {
#if BUILDFLAG(USE_V4L2_CODEC)
&V4L2SliceVideoDecoder::Create,
#endif // BUILDFLAG(USE_V4L2_CODEC)
#if BUILDFLAG(USE_VAAPI)
&VaapiVideoDecoder::Create,
#endif // BUILDFLAG(USE_VAAPI)
#if BUILDFLAG(USE_V4L2_CODEC)
&V4L2SliceVideoDecoder::Create,
#endif // BUILDFLAG(USE_V4L2_CODEC)
};
base::queue<VideoDecoderPipeline::CreateVDFunc> ret;
......
......@@ -167,13 +167,13 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA(
#if defined(OS_WIN)
&GpuVideoDecodeAcceleratorFactory::CreateDXVAVDA,
#endif
#if BUILDFLAG(USE_VAAPI)
&GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA,
#endif
#if BUILDFLAG(USE_V4L2_CODEC)
&GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA,
&GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA,
#endif
#if BUILDFLAG(USE_VAAPI)
&GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA,
#endif
#if defined(OS_MACOSX)
&GpuVideoDecodeAcceleratorFactory::CreateVTVDA,
#endif
......
......@@ -86,12 +86,12 @@ std::vector<VEAFactoryFunction> GetVEAFactoryFunctions(
if (!vea_factory_functions.empty())
return vea_factory_functions;
#if BUILDFLAG(USE_V4L2_CODEC)
vea_factory_functions.push_back(base::BindRepeating(&CreateV4L2VEA));
#endif
#if BUILDFLAG(USE_VAAPI)
vea_factory_functions.push_back(base::BindRepeating(&CreateVaapiVEA));
#endif
#if BUILDFLAG(USE_V4L2_CODEC)
vea_factory_functions.push_back(base::BindRepeating(&CreateV4L2VEA));
#endif
#if defined(OS_ANDROID)
vea_factory_functions.push_back(base::BindRepeating(&CreateAndroidVEA));
#endif
......
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