Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 3da8e59

Browse files
ZhuChenyanXchenyanxzhu
authored andcommitted
Fix CtsGpuProfilingDataTest fail
Rename the perfetto gpu data producer name from libpps-producer to libgpudataproducer to align with AGI/cts. To pass the test, it also need following cmd: 1, setenforce 0 2, sysctl dev.i915.perf_stream_paranoid=0 sysctl dev.i915_ag.perf_stream_paranoid=0 When in vm mode, at least 1 gpu needs to be passthoughed. SRIOV mode has no metrics info provided under dir: /sys/dev/char/%d:%d/device/drm Tracked-On: OAM-128560 Signed-off-by: ZhuChenyanX <zhucx@intel.com>
1 parent 20e130e commit 3da8e59

9 files changed

Lines changed: 104 additions & 7 deletions

File tree

android/Android.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ ifneq ($(strip $(BOARD_MESA3D_GALLIUM_DRIVERS)),)
197197
$(eval $(call mesa3d-lib,libgallium_dri,.so.0,dri,MESA3D_GALLIUM_DRI_BIN))
198198
# Module 'libglapi', produces '/vendor/lib{64}/libglapi.so'
199199
$(eval $(call mesa3d-lib,libglapi,.so.0,,MESA3D_LIBGLAPI_BIN))
200-
# Module 'libpps-producer', produces '/vendor/lib{64}/libpps-producer.so'
201-
$(eval $(call mesa3d-lib,libpps-producer,.so.0,,MESA3D_LIBPPS_PRODUCER))
200+
# Module 'libgpudataproducer', produces '/vendor/lib{64}/libgpudataproducer.so'
201+
$(eval $(call mesa3d-lib,libgpudataproducer,.so.0,,MESA3D_LIBPPS_PRODUCER))
202202

203203
# Module 'libEGL_mesa', produces '/vendor/lib{64}/egl/libEGL_mesa.so'
204204
$(eval $(call mesa3d-lib,libEGL_mesa,.so.1,egl,MESA3D_LIBEGL_BIN))
@@ -220,10 +220,9 @@ endif
220220
#-------------------------------------------------------------------------------
221221

222222
include $(CLEAR_VARS)
223-
LOCAL_SHARED_LIBRARIES := libpps-producer
224223
LOCAL_SRC_FILES := perfetto/pps-producer.cc
225224
LOCAL_VENDOR_MODULE := true
226-
LOCAL_MODULE := pps-producer
225+
LOCAL_MODULE := gpudataproducer
227226
LOCAL_CPP_EXTENSION := .cc
228227
LOCAL_MODULE_TAGS := optional
229228
include $(BUILD_EXECUTABLE)

android/mesa3d_cross.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ MESON_GEN_NINJA := \
9696
-Dlmsensors=disabled \
9797
-Dandroid-libbacktrace=disabled \
9898
-Dperfetto=true \
99+
-Ddatasources=auto \
99100
$(BOARD_MESA3D_MESON_ARGS) \
100101

101102
MESON_BUILD := PATH=/usr/bin:/bin:/sbin:$$PATH ninja -C $(MESON_OUT_DIR)/build

android/perfetto/pps-producer.cc

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
1-
extern int pps_main(int argc, const char **argv);
1+
#include <cstdio>
2+
#include <dlfcn.h>
3+
4+
typedef void (*pps_main_fn_t)(int, const char **);
5+
6+
#define PPS_LIB "/vendor/lib64/libgpudataproducer.so"
27

38
int main(int argc, const char **argv) {
4-
return pps_main(argc, argv);
9+
char *error;
10+
11+
void *handle = dlopen(PPS_LIB, RTLD_GLOBAL);
12+
if ((error = dlerror()) != nullptr || handle == nullptr) {
13+
fprintf(stdout, "Error loading lib: %s\n", error);
14+
return -1;
15+
}
16+
17+
pps_main_fn_t ppsFn = (pps_main_fn_t)dlsym(handle, "pps_main");
18+
if (((error = dlerror()) != nullptr) || (ppsFn == nullptr)) {
19+
fprintf(stdout, "Error looking for pps_main symbol: %s\n", error);
20+
dlclose(handle);
21+
return -1;
22+
}
23+
24+
fprintf(stdout, "start call pps_main\n");
25+
(*ppsFn)(argc, argv);
26+
fprintf(stdout, "end call pps_main\n");
27+
28+
dlclose(handle);
29+
return 0;
530
}

