Skip to content

Commit

Permalink
Revert of Clean up V4L2 codec-related flags and defines (patchset chr…
Browse files Browse the repository at this point in the history
…omium#3 id:40001 of https://codereview.chromium.org/828063009/)

Reason for revert:
x86 Chrome compile failure due to https://code.google.com/p/chromium/issues/detail?id=455545.

Original issue's description:
> 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
>
> Committed: https://crrev.com/d5eeecc577f274bb8ed9d1954f263d83b5f00050
> Cr-Commit-Position: refs/heads/master@{#314536}

TBR=piman@chromium.org,wuchengli@chromium.org,henryhsu@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=449883

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

Cr-Commit-Position: refs/heads/master@{#314760}
  • Loading branch information
posciak authored and Commit bot committed Feb 5, 2015
1 parent a3cbdfc commit a3566c5
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 90 deletions.
66 changes: 8 additions & 58 deletions content/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,42 +49,6 @@ 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"
Expand Down Expand Up @@ -316,46 +280,32 @@ 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 += [
Expand Down
9 changes: 4 additions & 5 deletions content/common/common.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ content_common_gypi_values =
[ "../content_common.gypi" ])

declare_args() {
# 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.
# 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.
use_v4l2_codec = false
}
12 changes: 8 additions & 4 deletions content/common/gpu/media/gpu_video_decode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@
#elif defined(OS_MACOSX)
#include "content/common/gpu/media/vt_video_decode_accelerator.h"
#elif defined(OS_CHROMEOS)
#if defined(USE_V4L2_CODEC)
#if defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
#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
#endif // defined(ARCH_CPU_X86_FAMILY)
#elif defined(USE_OZONE)
#include "media/ozone/media_ozone_platform.h"
#elif defined(OS_ANDROID)
Expand Down Expand Up @@ -300,7 +303,8 @@ GpuVideoDecodeAccelerator::CreateDXVAVDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
(defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
decoder.reset(new V4L2VideoDecodeAccelerator(
Expand All @@ -318,7 +322,7 @@ GpuVideoDecodeAccelerator::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateV4L2SliceVDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
decoder.reset(new V4L2SliceVideoDecodeAccelerator(
Expand Down
8 changes: 5 additions & 3 deletions content/common/gpu/media/gpu_video_encode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
#include "media/base/video_frame.h"

#if defined(OS_CHROMEOS)
#if defined(USE_V4L2_CODEC)
#if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && 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
#endif // defined(ARCH_CPU_X86_FAMILY)
#elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
#include "content/common/gpu/media/android_video_encode_accelerator.h"
#endif
Expand Down Expand Up @@ -211,7 +212,8 @@ GpuVideoEncodeAccelerator::CreateVEAFps() {
scoped_ptr<media::VideoEncodeAccelerator>
GpuVideoEncodeAccelerator::CreateV4L2VEA() {
scoped_ptr<media::VideoEncodeAccelerator> encoder;
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
(defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder);
if (device)
encoder.reset(new V4L2VideoEncodeAccelerator(device));
Expand Down
9 changes: 6 additions & 3 deletions content/common/gpu/media/video_decode_accelerator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
#include "base/win/windows_version.h"
#include "content/common/gpu/media/dxva_video_decode_accelerator.h"
#elif defined(OS_CHROMEOS)
#if defined(USE_V4L2_CODEC)
#if defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
#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
Expand Down Expand Up @@ -503,7 +505,8 @@ GLRenderingVDAClient::CreateDXVAVDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GLRenderingVDAClient::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
(defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr();
Expand All @@ -522,7 +525,7 @@ GLRenderingVDAClient::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator>
GLRenderingVDAClient::CreateV4L2SliceVDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_LIBV4L2)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr();
Expand Down
44 changes: 27 additions & 17 deletions content/content_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@
}],
['use_v4lplugin==1 and chromeos==1', {
'defines': [
'USE_LIBV4L2'
'USE_LIBV4L2',
],
'variables': {
'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py',
Expand Down Expand Up @@ -821,40 +821,50 @@
'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',
],
}],
['target_arch == "arm" and chromeos == 1', {
'sources': [
'common/gpu/media/tegra_v4l2_video_device.cc',
'common/gpu/media/tegra_v4l2_video_device.h',
'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', {
Expand Down
4 changes: 4 additions & 0 deletions content/content_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

{
'variables': {
'use_v4lplugin%': 0,
'layouttest_support_content_sources': [
'public/test/layouttest_support.h',
'public/test/nested_message_pump_android.cc',
Expand Down Expand Up @@ -1617,6 +1618,9 @@
'../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, ],
Expand Down

0 comments on commit a3566c5

Please sign in to comment.