| # 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/bind/bind.gni") |
| import("//build/cipd.gni") |
| import("//build/components.gni") |
| import("//build/drivers.gni") |
| |
| declare_args() { |
| # Path to the amlogic decoder firmware file. Overrides the default in the build. |
| amlogic_decoder_firmware_path = "" |
| } |
| |
| driver_bind_rules("amlogic_video_bind") { |
| rules = "amlogic_video.bind" |
| tests = "bind_tests.json" |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.amlogiccanvas:fuchsia.hardware.amlogiccanvas_bindlib", |
| "//sdk/fidl/fuchsia.hardware.clock:fuchsia.hardware.clock_bindlib", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_bindlib", |
| "//sdk/fidl/fuchsia.hardware.tee:fuchsia.hardware.tee_bindlib", |
| "//src/devices/bind/fuchsia.amlogic.platform", |
| "//src/devices/bind/fuchsia.clock", |
| "//src/devices/bind/fuchsia.platform", |
| ] |
| } |
| |
| # Note: This target uses the same source as above, the only difference is the addition of |
| # `diasable_autobind = true`, and tests are omitted. |
| driver_bind_rules("amlogic_video_test_bind") { |
| rules = "amlogic_video.bind" |
| disable_autobind = true |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.amlogiccanvas:fuchsia.hardware.amlogiccanvas_bindlib", |
| "//sdk/fidl/fuchsia.hardware.clock:fuchsia.hardware.clock_bindlib", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_bindlib", |
| "//sdk/fidl/fuchsia.hardware.tee:fuchsia.hardware.tee_bindlib", |
| "//src/devices/bind/fuchsia.amlogic.platform", |
| "//src/devices/bind/fuchsia.clock", |
| "//src/devices/bind/fuchsia.platform", |
| ] |
| } |
| |
| test_list = [ ":amlogic_video_bind_test" ] |
| |
| # These targets only compile for arm64. |
| if (target_cpu == "arm64") { |
| # internal access is needed to get the firmware from the default path. |
| _has_decoder_firmware = internal_access || amlogic_decoder_firmware_path != "" |
| |
| group("amlogic_decoder") { |
| deps = [] |
| if (_has_decoder_firmware) { |
| deps += [ ":amlogic_decoder-package" ] |
| } |
| } |
| |
| test_list += [ |
| "tests/runner:amlogic_decoder_integration_tests", |
| "tests/unit_tests:amlogic-decoder-unittest", |
| ] |
| if (_has_decoder_firmware) { |
| test_list += [ |
| ":amlogic_decoder_firmware", |
| ":amlogic_decoder_test-package", |
| ] |
| } |
| |
| fuchsia_driver("amlogic_video_decoder-driver") { |
| output_name = "amlogic_video_decoder" |
| deps = [ |
| ":amlogic_video_bind", |
| ":sources", |
| ":test_support", |
| "//sdk/lib/syslog/cpp:backend", |
| ] |
| |
| sources = [ "binding.cc" ] |
| } |
| |
| fuchsia_driver_component("amlogic_video_decoder-component") { |
| component_name = "amlogic_video_decoder" |
| deps = [ ":amlogic_video_decoder-driver" ] |
| info = "amlogic_video_decoder-info.json" |
| manifest = "meta/amlogic_video_decoder-component.cml" |
| } |
| |
| # This version of the driver runs tests on startup. |
| fuchsia_driver("amlogic_decoder_test-driver") { |
| output_name = "amlogic_video_decoder_test" |
| |
| testonly = true |
| |
| deps = [ |
| ":amlogic_video_test_bind", |
| ":sources", |
| ":test_sources", |
| ":test_support", |
| "//sdk/fidl/fuchsia.hardware.mediacodec:fuchsia.hardware.mediacodec_cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/syslog/cpp:backend", |
| ] |
| sources = [ |
| "test_binding.cc", |
| "test_device_ctx.cc", |
| "test_device_ctx.h", |
| ] |
| } |
| |
| fuchsia_driver_component("amlogic_decoder_test-component") { |
| testonly = true |
| component_name = "amlogic_video_decoder_test" |
| deps = [ ":amlogic_decoder_test-driver" ] |
| info = "amlogic_video_decoder_test-info.json" |
| manifest = "meta/amlogic_video_decoder_test.cml" |
| } |
| |
| config("sources_include_config") { |
| include_dirs = [ "." ] |
| } |
| |
| source_set("test_support") { |
| deps = [ |
| "//src/devices/lib/driver", |
| "//src/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_multi_decoder.cc", |
| "h264_multi_decoder.h", |
| "h264_utils.cc", |
| "h264_utils.h", |
| "hevcdec.cc", |
| "hevcdec.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", |
| "setbuf_workaround.cc", |
| "thread_role.h", |
| "vdec1.cc", |
| "vdec1.h", |
| "video_decoder.cc", |
| "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_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 = [ |
| "//sdk/fidl/fuchsia.hardware.amlogiccanvas:fuchsia.hardware.amlogiccanvas_cpp", |
| "//sdk/fidl/fuchsia.hardware.clock:fuchsia.hardware.clock_cpp", |
| "//sdk/fidl/fuchsia.hardware.mediacodec:fuchsia.hardware.mediacodec_cpp", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_cpp", |
| "//sdk/fidl/fuchsia.hardware.tee:fuchsia.hardware.tee_cpp", |
| "//sdk/fidl/fuchsia.tee:fuchsia.tee_hlcpp", |
| "//sdk/lib/fit", |
| "//sdk/lib/fit-promise", |
| "//src/devices/bind/fuchsia.amlogic.platform.sysmem.heap:fuchsia.amlogic.platform.sysmem.heap_cpp", |
| "//src/devices/bind/fuchsia.sysmem.heap:fuchsia.sysmem.heap_cpp", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/mmio", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//src/lib/memory_barriers", |
| "//src/media/lib/extend_bits", |
| "//src/media/lib/internal_buffer", |
| "//src/media/third_party/chromium_media", |
| "//src/security/lib/tee/tee-client-api", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/hwreg", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/trace-vthread", |
| "//zircon/system/ulib/zx", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| deps = [ |
| ":test_support", |
| "third_party/libvpx", |
| "third_party/vp9_adapt_probs", |
| "//sdk/fidl/fuchsia.mediacodec:fuchsia.mediacodec_hlcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fidl/cpp", |
| "//src/lib/ddktl", |
| "//src/lib/metrics_buffer", |
| "//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:fuchsia.mediacodec_hlcpp", |
| "//src/devices/lib/mmio:test_helper", |
| "//src/media/lib/codec_impl", |
| "//third_party/boringssl:crypto", |
| "//third_party/googletest:gtest", |
| "//zircon/system/ulib/mmio-ptr:mmio-ptr-fake", |
| ] |
| sources = [ |
| "tests/integration/bear_h264_hashes.h", |
| "tests/integration/test_25fps_h264_hashes.h", |
| "tests/integration/test_25fps_vp9_hashes.h", |
| "tests/integration/test_amlogic_video.cc", |
| "tests/integration/test_frame_allocator.h", |
| "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_basic_client.h", |
| "tests/test_support.cc", |
| "tests/test_support.h", |
| "tests/unit_tests/test_pts_manager.cc", |
| "tests/unit_tests/test_vp9.cc", |
| ] |
| |
| # TODO(https://fxbug.dev/42085293): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-vla-cxx-extension" ] |
| } |
| |
| resource("test_files") { |
| sources = [ |
| "//prebuilt/test_data/media/third_party/chromium_media_test_data/bear.h264", |
| "//prebuilt/test_data/media/third_party/chromium_media_test_data/red-green.h264", |
| "//prebuilt/test_data/media/third_party/chromium_media_test_data/test-25fps.h264", |
| "//prebuilt/test_data/media/third_party/chromium_media_test_data/test-25fps.vp9", |
| "//prebuilt/test_data/media/third_party/chromium_media_test_data/test-25fps.vp9_2", |
| "//prebuilt/test_data/media/third_party/chromium_media_test_data_downstream/bear.mpeg2", |
| ] |
| outputs = [ "lib/firmware/video_test_data/{{source_file_part}}" ] |
| } |
| |
| if (_has_decoder_firmware) { |
| resource("amlogic_decoder_firmware") { |
| if (amlogic_decoder_firmware_path != "") { |
| sources = [ amlogic_decoder_firmware_path ] |
| } else { |
| sources = |
| [ "//prebuilt/media/firmware/amlogic-decoder/video_ucode.bin" ] |
| } |
| outputs = [ "lib/firmware/amlogic_video_ucode.bin" ] |
| } |
| |
| fuchsia_driver_package("amlogic_decoder-package") { |
| driver_components = [ ":amlogic_video_decoder-component" ] |
| deps = [ ":amlogic_decoder_firmware" ] |
| } |
| } |
| |
| fuchsia_driver_package("amlogic_decoder_test-package") { |
| testonly = true |
| driver_components = [ ":amlogic_decoder_test-component" ] |
| deps = [ ":test_files" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = test_list |
| } |