Files
VoelinClient/spikes/gpui/video
faumarayandClaude Opus 5.5 f9f95dbf0d spikes/gpui: the Slint app's logs stay out of the desktop's state directory
headless.sh and headless-wayland.sh set XDG_STATE_HOME to the run's state
directory as they set the other XDG directories: the Slint app (the
slint-720p30 case) keeps its log files there, and its runs had written
them to the desktop's ~/.local/state/voelin/logs.

measure.sh waits for the Slint app's window (up to 60 s; it took more than
20 s to appear on a busy machine, past the fixed 8 s the case waited) and
then measures it for the case's full length. The video README gives the
static cases and the Wayland run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 02:38:08 +03:00
..

Spike 1: the video path

spike-video shows the synthetic test pattern in a GPUI window the way voelin-ui shows a watched stream:

  • Source. --mode pipeline runs voelin_core::media::LocalPreview with SourceId::Synthetic, as Video::demo (crates/voelin-ui/src/video.rs) does: capture, the VP8 encoder (libvpx), the decoder, no server. --mode raw hands decoded-looking I420 frames from memory at --fps straight to the converter, so a frame rate below the source's belongs to the conversion and GPUI alone.
  • Delivery (src/frames.rs): the port of video.rs' deliver, FrameSlot, Handoff and Buffers. The decoder hands over its newest frame only; a converter thread (voelin-picture) turns it into an Arc<RenderImage> (BGRA, spike_common::bgra::to_bgra, the BGRA twin of voelin_media::convert::to_rgba) and puts it into a Latest; the window is woken through a channel only when the slot was empty (GPUI's AsyncApp is not Send). A RenderImage owns its pixels and gives no way back to them, so the buffer reuse of Buffers cannot be ported: every picture is a new buffer.
  • Window (src/main.rs): img(ImageSource::Render(..)), the picture taken from Latest in render, the one it replaces dropped from every window's sprite atlas with cx.drop_image (--no-drop leaves it: the negative control). inactive_frame_interval: None: GPUI throttles animation frames of an unfocused window to 30 fps by default.

Once a second it prints a JSON line (CPU of the process and of each thread group in percent of one core, resident memory, and per second: frames captured, encoded, decoded, handed to the converter, converted, shown and rendered, conversion time); at the end a summary over the steady part.

Reproducing the measurements

Build, then run every case on the headless display (Xvfb :91, openbox, lavapipe through wgpu's Vulkan backend; see ../README.md):

spikes/gpui/shell.sh sh -c 'cd spikes/gpui && cargo build --locked --release'
# the Slint app, for its demo stream (the root workspace, Rust 1.94):
TOOLCHAIN=1.94 spikes/gpui/shell.sh cargo build --locked --release -p voelin-ui
spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/video/measure.sh

measure.sh runs, 70 s each with 10 s of warm-up not averaged (SECONDS_RUN, WARMUP), and writes <case>.jsonl, <case>-damage.jsonl (the X server's count of the window's content changes), <case>.load (load average before and after) and a screenshot from the warm-up to $OUT (default .scratch/gpui-spikes-results):

Case Command
bench spike-video --bench --iterations 300 (RGBA against BGRA, 1080p and 1440p, into a reused and a new buffer, and as a RenderImage)
static-1080p60, static-1440p60 spike-video --mode static --size …: one picture, the window repainted every frame (the control: what GPUI and the renderer manage with no upload)
raw-1080p60, raw-1440p60 spike-video --mode raw --size 1920x1080 (or 2560x1440) --fps 60
pipeline-1080p60, pipeline-1440p60 spike-video --mode pipeline --size … --fps 60 (bitrate automatic, as the share dialog's default)
pipeline-1440p60-rgba the same with --convert rgba (voelin-media's conversion; red and blue show swapped)
nodrop-1440p spike-video --mode pipeline --size 2560x1440 --fps 15 --no-drop --seconds 12 --warmup 2 (memory grows by a picture per frame)
pipeline-720p30 spike-video --mode pipeline --size 1280x720 --fps 30 --bitrate 4608: Video::demo's own settings (StreamerConfig::default())
slint-720p30 voelin with VOELIN_DEMO_STREAM=1 SLINT_BACKEND=winit-software, measured from outside with proc-meter and damage-count

One case: spikes/gpui/shell.sh spikes/gpui/headless.sh -- spikes/gpui/video/measure.sh raw-1440p60.

GPUI's Wayland backend, on sway's headless backend with a 2560x1440 output (the window is tiled to it; no damage count there):

spikes/gpui/shell.sh spikes/gpui/headless-wayland.sh -s 2560x1440 -- sh -c \
  'mkdir -p .scratch/gpui-spikes-results && target/release/spike-video --mode raw --size 2560x1440 --fps 60 --seconds 40 --warmup 10 --out .scratch/gpui-spikes-results/wayland-raw-1440p60.jsonl'

The figures and what they mean are in docs/design/gpui-spikes.md.