blob: cf04e544e1e538c1793b6fc39d26bca0062738c2 [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_platforms",
"fuchsia_test_component",
"fuchsia_test_package",
"fuchsia_unittest_package",
)
load(
"@fuchsia_sdk//fuchsia:licenses.bzl",
"fuchsia_licenses_collection",
"fuchsia_licenses_spdx",
)
package(
default_applicable_licenses = ["//:license_fuchsia"],
default_visibility = ["//visibility:public"],
)
exports_files(["README.fuchsia"])
fuchsia_driver_bind_bytecode(
name = "bind_bytecode",
output = "msd_arm_bind.bindbc",
rules = "msd_arm.bind",
deps = [
"//fidl/fuchsia.hardware.gpu.mali:fuchsia.hardware.gpu.mali_bindlib",
"@fuchsia_sdk//bind/fuchsia.arm.platform",
"@fuchsia_sdk//bind/fuchsia.devicetree",
"@fuchsia_sdk//bind/fuchsia.platform",
],
)
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"],
visibility = ["//visibility:public"],
)
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",
"@magma//sdk/lib/scheduler/cpp:scheduler_cpp",
],
)
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",
],
output_name = "msd_arm",
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",
],
output_name = "msd_arm_test",
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"],
disable_repository_name = "fuchsia.com",
platform = fuchsia_platforms.arm64,
visibility = ["//visibility:public"],
)
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 = "msd_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",
manifest = ":nonhardware_manifest",
deps = [":msd_arm_mali_nonhardware_tests"],
)
fuchsia_test_package(
name = "unit_tests",
package_name = "msd-arm-mali-unit-tests",
platform = fuchsia_platforms.x64,
test_components = [
":nonhardware_tests_component",
],
visibility = ["//visibility:public"],
)
fuchsia_cc_test(
name = "msd_arm_mali_lifecycle_tests",
srcs = [
"tests/unit_tests/driver_logger_harness.h",
"tests/unit_tests/driver_logger_harness_dfv2.cc",
"tests/unit_tests/lifecycle_tests.cc",
],
copts = ["-Wno-thread-safety-reference-return"],
deps = [
":msd-arm-mali-with-entry",
"//src/devices/bus/testing/fake-pdev",
"//src/devices/testing/fake-resource",
"@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_unittest_package(
name = "lifecycle_tests",
package_name = "msd-arm-mali-lifecycle-tests",
platform = fuchsia_platforms.x64,
unit_tests = [
":msd_arm_mali_lifecycle_tests",
],
visibility = ["//visibility:public"],
)
fuchsia_test_package(
name = "integration_tests",
package_name = "msd-arm-mali-integration-tests",
components = [
":test_component",
],
platform = fuchsia_platforms.arm64,
test_components = [
":integration_tests_component",
],
test_realm = "/core/testing:devices-tests",
visibility = ["//visibility:public"],
)
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",
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 = [
"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.development:fuchsia.driver.development_cpp_wire",
"@fuchsia_sdk//fidl/fuchsia.driver.registrar:fuchsia.driver.registrar_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",
],
)
fuchsia_component_manifest(
name = "conformance_manifest",
src = "tests/meta/msd_arm_mali_conformance_tests.cml",
includes = [
"@fuchsia_sdk//pkg/syslog:client",
"@fuchsia_sdk//pkg/trace:offer",
],
)
fuchsia_test_component(
name = "conformance_component",
manifest = ":conformance_manifest",
)
fuchsia_test_package(
name = "magma_conformance_tests",
platform = fuchsia_platforms.arm64,
subpackages = ["@fuchsia_sdk//packages/magma_conformance_tests"],
test_components = [":conformance_component"],
test_realm = "/core/testing:system-tests",
visibility = ["//visibility:public"],
)
fuchsia_licenses_collection(
name = "msd-arm-mali_pkg_licenses_collection",
root_target = ":pkg",
)
fuchsia_licenses_spdx(
name = "msd-arm-mali_licenses.spdx.json",
document_namespace = "https://fuchsia.googlesource.com/drivers/graphics/gpu/",
licenses = ":msd-arm-mali_pkg_licenses_collection",
licenses_cross_refs_base_url = "https://fuchsia.googlesource.com/drivers/graphics/gpu/+/refs/heads/main/",
root_package_homepage = "https://fuchsia.googlesource.com/drivers/graphics/gpu/",
root_package_name = "msd-arm-mali",
)