copy_mutex duplicated the pthread_mutex_t of vk.queue.mutex into
main_queue->mutex by value, which creates an independent mutex: monado
submissions on IPC client threads (comp_swapchain image transitions,
vkDeviceWaitIdle in image_cleanup) did not exclude wivrn's layer_commit
and encoder submissions on the same VkQueue. This intermittently
corrupts driver state when a client creates or destroys swapchains
while streaming, observed as SIGSEGV inside vkQueueSubmit2 and as
uncaught vk::SystemError from layer_commit on NVIDIA.
Initialize monado's queue mutexes and redirect vk.queue.mutex to the
main queue os_mutex so every submitter takes the same lock.
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.
Compositor release left layouts as eUndefined while encoder acquire
transitioned to eVideoEncodeSrcKHR (or eTransferSrcOptimal on the NVIDIA
tmp_image path); the spec forbids that layout mismatch for exclusive-mode
QFOT. NVIDIA honoured it by treating encode-queue contents as undefined
(solid green frame).
Encoders now publish target_layout. The compositor's release and the
encoder's acquire both transition eGeneral -> target_layout in a single
barrier; per VkImageMemoryBarrier2 the layout transition is performed
exactly once between the queues, so no second non-QFOT barrier is needed.
target_layout is eVideoEncodeSrcKHR on the direct vulkan encode path and
eGeneral elsewhere.
Also fix optimal_transfer(): the inner `auto to = ...` shadowed the
parameter, so the maintenance9 check was effectively always false.
Replace the patches to Monado's main compositor with a local
implementation, reusing code when relevant.
The layer squasher is very close to comp_render_cs, while distortion is
completely replaced by foveation.