garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

cartopolis-agent · 2026-11-24T10:39:07Z

feat(node): QEMU's 3D virtio-gpu in the node image

Pinnacle's GPU route is Vulkan through QEMU's Venus: the guest's Vulkan
commands run by the host's (lavapipe on a CPU node). That needs QEMU's
3D virtio-gpu (qemu-hw-display-virtio-gpu-gl, with virglrenderer, which
Arch builds with Venus) and a GL context to start it, made by `-display
egl-headless` (qemu-ui-egl-headless, qemu-ui-opengl) on a render node.

A machine with no GPU gets a render node from the kernel's vgem; tried
2026-11-24 on the VPS in a throwaway container of this image: with
--device /dev/dri/renderD128 and these packages, QEMU starts a
virtio-gpu-gl-device with venus=on, blob=on; without a render node it
refuses ("egl: no drm render node available"). docs/node.md says how to
give a GPU-less machine one; the node's `gpu` flag stays off, since the
rendering stays on the CPU.
docs/node.md       | 9 +++++++++
 node/Containerfile | 7 ++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/docs/node.md b/docs/node.md
index a6eef9d..d163514 100644
--- a/docs/node.md
+++ b/docs/node.md
@@ -128,6 +128,15 @@ controller to users — a file `/etc/systemd/system/user@.service.d/dmem.conf`
 with `[Service]` and `DelegateControllers=cpu memory pids dmem` — reboot, and
 run setup again. `midas check` says whether the cap is in force.
 
+**A render node without a GPU:** QEMU's 3D virtio-gpu (what a guest's Vulkan
+goes through, Venus) needs a GL context, which in a container only a render
+node gives. A machine with no GPU (the VPS) gets one from the kernel's `vgem`:
+`echo vgem | sudo tee /etc/modules-load.d/vgem.conf`, `sudo modprobe vgem`,
+the node's user in the `render` group (`sudo usermod -aG render midas-node`),
+then setup with `--gpu /dev/dri/renderD128`. Rendering itself stays on the CPU
+(lavapipe): this gives QEMU its context, not the node a GPU, so the hub's `gpu`
+flag for it stays off.
+
 ## 3. Check it
 
 ```bash
diff --git a/node/Containerfile b/node/Containerfile
index 6f739d6..7a4d5d7 100644
--- a/node/Containerfile
+++ b/node/Containerfile
@@ -7,7 +7,11 @@
 # wasm32, aarch64-linux-android and aarch64-unknown-none targets (and nightly's
 # rust-src, for a wasm build that rebuilds std), rsync, and OpenSSH, whose sshd
 # is hooked into midas. QEMU for AArch64 and x86-64, to boot a bare-metal kernel a project
-# builds (pinnacle) and check what it prints.
+# builds (pinnacle) and check what it prints, with virtio-gpu in 2D and in 3D:
+# the 3D device (virglrenderer, with Venus: the guest's Vulkan run by the
+# host's, lavapipe on a CPU node) needs a GL context, which `-display
+# egl-headless` makes on the node's render node; a machine with no GPU gives
+# it one from the kernel's vgem (`modprobe vgem`, `--gpu /dev/dri/renderD128`).
 # And what `midas deploy` builds with beside cargo: bun (a web UI), trunk (a
 # wasm client; it fetches the wasm-bindgen its lockfile names), a JDK 17, zip
 # and the compressors (an APK and pre-compressed assets), and zig with
@@ -27,6 +31,7 @@ RUN pacman -Syu --noconfirm --needed \
         alsa-lib pkgconf cmake python jq curl \
         bun trunk jdk17-openjdk zip unzip brotli zstd zig cargo-zigbuild chromium \
         qemu-system-aarch64 qemu-hw-display-virtio-gpu qemu-system-x86 qemu-system-x86-firmware \
+        qemu-hw-display-virtio-gpu-gl qemu-ui-opengl qemu-ui-egl-headless virglrenderer \
     && pacman -Scc --noconfirm
 
 # The one account anything that lands here runs as. uid 1000 so the files in