From b74e641c04b55eda414ed056a39f093b6d1f9623 Mon Sep 17 00:00:00 2001 From: Renato Pereyra Date: Thu, 10 Jul 2025 13:35:23 -0500 Subject: [PATCH] pps: Generate libgpudataprofiling.so from pps-producer sources for Android CTS Android CTS expects GPU counters to be provided by a DSO named libgpudataprofiling.so. This change leaves pps-producer unchanged and builds this DSO from the same sources. Part-of: --- src/tool/pps/meson.build | 10 ++++++++++ src/tool/pps/pps_producer.cc | 22 +++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/tool/pps/meson.build b/src/tool/pps/meson.build index 97da00aedc7..32a9405c9b5 100644 --- a/src/tool/pps/meson.build +++ b/src/tool/pps/meson.build @@ -40,6 +40,16 @@ executable( install: true ) +if with_platform_android + shared_library( + 'gpudataproducer', + sources: producer_sources, + include_directories: [include_pps, inc_src], + dependencies: [dep_pps, dep_perfetto], + install: true + ) +endif + config_sources = [ 'pps_config.cc' ] diff --git a/src/tool/pps/pps_producer.cc b/src/tool/pps/pps_producer.cc index f0df89652ec..e1d9d39c9ea 100644 --- a/src/tool/pps/pps_producer.cc +++ b/src/tool/pps/pps_producer.cc @@ -9,9 +9,10 @@ #include +#include "util/detect_os.h" #include "pps_datasource.h" -int main(int argc, const char **argv) +int init(std::string &driver_name) { using namespace pps; @@ -20,8 +21,6 @@ int main(int argc, const char **argv) args.backends = perfetto::kSystemBackend; perfetto::Tracing::Initialize(args); - std::string driver_name = - (argc > 1) ? Driver::find_driver_name(argv[1]) : Driver::default_driver_name(); GpuDataSource::register_data_source(driver_name); const auto &driver = Driver::get_supported_drivers().at(driver_name); @@ -35,3 +34,20 @@ int main(int argc, const char **argv) return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + using namespace pps; + std::string driver_name = + (argc > 1) ? Driver::find_driver_name(argv[1]) : Driver::default_driver_name(); + return init(driver_name); +} + +#if DETECT_OS_ANDROID +extern "C" int start() +{ + using namespace pps; + std::string driver_name = Driver::default_driver_name(); + return init(driver_name); +} +#endif