blob: f8a788a95b4162403d47cd99aa7dff25e8aa4718 [file] [log] [blame]
# Copyright 2018 The Fuchsia 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/config/fuchsia/rules.gni")
import("//build/package.gni")
declare_args() {
amlogic_decoder_tests = false
}
driver_module("amlogic_decoder") {
output_name = "amlogic_video_decoder"
deps = [
":sources",
]
if (amlogic_decoder_tests) {
testonly = true
deps += [ ":tests" ]
}
configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ]
configs += [ "//build/config/fuchsia:static_cpp_standard_library" ]
}
config("sources_include_config") {
include_dirs = [ "." ]
if (amlogic_decoder_tests) {
include_dirs += [ "./tests/integration/test_data_headers" ]
}
}
source_set("test_support") {
deps = [
"//zircon/public/lib/ddk",
"//zircon/public/lib/driver",
]
sources = [
"tests/test_support.h",
]
}
source_set("sources") {
sources = [
# Driver structure:
"device_ctx.cc",
"device_ctx.h",
"driver_ctx.cc",
"driver_ctx.h",
# HW driving:
"amlogic-video.cc",
"amlogic-video.h",
"binding.c",
"decoder_core.h",
"firmware_blob.cc",
"firmware_blob.h",
"h264_decoder.cc",
"h264_decoder.h",
"hevcdec.cc",
"hevcdec.h",
"macros.h",
"mpeg12_decoder.cc",
"mpeg12_decoder.h",
"pts_manager.cc",
"pts_manager.h",
"registers.h",
"vdec1.cc",
"vdec1.h",
"video_decoder.h",
"video_frame.cc",
"video_frame.h",
"vp9_decoder.cc",
"vp9_decoder.h",
# CodecFactory+Codec interface handling:
"codec_adapter.cc",
"codec_adapter.h",
"codec_adapter_events.cc",
"codec_adapter_events.h",
"codec_adapter_h264.cc",
"codec_adapter_h264.h",
"codec_adapter_mpeg2.cc",
"codec_adapter_mpeg2.h",
"codec_admission_control.cc",
"codec_admission_control.h",
"codec_buffer.cc",
"codec_buffer.h",
"codec_impl.cc",
"codec_impl.h",
"codec_input_item.cc",
"codec_input_item.h",
"codec_packet.cc",
"codec_packet.h",
"device_fidl.cc",
"device_fidl.h",
"local_codec_factory.cc",
"local_codec_factory.h",
]
public_deps = [
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/ddk",
"//zircon/public/lib/driver",
"//zircon/public/lib/fbl",
"//zircon/public/lib/hwreg",
"//zircon/public/lib/zx",
]
deps = [
":test_support",
"third_party/libvpx",
"//garnet/public/fidl/fuchsia.mediacodec",
"//garnet/public/lib/fidl/cpp",
"//garnet/public/lib/fxl",
]
if (amlogic_decoder_tests) {
testonly = true
defines = [ "ENABLE_DECODER_TESTS" ]
}
public_configs = [ ":sources_include_config" ]
cflags = []
}
source_set("tests") {
testonly = true
deps = [
":sources",
":test_support",
"//garnet/public/fidl/fuchsia.mediacodec",
"//garnet/public/lib/fxl",
"//third_party/googletest:gtest",
]
sources = [
"tests/integration/test_h264.cc",
"tests/integration/test_mpeg2.cc",
"tests/integration/test_vp9.cc",
"tests/test_support.cc",
"tests/unit_tests/test_binding.cc",
"tests/unit_tests/test_vp9.cc",
]
}
copy("video-ucode") {
sources = [
"firmware/video_ucode.bin",
]
outputs = [
"$root_out_dir/firmware/amlogic_video_ucode.bin",
]
}
copy("test_files") {
sources = [
"//garnet/test_data/media/third_party/chromium_media_test_data/bear.h264",
"//garnet/test_data/media/third_party/chromium_media_test_data/test-25fps.h264",
"//garnet/test_data/media/third_party/chromium_media_test_data/test-25fps.vp9",
"//garnet/test_data/media/third_party/chromium_media_test_data/test-25fps.vp9_2",
]
outputs = [
"$root_out_dir/firmware/video_test_data/{{source_file_part}}",
]
}
package("amlogic_video_decoder") {
deprecated_system_image = true
if (amlogic_decoder_tests) {
testonly = true
}
deps = [
":amlogic_decoder",
":video-ucode($shlib_toolchain)",
]
drivers = [
{
name = "amlogic_video_decoder.so"
},
]
libraries = [
{
name = "firmware/amlogic_video_ucode.bin"
},
]
if (amlogic_decoder_tests) {
deps += [ ":test_files($shlib_toolchain)" ]
# The test data is stored as a firmware file, because that's the only way
# that a file can be read from a driver.
libraries += [
{
name = "firmware/video_test_data/bear.h264"
},
{
name = "firmware/video_test_data/test-25fps.h264"
},
{
name = "firmware/video_test_data/test-25fps.vp9"
},
{
name = "firmware/video_test_data/test-25fps.vp9_2"
},
]
}
}
#
# Manual tests
#
executable("test_amlogic_codec_factory") {
testonly = true
sources = [
"tests/manual/test_amlogic_codec_factory.cc",
]
deps = [
"//garnet/public/fidl/fuchsia.mediacodec",
"//garnet/public/lib/component/cpp",
"//zircon/public/lib/async-loop-cpp",
]
}
package("test_amlogic_codec_factory_package") {
# TODO(dustingreen): Do we need deprecated_system_image to be able to run a
# test manually from fx shell?
testonly = true
deps = [
":test_amlogic_codec_factory",
]
tests = [
{
name = "test_amlogic_codec_factory"
},
]
}