A writable twin of read-only pages was made only for a surface's read-only
alias, and a file of zeros only for an alias's block past its ranges: both
went with the host-OS surfaces, which no production path has made since
110b53637. So import_view loses its twin argument, and with it the twins'
map (shown_at), their mappings in the views' budget, the notwin refusal and
its trace record. Read-only pages are given to the runtime as they are, and
the views' gate refuses them, so the runtime copies them, as before.
The dma-buf sources lose their files of zeros (Zeros), which only those
blocks' pages took, and the budget's claims their reach, as only a twin
reached into the headroom. An import's pages are made once, so its record
says whether that import is still being made rather than how many are. The
remap, budget, vm, files and host_ram docs, qemu.md, lessons.md,
architecture.md and conventions.md no longer describe the twins, the
stand-in or the IOSurface memory the library held; the measured facts about
what a remap under an import reads stay in remap.rs. ResourceAddressRange,
which only the surface aliases gathered, goes.
Nothing the guest or host observes changes, as no production path has made
an OS surface since 110b53637.
Since 110b53637 nothing in production makes a host-OS surface: the
reims-graphics device's surfaces reach the Vulkan platform as buffers, and a
texture over a surface's plane is made with new_texture_over_surface_plane.
Only tests made IOSurfaces, and the previous commit moved those onto that
creator.
So the platform's surfaces go: the Surfaces trait and Platform::surfaces,
GpuDevice::new_buffer_on_surface and new_texture_on_surface, the resources'
iosurface getters, the OS modules (os/surface.rs, os/linux/surface.rs,
os/macos/iosurface.rs) and the testkit's counted surfaces. With them goes
what only an object over an OS surface reached:
- metal_space's surface ranges and Over::Surface/Over::Plane;
- backing.rs's surface aliases (Alias, gather_or_nil, its zeros);
- writes.rs's bound-memory and slot-writes queries, and encode_render's
Reach and binds, which decided the refused writes of 523 and 527 into a
texture over a surface, with the compute pipelines' kept descriptors that
only those queries read (a render pipeline keeps its guest descriptor,
which its encoders read);
- predication's dropped texel writes, and the message layer's fatal_send;
- allocate_zeros, TWINS_READ_ONLY and an import's second making on Linux.
The measured facts the live path relies on stay, in the live modules' docs:
metal_space's (the surfaces' address ranges Metal gives), ycbcr.rs's
("Writes": which YCbCr writes Metal stores, drops, or changes by a rule the
runtime does not hold) and resource.rs's (the plane Metal asserts or answers
nil at). out_of_host_memory is Linux's alone now, as only Linux's views and
imports run out of memory short of Metal. docs/architecture.md,
development.md and qemu.md no longer describe the OS surfaces.
Nothing the guest or host observes changes, as no production path has made
an OS surface since 110b53637.
Every command queue doorbell write exited to QEMU and ran the library on
the guest's vCPU, though only a buffer that asks for its CB_SUBMITTED can
be answered there; the rest need only the queue's thread woken. Measured
on the Radeon 780M host, a doorbell QEMU takes as an ioeventfd costs the
guest 8.9 us and one run through the library 13.4 us, of a 17.1 us
commit.
The device offers DOORBELL_ASKS (feature bit 43, FEATURES_HI bit 11): a
guest that takes it writes an asking buffer's doorbell with the ring's
id and RGFX_DOORBELL_ASKS (bit 0), and every other doorbell with the id
alone. The device then answers at the doorbell only an asking write, and
gives each queue an eventfd its thread sleeps on, which it hands the host
with the ring's id (route_doorbell, a new C API callback at the end of
RvgGraphicsCallbacks, its second version). QEMU adds it as an ioeventfd
matching the id exactly, so KVM wakes the queue's thread in the kernel and
the vCPU goes back to the guest with no exit; the asking write matches no
route and reaches the library as before. A guest without the bit sees
nothing new: every doorbell is answered as before, and no queue is
routed.
The device routes at most 128 queues (KVM holds 1000 devices on its MMIO
bus, and QEMU ends the VM where KVM refuses one); a queue past them, or
one the host refuses, keeps its doorbell on the write, logged once per
kind and counted. A route goes as its queue ends, before the destroy,
close or reset is answered, and QEMU drops it under the BQL before the
callback returns, so a queue made again over the same ring gets every
write. The thread drains the eventfd and walks its ring on each wake, so
coalesced writes take every buffer in ring order.
QEMU's side is vendor/qemu d81bcaac. The guest's side, the ROM's record
and both guest sets follow.
The C API's release of the process's last graphics device now lets go of
the platform's GPU devices before the process exits, and QEMU releases its
device as it quits. The architecture's C API section names the let-go beside
the other release rules, and docs/qemu.md says when QEMU's device goes at
its quit, with the boot that measured it on an RTX 3090: a clean exit after
the guest's shutdown, the let-go logged, no core.
A boot's check reads the codes of its degradations from its logged
degradation counts (AGENTS.md), which nothing wrote: the counts of the
relayed, native and inexact kinds and of the calls answered as when memory
runs out were read only by tests. HeapTwoPlaneTexture, one of the kinds a
creator hears, was relayed at every heap texture it was announced for, and
a driver's error message at every occurrence.
Every heard kind is now relayed the first time alone and counted, the
other kinds the runtime announces are counted, and a driver's or a layer's
error message is relayed once per id name and class of its text, then
counted. At each reset of the device and at the process's exit (the exit
gate's hook, after its wait), the library writes, where they changed,
"reims-vgpu: degradation counts: <code> <n>, ..." on stderr, sorted by
code, and the logger's count of the lines it wrote at debug.
IOMobileFramebuffer.framework counts an arm64 guest's displays from the
display-subsystem children of /arm-io once in a process, and WindowServer
counts before our kexts load from the auxiliary kernel collection, so it
counted none and ran headless. Ambrosia's Graphics > DisplayNode places
/arm-io/<name>, with only its name and that device_type, where the module
drives a display, before the kernel starts.
Our configuration's bundle now names reims-display0, the node ReimsGraphics
uses as display 0's. stage-config.py adds the key with the kexts' entries, not
config.plist, so the module's bundle alone gives no node and no process waits
30 seconds for a framebuffer service that nothing publishes.
The arm64 display's guests panicked when WindowServer first asked for the
frame info. IOMobileFramebufferUserClient::s_supported_frame_info calls
supported_frame_info through IOMobileFramebuffer and authenticates the slot
with IOMobileFramebuffer's discriminator, 0xbd70. Our synthesized vtable's
slot was signed with Legacy's, 0x7dc3: Legacy's own table signs the four
pure methods IOMobileFramebuffer declares (set_notify_tag_mask_gated,
supported_frame_info, factory_portal, executeFactoryConfigurations_gated)
with its own redeclaration's discriminators. Those four slots are the only
ones where Legacy's table and its bases' differ, on 14, 15, 26 and 27.
Graft 1.3.2 signs each synthesized slot with the discriminator of the most
base handed table that covers it, and refuses the display bind unless every
superclass's table is handed. Ambrosia now exports IOMobileFramebufferService's
and IOMobileFramebuffer's vtables beside Legacy's; each is defined in
IOMobileGraphicsFamily in every arm64 Boot KC from 12 to 27.0. Graft 1.3.0
and 1.3.1 look up only Legacy's table by its symbol, and ignore the others.
Graft 1.3.0 signs each inherited slot of the arm64e display's synthesized
vtable with the live parent's pointer-authentication discriminator. Our
arm64 firmware, Ambrosia, measures those discriminators from the Boot
kernel collection and hands them over in the device tree, but only for
the vtables its configuration names. Without that, Graft refuses the bind.
Our config.plist named none, so every boot that bound ReimsGraphics ran on
a local configuration that named the vtable.
Our configuration now names __ZTV25IOMobileFramebufferLegacy under
Kernel > ExportVtableDiscriminators. stage-config.py keeps every Kernel
key but Add, so make config-bundle carries the key into Config.cpio, and
make bundle carries it as well.
On VA-API every picture the reims-graphics device decoded was read back and
copied into the guest's output planes by the CPU (B93): CoreVideo lays each
plane 32 bytes into its page, and neither radeonsi's nor iHD's video
processing writes that layout, so the in-place write declined every picture.
Where the in-place write declines, the arm now exports the decode surface as
dma-bufs (vaExportSurfaceHandle, each plane a layer of its own, kept with the
surface's pool), imports each plane once into the runtime device as an image
of its DRM format modifier, and copies it with vkCmdCopyImageToBuffer into the
buffer the output plane lies in, the surface's pages or its device cache, at
the plane's offset and rows: the Vulkan platform's PlaneCopier, one a session
on a runtime queue of its own, which waits for the copy on a fence. The copy
writes the crop the CPU's copy writes and nothing past it, after the decode is
done, and the session signals the decode once the copy is done on the GPU.
Which way each host's pictures take, in order, each where those before it
refuse:
- radeonsi (Radeon 780M, Mesa 26.2.6): the in-place write declines
CoreVideo's planes (it imports planes 256 bytes apart alone); every picture
lands by the GPU's copy: radeonsi exports one object of modifier
0x200000010401b04, and RADV imports each plane.
- iHD (Iris Xe, intel-media-driver 26.3.5): the in-place write declines them
(iHD writes a plane only at its dma-buf's first byte, U26); every picture
lands by the GPU's copy: iHD exports one Y-tiled object (0x100000000000002),
and ANV imports each plane.
- A host whose driver exports a surface other than as a layer a plane, whose
runtime device lists none of the dma-buf image extensions or refuses the
modifier for the plane's format, or whose plane lies in a buffer the GPU's
writes do not reach (pages the runtime copies, a detached buffer): the CPU's
copy, as before. The session logs each reason once at that point, as `a
picture copied by the CPU: <the in-place write's refusal>; and the GPU's
copy: <its refusal>`, or `; and no GPU copy: <why>` where the device made
the session no copier.
The in-place write stays first wherever the import check passes for the
planes' layout.
For the guest nothing changes: the planes hold the same bytes, padding
included, and the decode's event and completion come as before. For the
host, the pictures land by the hardware instead of the CPU, the session's
counts say so, and each session logs its GPU copies and their GPU time at its
end.
Checked on the Radeon 780M and the Iris Xe: the conformance suites
(h264-check.sh 62 and hevc-check.sh 156 checks pass on each), the video
crate's ignored VA tests (15 on each), and a new ignored test,
a_picture_copied_by_the_gpu_is_the_cpus_copy_byte_for_byte, which lands every
picture of the suites' Annex B streams by the GPU's copy and by the CPU's into
the same CoreVideo-like layout at two pitches and compares every byte: 4849
pictures of 79 streams equal on the 780M, 4951 on the Iris (the latter going
on past the leading pictures random access skips). The workspace's Linux
tests pass on the radeonsi host (1862).
In cold boots of a macOS 26.7.2 guest playing 4K 60 fps HEVC in Safari,
against the arm before it on the same GPU: on the 780M no picture was copied
by the CPU (9979 before), 10000 by the GPU at 1.01 ms of GPU time each, and
three clips at once played at 53.2, 53.7 and 52.5 fps with 3, 2 and 0 frames
dropped (50.0, 50.3, 52.0 and 10, 11, 5 before); on the Iris none (9899
before), 10040 at 0.52 ms each, 53.8, 54.2 and 56.4 fps with 4, 3 and 0
dropped (52.3, 51.7, 53.5 and 71, 74, 1 before).
docs/qemu.md now says how to build our configuration's bundle and check a
boot of it, what each check reads, what the first partial run on the M3 Max
showed (the early console, SSH, SIP and boot-args passing; the kext and Metal
checks failing as they must without kexts; KextsNotPlaced reported at once),
what a pass still needs, and what a TCG run on a Linux member needs: the node
holding the guests, its GPU, the library and our QEMU built there with the
device, the copies from the Mac, and RAM. README.md and architecture.md 11.5
list the new target and files.
reims-vgpu-core is folded into reims-vgpu-vulkan, so the docs, the
manifests' comments and the crate descriptions that named the crate name
its module now: the crate lists and graph, seven crates, core's files under
crates/reims-vgpu-vulkan/src/core, the testkit feature, and what the x86-64
leg runs. The design note that put the decoder in core says where it is,
reims-vgpu's graphics::decode, and the path of a deleted file goes. The
kache measurement keeps the crate's name, as it was measured then.
The crate that holds the reims-graphics device's wire and transport now
carries the library's prefix, as reims-vgpu-video does: its directory is
crates/reims-vgpu-graphics, its package reims-vgpu-graphics, and its Rust
path and log target reims_vgpu_graphics. The guest's, the option ROM's and
Ambrosia's Makefiles include the wire header from the new directory, and the
prebuilt records name it there.
Nothing changes for the guest or the host. The device keeps its name
(reims-graphics, QEMU's reims-graphics-pci, PCI 1234:5247), and the wire
header keeps its file name and RGFX_ symbols. The C API header is unchanged,
and the prebuilt kexts and option ROM are byte-identical; only the records'
paths and source hashes move. A log filter names the crate's lines by its
new target (REIMS_VGPU_LOG=info,reims_vgpu_graphics=trace), a diagnostic.
The module is a new piece of the repository, so the layout, the
architecture and the checks a change to it needs name it: architecture
11.5 says what it does and how it is linked, and AGENTS.md gives a change
to it a build and an arm64 guest's boot on Ambrosia.
docs/qemu.md says how a qemu-system-aarch64 with the device is configured,
which make qemu does not build, how a guest boots with the module, and what
the boots measured on the M3 Max: the console on the device, SSH with SIP
enabled and no boot arguments, the BARs where the module put them, and the
HVF assertion that the device's scanout dirty log, before 7aee20f4, hits.
The owner's ruling of 2026-11-07: remove the cause of the desktop's copy, so
there is no copy at all. On Intel's Vulkan driver (ANV) a render pass writes
back whole 64-byte lines, so a guest surface over the guest's RAM is drawn in
place only where each row starts and ends on a line. The guest's desktop
surfaces are its mode's width in BGRA8: the 3662-pixel desktop of a window
3662 pixels wide ends each 14648-byte row 56 bytes into a line, and stayed a
copy of the guest's pages, 2.54 ms of GPU time a plain frame and 3.94 ms a
frame that reads its own pixels on homelab-ms01's Iris Xe (measured by
metal2vulkan's lane). Padding the row's bytes alone cannot help: its last line
still holds bytes past its last pixel.
What the guest sees: the one mode the reims-graphics display offers, the
window's size in pixels, now has its width rounded down to a multiple of 16
(64 bytes) and its height to even, where it was rounded to even each way
(geometry::offered_mode); HiDPI modes still halve exactly. The device, the
option ROM and the kext take their modes from it, so they agree.
What the host sees (features.md, changed on purpose):
- a window of other pixels shows the mode unscaled at its top left beside up
to 15 columns and a row of black, where it was at most one of each;
- a new window opens on whole pixels a multiple of 16 wide and even high
(AppKit's sizing and SDL's first size), so it shows no black;
- AppKit's windowed window resizes in steps of 16 by 2 pixels (its content
resize increments at the scale of the screen it opened on). SDL takes no
increments, so on Linux a resized window can show the black columns.
The tests that held the even rounding change with it:
geometry::a_drawable_offers_a_mode_a_multiple_of_16_wide_drawn_unscaled,
sdl::units::a_window_opens_a_multiple_of_16_pixels_wide_at_fractional_scales,
and the macOS shell's sizing tests, with a new guard for the increments.
macOS's FrameSink and Linux's were two copies of one trait since the drawable
path went: a presenter over the window's Vulkan surface, and the guest's cursor
position. It is now one, in present.rs beside the Presenter it makes, and each
OS's render thread asks it the same way. The window crate's public FrameSink
is that one, so reims-vgpu's sink is unchanged.
Nothing changes for the guest or the host.
BucketOrderMap (the task table), ListOrderMap (the resource caches), FirstFitVa
(the root task's address space), StagedMutex and ProcessOnce served the
paravirt device's tasks, and nothing in the workspace uses them since it went:
a grep finds no user outside their own files, and the workspace builds and
lints without them. They go with their tests. LookupMap and KeyHasher stay:
the display's pipeline cache and the decoder's tables use them.
Nothing changes for the guest or the host.
On macOS a FrameSink could draw into each drawable the render thread took of
the layer (`draw`, with `device` and `render_target_only` to set the layer up),
or present through a presenter of its own (`presents`, `presenter`). Only the
Metal platform's sink drew into drawables, and it is gone: the one sink left,
the Vulkan platform's, presents through its swapchain, answering no device, a
draw that drew nothing, and drawables that take transfers. So macOS's FrameSink
is now Linux's, `presenter` and `guest_cursor_position`; the render thread
always draws through the presenter; and the layer is set up as it was for that
sink: no device (the swapchain sets it), not framebuffer-only. The sink's two
per-OS impls become one, and reims-vgpu no longer links objc2-quartz-core, its
objc2 and objc2-metal only in its macOS tests.
Nothing changes for the guest or the host. The view's layer test now checks
the one setup there is (`a_layer_is_bgra8_opaque_and_takes_transfers`); a
window whose display ended before it opened, which draws nothing, no longer
sets its layer framebuffer-only. features.md keeps every entry and guard.
The Metal platform is gone (the commit before): AGENTS.md, README.md and the
docs now say the library carries out the guest's calls on the Vulkan
platform, on Linux and on a Mac over MoltenVK for development and tests;
that the display's shaders live in the Vulkan crate; that `cargo xtask
dist` writes target/dist-vulkan on every OS; and that the tests of the
Vulkan platform compare with Metal's recorded answers. architecture.md's
section 4.6 describes the answer layer and the macOS message layer in
place of the metal crate's. conventions.md keeps "core changes as little as
the Vulkan and Linux work allows" without its reason, the Metal product.
The display showed the guest's scanout again at a refresh only where the
host's dirty log said the guest wrote it (scanout_written, QEMU's log over
BAR 2's allocations). The scanout shows only at boot and in recovery, and
the owner takes its full cost for the simplicity (2026-11-07): the
callback, RvgGraphicsScanoutWrittenFn and RvgGraphicsCallbacks'
scanout_written, are gone from the C API, with reims-vgpu's
ScanoutWrittenFn and reims-graphics' Host::scanout_written.
Each refresh while the guest has a scanout now asks the screen to show it
again (Screen::present). The window draws it only while it shows the
scanout: while a presented surface shows, a refresh draws nothing, and the
guest's presents alone draw, as before, so an accelerated desktop's
refreshes cost no frame (a 4K window at 120 Hz would otherwise copy about
4 GB/s for nothing).
For the host: RvgGraphicsCallbacks loses its scanout_written field, so the
cursor callbacks after it move up one pointer; QEMU's reims-graphics-pci
no longer sets it (the commit before). For the guest: the boot and
recovery screens show what the guest wrote by the next refresh, as before.
Window::frames_asked counts the frames a window is asked for, which the
new tests read: a refresh draws the scanout while no surface shows, and
nothing while one does.
architecture.md and api.md described Apple's paravirtualized device: its
tasks, FIFOs, displays, frames, IOSurface and video devices, suspend and
resume, isolated tasks, the suite's runner and QEMU's apple-gfx. api.md now
specifies the C API there is, the graphics device's ten functions, with its
threads and locks in section 5, which the header cites. architecture.md
describes the crates and the device as they are, keeping the section and
decision numbers code cites; the numbers of what went are retired, not
reused.
On Linux the Vulkan platform is the library's only one, yet reims-vgpu and
reims-vgpu-c refused to build without their `vulkan` features (a
compile_error!), and the code behind it did not compile either: a
default-feature Linux build of the package failed. A crate that does not
build in a feature setting is a failure, so the platform is now unconditional
on Linux.
- reims-vgpu's new build script sets `cfg(vulkan_platform)` on Linux, and on
macOS with the `vulkan` feature, declared for check-cfg. Every
`feature = "vulkan"` gate in the crate is that cfg; the gates of "macOS or
the feature", true on every target the library builds for, are gone.
- The Vulkan platform's dependencies are not optional on Linux; on macOS they
stay the feature's, optional, so the Mac's default build is as before.
- reims-vgpu-c makes every handle on VulkanPlatform on Linux whatever its
features; the compile_error!s go.
Behaviour is unchanged on both OSes: on macOS every cfg answers as the
feature did, and on Linux as the builds with the feature did. The docs and
comments that said Linux needs the feature say it no longer does.
A Rust panic in the graphics lane's code, a bug that guest input can reach,
ended QEMU: the panic hook aborted before anything unwound, and a refusal
scope would have re-raised the unwind anyway (ledger R099g). The lane's rule
is that no guest input ends QEMU (docs/graphics-kext/design.md, "Guest input
the host refuses").
Inside a refusal scope the hook now writes its line and lets the panic
unwind, and the scope answers it as a Refusal of DeathId::Panic, logged at
ERROR as the bug it is: the op is refused as for a death there. Outside every
scope (the paravirt device, the host's calls) a panic aborts as before.
Under the test capture a panic still fails its test, passing every scope, so
the decoder's fuzz and every test's assertion in scoped work still fail.
What the guest and the host see changes: an op whose decode panics is
refused (its create unanswered, its command buffer failed, a completion
handler's work ended alone) where QEMU ended before.
Each exec (op 55 or 67) of an isolated task waited for four woken threads in
turn: the connection queue's worker delivered the message, the service queue's
worker ran the job, the link queue's worker ran the reply, and the FIFO thread
woke on it. On the M3 Max, in a macOS 26 guest's Finder drag at 120 Hz, those
hand-offs were 0.41 ms of the FIFO thread's 1.41 ms of execs a frame on the
Metal platform, and 0.48 to 0.9 ms a frame on the Vulkan one; a trace on an
Iris Xe put them at about 0.15 ms an exec, 6 ms a frame.
The FIFO thread now delivers the exec itself (ServiceLink::send_here): it takes
the connection queue's turn and then the service queue's, with
SerialQueue::sync, and the service runs the job there, as the task's code. The
reply, made on that thread, runs there too when the link's queue is idle with
nothing queued: its turn on that queue (SerialQueue::hold_if_idle, a held turn
that waits for nothing and wakes no one) is taken under the state lock, under
which every hand-over to the queue happens, so it keeps its place in the order
of the service's messages and replies, and runs outside the task's code, as on
the queue's worker. When the link's queue is busy, its worker runs the reply
as before.
What the delivery holds with no holder goes when it returns
(rt::held::LastResortScope), as the queues' workers release theirs.
Messages still reach the service in send order, jobs run in arrival order, and
replies run in the order the service made them. A death in the job unwinds to
the delivery's TaskLife::run and ends only the task, whose FIFO sees status 4.
The FIFO thread waited for the reply before as well: what changes is which
library thread runs the job and the reply, which the contract leaves free. The
FIFO thread's stack grows from 512 to 576 KiB: a queue worker's 512 KiB for the
job, and room for its own frames.
It is always on, with no switch. A cold-cache macOS 26 boot on the Vulkan
platform once stalled before its menu bar with it on; cold boots showed the
same stall with it off (a pipeline compile into empty caches held an exec past
the guest's own 10 s check), and warm boots were clean either way.
The tests of the queues' workers that the delivery now skips take its path,
and the reply's worker path is tested through a busy link queue. A drop-order
test's scripted service blocked in its exec handler until the test thread
opened a gate; its GPU completion now comes from a thread of its own, as a
Metal completion handler's does.
Issue #135: with the mouse passed through to the guest (QEMU's usb-host), the
window drew the guest's glyph at the host's pointer, which never moves, while
the guest's cursor moved elsewhere.
At each cursor doorbell the window now reads the guest's cursor position
through its sink, via the display's core, which the callback's block holds.
A change of position with no pointer event of the window's in the second
before means something else moves the cursor: a passed-through mouse, or the
guest placing its own. The window then draws the guest's cursor into its
image at that position, and the host's cursor is invisible over the image.
The window's next pointer event gives the cursor back to the host's pointer.
A doorbell that moves nothing (a show, a hide, a glyph change) changes
nothing. The lead is timed on the platform's clock. There is no option: the
window decides from what the guest does.
The glyph is a second draw in the display's own render pass, after the
frame's and before its endEncoding (DisplayCore::encode_current_frame_with
and an OverlayDraw), so the target is stored once, with no pass that loads it
again. The host's encode_current_frame is unchanged and draws no overlay.
- The draw uses the display's own quad buffers over a viewport that is the
glyph's rectangle, clipped to the image by a scissor.
- The pipeline is the display's overlay pipeline, kept in its cache and made
of its functions (DisplayPipelineCache::overlay_for). Colour attachment 0
blends premultiplied (RenderPipelineDesc::blend_over, on Metal and Vulkan).
- The glyph's texture holds it premultiplied, so a scaled glyph's filtered
edges keep their colour.
- The runtime hands a viewport to Vulkan as it is, so a glyph whose viewport
would reach past the least bounds Vulkan sets every device ([-8192, 8191],
4096 wide) is not drawn: only one at the far edge of a window over 8000
pixels across.
Nothing the guest reads moves for it: the pass makes no buffer, and on the
Vulkan platform the glyph's texture is the platform's own
(VulkanDevice::new_own_texture: no resource ID, no range of Metal's space).
The pipeline and the texture are made before the display encodes the frame,
outside the time a guest's present waits on. The position is read without
dying while the guest display is paused (DisplayCore::guest_cursor_position).
Tests: the lead and the doorbell's read; the placement, the clip and the
viewport bounds; the overlay draw's place in the display's pass; pixels
on Metal and on the Vulkan platform through SinkDisplay::encode, at 1:1,
scaled, letterboxed and clipped; the own texture's ID and address; the
blending pipeline value on both platforms. features.md gains the entry, with
a manual walk owed.
scripts/ mixed the one script a person installing reims-ctl runs,
install-ctl.sh, with eight that only developing the project runs: the worktree
and build environment, the GPU locks, the VM boot and tour drivers, the window
walk and the IOSurface qtest. Those move to scripts/internal, so scripts/ holds
what users run. run_vmapple.sh, walk_window_macos.sh and vm_drive.py find the
repository from their own path, one level deeper now; every reference in the
docs, the Makefile, the video crates' tools and the code's comments follows.
Tests that pass alone failed under the check's load:
- client_direction's GPU-faulting test failed 9 to 14 others of each
check on the M3 Max; it runs first and alone;
- the Vulkan crate's paging and unmap tests held work in flight with busy
kernels sized for the M3 Max, too short on an RTX 5080 Laptop GPU; each
holds as long as it means, through gpu::spin;
- Metal's compute answers are made in a child the test restarts when the
compiler service crashes;
- a released ICB's ID may come back once the handlers ran, timed by the
crate's clock.
docs say what a busy kernel holds and what it cannot, and tie a compiler
crash's client to its binary.
Source: 3ff3ef405 f278b85aa 88b524c90 92ffe0067 38bd30f60 084cad5ae c442c1d44
294a44dcf
- A no-copy buffer's and a descriptor's deallocators ran core's closures on
Metal's threads unmarked, so a panic unwound into Metal's frames; each
now marks its thread for the call.
- A death inside an isolated task's function resolver unwound through
Metal's deserializer frames. The context catches it in
functionWithFunctionRef: and carries it across them, and a raise Metal
answered past lands in the send's hold.
- A dead isolated task's IOSurface references leak, as its other handles
do, and REIMS_VGPU_TRACE writes a timed trace on Metal too.
- The macOS 27.0.1 hang workaround made its no-draw pipeline at every pass
over a mutable rate map. A pass is now marked, a draw of at least one
whole triangle (3 vertices, an instance or more) removes the mark, and
endEncoding makes the pipeline only for a pass still marked.
For the guest: an ICB-capable pipeline's uniqueIdentifier is Metal's own
until the first pass over a mutable map that ends with no such draw, where
it moved from the first pass over a mutable map, drawing or not. The
rate-map suite cases pass unchanged, so no expected file changes.
Source: f27786809 affb99292 24b5acbfe 165cad0bc e8409d961 c2eec45a8 9b0dfdb79
8b2cd7ebb 79e3df85c
- The root task's allocator rounded sizes and block ends with wrapping
arithmetic, so a request near 2^64 could take a block it never held. Such
a request now fails and changes nothing; no guest or host reaches it
today, as every root-task mapping is at most 2^32 bytes.
- Two FIFOs of one in-process task binding a resource's guest pages at once
could each make a transfer buffer, and the second store released the
first. Apple's framework keeps the overwritten buffer (read in macOS
27.0.1's ParavirtualizedGraphics), and now every kind keeps it too.
- The IOSurface device lookup that the mapper service and the video and
scaler devices make on their own threads retained the device, so a host's
last release during a lookup left the teardown to the lookup's thread. The
lookup now never retains the device.
- A test pins the hang of an EFI display ending a display as Apple's
framework's own, and three docs say what the code does.
For the host, under those races alone: it gets no unmap of the overwritten
transfer buffer, the GPU VAs placed after it are numbered after it, and its
last release of an IOSurface device always runs the teardown on its own
thread.
Source: 26e0df468 e3babe69d c855160f3 18f681533 31a47a52b befc42c4a 15790979b
9c62ee575 022e74743
A click into the image captured only the keyboard: the host's pointer could
still leave the window for the bars, the title bar or another app, where a
click meant for the guest's edge landed on the host instead. Capture now takes
the pointer too, and never one without the other: while captured, the host's
pointer is held over the image, and ⌃⌥⌘ (Ctrl+Alt+Super on Linux), Release
Input, losing focus or closing frees both.
On AppKit's window the hold is NSWindow's mouseConfinementRect, the property
SDL3 confines its macOS windows with, which AppKit leaves out of its headers;
a window that does not answer it leaves the pointer free and logs one line.
On SDL's windows it is SDL's mouse rect, rounded out to whole points so the
image's last row and column stay in reach, which SDL keeps with the
compositor's pointer constraints on Wayland, XFixes barriers on X11 and the
same property on macOS; where SDL has no mouse rect, its mouse grab holds the
pointer in the whole window. In native full screen an image that reaches the
screen's top or bottom edge takes the pointer there, where macOS slides its
own menu bar or Dock in.
features.md, README.md, docs/api.md, docs/architecture.md and the module docs
say so. The macOS walk releases capture wherever a step needs the pointer off
the image, captures before Finder takes focus in C4, and walks the hold at
each edge and corner (C2), at the window's edge (C2e), across Mission Control
(C2m), in full screen (C2f) and after a mode change (M4), which only a
person's own mouse shows: a warped pointer, or one moved by events posted at
the HID tap, is not held.
An x86-64 macOS guest running Apple's arm64 GPU driver, ported, needs the
IOSurface host device vmapple has as apple-gfx-mmio's second region: the
driver's start waits for its mapper's service, and every texture over an
IOSurface is a mapper texture. reims-ctl now gives every x86-64 VM on
reims-vgpu that device, with no opt-in, and Apple's own x86-64 driver keeps
running as before.
For the guest:
- apple-gfx-iosurface-pci (106b:eeef, ours) sits at 00:06.0 next to the GPU
at 00:04.0: its registers in BAR 0 at 0x1000, 8-byte accesses passed
whole, one MSI vector per completed command. A reset returns its
registers to 0, ring size aside.
- 0x1028 offers the second, 0x400-byte descriptor form only where its table
holds all 8192 mapping ids (16 KiB pages); on x86-64's 4 KiB pages it
reads 0, and the guest's mapper takes the first form, which fills them.
- On apple-gfx-pci, a task other than task 0 runs isolated only if the
IOSurface device has a descriptor table when the guest defines it, and
device info offers argument buffers (key 33 bit 0x20, key 42) only while
it has one. Apple's x86-64 driver, stock (binary version 6) or patched by
reims-util (245), never programs the IOSurface device and makes ref
textures whose backing is in task 0, which an isolated task does not
serve (testing.md 6.20); its tasks stay in process and its device info
is as without isolation. The ported driver's mapper programs the device
before its GPU driver starts, and its tasks run isolated, which its info
replies need. apple-gfx-mmio still isolates every task.
For the host:
- apple-gfx-pci has no option for this: adding apple-gfx-iosurface-pci is
the only switch, and a VM without it runs as before. Its gpu link is
optional, the machine's only apple-gfx-pci when unset. vendor/qemu moves
to bd95509a.
- RvgDeviceConfig gains process_isolation_follows_guest at its end (64
bytes; a host that passes 56 reads it false), and the Rust API's
DeviceConfig the same field; apple-gfx-pci always sets it with
use_iosurface_mapper and process_isolation. Each task made under it logs
whether it runs isolated or in process, and device info logs each change
of its argument-buffer answer.
- reims-ctl's q35-x86_64 profile adds
apple-gfx-iosurface-pci,id=iosfc,gpu=gfx,addr=0x6; vmware-svga and
vmapple VMs are unchanged. reims-ctl and QEMU from this commit go
together, as its installer installs them.
- On Linux, the detach heap's temporary and a writable alias with zeros
past its pages come from a range of a file of the library's own, so the
Vulkan platform can alias and import them; QEMU no longer ends at an
x86-64 guest's first such heap. macOS is unchanged.
- The first command given to a task whose service has died writes one
warning naming the task.
- scripts/qtest_iosurface_pci.py checks the device under qtest (27 checks).
Checked: cargo xtask check and the suite on the M3 Max; reims-ctl's install
and a cold boot on um780; stock, reims-util and ported-driver guests booted
on gem10 and ms01 with the isolation rule, Apple's driver's tasks in
process at about 62 fps, the port's isolated.
A new x86-64 VM needed an OpenCore image and an installer made by hand with
OSX-KVM or ULTMOS. reims-ctl now runs reims-util for both: pick a macOS
version (n in the interface, create --macos on the command line) and it
downloads the installer from Apple, makes the VM's OpenCore image with OVMF
and a Mac identity of its own, and makes the disk.
- create --macos VERSION downloads Apple's recovery image (about 1 GB), or
with --offline an installer of one release (13 to 20 GB). Installers are
kept in the data directory's installers for the next VM, one reims-util at
a time writes there, and a stopped download continues. The download comes
before the VM's directory, so stopping it leaves no VM half made, and
reims-util ends with reims-ctl on Linux. What create is given (a disk, an
installer, an OpenCore image and the OVMF beside it, reims-util itself) is
checked before the download and the disk's copy, and the VM list is read
again before the VM joins it, so VMs made or deleted during a download
stay as they are.
- --opencore is optional: without it reims-util makes the image, with the
VM's MAC as its ROM, and an iMacPro1,1 for macOS 10.13 and 10.14. An image
of the user's brings OVMF_CODE.fd and OVMF_VARS.fd beside it, as
reims-util writes them.
- The interface's form asks where macOS comes from, the version first; with
no name, the VM takes the version's, skipping names a VM or a leftover
directory has. A VM with an installer says in its details, and create
prints, how to install macOS from it; one made from a disk is reminded to
set Metal's error mode.
- A new disk needs an installer or a download: a VM of an empty disk and no
installer is refused.
- Every installer attaches as a read-only disk (snapshot=on), a DMG
converted to a raw image in the VM's directory, so the CD drive is gone: a
change of installer applies at the next start. vm.toml's installer_kind
is no longer written, and is ignored where an older vm.toml has it. A
missing installer says how to eject it.
- reims-ctl __record-install, which scripts/install-ctl.sh runs last,
installs reims-util at the commit reims_util.rs pins, so the update that
brings this reims-ctl installs it too, though it runs the script it
started with. doctor checks for it in place of the system's OVMF, and the
install no longer adds the ovmf or edk2-ovmf package.
- vm.max_map_count: a new VM's default of up to 16 GiB needs about 1.13
million mappings, more than the 1048576 suggested (CachyOS's stock
value). The README, the install script, doctor and the start warning
suggest 2097152, which covers 30 GiB, and check against what the VM, the
largest VM or a new one's default needs.
- Updating from the interface while a create runs says the restart stops
it, as quitting does.
Dropped, as reims-util's images leave nothing for them to cover:
- create --from-script and the interface's launch-script import, which read
OSX-KVM's and ULTMOS's QEMU scripts. A VM made from one keeps working; its
vm.toml names its own copies.
- The search for OVMF beside a user's OpenCore image in those projects'
layouts, QEMU's edk2 build and the distributions' packages, and
--firmware-code and --firmware-vars.
- create --disk-mode overlay: copy, a reflink where the file system can, or
in-place covers an existing disk. A VM made with an overlay keeps working.
- --cpu-model and --cpu-flags on create and set, and the edit form's CPU
fields: new VMs take Skylake-Client-noTSX-IBRS. vm.toml keeps cpu_model
and cpu_flags, so an older VM keeps its model; docs/qemu.md says how to
change it there.
- --installer's --iso and --cdrom aliases.
README, the help and the docs no longer point at OSX-KVM or ULTMOS. README
step 3 describes reims-util's OpenCore picker (5 seconds, which an arrow key
stops, measured on homelab-ms01), and architecture.md 11.4 counts its image
among those that keep AvoidRuntimeDefrag on.
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.