blob: 9e5be7d3d5f3b9245c9b4a928091f7cdd3166615 [file] [log] [blame]
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
import("//media/gpu/args.gni")
import("//media/media_options.gni")
import("//testing/test.gni")
import("//tools/generate_stubs/rules.gni")
buildflag_header("buildflags") {
header = "buildflags.h"
flags = [
"USE_VAAPI=$use_vaapi",
"USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs",
"USE_V4L2_CODEC=$use_v4l2_codec",
"USE_LIBV4L2=$use_v4lplugin",
]
}
component("gpu") {
output_name = "media_gpu"
# Only local test code, GPU-related IPC code in the media layer, and
# media-related content code should access //media/gpu.
visibility = [
":*",
"//chrome/gpu",
"//chromecast/*",
"//components/arc/mojom:media",
"//components/arc/mojom:media_mojolpm",
"//components/arc/video_accelerator:common",
"//components/chromeos_camera/*",
"//components/mirroring/service:mirroring_service",
"//components/viz/service/main",
"//content/gpu:*",
"//content/renderer:*",
"//media/gpu/ipc/*",
"//media/gpu/test/*",
"//media/gpu/vaapi/*",
"//media/mojo/*",
"//remoting/codec:encoder",
# TODO(crbug.com/1184041): Remove //remoting/host:common when the usage is removed.
"//remoting/host:common",
]
if (is_mac) {
# On Mac, content/common reaches into here to do some pre-sandbox
# initialization.
visibility += [ "//content/common" ]
}
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"gpu_video_accelerator_util.cc",
"gpu_video_accelerator_util.h",
"gpu_video_decode_accelerator_factory.cc",
"gpu_video_decode_accelerator_factory.h",
"gpu_video_encode_accelerator_factory.cc",
"gpu_video_encode_accelerator_factory.h",
]
public_deps = [
":buildflags",
":command_buffer_helper",
":common",
"//base",
"//gpu",
"//media",
"//third_party/mesa_headers",
"//ui/gfx/geometry",
]
deps = [
"//third_party/libyuv",
"//ui/base",
"//ui/display/types",
"//ui/gl",
"//ui/platform_window",
]
libs = []
ldflags = []
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) {
public_deps += [
":video_frame_mapper",
"//media/gpu/chromeos",
]
}
if (is_mac) {
public_deps += [ "//media/gpu/mac" ]
}
if (is_android) {
sources += [
"android/android_video_encode_accelerator.cc",
"android/android_video_encode_accelerator.h",
"android/android_video_surface_chooser.cc",
"android/android_video_surface_chooser.h",
"android/android_video_surface_chooser_impl.cc",
"android/android_video_surface_chooser_impl.h",
"android/codec_allocator.cc",
"android/codec_allocator.h",
"android/codec_buffer_wait_coordinator.cc",
"android/codec_buffer_wait_coordinator.h",
"android/codec_image.cc",
"android/codec_image.h",
"android/codec_image_group.cc",
"android/codec_image_group.h",
"android/codec_output_buffer_renderer.cc",
"android/codec_output_buffer_renderer.h",
"android/codec_surface_bundle.cc",
"android/codec_surface_bundle.h",
"android/codec_wrapper.cc",
"android/codec_wrapper.h",
"android/device_info.cc",
"android/device_info.h",
"android/direct_shared_image_video_provider.cc",
"android/direct_shared_image_video_provider.h",
"android/frame_info_helper.cc",
"android/frame_info_helper.h",
"android/maybe_render_early_manager.cc",
"android/maybe_render_early_manager.h",
"android/media_codec_video_decoder.cc",
"android/media_codec_video_decoder.h",
"android/pooled_shared_image_video_provider.cc",
"android/pooled_shared_image_video_provider.h",
"android/promotion_hint_aggregator.h",
"android/promotion_hint_aggregator_impl.cc",
"android/promotion_hint_aggregator_impl.h",
"android/shared_image_video_provider.cc",
"android/shared_image_video_provider.h",
"android/surface_chooser_helper.cc",
"android/surface_chooser_helper.h",
"android/video_frame_factory.h",
"android/video_frame_factory_impl.cc",
"android/video_frame_factory_impl.h",
]
libs += [ "android" ]
deps += [
"//gpu/ipc/common:android_image_reader_utils",
# TODO(crbug.com/789435): This can be removed once CdmManager is removed.
"//gpu/ipc/common",
"//media/mojo:buildflags",
"//services/service_manager/public/cpp:cpp",
"//ui/gl:gl_jni_headers",
]
if (enable_vulkan) {
deps += [ "//gpu/vulkan:vulkan" ]
}
}
if (use_v4l2_codec) {
public_deps += [ "//media/gpu/v4l2" ]
}
if (use_vaapi) {
public_deps += [
"//media/gpu/vaapi",
"//media/gpu/vaapi:common",
]
}
if (is_win) {
sources += [
"windows/av1_guids.h",
"windows/d3d11_av1_accelerator.cc",
"windows/d3d11_av1_accelerator.h",
"windows/d3d11_com_defs.h",
"windows/d3d11_copying_texture_wrapper.cc",
"windows/d3d11_copying_texture_wrapper.h",
"windows/d3d11_decoder_configurator.cc",
"windows/d3d11_decoder_configurator.h",
"windows/d3d11_h264_accelerator.cc",
"windows/d3d11_h264_accelerator.h",
"windows/d3d11_picture_buffer.cc",
"windows/d3d11_picture_buffer.h",
"windows/d3d11_texture_selector.cc",
"windows/d3d11_texture_selector.h",
"windows/d3d11_texture_wrapper.cc",
"windows/d3d11_texture_wrapper.h",
"windows/d3d11_video_context_wrapper.cc",
"windows/d3d11_video_context_wrapper.h",
"windows/d3d11_video_decoder.cc",
"windows/d3d11_video_decoder.h",
"windows/d3d11_video_decoder_client.h",
"windows/d3d11_video_decoder_impl.cc",
"windows/d3d11_video_decoder_impl.h",
"windows/d3d11_video_device_format_support.cc",
"windows/d3d11_video_device_format_support.h",
"windows/d3d11_video_processor_proxy.cc",
"windows/d3d11_video_processor_proxy.h",
"windows/d3d11_vp9_accelerator.cc",
"windows/d3d11_vp9_accelerator.h",
"windows/d3d11_vp9_picture.cc",
"windows/d3d11_vp9_picture.h",
"windows/dxva_picture_buffer_win.cc",
"windows/dxva_picture_buffer_win.h",
"windows/dxva_video_decode_accelerator_win.cc",
"windows/dxva_video_decode_accelerator_win.h",
"windows/hresult_status_debug_device.cc",
"windows/hresult_status_debug_device.h",
"windows/init_guid.cc",
"windows/media_foundation_video_encode_accelerator_win.cc",
"windows/media_foundation_video_encode_accelerator_win.h",
"windows/supported_profile_helpers.cc",
"windows/supported_profile_helpers.h",
]
configs += [
# TODO(https://crbug.com/167187): Fix size_t to int truncations.
"//build/config/compiler:no_size_t_to_int_warning",
"//third_party/khronos:khronos_headers",
]
public_deps += [ "//media/base/win:media_foundation_util" ]
deps += [
"//media/base/win:hresult_status_helper",
"//media/parsers",
"//third_party/angle:includes",
"//ui/display",
]
libs += [
"d3d9.lib",
"d3d11.lib",
"dxva2.lib",
"strmiids.lib",
"mf.lib",
"mfplat.lib",
"mfuuid.lib",
]
ldflags += [
"/DELAYLOAD:d3d9.dll",
"/DELAYLOAD:d3d11.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:mf.dll",
"/DELAYLOAD:mfplat.dll",
]
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
}
source_set("common") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"accelerated_video_decoder.h",
"buffer_validation.cc",
"buffer_validation.h",
"codec_picture.cc",
"codec_picture.h",
"gpu_video_decode_accelerator_helpers.cc",
"gpu_video_decode_accelerator_helpers.h",
"gpu_video_encode_accelerator_helpers.cc",
"gpu_video_encode_accelerator_helpers.h",
"h264_decoder.cc",
"h264_decoder.h",
"h264_dpb.cc",
"h264_dpb.h",
"macros.h",
"vp9_decoder.cc",
"vp9_decoder.h",
"vp9_picture.cc",
"vp9_picture.h",
"vp9_reference_frame_vector.cc",
"vp9_reference_frame_vector.h",
]
if (proprietary_codecs && enable_platform_hevc) {
sources += [
"h265_decoder.cc",
"h265_decoder.h",
"h265_dpb.cc",
"h265_dpb.h",
]
}
visibility = [
":gpu",
"//media/gpu/*",
]
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) {
sources += [
"decode_surface_handler.h",
"vp8_decoder.cc",
"vp8_decoder.h",
"vp8_picture.cc",
"vp8_picture.h",
"vp8_reference_frame_vector.cc",
"vp8_reference_frame_vector.h",
]
}
public_deps = []
deps = [
":buildflags",
"//base",
"//build:chromeos_buildflags",
"//media",
"//media/parsers",
"//ui/gfx:buffer_types",
"//ui/gfx:memory_buffer",
"//ui/gfx/geometry",
]
if (use_libgav1_parser) {
sources += [
"av1_decoder.cc",
"av1_decoder.h",
"av1_picture.cc",
"av1_picture.h",
]
public_deps += [ "//third_party/libgav1:libgav1" ]
}
}
source_set("command_buffer_helper") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"command_buffer_helper.cc",
"command_buffer_helper.h",
"gles2_decoder_helper.cc",
"gles2_decoder_helper.h",
]
public_deps = [
"//base",
"//gpu/command_buffer/common",
"//gpu/command_buffer/common:gles2_utils",
"//gpu/command_buffer/service",
"//gpu/command_buffer/service:gles2",
"//gpu/ipc/service",
"//ui/gl",
]
}
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) {
source_set("video_frame_mapper") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [ "video_frame_mapper_factory.cc" ]
public_deps = [ ":video_frame_mapper_common" ]
deps = []
# generic_dmabuf_video_frame_mapper
if (use_v4l2_codec || use_vaapi) {
deps += [ "//media/gpu/chromeos:video_frame_mapper" ]
}
# vaapi_dmabuf_video_frame_mapper
if (use_vaapi) {
deps += [ "//media/gpu/vaapi" ]
}
}
source_set("video_frame_mapper_common") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"video_frame_mapper.h",
"video_frame_mapper_factory.h",
]
public_deps = [
":buildflags",
"//base",
"//media",
]
}
}
# TODO(watk): Run this on bots. http://crbug.com/461437
if (is_android) {
test("video_decode_accelerator_unittest") {
testonly = true
data = [ "//media/test/data/" ]
deps = [
":android_video_decode_accelerator_unittests",
":gpu",
"//base",
"//base/test:test_support",
"//gpu/command_buffer/service:android_texture_owner_unittests",
"//media:test_support",
"//media/base/android:media_java",
"//media/test:run_all_unittests",
"//mojo/core/embedder",
"//testing/gtest",
"//ui/android:ui_java",
"//ui/base",
"//ui/display/manager",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/gl",
"//ui/gl:test_support",
"//ui/gl/init",
]
configs += [ "//third_party/khronos:khronos_headers" ]
}
}
source_set("android_video_decode_accelerator_unittests") {
if (is_android) {
testonly = true
sources = [
"android/android_video_surface_chooser_impl_unittest.cc",
"android/codec_allocator_unittest.cc",
"android/codec_image_group_unittest.cc",
"android/codec_image_unittest.cc",
"android/codec_wrapper_unittest.cc",
"android/fake_codec_allocator.cc",
"android/fake_codec_allocator.h",
"android/frame_info_helper_unittest.cc",
"android/maybe_render_early_manager_unittest.cc",
"android/media_codec_video_decoder_unittest.cc",
"android/mock_android_video_surface_chooser.cc",
"android/mock_android_video_surface_chooser.h",
"android/mock_codec_buffer_wait_coordinator.cc",
"android/mock_codec_buffer_wait_coordinator.h",
"android/mock_codec_image.cc",
"android/mock_codec_image.h",
"android/mock_device_info.cc",
"android/mock_device_info.h",
"android/mock_promotion_hint_aggregator.cc",
"android/mock_promotion_hint_aggregator.h",
"android/mock_shared_image_video_provider.cc",
"android/mock_shared_image_video_provider.h",
"android/pooled_shared_image_video_provider_unittest.cc",
"android/promotion_hint_aggregator_impl_unittest.cc",
"android/surface_chooser_helper_unittest.cc",
"android/video_frame_factory_impl_unittest.cc",
]
deps = [
":gpu",
"//base/test:test_support",
"//gpu:test_support",
"//gpu/command_buffer/service:android_texture_owner_test_support",
"//media",
"//media:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/gl",
"//ui/gl/init",
]
}
}
static_library("test_support") {
visibility = [ "//media/gpu/*" ]
testonly = true
sources = [
"test/fake_command_buffer_helper.cc",
"test/fake_command_buffer_helper.h",
]
configs += [ "//media:media_config" ]
public_deps = [
":gpu",
"//base",
"//media",
]
}
source_set("unit_tests") {
testonly = true
deps = [
"//base",
"//base/test:test_support",
"//media:test_support",
"//media/gpu",
"//media/gpu:test_support",
"//media/gpu/ipc/service:unit_tests",
"//testing/gmock",
"//testing/gtest",
"//ui/gl:test_support",
]
sources = [ "h264_decoder_unittest.cc" ]
if (proprietary_codecs && enable_platform_hevc) {
sources += [ "h265_decoder_unittest.cc" ]
}
if (is_chromeos_ash && (use_v4l2_codec || use_vaapi)) {
deps += [ "//media/gpu/chromeos:unit_tests" ]
}
if (use_vaapi) {
deps += [ "//media/gpu/vaapi:unit_test" ]
}
if (use_v4l2_codec) {
deps += [ "//media/gpu/v4l2:unit_test" ]
}
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) {
sources += [ "vp8_decoder_unittest.cc" ]
}
if (use_libgav1_parser) {
sources += [ "av1_decoder_unittest.cc" ]
deps += [
"//build:chromeos_buildflags",
"//third_party/ffmpeg",
]
}
if (is_win && enable_library_cdms) {
sources += [
"windows/d3d11_copying_texture_wrapper_unittest.cc",
"windows/d3d11_decoder_configurator_unittest.cc",
"windows/d3d11_picture_buffer_unittest.cc",
"windows/d3d11_texture_selector_unittest.cc",
"windows/d3d11_texture_wrapper_unittest.cc",
"windows/d3d11_video_decoder_unittest.cc",
"windows/d3d11_video_device_format_support_unittest.cc",
"windows/d3d11_video_processor_proxy_unittest.cc",
"windows/supported_profile_helpers_unittest.cc",
]
libs = [ "dxguid.lib" ]
}
if (is_mac) {
deps += [ "//media/gpu/mac:unit_tests" ]
}
}
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) {
test("video_decode_accelerator_tests") {
assert(enable_av1_decoder)
testonly = true
sources = [ "video_decode_accelerator_tests.cc" ]
data = [ "//media/test/data/" ]
deps = [
":buildflags",
"test:frame_file_writer",
"test:frame_validator",
"test:helpers",
"test:test_helpers",
"test:video_player",
"test:video_player_test_environment",
"test:video_player_thumbnail_renderer",
"//media:test_support",
"//testing/gtest",
]
}
test("video_decode_accelerator_perf_tests") {
testonly = true
sources = [ "video_decode_accelerator_perf_tests.cc" ]
data = [ "//media/test/data/" ]
deps = [
":buildflags",
"test:helpers",
"test:video_player",
"test:video_player_test_environment",
"//media:test_support",
"//testing/gtest",
]
}
test("video_encode_accelerator_tests") {
testonly = true
sources = [ "video_encode_accelerator_tests.cc" ]
data = [ "//media/test/data/" ]
deps = [
":buildflags",
"test:frame_file_writer",
"test:frame_validator",
"test:helpers",
"test:test_helpers",
"test:video_encoder",
"test:video_encoder_test_environment",
"//media:test_support",
"//testing/gtest",
]
}
test("video_encode_accelerator_perf_tests") {
testonly = true
sources = [ "video_encode_accelerator_perf_tests.cc" ]
data = [ "//media/test/data/" ]
deps = [
":buildflags",
"test:frame_validator",
"test:helpers",
"test:test_helpers",
"test:video_encoder",
"test:video_encoder_test_environment",
"test:video_encoder_test_environment",
"//media:test_support",
"//testing/gtest",
]
}
}
if (proprietary_codecs && enable_platform_hevc) {
fuzzer_test("media_h265_decoder_fuzzer") {
sources = [ "h265_decoder_fuzzertest.cc" ]
deps = [
":gpu",
"//base",
"//media",
]
}
}
if (use_libgav1_parser) {
fuzzer_test("media_av1_decoder_fuzzer") {
sources = [ "av1_decoder_fuzzertest.cc" ]
deps = [
":common",
"//base",
"//media",
]
}
}