| # 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/cipd.gni") |
| import("//build/config/fuchsia/rules.gni") |
| import("//build/driver_package.gni") |
| import("//build/test/test_package.gni") |
| |
| declare_args() { |
| # Path to the amlogic decoder firmware file. Overrides the default in the build. |
| amlogic_decoder_firmware_path = "" |
| } |
| |
| # These targets only compile for arm64. |
| if (target_cpu == "arm64") { |
| group("amlogic_decoder") { |
| deps = [ |
| ":amlogic_decoder_firmware", |
| ":amlogic_decoder_package", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":amlogic_decoder_firmware", |
| ":amlogic_decoder_test_package", |
| ":test_amlogic_codec_factory_package", |
| "tests/runner:amlogic_decoder_integration_tests", |
| ] |
| } |
| |
| driver_module("amlogic_video_decoder") { |
| deps = [ |
| ":sources", |
| ":test_support", |
| ] |
| |
| sources = [ "binding.c" ] |
| |
| configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ] |
| configs += [ "//build/config/fuchsia:static_cpp_standard_library" ] |
| } |
| |
| # This version of the driver runs tests on startup. |
| driver_module("amlogic_decoder_test") { |
| output_name = "amlogic_video_decoder_test" |
| |
| testonly = true |
| |
| deps = [ |
| ":sources", |
| ":test_sources", |
| ":test_support", |
| "//sdk/fidl/fuchsia.hardware.mediacodec:fuchsia.hardware.mediacodec_llcpp", |
| "//zircon/public/lib/fdio", |
| ] |
| sources = [ |
| "test_binding.c", |
| "test_device_ctx.cc", |
| ] |
| |
| configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ] |
| configs += [ "//build/config/fuchsia:static_cpp_standard_library" ] |
| } |
| |
| config("sources_include_config") { |
| include_dirs = [ "." ] |
| } |
| |
| source_set("test_support") { |
| deps = [ |
| "//src/devices/lib/driver", |
| "//zircon/public/lib/ddk", |
| ] |
| 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", |
| "decoder_core.h", |
| "firmware_blob.cc", |
| "firmware_blob.h", |
| "h264_decoder.cc", |
| "h264_decoder.h", |
| "h264_multi_decoder.cc", |
| "h264_multi_decoder.h", |
| "h264_utils.cc", |
| "h264_utils.h", |
| "hevcdec.cc", |
| "hevcdec.h", |
| "internal_buffer.cc", |
| "internal_buffer.h", |
| "macros.h", |
| "mpeg12_decoder.cc", |
| "mpeg12_decoder.h", |
| "parser.cc", |
| "parser.h", |
| "pts_manager.cc", |
| "pts_manager.h", |
| "registers.h", |
| "secmem_session.cc", |
| "secmem_session.h", |
| "third_party/vp9_adapt_probs/vp9_coefficient_adaptation.c", |
| "vdec1.cc", |
| "vdec1.h", |
| "video_decoder.h", |
| "video_firmware_session.cc", |
| "video_firmware_session.h", |
| "video_frame.cc", |
| "video_frame.h", |
| "vp9_decoder.cc", |
| "vp9_decoder.h", |
| "vp9_utils.cc", |
| "vp9_utils.h", |
| "watchdog.cc", |
| "watchdog.h", |
| |
| # CodecFactory+Codec interface handling: |
| "codec_adapter_h264.cc", |
| "codec_adapter_h264.h", |
| "codec_adapter_h264_multi.cc", |
| "codec_adapter_h264_multi.h", |
| "codec_adapter_mpeg2.cc", |
| "codec_adapter_mpeg2.h", |
| "codec_adapter_vp9.cc", |
| "codec_adapter_vp9.h", |
| "device_fidl.cc", |
| "device_fidl.h", |
| "local_codec_factory.cc", |
| "local_codec_factory.h", |
| ] |
| public_deps = [ |
| "h264:h264_parser", |
| "//sdk/banjo/ddk.protocol.amlogiccanvas", |
| "//sdk/banjo/ddk.protocol.composite", |
| "//sdk/banjo/ddk.protocol.platform.device", |
| "//sdk/banjo/ddk.protocol.sysmem", |
| "//sdk/banjo/ddk.protocol.tee", |
| "//sdk/fidl/fuchsia.tee", |
| "//src/devices/bus/lib/device-protocol-platform-device", |
| "//src/devices/lib/driver", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/ddk", |
| "//zircon/public/lib/ddktl", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/hwreg", |
| "//zircon/public/lib/mmio", |
| "//zircon/public/lib/safemath", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/trace-driver", |
| "//zircon/public/lib/zx", |
| "//zircon/system/ulib/tee-client-api", |
| ] |
| deps = [ |
| ":test_support", |
| "third_party/libvpx", |
| "//sdk/fidl/fuchsia.hardware.mediacodec:fuchsia.hardware.mediacodec_c", |
| "//sdk/fidl/fuchsia.mediacodec", |
| "//sdk/lib/fidl/cpp", |
| "//src/media/lib/codec_impl", |
| ] |
| public_configs = [ ":sources_include_config" ] |
| cflags = [] |
| } |
| |
| source_set("test_sources") { |
| testonly = true |
| deps = [ |
| ":sources", |
| ":test_support", |
| "//sdk/fidl/fuchsia.mediacodec", |
| "//src/media/lib/codec_impl", |
| "//third_party/boringssl:crypto", |
| "//third_party/googletest:gtest", |
| ] |
| sources = [ |
| "tests/integration/test_amlogic_video.cc", |
| "tests/integration/test_h264.cc", |
| "tests/integration/test_h264_multi.cc", |
| "tests/integration/test_mpeg2.cc", |
| "tests/integration/test_parser.cc", |
| "tests/integration/test_vp9.cc", |
| "tests/integration/video_frame_helpers.cc", |
| "tests/integration/video_frame_helpers.h", |
| "tests/test_support.cc", |
| "tests/unit_tests/test_binding.cc", |
| "tests/unit_tests/test_pts_manager.cc", |
| "tests/unit_tests/test_vdec1.cc", |
| "tests/unit_tests/test_vp9.cc", |
| ] |
| } |
| |
| 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/red-green.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", |
| "//garnet/test_data/media/third_party/chromium_media_test_data_downstream/bear.mpeg2", |
| ] |
| outputs = [ "$root_out_dir/firmware/video_test_data/{{source_file_part}}" ] |
| } |
| |
| driver_package("amlogic_decoder_firmware") { |
| # internal access is needed to get the firmware from the default path |
| if (target_cpu == "arm64" && |
| (internal_access || amlogic_decoder_firmware_path != "")) { |
| if (amlogic_decoder_firmware_path == "") { |
| amlogic_decoder_firmware_path = |
| "//prebuilt/media/firmware/amlogic-decoder/video_ucode.bin" |
| } |
| libraries = [ |
| { |
| source = rebase_path(amlogic_decoder_firmware_path) |
| name = "firmware/amlogic_video_ucode.bin" |
| }, |
| ] |
| } |
| } |
| |
| driver_package("amlogic_decoder_package") { |
| # internal access is needed to get the firmware from the default path |
| if (target_cpu == "arm64" && |
| (internal_access || amlogic_decoder_firmware_path != "")) { |
| deps = [ ":amlogic_video_decoder" ] |
| drivers = [ |
| { |
| name = "amlogic_video_decoder.so" |
| }, |
| ] |
| } |
| } |
| |
| driver_package("amlogic_decoder_test_package") { |
| # internal access is needed to get the firmware from the default path |
| if (target_cpu == "arm64" && |
| (internal_access || amlogic_decoder_firmware_path != "")) { |
| testonly = true |
| |
| deps = [] |
| deps += [ |
| ":amlogic_decoder_test", |
| ":test_files($shlib_toolchain)", |
| ] |
| drivers = [ |
| { |
| name = "amlogic_video_decoder_test.so" |
| }, |
| ] |
| |
| # 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.mpeg2" |
| }, |
| { |
| name = "firmware/video_test_data/bear.h264" |
| }, |
| { |
| name = "firmware/video_test_data/red-green.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 = [ |
| "//sdk/fidl/fuchsia.mediacodec", |
| "//sdk/lib/sys/cpp", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| ] |
| } |
| |
| test_package("test_amlogic_codec_factory_package") { |
| if (target_cpu == "arm64") { |
| deps = [ ":test_amlogic_codec_factory" ] |
| tests = [ |
| { |
| name = "test_amlogic_codec_factory" |
| environments = [ astro_env ] |
| |
| # Manual only test; comment out to use `fx run-test` |
| disabled = true |
| }, |
| ] |
| } |
| } |
| } |