0

Clean up V4L2 codec-related flags and defines

All arm platforms support V4L2 SVDA by default and use_v4l2_codec also governs V4L2 VDA/VEA now.
Generates libv4l2 stub in GN file.

BUG=449883
TEST=build chrome and vda unittest on peach_pit, veyron_pinky, squawks,
and panther_freon

Review URL: https://codereview.chromium.org/828063009

Cr-Commit-Position: refs/heads/master@{#314536}
This commit is contained in:
henryhsu
2015-02-04 02:55:32 -08:00
committed by Commit bot
parent edc37d4967
commit d5eeecc577
7 changed files with 90 additions and 62 deletions

@ -49,6 +49,42 @@ if (is_chromeos && cpu_arch != "arm") {
}
}
if (is_chromeos && use_v4lplugin) {
action("libv4l2_generate_stubs") {
extra_header = "gpu/media/v4l2_stub_header.fragment"
script = "../../tools/generate_stubs/generate_stubs.py"
sources = [
"gpu/media/v4l2.sig",
]
inputs = [
extra_header,
]
stubs_filename_root = "v4l2_stubs"
outputs = [
"$target_gen_dir/gpu/media/$stubs_filename_root.cc",
"$target_gen_dir/gpu/media/$stubs_filename_root.h",
]
args = [
"-i",
rebase_path("$target_gen_dir/gpu/media", root_build_dir),
"-o",
rebase_path("$target_gen_dir/gpu/media", root_build_dir),
"-t",
"posix_stubs",
"-e",
rebase_path(extra_header, root_build_dir),
"-s",
stubs_filename_root,
"-p",
"content/common/gpu/media",
]
args += rebase_path(sources, root_build_dir)
}
}
if (is_mac) {
action("libvt_generate_stubs") {
extra_header = "gpu/media/vt_stubs_header.fragment"
@ -280,32 +316,46 @@ source_set("common") {
}
if (is_chromeos) {
if (use_v4lplugin) {
defines += [ "USE_LIBV4L2" ]
sources += get_target_outputs(":libv4l2_generate_stubs")
deps += [ ":libv4l2_generate_stubs" ]
}
if (use_v4l2_codec) {
defines += [ "USE_V4L2_CODEC" ]
}
if (cpu_arch == "arm" || (use_ozone && use_v4l2_codec)) {
sources += [
"gpu/media/accelerated_video_decoder.h",
"gpu/media/generic_v4l2_video_device.cc",
"gpu/media/generic_v4l2_video_device.h",
"gpu/media/h264_decoder.cc",
"gpu/media/h264_decoder.h",
"gpu/media/h264_dpb.cc",
"gpu/media/h264_dpb.h",
"gpu/media/v4l2_image_processor.cc",
"gpu/media/v4l2_image_processor.h",
"gpu/media/v4l2_slice_video_decode_accelerator.cc",
"gpu/media/v4l2_slice_video_decode_accelerator.h",
"gpu/media/v4l2_video_decode_accelerator.cc",
"gpu/media/v4l2_video_decode_accelerator.h",
"gpu/media/v4l2_video_device.cc",
"gpu/media/v4l2_video_device.h",
"gpu/media/v4l2_video_encode_accelerator.cc",
"gpu/media/v4l2_video_encode_accelerator.h",
"gpu/media/vp8_decoder.cc",
"gpu/media/vp8_decoder.h",
"gpu/media/vp8_picture.cc",
"gpu/media/vp8_picture.h",
]
libs = [
"EGL",
"GLESv2",
]
if (cpu_arch == "arm") {
sources += [
"gpu/media/tegra_v4l2_video_device.cc",
"gpu/media/tegra_v4l2_video_device.h",
]
}
}
if (cpu_arch == "arm") {
sources += [
"gpu/media/tegra_v4l2_video_device.cc",
"gpu/media/tegra_v4l2_video_device.h",
]
}
if (cpu_arch != "arm") {
sources += [

@ -13,9 +13,10 @@ content_common_gypi_values =
[ "../content_common.gypi" ])
declare_args() {
# TODO(henryhsu): This flag should be removed after the linux header of
# trybot is updated.
# Indicates if Video4Linux2 codec is used. This is used for x86 CrOS
# platform which has v4l2 hardware encoder / decoder.
# Indicates if V4L plugin is used.
use_v4lplugin = false
# Indicates if Video4Linux2 codec is used. This is used for all CrOS
# platforms which have v4l2 hardware encoder / decoder.
use_v4l2_codec = false
}

@ -31,18 +31,15 @@
#elif defined(OS_MACOSX)
#include "content/common/gpu/media/vt_video_decode_accelerator.h"
#elif defined(OS_CHROMEOS)
#if defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
#if defined(USE_V4L2_CODEC)
#include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h"
#endif // defined(ARCH_CPU_ARMEL)
#if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
#include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
#include "content/common/gpu/media/v4l2_video_device.h"
// defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
#endif
#if defined(ARCH_CPU_X86_FAMILY)
#include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
#include "ui/gl/gl_implementation.h"
#endif // defined(ARCH_CPU_X86_FAMILY)
#endif
#elif defined(USE_OZONE)
#include "media/ozone/media_ozone_platform.h"
#elif defined(OS_ANDROID)
@ -303,8 +300,7 @@ GpuVideoDecodeAccelerator::CreateDXVAVDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
(defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
decoder.reset(new V4L2VideoDecodeAccelerator(
@ -322,7 +318,7 @@ GpuVideoDecodeAccelerator::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateV4L2SliceVDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
decoder.reset(new V4L2SliceVideoDecodeAccelerator(

@ -18,13 +18,12 @@
#include "media/base/video_frame.h"
#if defined(OS_CHROMEOS)
#if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
#if defined(USE_V4L2_CODEC)
#include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
// defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
#endif
#if defined(ARCH_CPU_X86_FAMILY)
#include "content/common/gpu/media/vaapi_video_encode_accelerator.h"
#endif // defined(ARCH_CPU_X86_FAMILY)
#endif
#elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
#include "content/common/gpu/media/android_video_encode_accelerator.h"
#endif
@ -212,8 +211,7 @@ GpuVideoEncodeAccelerator::CreateVEAFps() {
scoped_ptr<media::VideoEncodeAccelerator>
GpuVideoEncodeAccelerator::CreateV4L2VEA() {
scoped_ptr<media::VideoEncodeAccelerator> encoder;
#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
(defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder);
if (device)
encoder.reset(new V4L2VideoEncodeAccelerator(device));

@ -59,10 +59,8 @@
#include "base/win/windows_version.h"
#include "content/common/gpu/media/dxva_video_decode_accelerator.h"
#elif defined(OS_CHROMEOS)
#if defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
#if defined(USE_V4L2_CODEC)
#include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h"
#endif // defined(ARCH_CPU_ARMEL)
#if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
#include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
#include "content/common/gpu/media/v4l2_video_device.h"
#endif
@ -505,8 +503,7 @@ GLRenderingVDAClient::CreateDXVAVDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GLRenderingVDAClient::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
(defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr();
@ -525,7 +522,7 @@ GLRenderingVDAClient::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GLRenderingVDAClient::CreateV4L2SliceVDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr();

@ -768,7 +768,7 @@
}],
['use_v4lplugin==1 and chromeos==1', {
'defines': [
'USE_LIBV4L2',
'USE_LIBV4L2'
],
'variables': {
'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py',
@ -819,50 +819,40 @@
'defines': [
'USE_V4L2_CODEC'
],
}],
['chromeos==1 and (target_arch=="arm" or (use_ozone==1 and use_v4l2_codec==1))', {
'dependencies': [
'../media/media.gyp:media',
],
'sources': [
'common/gpu/media/accelerated_video_decoder.h',
'common/gpu/media/generic_v4l2_video_device.cc',
'common/gpu/media/generic_v4l2_video_device.h',
'common/gpu/media/h264_decoder.cc',
'common/gpu/media/h264_decoder.h',
'common/gpu/media/h264_dpb.cc',
'common/gpu/media/h264_dpb.h',
'common/gpu/media/v4l2_image_processor.cc',
'common/gpu/media/v4l2_image_processor.h',
'common/gpu/media/v4l2_slice_video_decode_accelerator.cc',
'common/gpu/media/v4l2_slice_video_decode_accelerator.h',
'common/gpu/media/v4l2_video_decode_accelerator.cc',
'common/gpu/media/v4l2_video_decode_accelerator.h',
'common/gpu/media/v4l2_video_device.cc',
'common/gpu/media/v4l2_video_device.h',
'common/gpu/media/v4l2_video_encode_accelerator.cc',
'common/gpu/media/v4l2_video_encode_accelerator.h',
'common/gpu/media/vp8_decoder.cc',
'common/gpu/media/vp8_decoder.h',
'common/gpu/media/vp8_picture.cc',
'common/gpu/media/vp8_picture.h',
],
'include_dirs': [
'<(DEPTH)/third_party/khronos',
],
'conditions': [
['target_arch == "arm"', {
'sources': [
'common/gpu/media/tegra_v4l2_video_device.cc',
'common/gpu/media/tegra_v4l2_video_device.h',
],
'conditions': [
['use_v4lplugin==1', {
'sources': [
'common/gpu/media/accelerated_video_decoder.h',
'common/gpu/media/h264_decoder.cc',
'common/gpu/media/h264_decoder.h',
'common/gpu/media/h264_dpb.cc',
'common/gpu/media/h264_dpb.h',
'common/gpu/media/v4l2_slice_video_decode_accelerator.cc',
'common/gpu/media/v4l2_slice_video_decode_accelerator.h',
'common/gpu/media/vp8_decoder.cc',
'common/gpu/media/vp8_decoder.h',
'common/gpu/media/vp8_picture.cc',
'common/gpu/media/vp8_picture.h',
],
}],
],
}],
}],
['target_arch == "arm" and chromeos == 1', {
'sources': [
'common/gpu/media/tegra_v4l2_video_device.cc',
'common/gpu/media/tegra_v4l2_video_device.h',
],
}],
['target_arch != "arm" and chromeos == 1', {

@ -4,7 +4,6 @@
{
'variables': {
'use_v4lplugin%': 0,
'layouttest_support_content_sources': [
'public/test/layouttest_support.h',
'public/test/nested_message_pump_android.cc',
@ -1617,9 +1616,6 @@
'../ui/ozone/ozone.gyp:ozone', # Used by rendering_helper.cc
],
}],
['use_v4lplugin==1', {
'defines': ['USE_LIBV4L2'],
}],
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],