Add WiVRn-native Perfetto via Perfetto SDK

Optional server profiling built on the Perfetto SDK. Adds CPU spans
(compositor, encoder, network), GPU encode/copy slices from Vulkan timestamp
queries (Vulkan/NVENC/VAAPI), and headset feedback markers from dump_time.

WIVRN_TRACING enables tracing and selects the backend (system, inprocess, or
both); WIVRN_USE_PERFETTO gates it at build time and compiles it out otherwise.
WIVRN_TRACE_MONADO additionally drives Monado's percetto tracing from the same
switch so WiVRn and Monado land on one timeline.

Tooling: server-tracing[-monado] presets and a CI build, two Perfetto configs
(WiVRn-only and full-system), a wivrn_capture.py capture wrapper, a pftrace
summary script, and docs/profiling.md.
This commit is contained in:
Jonathan Steffan
2026-07-01 21:04:08 +02:00
committed by xytovl
parent b11655fdee
commit b9c8a54d92
34 changed files with 1968 additions and 58 deletions
@@ -20,6 +20,7 @@
#include "video_encoder_ffmpeg.h"
#include "util/u_logging.h"
#include "utils/wivrn_trace.h"
extern "C"
{
@@ -83,9 +84,13 @@ std::optional<wivrn::video_encoder::data> video_encoder_ffmpeg::encode(uint8_t s
bool is_idr = idr_handler.get_type(frame_index) == default_idr_handler::frame_type::i;
push_frame(is_idr, slot);
std::shared_ptr<AVPacket> enc_pkt(av_packet_alloc(), [](AVPacket * d) { av_packet_free(&d); });
int err = avcodec_receive_packet(encoder_ctx.get(), enc_pkt.get());
int err;
{
wivrn::trace::scope trace_send_recv(wivrn::trace::cpu_track::encoder, stream_idx, frame_index, "avcodec_send+receive");
push_frame(is_idr, slot);
err = avcodec_receive_packet(encoder_ctx.get(), enc_pkt.get());
}
if (err == 0)
{
return data{