Perfetto support in radeonsi driver
What does this MR do and why?
Add support for perfetto tracing in radeonsi driver. Use -Dperfetto=true
in meson build command to build radeonsi with perfetto support.
Changes:
-
Add
si_perfetto.h
andsi_perfetto.cpp
files which contains data structures to keep intermediate state of tracing data source and also contains tracing events callbacks.-
struct si_ds_device
keeps the intermediate state of trace,struct si_ds_stage
contains data for each render stages andstruct si_ds_queue
keeps all the render stages for a command stream. -
si_ds_begin_##event_name
andsi_ds_end_##event_name
are trace callbacks, it is called from u_trace once the timestamps from the GPU has been collected.
-
-
Add
si_utrace.h
andsi_utrace.c
which contains initialization code for u_trace APIs and callbacks required in u_trace to emit timestamps in cmdstream and read back timestamps. -
Add
si_ds_device
,u_trace
andsi_ds_queue
insi_context
and initialize u_trace when creating context.u_trace
contains trace event chunks with timestamp and payload, which is flushed to a queue inu_trace_context
when driver flush the command stream to kernel code.u_trace_context
processes the queue later in pctx->flush(). -
Add
si_tracepoints.py
to create trace point functions in generated codesi_tracepoints.h
andsi_tracepoints.c
-
Add amd.cfg and modify system.cfg to provide data source configurations.
Collecting traces
- Build Perfetto from sources available at subprojects/perfetto following this guide.
- Go to the subprojects/perfetto directory and run a convenience script
CONFIG=../../src/tool/pps/cfg/system.cfg OUT=out/linux/ ./tools/tmux -n
- Start perfetto under the tmux session initiated in step 2
- Once tracing has finished, you can detach from tmux with
Ctrl+b
,d
, and the convenience script should automatically copy the trace files into tmp directory. - Go to ui.perfetto.dev and upload trace file by clicking on Open trace file