# HDMI plug: CMA for scanout buffers (tasks 1.1 and 2.1) ## 1.1 Host build The board boot files were built with `nix build "git+file://…?rev=84b8b993#kernelMainlineDrmShellLandscapeHdmiBootFiles"` (exit 0). `84b8b993` is the integration branch `integ-cma-popup`, which contains this change's `dcbbab82` (rebased as this branch's source commit), the keyboard-popup fix and the vision redesign. The built kernel `/nix/store/b7jgc85iri7i1i77dvr1353yg9whg45m-linux-riscv64-unknown-linux-gnu-7.3.0-rc5` has these lines in its `config`: ``` CONFIG_CMA=y CONFIG_DMA_CMA=y CONFIG_CMA_SIZE_MBYTES=64 ``` The running compositor's config, `/nix/store/gfg4gwkbdslab8x0rkwqsvq5pzfnjw1i-k230-sway.conf`, line 36: ``` output HDMI-A-1 mode 1280x800 transform normal bg #000000 solid_color max_render_time 8 ``` ## 2.1 Board boot Evidence class: board shell over SSH after a soft `systemctl reboot` into `/nix/store/6mmvyyasczi0xsgw9hx2bhx6vrlycr07-nixos-system-nixos-26.11.20260919.20b1ddd` (installed with `/boot` kernel, initrd and DTB from the same bundle). HDMI was unplugged and the panel was the active output. ``` $ uptime 15:41:22 up 0:01, 1 user, load average: 6.01, 1.76, 0.61 $ dmesg | grep -i cma [ 0.000000] cma: Reserved 64 MiB at 0x000000003a000000 [ 0.018038] Memory: 845372K/1048576K available (16490K kernel code, 5952K rwdata, 14336K rodata, 3029K init, 843K bss, 128688K reserved, 65536K cma-reserved) $ grep -i cma /proc/meminfo CmaTotal: 65536 kB CmaFree: 63016 kB ``` At about one minute of uptime, 2.5 MiB of the pool was already in use, which matches the panel's scanout buffers. The panel's buffers now come from CMA rather than the buddy allocator. ## 2.2 Plug after hours of uptime (2026-10-17 00:21Z) The board had been up 13279 s (3 h 41 min) since the 2.1 reboot. In that time there were several live deploys (`switch-to-configuration test`, each restarting the shell) and repeated Vision and theme changes; the journal held 174 theme-helper lines. Just before the plug, `CmaFree` read 1424 kB. That low figure means the kernel had lent the pool to movable pages, not that the pool was used up. At the plug it read 252 kB. The operator plugged in the HP 27wm at 19:21:03 local (00:21:03Z). - Kernel: `HDMI HPD: connected`, then at 19:21:05 `lt9611 0-003b: video check: hactive_a=1280 … vactive=801`. - Sway, 1.2 s after HPD: `Allocated 1280x800 DRM dumb buffer`, then `Commit of 1 outputs succeeded`. - No allocation failure was logged. The only `[ERROR]` line was sway's `Requested backend configuration failed, searching for valid fallbacks`, logged after `Output doesn't support format 0x34325258` (XR24); the fallback to AR24 then committed. The `Failed to import buffer for scan-out` lines are debug-level direct-scanout attempts, which fall back to compositing. - `swaymsg -t get_outputs`: HDMI-A-1 active at 1280x800 @ 59.910 Hz. - `board-hdmi-plug-3h41m-black-bg.png` is the `grim` capture: Home on HDMI, over solid black. - The operator confirmed the monitor showed the shell, and said the vinyl wallpaper was missing. ## 1.2 The black background (2026-10-17) The wallpaper was missing because the sway config line `output HDMI-A-1 … bg #000000 solid_color` runs a `swaybg -o HDMI-A-1 -c #000000`. Its background-layer surface stacked over the shell's own wallpaper surface after the hotplug. Killing that swaybg (pid 7628) showed the wallpaper at once (`board-hdmi-swaybg-stopped.png`). The fix drops `bg` from that line. The built config `/nix/store/x9j62ghnbmsv7z2aj9dwin2i6x0lav1d-k230-sway.conf` line 41 reads `output HDMI-A-1 mode 1280x800 transform normal max_render_time 8`. It was deployed live as `/nix/store/8c75n3nxwppr8i658ing1yi4kcqpca1y-nixos-system-…`, and no swaybg runs afterwards. The operator then unplugged and replugged twice. **First replug (19:54:37–19:54:42).** The board side was complete by 19:54:44.9 (lt9611 video check). The operator reported the monitor black. The journal then shows two power-key presses: 19:55:06 (`output * power off`) and 19:55:11 (`output * power on`). The picture came back after them. The operator later said they had not touched the power button "the second time". It is unclear whether these presses were the operator's. **Second replug (20:30:53 out, 20:30:57.6 in).** - HPD connected at 20:30:57.6. - DSI PHY up at 20:30:58.8. - lt9611 video check at 20:30:59.5, and the sway commit at 20:30:59.5. - From then until the picture appeared, the journal has no further kernel, sway or power-key events. - The operator reported in chat that the monitor was still black at about 20:31:25, and that it "came up like right after I said that". - That is about 28–33 s after HPD, with the board idle for the last 25–30 s. The remaining delay is the monitor locking onto the signal, not the board. - `board-hdmi-replug-after-fix.png` is the `grim` capture with the vinyl wallpaper. ## Limits - The time until the monitor shows a picture comes from the operator's chat messages, not a measurement. One replug was at or just over the scenario's 30 s ceiling. All of that delay was after the board's last event. - The first replug's power-key presses are unexplained. - Uptime-plug evidence is one plug after 3 h 41 min.