fix: pace low-power GPU presentation with vsync#13119
Conversation
Co-Authored-By: Elijah Lynn <ElijahLynn@users.noreply.github.com> Co-Authored-By: Oz <oz-agent@warp.dev>
Manual A/B test results (native Wayland, Intel Iris Xe)I reproduced the high GPU usage from #2319 on a local dev build of this PR branch and ran an automated A/B comparison between the two present-mode paths. The PR change did not meaningfully reduce GPU load under a heavy typing/scroll workload. Environment
WorkloadAutomated, repeatable input via
~18s workload, ~20s GPU sampling at 200ms intervals. Results
Both runs used the same binary, same native Wayland config, and the same automated workload. The difference is within noise (~1% avg, ~5% peak). Observations
SuggestionThis looks like a reasonable small mitigation for uncapped over-presentation, but for cases like mine (single Iris Xe, native Wayland, heavy terminal redraw) a deeper fix may be needed — e.g. frame coalescing/throttling on input, dirty-region rendering, or reducing full-grid redraws during typing/scroll. Happy to re-run with different configs (XWayland vs Wayland, longer scrollback, etc.) if useful. |
Reproducibility: methodology + scriptsFollow-up to the A/B results above — full reproduction steps and the scripts used. Prerequisites# Build the PR branch locally
gh pr checkout 13119
cargo build
# GPU measurement: i915 PMU via perf (same source as btop/intel_gpu_top)
# btop ships with cap_perfmon; for a script you need one of:
sudo sysctl kernel.perf_event_paranoid=0 # revert: =2
# Input automation under native GNOME Wayland (kernel uinput)
sudo pacman -S --needed ydotool # or apt equivalent
# ydotoold runs as your user if /dev/uinput ACL grants accessbtop reference: cloned Per-process Config (dev build
|
| File | Role |
|---|---|
gpu_pmu_sampler.py |
Samples whole-GPU rcs0-busy (render) via i915 PMU, writes CSV |
workload.sh |
Fixed typing / seq 1 4000 / PageUp-Down workload via ydotool |
run_mode_auto.sh |
Writes config, relaunches warp-oss, countdown, runs sampler + workload |
Run commands (what I actually ran)
mkdir -p ~/warp-gpu-test
# copy scripts from gist into ~/warp-gpu-test, chmod +x
ydotoold --socket-path "$XDG_RUNTIME_DIR/.ydotool_socket" --socket-own "$(id -u):$(id -g)" &
# AutoVsync (PR path)
./run_mode_auto.sh vsync true 10 20 18
# -> /tmp/gpu_vsync.csv
# AutoNoVsync (baseline) — re-focus Warp during countdown
./run_mode_auto.sh novsync false 10 20 18
# -> /tmp/gpu_novsync.csvImportant: ydotool sends input to the focused window. Click the Warp terminal pane during the countdown and don't touch keyboard/mouse during the ~18s workload.
Summarize CSVs
for f in /tmp/gpu_vsync.csv /tmp/gpu_novsync.csv; do
echo -n "$f: "
awk -F, 'NR>1{r+=$2; n++; if($2>p)p=$2} END{printf "render avg=%.1f%% peak=%.1f%%\n", r/n, p}' "$f"
done
Closes #2319
Summary
PresentMode::AutoVsyncfor low-power rendering so typing and scrolling are paced to display refresh instead of using the non-vsync presentation path.PresentMode::AutoNoVsyncfor the high-performance rendering path to keep the existing low-latency behavior when users opt out of low-power rendering.Validation
./script/format --checkcargo test -p warpui presentation_mode --no-fail-fastcargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warningscargo clippy -p warp_completer --all-targets --tests -- -D warningsNotes
cargo clippy --workspace --all-targets --all-features --tests -- -D warningsrun is not the current presubmit path and fails on unrelated all-features dead-code/unused-item warnings across terminal modules.