Files
reims-vgpu/scripts/qmp
Anees Iqbal fc7c867c3d 🔍 A drag's duration and its event count were one knob, so "speed is the repro condition" named neither
`scripts/qmp/qmp.py` (x86 rail driving; host-side, no guest or Rust change).

`drag` interpolates `steps` sub-moves per segment `hold_s` apart, and both were
hardcoded at the call site. Gesture duration is therefore `steps * hold_s` per
segment: a longer drag is *simultaneously* a slower one and a busier one, and
the two cannot be varied independently.

That matters because the residue class's one distinguishing fact was stated in
terms of it. A ~6 s drag left 39 645 px of residue where a ~0.7 s drag left 386;
the conclusion recorded was "speed is the repro condition". With duration welded
to event count that number supports two incompatible readings — residue tracks
elapsed wall-clock (some timer ages guest-owned state out mid-gesture), or it
tracks pointer events (per-present accumulation, every timer exonerated) — and
they point at disjoint code.

Expose both as `QMP_DRAG_STEPS` and `QMP_DRAG_HOLD_S` so a caller can hold one
axis fixed and move the other. No default changes: 8 and 0.02 are what the call
site already passed, so every existing repro drives the guest identically.

Verified: `qmp.py` parses; a 2x2 sweep (320/80 events x ~1.6/~6.4 s on one fixed
path) drove the guest through all four cells on a live x86/Vulkan boot, with
measured durations landing in the two intended groups (1.83-1.97 s and
6.63-6.82 s). Not verified: arm64, and the knobs are not exercised by any Rust
test — this is host-side driving only.
2026-07-28 12:42:22 +03:00
..
2026-07-26 15:24:53 +03:00

qmp.py

One-shot QMP client for the VM's control socket. vm/boot-arm64.sh opens a per-boot socket in vm/guest/run/ plus a stable qmp.sock symlink — the default here; override with QMP_SOCK=/path/to.sock.

The x86 guest rail (vm/boot-x86.sh) puts its per-boot socket + qmp.sock symlink under vm/disks/run/, so the arm default does not apply there — pass QMP_SOCK=vm/disks/run/qmp.sock (the boot script prints the exact path).

Covers both raw QMP commands and GUI input helpers over the machine's built-in usb-kbd + usb-tablet.

Raw QMP

scripts/qmp/qmp.py cmd query-status
scripts/qmp/qmp.py cmd quit
scripts/qmp/qmp.py cmd human-monitor-command '{"command-line":"info usb"}'

GUI helpers

scripts/qmp/qmp.py click 640 480
scripts/qmp/qmp.py click 640 480 --double
scripts/qmp/qmp.py move 100 100
scripts/qmp/qmp.py drag 900 500 400 500 1400 700   # left-button rubber-band drag through points
scripts/qmp/qmp.py key ret                  # qcodes; chords via +
scripts/qmp/qmp.py key meta_l+q
scripts/qmp/qmp.py type 'hello World_123'

Click coordinates are guest display pixels.

Screenshots

Screenshot capture is intentionally handled by the host helpers, not by QMP. qmp.py shot, qmp.py screendump, and qmp.py cmd screendump are blocked so a stale QEMU display surface is not mistaken for the host-owned window.

scripts/screenshot-when-macos-host/screenshot-when-macos-host.sh out.png
scripts/screenshot-when-kde-plasma-host/screenshot-when-kde-plasma-host.sh -o out.png

click / move / drag still size the guest display through QMP internally. They are input helpers, not screenshot helpers.

Why QMP Screenshots Are Blocked

QMP display capture reads QEMU's DisplaySurface. The host-owned window presents through the Rust backend and the compositor, so QMP is the wrong observation surface for screenshots. Use scripts/screenshot-when-macos-host/ on macOS or scripts/screenshot-when-kde-plasma-host/ on KDE Plasma.

Input delivery is unaffected. click / move / drag / key / type ride input-send-event to the guest's usb-kbd + usb-tablet, which is display- independent; they keep working under -display none and the host window. The pointer helpers still use QMP to learn the display geometry, but input delivery itself does not depend on QEMU owning the visible window.