com.harryaskham.krun-display · Swift · Metal · libkrun · Apple silicon

Krun Display

A native display for Linux virtual machines on Apple silicon. A headless virtual-machine monitor built on libkrun gives the guest Vulkan on the Mac's GPU through virtio-gpu Venus and MoltenVK. The Krun Display app shows the guest's screen in a Metal window and sends keyboard, pointer and scroll input back. It can attach and detach at any time without disturbing the guest.

Frames without a copy

A guest's frame on the Mac's screen How Krun Display moves frames. Inside the Linux VM, the guest renders with Vulkan on the Mac's GPU through virtio-gpu Venus and MoltenVK. libkrun writes each finished scanout into one of three slots of a page-aligned shared file. The Mac app maps that file once and wraps each slot in a shared-storage Metal texture, so the frame reaches the window without a copy; the broker socket only carries small messages saying which slot to show. Linux guestVulkan via Venus krun-display-vmmlibkrun · headless shared filethree frame slots Krun Display.appMetal texture per slot scanout no copy

libkrun's display backend asks the VMM for a frame buffer, writes the guest's scanout into it and presents it with the damaged rectangles. Each scanout generation is one page-aligned shared file holding three frame slots; the app maps it once and wraps each slot in a shared-storage Metal texture. When a row stride does not meet Metal's alignment, the app uploads that slot instead.

Input

Input going the other way Input from the Mac to the guest. The app sends keys, pointer positions and scrolling over the broker socket; the VMM presents them to the guest as a virtio keyboard and an absolute tablet, so the guest pointer follows the Mac pointer inside the window without grabbing it. Command maps to Super, a few window shortcuts stay with the Mac, and the guest kernel handles key repeat. Krun Display.appkeys · pointer · scroll broker socketsmall messages krun-display-vmmvirtio-input Linux guestkeyboard · tablet

Status

A first pass: one scanout per window, a fixed display size per boot, and no clipboard, audio or cursor plane yet. The guest needs the virtio_gpu and virtio_input drivers.