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:
@@ -35,6 +35,7 @@
|
||||
#include "encoder/video_encoder.h"
|
||||
#include "inplace_vector.hpp"
|
||||
#include "utils/method.h"
|
||||
#include "utils/wivrn_trace.h"
|
||||
|
||||
#include "xrt/xrt_config_build.h" // IWYU pragma: keep
|
||||
#ifdef XRT_FEATURE_RENDERDOC
|
||||
@@ -628,12 +629,15 @@ void compositor::encoder_work(std::stop_token tok)
|
||||
if (req < 0)
|
||||
{
|
||||
encode_request.wait(req);
|
||||
wivrn::trace::cpu_instant(wivrn::trace::cpu_track::compositor, "encoder_work wake", 0, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(req < images.size());
|
||||
auto & image = images[req];
|
||||
|
||||
wivrn::trace::scope trace_iter(wivrn::trace::cpu_track::compositor, 0, image.frame_index, "encoder_work iter");
|
||||
|
||||
try
|
||||
{
|
||||
for (auto & encoder: encoders)
|
||||
@@ -720,6 +724,14 @@ compositor::compositor(wivrn_session & session) :
|
||||
log_level);
|
||||
vk::detail::resultCheck(vk::Result(res), "vk_init_from_given");
|
||||
|
||||
// vk_init_from_given can't enable calibrated timestamps; do it here.
|
||||
#ifdef VK_EXT_calibrated_timestamps
|
||||
c_base->vk.has_EXT_calibrated_timestamps = vk.has_device_ext(VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
// Share monado's vk_bundle so gpu_timestamp_pool reuses its calibration cache.
|
||||
wivrn::trace::set_calibration_source(&c_base->vk);
|
||||
|
||||
// vk_init_from_given assumes a graphics queue was provided
|
||||
c_base->vk.graphics_queue = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user