meson: Allow configuring with Android-internal perfetto

This enables ninja-to-soong to generate an Android.bp that builds Mesa
against Android's `libperfetto_client_experimental` library.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36561>
This commit is contained in:
Matt Turner 2025-08-04 18:41:01 +00:00 committed by Marge Bot
parent eb6f6c1976
commit a8ab696033
6 changed files with 35 additions and 1 deletions

View file

@ -2176,6 +2176,10 @@ if with_perfetto
pre_args += '-DHAVE_PERFETTO' pre_args += '-DHAVE_PERFETTO'
endif endif
if get_option('android-libperfetto').enabled()
pre_args += '-DANDROID_LIBPERFETTO'
endif
with_teflon = get_option('teflon') with_teflon = get_option('teflon')
if with_teflon and with_tests if with_teflon and with_tests
dep_xtensor = dependency('xtensor') dep_xtensor = dependency('xtensor')

View file

@ -51,6 +51,12 @@ option(
description : 'Use Android\'s libbacktrace', description : 'Use Android\'s libbacktrace',
) )
option(
'android-libperfetto',
type : 'feature',
description : 'Use Android\'s libperfetto',
)
option( option(
'dri-drivers-path', 'dri-drivers-path',
type : 'string', type : 'string',

View file

@ -7,7 +7,16 @@
#pragma once #pragma once
#ifndef ANDROID_LIBPERFETTO
#include <perfetto.h> #include <perfetto.h>
#else
#include <perfetto/tracing.h>
#include <perfetto/common/gpu_counter_descriptor.gen.h>
#include <perfetto/common/gpu_counter_descriptor.pbzero.h>
#include <perfetto/config/gpu/gpu_counter_config.pbzero.h>
#include <perfetto/trace/clock_snapshot.pbzero.h>
#include <perfetto/trace/gpu/gpu_counter_event.pbzero.h>
#endif
#define PPS_LOG PERFETTO_LOG #define PPS_LOG PERFETTO_LOG
#define PPS_LOG_IMPORTANT PERFETTO_ILOG #define PPS_LOG_IMPORTANT PERFETTO_ILOG

View file

@ -23,7 +23,11 @@
#include "u_perfetto.h" #include "u_perfetto.h"
#ifndef ANDROID_LIBPERFETTO
#include <perfetto.h> #include <perfetto.h>
#else
#include <perfetto/tracing.h>
#endif
#include "c11/threads.h" #include "c11/threads.h"
#include "util/macros.h" #include "util/macros.h"

View file

@ -23,7 +23,11 @@
#include "vulkan/runtime/vk_object.h" #include "vulkan/runtime/vk_object.h"
#include "perfetto.h" #ifndef ANDROID_LIBPERFETTO
#include <perfetto.h>
#else
#include <perfetto/tracing.h>
#endif
#include "util/hash_table.h" #include "util/hash_table.h"
#include "util/perf/u_trace.h" #include "util/perf/u_trace.h"

View file

@ -673,7 +673,14 @@ perfetto_utils_hdr_template = """\
#ifndef ${guard_name} #ifndef ${guard_name}
#define ${guard_name} #define ${guard_name}
#ifndef ANDROID_LIBPERFETTO
#include <perfetto.h> #include <perfetto.h>
#else
#include <perfetto/tracing.h>
#include <perfetto/trace/clock_snapshot.pbzero.h>
#include <perfetto/trace/gpu/gpu_render_stage_event.pbzero.h>
#include <perfetto/trace/gpu/vulkan_api_event.pbzero.h>
#endif
% for header in HEADERS: % for header in HEADERS:
#include "${header.hdr}" #include "${header.hdr}"