src/intel/ds/intel_driver_ds.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,12 @@ intel_driver_ds_init_once(void)
566566
#ifdef HAVE_PERFETTO
567567
util_perfetto_init();
568568
perfetto::DataSourceDescriptor dsd;
569+
#ifdef ANDROID
570+
/* AGI requires this name */
571+
dsd.set_name("gpu.renderstages");
572+
#else
569573
dsd.set_name("gpu.renderstages.intel");
574+
#endif
570575
IntelRenderpassDataSource::Register(dsd);
571576
#endif
572577
}

src/tool/pps/cfg/gpu.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@ data_sources {
2121
}
2222
}
2323

24+
data_sources {
25+
config {
26+
name: "gpu.counters"
27+
gpu_counter_config {
28+
counter_period_ns: 1000000000
29+
}
30+
}
31+
}
32+
2433
duration_ms: 16000

src/tool/pps/cfg/intel.cfg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ data_sources {
5858
}
5959
}
6060

61+
data_sources {
62+
config {
63+
name: "gpu.counters"
64+
gpu_counter_config {
65+
counter_period_ns: 100000
66+
}
67+
}
68+
}
69+
70+
data_sources {
71+
config {
72+
name: "gpu.renderstages"
73+
}
74+
}
75+
6176
data_sources {
6277
config {
6378
name: "track_event"

src/tool/pps/cfg/system.cfg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ data_sources {
3939
}
4040
}
4141

42+
data_sources {
43+
config {
44+
name: "gpu.counters"
45+
gpu_counter_config {
46+
counter_period_ns: 100000
47+
}
48+
}
49+
}
50+
51+
data_sources {
52+
config {
53+
name: "gpu.renderstages"
54+
}
55+
}
56+
4257
data_sources {
4358
config {
4459
name: "track_event"

src/tool/pps/pps_datasource.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ void GpuDataSource::OnSetup(const SetupArgs &args)
5151
}
5252

5353
this->driver = driver;
54+
// use first available driver, to avoid be covered by following failed driver.
55+
break;
5456
}
5557
}
5658
if (driver == nullptr) {
@@ -324,7 +326,12 @@ void GpuDataSource::register_data_source(const std::string &_driver_name)
324326
{
325327
driver_name = _driver_name;
326328
static perfetto::DataSourceDescriptor dsd;
329+
#ifdef ANDROID
330+
/* AGI requires this name */
331+
dsd.set_name("gpu.counters");
332+
#else
327333
dsd.set_name("gpu.counters." + driver_name);
334+
#endif
328335

329336
Driver * driver = nullptr;
330337
auto drm_devices = DrmDevice::create_all();
@@ -336,6 +343,8 @@ void GpuDataSource::register_data_source(const std::string &_driver_name)
336343
if ((driver != nullptr) && !driver->init_perfcnt()) {
337344
driver = nullptr;
338345
}
346+
// use first available driver, to avoid be covered by following failed driver.
347+
break;
339348
}
340349

341350
if (driver != nullptr) {

src/tool/pps/pps_producer.cc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "pps_datasource.h"
1313

14-
int pps_main(int argc, const char **argv)
14+
extern "C" int pps_main(int argc, const char **argv)
1515
{
1616
using namespace pps;
1717

@@ -35,3 +35,22 @@ int pps_main(int argc, const char **argv)
3535

3636
return EXIT_SUCCESS;
3737
}
38+
39+
extern "C" void start()
40+
{
41+
using namespace pps;
42+
43+
// Connects to the system tracing service
44+
perfetto::TracingInitArgs args;
45+
args.backends = perfetto::kSystemBackend;
46+
perfetto::Tracing::Initialize(args);
47+
48+
GpuDataSource::register_data_source(Driver::default_driver_name());
49+
50+
while (true) {
51+
GpuDataSource::wait_started();
52+
GpuDataSource::Trace(GpuDataSource::trace_callback);
53+
}
54+
55+
return;
56+
}

0 commit comments

Comments
 (0)