From f9f95dbf0df040e1764a9009916fadb839bc98e4 Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 27 Oct 2026 02:38:08 +0300 Subject: [PATCH] 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 --- spikes/gpui/headless-wayland.sh | 4 +++- spikes/gpui/headless.sh | 4 +++- spikes/gpui/video/README.md | 9 +++++++++ spikes/gpui/video/measure.sh | 13 +++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/spikes/gpui/headless-wayland.sh b/spikes/gpui/headless-wayland.sh index b9083c5..34d926b 100755 --- a/spikes/gpui/headless-wayland.sh +++ b/spikes/gpui/headless-wayland.sh @@ -27,7 +27,7 @@ SPIKE_STATE=${SPIKE_STATE:-$root/.scratch/gpui-spikes-state} # Short: a socket path has at most 107 bytes (sway's IPC socket is # sway-ipc...sock in it). runtime=$root/.scratch/wl -mkdir -p "$runtime" "$SPIKE_STATE/config" "$SPIKE_STATE/data" "$SPIKE_STATE/cache" +mkdir -p "$runtime" "$SPIKE_STATE/config" "$SPIKE_STATE/data" "$SPIKE_STATE/cache" "$SPIKE_STATE/state" chmod 700 "$runtime" tools=$(nix build --option substituters "https://cache.nixos.org/ https://nix-community.cachix.org" \ --no-link --print-out-paths nixpkgs#sway nixpkgs#wtype) @@ -35,6 +35,8 @@ for t in $tools; do PATH="$t/bin:$PATH"; done unset DISPLAY WAYLAND_DISPLAY WAYLAND_SOCKET XDG_SESSION_TYPE DBUS_SESSION_BUS_ADDRESS SWAYSOCK export XDG_RUNTIME_DIR="$runtime" XDG_CONFIG_HOME="$SPIKE_STATE/config" export XDG_DATA_HOME="$SPIKE_STATE/data" XDG_CACHE_HOME="$SPIKE_STATE/cache" +# The Slint app keeps its logs in XDG_STATE_HOME: never the desktop's. +export XDG_STATE_HOME="$SPIKE_STATE/state" cat >"$SPIKE_STATE/sway.conf" <&2; exit 2; } root=$(cd "$(dirname "$0")/../.." && pwd) SPIKE_STATE=${SPIKE_STATE:-$root/.scratch/gpui-spikes-state} -mkdir -p "$SPIKE_STATE/runtime" "$SPIKE_STATE/config" "$SPIKE_STATE/data" "$SPIKE_STATE/cache" +mkdir -p "$SPIKE_STATE/runtime" "$SPIKE_STATE/config" "$SPIKE_STATE/data" "$SPIKE_STATE/cache" "$SPIKE_STATE/state" chmod 700 "$SPIKE_STATE/runtime" if [ -e "/tmp/.X11-unix/X$number" ]; then echo "headless.sh: display :$number is taken" >&2 @@ -46,6 +46,8 @@ unset WAYLAND_DISPLAY WAYLAND_SOCKET XDG_SESSION_TYPE DBUS_SESSION_BUS_ADDRESS export DISPLAY=":$number" export XDG_RUNTIME_DIR="$SPIKE_STATE/runtime" XDG_CONFIG_HOME="$SPIKE_STATE/config" export XDG_DATA_HOME="$SPIKE_STATE/data" XDG_CACHE_HOME="$SPIKE_STATE/cache" +# The Slint app keeps its logs in XDG_STATE_HOME: never the desktop's. +export XDG_STATE_HOME="$SPIKE_STATE/state" export GPUI_X11_SCALE_FACTOR=${GPUI_X11_SCALE_FACTOR:-1} if [ $wm = 1 ]; then openbox --sm-disable >"$SPIKE_STATE/openbox-$number.log" 2>&1 & diff --git a/spikes/gpui/video/README.md b/spikes/gpui/video/README.md index e5a3e79..4940473 100644 --- a/spikes/gpui/video/README.md +++ b/spikes/gpui/video/README.md @@ -50,6 +50,7 @@ average before and after) and a screenshot from the warm-up to `$OUT` | 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) | @@ -59,5 +60,13 @@ average before and after) and a screenshot from the warm-up to `$OUT` 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): + +```sh +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](../../../docs/design/gpui-spikes.md#spike-1-the-video-path). diff --git a/spikes/gpui/video/measure.sh b/spikes/gpui/video/measure.sh index 769bc1b..cca917e 100755 --- a/spikes/gpui/video/measure.sh +++ b/spikes/gpui/video/measure.sh @@ -69,12 +69,17 @@ for c in $cases; do VOELIN_DATA_DIR="$data" VOELIN_DEMO_STREAM=1 VOELIN_WINDOW_SIZE=1440x960 VOELIN_FFMPEG=0 \ "$bin/voelin" >"$out/$c.log" 2>&1 & app=$! + # The app takes 20 s or more to open its window on a busy machine. + i=0 + until w=$(xdotool search --name '^Voelin$' 2>/dev/null | head -1) && [ -n "$w" ]; do + i=$((i + 1)) + [ $i -lt 600 ] || { echo "no Voelin window" >&2; kill "$app"; exit 1; } + sleep 0.1 + done "$bin/damage-count" Voelin "$((seconds - 1))" "$warmup" >"$out/$c-damage.jsonl" & damage=$! - sleep 8 - w=$(xdotool search --name '^Voelin$' | head -1) - xwd -id "$w" -silent | magick xwd:- "png:$out/$c.png" - "$bin/proc-meter" "$app" "$((seconds - 8))" "$((warmup > 8 ? warmup - 8 : 1))" >"$out/$c.jsonl" + (sleep 5 && xwd -id "$w" -silent | magick xwd:- "png:$out/$c.png") & + "$bin/proc-meter" "$app" "$seconds" "$warmup" >"$out/$c.jsonl" wait "$damage" || true echo "load after: $(cat /proc/loadavg)" >>"$out/$c.load" kill "$app" 2>/dev/null || true