Files
reims-vgpu/scripts/qmp/README.md
T
Anees Iqbal 4ceee35665 probes: the driver scripts resolve the live pathway instead of naming one
Three probes — sustained-animation, gpu-load, spotlight — spelled one checkout's
absolute path (`/home/aneesiqbal/...`) as `REPO`, so they could not run on any
other machine. Twelve more, those three included, spelled
`vm/disks/run/qmp.sock` as the QMP socket, which is the x86 pathway's; an arm64
boot puts its socket under `vm/guest/run/`.

Between them that is the whole driven-boot harness pinned to the x86 host, and
the arm64 host is the only one the Metal rail exists on — so the probes that
rank this device's per-draw costs could not be pointed at the rail whose costs
are least known.

`qmp.py` already resolves whichever pathway is live and has since it was
written; the shell scripts were overriding that resolution with a constant.
`qmp.py sock` prints what it resolved, so there is one resolver and the drivers
ask it rather than each carrying a copy of half the answer. It answers without
connecting, because the question is which socket to use and that is worth
asking before a boot as well as during one.

`REPO` is derived from `BASH_SOURCE` in all three, which is what every other
script in `scripts/` already did.
2026-09-01 00:15:02 +03:00

61 lines
2.2 KiB
Markdown

# 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=...` (`scripts/qmp/qmp.py sock` prints the one it resolved, and the
boot script prints the same path).
Covers both **raw QMP** commands and GUI input helpers over the machine's
built-in usb-kbd + usb-tablet.
## Raw QMP
```sh
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
```sh
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.
```sh
scripts/screenshot/screenshot.sh 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 the
cross-platform helper under `scripts/screenshot/`.
**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.