blob: 4f585bcca541efc3b768b59db74bae97d7b354b7 [file] [log] [blame]
# Copyright 2024 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.
load(
"@fuchsia_sdk//fuchsia:defs.bzl",
"fuchsia_cc_driver",
"fuchsia_cc_test",
"fuchsia_component_manifest",
"fuchsia_component_manifest_shard",
"fuchsia_driver_bind_bytecode",
"fuchsia_driver_component",
"fuchsia_package",
"fuchsia_test_component",
"fuchsia_test_package",
)
fuchsia_driver_bind_bytecode(
name = "bind_bytecode",
output = "msd_arm_bind.bindbc",
rules = "msd_arm.bind",
deps = [
"@fuchsia_sdk//bind/fuchsia.arm.platform",
"@fuchsia_sdk//bind/fuchsia.platform",
"@fuchsia_sdk//bind/fuchsia.devicetree",
"//fidl/fuchsia.hardware.gpu.mali:fuchsia.hardware.gpu.mali_bindlib",
],
)
cc_library(
name = "msd-arm-include",
hdrs = [
"include/magma_arm_mali_types.h",
"include/magma_arm_mali_vendor_id.h",
"include/magma_vendor_queries.h",
],
includes = ["include"],
)
cc_library(
name = "msd-arm-mali-library",
srcs = [
"src/address_manager.cc",
"src/address_manager.h",
"src/address_space.cc",
"src/address_space.h",
"src/device_request.h",
"src/gpu_features.h",
"src/gpu_mapping.cc",
"src/gpu_mapping.h",
"src/job_scheduler.cc",
"src/job_scheduler.h",
"src/mali_register_io.h",
"src/msd_arm_atom.cc",
"src/msd_arm_atom.h",
"src/msd_arm_buffer.cc",
"src/msd_arm_buffer.h",
"src/msd_arm_connection.cc",
"src/msd_arm_connection.h",
"src/msd_arm_context.h",
"src/msd_arm_device.cc",
"src/msd_arm_device.h",
"src/msd_arm_driver.cc",
"src/msd_arm_driver.h",
"src/msd_arm_perf_count_pool.cc",
"src/msd_arm_perf_count_pool.h",
"src/msd_arm_semaphore.h",
"src/parent_device.h",
"src/parent_device_dfv2.cc",
"src/parent_device_dfv2.h",
"src/performance_counters.cc",
"src/performance_counters.h",
"src/performance_counters_manager.h",
"src/power_manager.cc",
"src/power_manager.h",
"src/region.cc",
"src/region.h",
"src/registers.h",
"src/string_printf.cc",
"src/string_printf.h",
"src/types.h",
],
deps = [
":msd-arm-include",
"//fidl/fuchsia.hardware.gpu.mali:fuchsia.hardware.gpu.mali_cpp_driver_wire",
"@fuchsia_sdk//fidl/fuchsia.hardware.platform.device:fuchsia.hardware.platform.device_cpp_wire",
"@fuchsia_sdk//pkg/async-loop-cpp",
"@fuchsia_sdk//pkg/driver_component_cpp",
"@fuchsia_sdk//pkg/driver_devfs_cpp",
"@fuchsia_sdk//pkg/hwreg",
"@fuchsia_sdk//pkg/inspect",
"@fuchsia_sdk//pkg/mmio-ptr",
"@fuchsia_sdk//pkg/trace",
"@magma//:all",
],
)
cc_library(
name = "msd-arm-mali-with-entry",
srcs = ["src/driver_entry_dfv2.cc"],
deps = [":msd-arm-mali-library"],
)
fuchsia_cc_driver(
name = "msd_arm",
srcs = [
"src/driver_entry_dfv2.cc",
],
linkopts = [
"-Wl,--no-undefined",
],
deps = [":msd-arm-mali-with-entry"],
)
fuchsia_cc_driver(
name = "msd_arm_test",
srcs = [
"src/driver_entry_dfv2.cc",
"src/driver_test_gtest.cc",
"tests/unit_tests/test_command_buffer.cc",
"tests/unit_tests/test_device.cc",
],
defines = ["MAGMA_TEST_DRIVER"],
linkopts = [
"-Wl,--no-undefined",
],
deps = [
":msd-arm-mali-library",
"@com_google_googletest//:gtest",
"@magma//:mock",
"@magma//lib/magma_service/test_util:msd_device",
"@magma//tests/msd_conformance_tests",
],
)
fuchsia_component_manifest_shard(
name = "manifest_shard",
src = "meta/msd_arm.shard.cml",
include_path = "",
)
fuchsia_component_manifest(
name = "manifest",
src = "meta/msd_arm.cml",
includes = [":manifest_shard"],
)
fuchsia_driver_component(
name = "component",
bind_bytecode = ":bind_bytecode",
driver_lib = ":msd_arm",
manifest = ":manifest",
)
fuchsia_package(
name = "pkg",
package_name = "msd-arm-mali",
components = [":component"],
)
fuchsia_component_manifest(
name = "test_manifest",
src = "meta/msd_arm_test.cml",
includes = [":manifest_shard"],
)
fuchsia_driver_component(
name = "test_component",
bind_bytecode = ":bind_bytecode",
component_name = "libmsd_arm_test",
driver_lib = ":msd_arm_test",
manifest = ":test_manifest",
)
fuchsia_cc_test(
name = "msd_arm_mali_nonhardware_tests",
srcs = [
"tests/unit_tests/driver_logger_harness.h",
"tests/unit_tests/driver_logger_harness_dfv2.cc",
"tests/unit_tests/fake_connection_owner_base.h",
"tests/unit_tests/non_hardware_test_device.cc",
"tests/unit_tests/test_address_manager.cc",
"tests/unit_tests/test_address_space.cc",
"tests/unit_tests/test_buffer.cc",
"tests/unit_tests/test_connection.cc",
"tests/unit_tests/test_job_scheduler.cc",
"tests/unit_tests/test_performance_counters.cc",
"tests/unit_tests/test_power_manager.cc",
"tests/unit_tests/test_region.cc",
"tests/unit_tests/test_timestamp.cc",
],
deps = [
":msd-arm-mali-library",
"@com_google_googletest//:gtest_main",
"@fuchsia_sdk//pkg/async_patterns_cpp",
"@fuchsia_sdk//pkg/async_patterns_testing_cpp",
"@fuchsia_sdk//pkg/driver_testing_cpp",
"@magma//:mock",
],
)
fuchsia_component_manifest(
name = "nonhardware_manifest",
src = "tests/meta/msd_arm_mali_nonhardware_tests.cml",
includes = [
"@fuchsia_sdk//pkg/sys/testing:gtest_runner",
],
)
fuchsia_test_component(
name = "nonhardware_tests_component",
testonly = True,
manifest = ":nonhardware_manifest",
deps = [":msd_arm_mali_nonhardware_tests"],
)
fuchsia_test_package(
name = "unit_tests",
package_name = "msd-arm-mali-unit-tests",
test_components = [
":nonhardware_tests_component",
],
)
fuchsia_test_package(
name = "integration_tests",
package_name = "msd-arm-mali-integration-tests",
components = [
":test_component",
],
test_components = [
":integration_tests_component",
],
)
fuchsia_component_manifest(
name = "integration_manifest",
src = "tests/meta/msd_arm_mali_integration_tests.cml",
includes = [
"@fuchsia_sdk//pkg/sys/testing:gtest_runner",
],
)
fuchsia_test_component(
name = "integration_tests_component",
testonly = True,
manifest = ":integration_manifest",
deps = [":msd_arm_mali_integration_tests"],
)
fuchsia_cc_test(
name = "msd_arm_mali_integration_tests",
srcs = [
"tests/integration/driver_registry.h",
"tests/integration/mali_utils.cc",
"tests/integration/mali_utils.h",
"tests/integration/run_unit_tests.cc",
"tests/integration/test_fault_recovery.cc",
"tests/integration/test_icd_list.cc",
"tests/integration/test_perf_counters.cc",
"tests/integration/test_shutdown.cc",
],
defines = [
"ASSUME_DFV2",
"MALI_OUT_OF_TREE",
"MALI_PRODUCTION_DRIVER_PACKAGE=\\\"fuchsia.com/msd-arm-mali\\\"",
"MALI_TEST_DRIVER_PACKAGE=\\\"bazel.integration.tests.publish.anonymous/msd-arm-mali-integration-tests\\\"",
],
deps = [
":msd-arm-include",
"@com_google_googletest//:gtest_main",
"@fuchsia_sdk//fidl/fuchsia.driver.registrar:fuchsia.driver.registrar_cpp_wire",
"@fuchsia_sdk//fidl/fuchsia.driver.development:fuchsia.driver.development_cpp_wire",
"@fuchsia_sdk//fidl/fuchsia.gpu.magma:fuchsia.gpu.magma_cpp_wire",
"@fuchsia_sdk//pkg/magma_client",
"@magma//:logger_syslog",
"@magma//:macros",
"@magma//lib/magma/test_util:logger_init",
"@magma//lib/magma_client/test_util:map_cpu",
"@magma//lib/magma_client/test_util:test_device",
],
)