Files
reims-vgpu/scripts/qmp
Anees IqbalandClaude Opus 5 ce25f8a1bc scripts: a drag reports the pointer rate it achieved, not the one it asked for
`scripts/qmp/qmp.py` — host-side input helper, used by every probe that drives
a guest through QMP.

`drag()` returned nothing and the CLI printed `ok`, so the rate the guest
actually received was never on the record. It is not a diagnostic: an app that
pans by tracking the pointer redraws per motion event and cannot produce more
distinct views than it was sent, so that rate is a ceiling on any frame rate
measured across a drag. A caller reporting frames without it is quoting
whichever of the two is smaller and cannot say which.

`drag()` now returns `(moves, seconds)` for the held glide — the press, its
settle and the release stay outside the timed window — and the CLI prints
`moves=`, `secs=` and `moves_s=`.

The rule is not new here. `window-drag-probe.sh` already computes `posted_hz`
and warns "the counters below are bounded by the drag, not by this device", and
`drag.c`'s header says reporting the device as slow for an under-driven probe
"would be measuring this program". `maps-probe.sh` was written later, drives
through this helper, and sends its stdout to /dev/null.

Two facts the new output established immediately, both recorded in the
docstring because both had been assumed:

- The QMP round-trip is **0.7-0.9 ms** on x86/PCI macos-15 with the device
  idle, so the default `hold_s=0.012` dominates and a drag achieves ~77
  moves/s in-glide. A session had reasoned from an assumed ~20 ms round-trip to
  the conclusion that a 28 fps app was bounded by this loop; the first arm
  refuted it.
- The returned rate is **in-glide**, and a caller spawning one `qmp.py` per
  circuit does not achieve it: ~0.14 s of process spawn between circuits took a
  measured 77/s in-glide down to 54/s sustained, and 1490/s down to 151/s.

Verification: offline against a stubbed transport, `drag()` reports 24 timed
moves per 4-segment circuit and recovers an injected round-trip to within
0.6 ms across three (hold, rtt) pairs. Live on macos-15 x86/PCI, two banded
bare-desktop arms produced the numbers above. No Rust changed, so no clippy or
test arm is affected.

Not verified: the round-trip was measured with the device idle. Whether it
holds while the device is drawing is a separate arm, in flight.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 12:08:54 +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.