The kext's framebuffer and accelerator, and the option ROM, accept only the
wire version they were built with, but a refusal said nothing useful: the kext
logged "not the device" with the magic beside the version, and the ROM left
the device silently, so a stale ROM showed up only as OpenCore's missing GOP
on a black screen.
Each now checks MAGIC, then VERSION, and on another version says so, naming
both versions and that the guest's parts and the host must come from one
build: the kext in the kernel log, the ROM on the firmware's console (the
Simple Text Output protocol, where the firmware has a console yet).
design.md, "The wire's version", says what the version covers and when it
moves: every change a guest built before it would misread moves it on by one,
in the same commit; a feature bit or a message older guests never send leaves
it.
This is meant to change what the guest's firmware sees: ReimsGraphics.rom's
bytes change (6656 to 7168 bytes). ReimsVgpu.rom's bytes are unchanged.
Integration found the guest and host wire headers disagreed on the control
ring's data size (the guest used 0x10000 - 256; the host, authoritatively,
uses a 32 KiB power of two) and on every name. The host's generated cbindgen
header is the source of truth, so the kext and the option ROM now build on it
and the guest's own copy is gone.
- Both include crates/reims-graphics/include/reims_graphics_wire.h; the
Makefiles point there.
- RG_* names become the host's RGFX_*; ring field offsets come from
RgfxRingHeader, and a command is now a full message struct (RgfxSetScanout
and the like) whose header the sender stamps.
- The ring index masks against RGFX_CONTROL_RING_DATA_SIZE, now a power of two.
- The option ROM's .S cannot assemble the C header, so the Makefile reads the
PCI identity from it with the preprocessor and passes it in. apple-gfx-pci's
ROM bytes are unchanged.
The reims-graphics lane's boot display is a GOP framebuffer in the device's
region, so firmware, boot.efi and the kernel console have a screen before the
guest's display kext starts. The new driver binds 1234:5247, resets the
device, adopts the control rings' counters, and offers one mode: the first
connected display's preferred mode from GET_DISPLAYS, or 1920x1080. SetMode
points the display at the region from 0x20000 with SET_SCANOUT, its rows
aligned to 256 bytes as the kext lays them out, so the boot frame keeps its
layout at the handover. Firmware polls the completion ring for answers.
OptionRom.S takes the PCI identity from its includer, so both ROMs share the
layout; apple-gfx-pci's ROM builds to the same bytes as before.
macOS installers and recovery images ship no AppleParavirtGPU, so the only
driver that binds the device is IOGraphics' IONDRVFramebuffer, which takes
the EFI boot framebuffer over only when it lies inside one of the device's
memory BARs. The option ROM gave the Graphics Output Protocol its
framebuffer in guest RAM, and the device had one register BAR, so the
installer's WindowServer found no usable display, aborted and started
again and again, the screen frozen on the Apple logo's progress bar.
vendor/qemu's 1a72df98 gives apple-gfx-pci a BAR 2: a 64 MiB window (the
efi-framebuffer-bar property, on by default) holding one alias of the
machine's RAM. After a guest write to 0x1210, QEMU reads the start back
from the library and shows the run of RAM there, up to 64 MiB and never
past what the guest sees of that RAM (so not SMRAM); only the next 0x1210
write and a reset change it.
The option ROM, after it writes the framebuffer's start and length (0x1210,
0x1214), asks PCI I/O for BAR 2's attributes: a memory BAR at least as long
as the buffer, below 4 GiB and with no address translation. It then writes
a pattern and its complement into the buffer's first and last dwords and
reads each back through BAR 2, restoring the dwords. When all four read
back, the GOP's FrameBufferBase is BAR 2's address; otherwise it is the
buffer's own, as before. The buffer stays runtime services data in RAM:
Blt draws into it, the registers name it, and the device presents it, so
the library, its C API, the suite and the pins are unchanged. Those pages
stay the framebuffer's only while the loader keeps boot.efi from moving
runtime data, as OpenCore's AvoidRuntimeDefrag does; the ROM's comment and
architecture.md 11.4 say so.
What the guest sees: one more memory BAR on apple-gfx-pci, which shows the
EFI framebuffer from the ROM's 0x1210 write until the next one or a reset,
and a GOP framebuffer at that BAR's address, which boot.efi hands the
kernel; on a device without BAR 2, the RAM address as before. The ROM's
size is unchanged (5,632 bytes); its bytes change.
docs/qemu.md and docs/architecture.md 11.4 describe BAR 2 and the ROM's
probe, and what the boots measured on the RTX 5080 Laptop GPU host: the
macOS 26.6.2 BaseSystem reaches its Recovery UI (kernel framebuffer at BAR
2, WindowServer started once), and the installed macOS 26 guest reaches
its desktop with BAR 2 on and off, its late draws to the boot framebuffer
landing in RAM.
This repository now holds libreims_vgpu, a Rust library that is the host
side of the paravirtualized GPU macOS guests drive, in place of Apple's
ParavirtualizedGraphics.framework: the library and its C API
(reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API
(vendor/qemu), the behaviour-lock suite that drives the C API as QEMU
does, and reims-ctl, the VM manager users run. README.md says what it is
and how it is laid out, and AGENTS.md how to change it.
Every file of the earlier tree is replaced. vendor/qemu moves to the
steelbrain/reims-vgpu branch of the same public repository.