fix(kvm): gate DRM/KMS scanout capture off by default (VA-109) #150
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VA-109-gate-drm-scanout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Addresses VA-109: a hard machine freeze (full seat lock, power-cycle to recover) seen during KVM desktop-tab testing on an amdgpu host, prime suspect the DRM/KMS scanout readback (VA-104).
Root cause (code-level)
The Wayland streaming capture
wayland::capture_rgb(the desktop-tab tile source, 5-30 fps) tried DRM scanout first, on by default, with no opt-in. Per frame the DRM path (drm_kms::capture_rgb->drm_gbm::read_scanout_rgb):gbm_create_device(fresh every frame),gbm_bo_importthe live buffer, andgbm_bo_map(READ)- which has the driver blit the actively-scanned-out buffer out of VRAM - plus the same for the cursor plane;Forcing a CPU-read map of a scanout buffer up to 30x/s, concurrent with active scanout, is a known GPU-hang / reset trigger on amdgpu (the host is AMD). A display-engine hang or failed reset presents as exactly this full-system freeze.
Caveat (honest): the link to this specific incident is circumstantial - the host that froze had latched DRM unavailable before the risky map that boot. But the path was default-on, ran the live-scanout blit every frame, and is unproven on the target GPUs, so it is a release-blocking freeze vector regardless. A hardware repro / GPU-log confirmation cannot be done in the CI sandbox (no GPU; deliberately wedging a display GPU is destructive) - it is left as an on-hardware step behind the opt-in.
Fix: opt-in, off by default
DRM/KMS scanout capture now engages only when
VERVAIN_KVM_DRM_SCANOUTis truthy (1/true/yes/on), logging a one-time warning when enabled. Unset ->capture_rgbskips DRM and uses grim / xdg-portal, which never touch the raw scanout buffer.Tradeoff (intentional, safety over capability): KWin/GNOME-Wayland hosts with no grim and no portal grant lose the consent-free capture path until an operator opts in on validated hardware.
Diagnostics
drm_gbm::map_bologs (debug) immediately before and after thegbm_bo_mapblit, so a post-freeze journal captured while validating the opt-in pinpoints whether it wedged inside the map (before-line present, after-line absent = froze in the blit).Docs + tests
docs/va-109-drm-scanout-freeze.md: analysis, caveat, the gate, on-hardware validation steps, and follow-ups (per-frame gbm device churn; render-node import path). Unit test covers the opt-in parsing (off by default / off for any non-truthy value). Linux workspaceclippy --deny warnings,fmt, and 94 kvm tests pass.Acceptance criteria
🤖 Generated with Claude Code