blob: e65f99484932609513ac1c0b5f7d05e36e37237d [file] [log] [blame]
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/gpu/args.gni")
import("//media/media_options.gni")
import("//testing/test.gni")
import("//tools/generate_stubs/rules.gni")
import("//ui/gl/features.gni")
assert(is_linux || is_chromeos)
assert(use_vaapi)
generate_stubs("libva_stubs") {
extra_header = "va_stub_header.fragment"
sigs = [ "va.sigs" ]
if (use_vaapi_x11) {
sigs += [ "va_x11.sigs" ]
}
if (is_chromeos_ash) {
sigs += [ "va_prot.sigs" ]
}
sigs += [ "va_drm.sigs" ]
output_name = "va_stubs"
deps = [
"//base",
"//media/gpu:buildflags",
]
}
source_set("vaapi") {
assert(use_libgav1_parser)
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"av1_vaapi_video_decoder_delegate.cc",
"av1_vaapi_video_decoder_delegate.h",
"av1_vaapi_video_encoder_delegate.cc",
"av1_vaapi_video_encoder_delegate.h",
"h264_vaapi_video_decoder_delegate.cc",
"h264_vaapi_video_decoder_delegate.h",
"h264_vaapi_video_encoder_delegate.cc",
"h264_vaapi_video_encoder_delegate.h",
"vaapi_dmabuf_video_frame_mapper.cc",
"vaapi_dmabuf_video_frame_mapper.h",
"vaapi_image_decode_accelerator_worker.cc",
"vaapi_image_decode_accelerator_worker.h",
"vaapi_image_decoder.cc",
"vaapi_image_decoder.h",
"vaapi_image_processor_backend.cc",
"vaapi_image_processor_backend.h",
"vaapi_jpeg_decoder.cc",
"vaapi_jpeg_decoder.h",
"vaapi_jpeg_encoder.cc",
"vaapi_jpeg_encoder.h",
"vaapi_picture.cc",
"vaapi_picture.h",
"vaapi_picture_factory.cc",
"vaapi_picture_factory.h",
"vaapi_video_decode_accelerator.cc",
"vaapi_video_decode_accelerator.h",
"vaapi_video_decoder.cc",
"vaapi_video_decoder.h",
"vaapi_video_decoder_delegate.cc",
"vaapi_video_decoder_delegate.h",
"vaapi_video_encode_accelerator.cc",
"vaapi_video_encode_accelerator.h",
"vaapi_video_encoder_delegate.cc",
"vaapi_video_encoder_delegate.h",
"vaapi_webp_decoder.cc",
"vaapi_webp_decoder.h",
"vp8_vaapi_video_decoder_delegate.cc",
"vp8_vaapi_video_decoder_delegate.h",
"vp8_vaapi_video_encoder_delegate.cc",
"vp8_vaapi_video_encoder_delegate.h",
"vp9_vaapi_video_decoder_delegate.cc",
"vp9_vaapi_video_decoder_delegate.h",
"vp9_vaapi_video_encoder_delegate.cc",
"vp9_vaapi_video_encoder_delegate.h",
]
if (enable_hevc_parser_and_hw_decoder) {
sources += [
"h265_vaapi_video_decoder_delegate.cc",
"h265_vaapi_video_decoder_delegate.h",
]
}
configs += [
"//build/config/linux/libva",
"//third_party/libvpx:libvpx_config",
]
deps = [
":common",
":vaapi_status",
"//base",
"//build:chromeos_buildflags",
"//gpu/command_buffer/service:gles2",
"//gpu/config",
"//gpu/ipc/common",
"//gpu/ipc/service",
"//media/gpu:common",
"//media/gpu:video_frame_mapper_common",
"//media/gpu/chromeos:common",
"//media/parsers",
"//mojo/public/cpp/bindings",
"//third_party/libaom:libaomrc",
"//third_party/libvpx:libvpxrc",
"//third_party/libyuv",
"//ui/gfx",
"//ui/gfx/geometry",
]
public_deps = [
"//media",
"//skia",
"//ui/gl",
]
if (is_chromeos_ash) {
sources += [
"vaapi_jpeg_encode_accelerator.cc",
"vaapi_jpeg_encode_accelerator.h",
"vaapi_mjpeg_decode_accelerator.cc",
"vaapi_mjpeg_decode_accelerator.h",
]
deps += [
"//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_gpu",
"//components/chromeos_camera:jpeg_encode_accelerator",
"//components/chromeos_camera:mjpeg_decode_accelerator",
]
}
if (use_ozone || use_egl) {
sources += [
"vaapi_picture_native_pixmap.cc",
"vaapi_picture_native_pixmap.h",
]
}
if (use_vaapi_x11) {
deps += [ "//ui/gfx/x" ]
sources += [
"gl_image_egl_pixmap.cc",
"gl_image_egl_pixmap.h",
"vaapi_picture_native_pixmap_angle.cc",
"vaapi_picture_native_pixmap_angle.h",
]
}
if (use_ozone) {
deps += [
"//media/gpu:buffer_validation",
"//ui/ozone",
]
sources += [
"vaapi_picture_native_pixmap_ozone.cc",
"vaapi_picture_native_pixmap_ozone.h",
]
}
if (use_egl) {
sources += [
"gl_image_gl_texture.cc",
"gl_image_gl_texture.h",
"vaapi_picture_native_pixmap_egl.cc",
"vaapi_picture_native_pixmap_egl.h",
]
}
}
# The vaapi status functionality is in its own source set so that it can be
# depended on without pulling the //media/gpu/vaapi:vaapi target.
source_set("vaapi_status") {
sources = [ "vaapi_status.h" ]
visibility = [
":vaapi",
"//media/mojo/mojom/stable:*",
]
deps = [ "//media" ]
}
source_set("common") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [
"va_surface.cc",
"va_surface.h",
"vaapi_common.cc",
"vaapi_common.h",
"vaapi_utils.cc",
"vaapi_utils.h",
"vaapi_wrapper.cc",
"vaapi_wrapper.h",
]
public_deps = [
"//base",
"//build/config/linux/libdrm",
"//gpu",
"//media",
"//media/gpu:common",
"//media/gpu/chromeos:fourcc",
"//ui/gfx/geometry",
]
deps = [
":libva_stubs",
"//build:chromeos_buildflags",
"//third_party/libyuv",
"//ui/base:features",
"//ui/gfx:memory_buffer",
"//ui/gfx/linux:drm",
"//ui/gl",
]
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
if (use_vaapi_x11) {
deps += [ "//ui/gfx/x" ]
}
configs += [ "//build/config/linux/libva" ]
}
source_set("vaapi_test_utils") {
testonly = true
sources = [
"test_utils.cc",
"test_utils.h",
]
deps = [
":common",
"//base",
"//testing/gtest",
"//third_party/libyuv:libyuv",
]
public_deps = [ "//ui/gfx/geometry" ]
}
source_set("unit_test") {
testonly = true
sources = [
"h264_vaapi_video_encoder_delegate_unittest.cc",
"vaapi_image_decode_accelerator_worker_unittest.cc",
"vaapi_video_decode_accelerator_unittest.cc",
"vaapi_video_encode_accelerator_unittest.cc",
"vaapi_wrapper_unittest.cc",
"vp9_vaapi_video_encoder_delegate_unittest.cc",
]
configs += [ "//third_party/libvpx:libvpx_config" ]
deps = [
":common",
":vaapi",
"//base",
"//base/test:test_support",
"//gpu:test_support",
"//gpu/ipc/service",
"//media:test_support",
"//media/gpu:common",
"//mojo/core/embedder",
"//testing/gmock",
"//testing/gtest",
"//third_party/libvpx:libvpxrc",
"//ui/gfx:memory_buffer",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
]
}
source_set("vaapi_image_decoder_test_common") {
testonly = true
sources = [
"vaapi_image_decoder_test_common.cc",
"vaapi_image_decoder_test_common.h",
]
deps = [
":vaapi",
":vaapi_test_utils",
"//base",
"//media:test_support",
"//testing/gtest",
]
}
# TODO(https://crbug.com/1043007): remove is_chromeos.
if (is_chromeos_ash) {
source_set("jpeg_decoder_unit_test") {
testonly = true
sources = [ "vaapi_jpeg_decoder_unittest.cc" ]
deps = [
":common",
":vaapi",
":vaapi_image_decoder_test_common",
":vaapi_test_utils",
"//base",
"//media/gpu/test:local_gpu_memory_buffer_manager",
"//media/parsers",
"//testing/gtest",
"//third_party/libyuv:libyuv",
"//ui/gfx:memory_buffer",
"//ui/gfx/codec",
"//ui/gfx/geometry",
]
}
source_set("webp_decoder_unit_test") {
testonly = true
sources = [ "vaapi_webp_decoder_unittest.cc" ]
deps = [
":common",
":vaapi",
":vaapi_image_decoder_test_common",
":vaapi_test_utils",
"//base",
"//media/gpu/test:local_gpu_memory_buffer_manager",
"//media/parsers",
"//testing/gtest",
"//third_party/libwebp",
"//ui/gfx:memory_buffer",
"//ui/gfx/geometry",
]
}
}
source_set("vaapi_utils_unittest") {
testonly = true
sources = [ "vaapi_utils_unittest.cc" ]
deps = [
":common",
"//base",
"//base/test:test_support",
"//testing/gtest",
"//ui/gfx/geometry",
]
}
test("vaapi_unittest") {
sources = [ "vaapi_unittest.cc" ]
deps = [
":common",
":vaapi_utils_unittest",
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//gpu",
"//media/gpu/test:helpers",
"//testing/gtest",
"//third_party/minigbm",
"//ui/gfx/linux:gbm",
]
# TODO(andrescj): the Chrome bots run vaapi_unittest with the fake driver, but
# the ChromeOS tests rely on a real driver. Therefore, we shouldn't need this
# unconditional data_deps. Instead, we should try to re-structure things so
# that ChromeOS can build the vaapi_unittest without building the fake driver.
data_deps = [ "//media/gpu/vaapi/test/fake_libva_driver:fake_drv_video" ]
# TODO(https://crbug.com/1043007): remove is_chromeos.
if (is_chromeos_ash) {
deps += [
":jpeg_decoder_unit_test",
":webp_decoder_unit_test",
]
}
if (use_ozone && is_linux) {
deps += [ "//ui/ozone" ]
}
}
group("vaapi_fuzzers") {
testonly = true
public_deps =
[ "//media/gpu/vaapi/fuzzers/jpeg_decoder:vaapi_jpeg_decoder_fuzzertest" ]
}
executable("decode_test") {
testonly = true
sources = [
"test/av1_decoder.cc",
"test/av1_decoder.h",
"test/decode.cc",
"test/h264_decoder.cc",
"test/h264_decoder.h",
"test/h264_dpb.cc",
"test/h264_dpb.h",
"test/h264_vaapi_wrapper.cc",
"test/h264_vaapi_wrapper.h",
"test/macros.h",
"test/scoped_va_config.cc",
"test/scoped_va_config.h",
"test/scoped_va_context.cc",
"test/scoped_va_context.h",
"test/shared_va_surface.cc",
"test/shared_va_surface.h",
"test/vaapi_device.cc",
"test/vaapi_device.h",
"test/video_decoder.cc",
"test/video_decoder.h",
"test/vp8_decoder.cc",
"test/vp8_decoder.h",
"test/vp9_decoder.cc",
"test/vp9_decoder.h",
]
if (enable_platform_hevc) {
sources += [
"test/h265_decoder.cc",
"test/h265_decoder.h",
"test/h265_dpb.cc",
"test/h265_dpb.h",
"test/h265_vaapi_wrapper.cc",
"test/h265_vaapi_wrapper.h",
]
}
deps = [
":libva_stubs",
"//base",
"//build/config/linux/libdrm",
"//media",
"//media:test_support",
"//media/gpu:common",
"//media/parsers:parsers",
"//third_party/libgav1:libgav1_parser",
"//third_party/libyuv",
"//ui/gfx/codec:codec",
"//ui/gfx/geometry",
]
}