garage44.eu/jeroen/pinnacle

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

.. /tools/macos-venus/README.md

raw

Venus on a Mac

build.sh builds, into ~/opt/venus, a QEMU whose 3D virtio-gpu runs the guest's Vulkan on the Mac's GPU: virglrenderer's Venus on the Vulkan loader and MoltenVK. cargo xtask finds it there on its own (else PINNACLE_QEMU names a QEMU), gives QEMU the device, and the self-check's gpu3d and venus run.

Homebrew's QEMU has no 3D device on macOS, and upstream QEMU builds one only with an OpenGL display, which a Mac does not have headless. Venus needs none: qemu-venus-without-gl.patch lets the device start with venus=on and no GL display, and tells virglrenderer to run Venus alone (VIRGL_RENDERER_NO_VIRGL).

Memory the guest's programs map for the GPU (wgpu's uploads) would go through the device's host-visible window, which is 256 MiB at most here: a bigger one needs QEMU's high PCI memory, which HVF refuses inside a VM (HV_UNSUPPORTED), and Cartopolis's upload bursts filled it. So the guest's RAM is shared memory (memory-backend-shm, which cargo xtask asks for here), and a guest blob in one piece of it is the GPU's memory as it is: qemu-guest-blobs-from-shm.patch hands such a blob to virglrenderer as that file at its offset, and virglrenderer-shm-offset.patch lets Venus import shared memory from an offset (it took only a file's start). On Linux, udmabuf would do the same; a macOS host has none. Without the patches the driver says so once and maps through the window as before. build.sh applies each patch once, to trees built before it was added too.

It needs no write access to Homebrew (a build node's user has none), only the libraries Homebrew's QEMU already brought. These are host tools, in C and Objective-C as QEMU is; Pinnacle itself stays Rust.

Run on a Mac node (QEMU's build takes most of the time):

sh tools/macos-venus/build.sh

Where it belongs for good is the Mac node image (midas builds it), so every Mac node has it; until then it is built by hand, once per node.