The x86-64 set (make -C guest prebuilt) and the arm64e set (make -C guest
prebuilt-arm64e), rebuilt on the M3 from this tree: the kept framebuffer, ring
0's completion arm-once, the kept framebuffer's liveness check, and a commit's
publish made in the kext call that posts the held messages. make -C guest
prebuilt-check passes for both.
The x86-64 and arm64e sets from this tree: the bundle's completion thread
arming an idle ring once, its deliveries arming the held destroys' timer
after their waiters go, and the kext writing ring 0's submit data through
a write-combined map on x86-64. Built by m3-max-29200 on the M3 Max, where
make -C guest test and make -C guest prebuilt-check passed.
The kext takes RGFX_FEATURE_READ_ONLY_PAGES and makes read-only pages
blocks, and the bundle lays read-only no-copy memory over them (the two
commits before this one). The x86 set (with the KDK) and the arm64e set are
rebuilt from the tree on the M3, with their sources records; make -C guest
prebuilt-check and make -C firmware prebuilt-check pass on it.
The host sees a command buffer only once a queue's thread takes it off its
ring, so the app's encode and the buffer's way to the host show as one span
with nothing pending on the host. This adds the guest's stamps that split it,
a diagnostic.
What changes for the guest:
- The device offers a new feature bit, RGFX_FEATURE_GUEST_TIMES (bit 44,
FEATURES_HI bit 12), and DRIVER_FEATURES takes it. The kext carries it.
- Where the device's word holds it, the bundle starts each command buffer's
stream with a new op, RGFX_OP_GUEST_TIMES (0x000e, 32 bytes): the guest's
clock as the buffer was made, as its commit was entered, and as its message
went on its ring. The last is written under the ring's lock, after the copy
and before producer is published; for a buffer in a block, into the block.
- After each VBLANK's reading of HOST_TIME the kext writes ring 0's new header
fields: guest_clock_offset_ns (0x18), then guest_clock_bound_ns (0x20) with
release, split out of reserved bytes. The host zeroes both as it initialises
a ring.
- The decoder walks the op as a no-op, so it changes nothing a buffer does,
and a host that did not offer the bit never sees it. Old guest sets carry
no bit, send no op and leave the fields 0.
The header is regenerated, both guest sets are rebuilt from the same sources,
and the option ROM's record takes the header's new hash; the ROM's bytes are
unchanged. The tests cover the op's and fields' layout (the header test, the
kext's vblank clock test), the bit's negotiation (the kext's features test,
the peer and memory-map tests), the stamps (the bundle's serializer and shell
tests) and the walk (a cmdbuf test, and the fuzz's streams). The host's
reading of the stamps is the next commit.
The kext answers each surface's lock and unlock seeds (SurfaceSeeds, 13) and
counts a surface's pages out of the contexts' lock; the bundle
syncs a copy again once a CPU write lock it caught is let go, and
says on its "surface copies" line whether unlock seeds are on and what they
did. Built on the Mac with Xcode 27.2 by make -C guest prebuilt
and prebuilt-arm64e on the tree these commits sit on, both sets checked by
make -C guest prebuilt-check.
The kext carries DOORBELL_ASKS and the bundle rings an asking buffer's
doorbell apart, so both sets are rebuilt from the guest's sources, and the
wire header's new constants change the ROM's record of its sources; the
ROM's bytes are unchanged. Built on m3-max (m3-max-25849) with
make -C guest prebuilt, prebuilt-arm64e and make -C firmware prebuilt;
make -C guest test and both prebuilt checks passed there.
make -C guest prebuilt and prebuilt-arm64e on the M3 Max (m3-max-25734), from
the kext and bundle of the two commits before this one; make -C guest
prebuilt-check passes on both.
The x86-64 and arm64e kext sets are rebuilt from this branch's guest/ on
development 788d82edd (make -C guest prebuilt, prebuilt-arm64e; m3-max job
25263, which also ran make -C guest test), and the option ROM's record from
its wire.h, whose LIBRARY_LOOKUP comment moved with the v2 library key; the
ROM's bytes are the same. prebuilt-check passes on this tree.
The kext posts a let-go's BLOCK_UNSHARE before the block's release and before
any ask holds the block again, so guest/prebuilt and guest/prebuilt-arm64e are
built again from their sources: ReimsGraphics.kext changes in each, and their
records name the new sources. The wire header is unchanged, and so is the
option ROM.
The bundle and the kexts take ICB_SLOTS_IN_PAGES, so guest/prebuilt and
guest/prebuilt-arm64e are built again from their sources. The wire header
gained the message's record, so the option ROM's record names its new hash;
the ROM's bytes are unchanged.
The x86 set and the arm64e set carry the kext and the bundle as built from
6e6a80dd9: equal pipeline creates of any process answered from the kext's
kept answers, and functions' AIR read without their bodies until asked (make
-C guest prebuilt and prebuilt-arm64e on the M3 Max, job m3-max-22490). The
option ROM's record follows the wire header, which gained PIPELINE_KEYS; the
ROM's bytes are unchanged (make -C firmware prebuilt, the same job).
The x86-64 and arm64e sets carry the kext and bundle with this branch's
commits: rasterization rate maps and their descriptor's mutability, the
residency set create's nil error out, a compute pipeline's function handles
and visible function tables, and its dynamic libraries. The wire header
changed (RATE_MAPS, FUNCTION_POINTERS and DYNAMIC_LIBRARIES, their messages,
and library_count where reserved_5c was), so the option ROM's record names
the new header; the ROM's bytes are unchanged. Built on the Mac with make -C
guest prebuilt and prebuilt-arm64e and make -C firmware prebuilt (job
m3-max-21410); prebuilt-check passes for the sets and the ROM.
Regenerate the prebuilt x86 and arm64e guest sets and their records from the
sources of the commits before, on pin 50's tree with Graft 0.3.0: the kext
has IOSurface align the bytes per row and the plane offsets it works out to the
host GPU's linear alignment, which every host that offers the surfaces' pages
answers now. Only ReimsGraphics changes in each set. The option ROM's bytes
are unchanged; its record moves with the wire header's comments. Built on
m3-max by job m3-max-20375, which also ran make -C guest test and both prebuilt
checks.
Regenerate the prebuilt x86 and arm64e guest sets, their records and the
option ROM's source record from the combined sources of batch 18 (x86
display-sleep, sampler LOD bias + reduction mode, guest-class Mac present).
The ROM bytes are unchanged (749434f8); the C header cbindgen writes was
already the combined one from the cherry-picks.
A slab of the Metal bundle's own memory, 2 MiB of plain pages, reaches the host
as up to 512 runs of guest RAM, since the guest's kernel scatters 4 KiB pages.
The host maps each run of a view apart against a per-process budget of
mappings (vm.max_map_count, 65530 by default on Linux): on NVIDIA, views of
scattered pages, slabs' among them, used up the budget and the buffers made
after it were copies.
The kext now gives a slab's memory as physically contiguous 64 KiB chunks
(selector 12, PagesChunked, kext feature 1 << 8): it takes them zero-filled,
maps them into the process in order and makes the pages block of their runs,
so a 2 MiB slab is 32 runs at most. The memory is the block's: the slab's
release takes it, and the kext unmaps it from the process and frees the chunks
once the device has answered the block's release, or at the client's close. A
slab the kext gives no chunks for is plain pages, as before.
64 KiB is the size the kernel gives at once however long the guest has run. On
an 8 GiB x86-64 macOS 26.7.2 guest on the Radeon 780M host, 4,096 chunks in a
row took 0.033 ms each, and 0.036 ms each once 978 MiB of 4 KiB pages had been
taken, the slowest 0.74 ms, none refused. Of 128 runs of 2 MiB asked, the same
guest gave 28 quiet and 16 once memory had been taken, the slowest in 264 ms.
Measured with the chunked set against development's, each on its own boot.
On the Radeon 780M, an x86-64 macOS 12.7.6 guest (manypieces' m3-max-18395
against m3-max-18394), the host's copy-ins of guest pages fell from 632.8 to
0.9 million texels a second in a WebGL scene (gl3d), from 202.4 to 0.2 playing
1080p video in Safari, 96.4 to 4.7 scrolling, 84.6 to 22.2 in Maps, 31.8 to
8.1 in Launchpad and 21.7 to 1.1 in Mission Control; gl3d drew 39.5 frames a
second where it drew 34.1, the GPU 51.4% busy where it was 63.7%. The slabs,
WebKit's tiles, the WebGL drawing buffer and the video's BGRA buffer among
them, are now used in place there; what is still copied is no-copy buffers
over an app's own pages. On the Iris Xe, a 26.7.2 guest's walk (m3-max-18417
against m3-max-18418) peaked at 85,951 of QEMU's mappings where it peaked at
94,896, and scrolled and drew as before (58.8 and 58.7 frames a second
scrolling, 47.5 and 47.1 in gl3d); manypieces' Iris pair (m3-max-18398
against m3-max-18397) drew gl3d at 48.6 frames a second where it drew 43,
with the same copy-ins. An arm64 macOS 27.0.1 guest on the M3 Max under HVF
passed the arm64 gate's 15 checks with the arm64e set (m3-max-18496).
Tests: a heaped slab and a large Shared slab are the kext's chunks first, the
heap and the buffer over their block with no pages asked of the kernel; a slab
the kext gives no chunks for is plain pages; a chunked slab's memory goes with
its block's release alone, a plain one's pages after it. The user client's words
test holds selector 12, its feature bit and the chunk's size. make -C guest
test, prebuilt and prebuilt-arm64e on a Mac, and both sets committed here; make
-C guest prebuilt-check passes.
The x86-64 ReimsGraphics now says its display is built in, keeps its EDID
under 32 inches with the window's size in a text descriptor, and answers a
mode the device no longer shows as never shown and not valid. make -C guest
prebuilt and prebuilt-arm64e rebuilt both sets on a Mac (m3-max-17233,
whose prebuilt-check and make -C guest test passed). The arm64e binaries
are byte for byte the same, since the changes are x86-64 only; the arm64e
set's sources.toml records the changed sources.
The guest's x86-64 and arm64e sets, built by make -C guest prebuilt and make
-C guest prebuilt-arm64e from the tree with the feature (bit 36) and the
bundle's messages, beside the no-copy buffers' joined pages blocks, and the
option ROM's record, whose wire header changed; the ROM's bytes are unchanged
(make -C firmware prebuilt). Built on the M3 (m3-max-16888), whose make -C
guest test passed first.
ReimsGraphics' sources changed (it takes DISPLAY_SCALE and gives the OS
the display's density from it), and so did the wire header it compiles,
so both sets are rebuilt from the tree on Graft 0.2.0: ReimsGraphics
changes on x86-64 and arm64e, while Graft and RgfxGate are byte for byte
the sets before. The option ROM's bytes are unchanged; its record took
the header's hash with the header.
ReimsGraphics, x86-64 and arm64e, built from the commit before, whose
accelerator personality holds only its matching and driver keys and whose
start sets the accelerator's other keys on its registry entry. Graft and
RgfxGate are unchanged, byte for byte.
Built by `make -C guest prebuilt` and `make -C guest prebuilt-arm64e` on
m3-max (potluck job m3-max-15864, Xcode 27.2), with `make -C guest
prebuilt-check` and `make -C guest test` passing there.
The sets of the two commits before this one, from package job m3-max-15762.
ReimsGraphics changes in both sets: the arm64e one for the external display that
is plugged in from its start and for the mode change's hot-plug notices, and the
x86-64 one for the fields and refresh flag that the hot-plug commit adds. Both
are byte-identical to the ones the boots tested at 78eec022a. Graft and
RgfxGate are byte-identical to development's.
IOSurfaceRoot answers INT_MAX for the largest surface's width, height and bytes
per row (IOSurfaceGetPropertyMaximum) until an accelerator lowers them at its
start, as a Mac's GPUs do: 16384 wide and tall on the Intel and AMD Mac, with
131072 bytes a row, and 16384 and 32768 on the M3. The kext lowered none, so
our guests answered INT_MAX. Safari 16.6 under macOS 13 divides the maximum
width by the screen's scale in float to size the tiles of a page that scrolls
only vertically: at 1x that is 2^31, its int overflows, and every such page drew
only its scroll bar, on every host GPU. In a HiDPI mode the same page drew.
The kext now lowers them at its start, from the device info: the width and the
height to the device's max_texture_width_2d and max_texture_height_2d, which
the bundle answers to Metal, and the bytes per row to that width times 16, the
largest pixel a texture over a surface has (RGBA32Float). updateLimits' three
limits are named from a measurement: a probe kext's three distinct values, read
back in a 13.7.8 guest, came out as the bytes per row, the width and the height.
The row alignment the kext asked for before is asked for as it was.
What the guest sees: IOSurfaceGetPropertyMaximum answers the device's width and
height (16384) and 16 times the width a row, where it answered 2147483647.
surface_limits_test holds the limits it takes from the device info.
Checked: make -C guest test, both sets and prebuilt-check on the M3 Max. Cold
boots with this change's library and set, through the desktop, Finder,
Launchpad, Mission Control, Safari and the tall pages: 11.7.11, 12.7.6, 14.8.9
and 15.8.2 on the 780M, 13.7.8 on the 780M and the 3090, 26.7.2 on the 780M,
and arm64 27.0.1 under HVF (check-boot, 15 of 15). Each answered 16384, 16384
and 262144, and 13.7.8 drew the tall pages at 1x.
Both sets now carry Graft 0.2.0 (graft-0.2.0.zip, Graft commit 540b563da5),
byte for byte the Graft and Graft-arm64e that its vendoring builds.
ReimsGraphics registers its accelerator only once its framebuffer has started,
and logs each failure once a boot and its summaries once a minute. The arm64e
ReimsGraphics also shows a swap's layer 1 as the device's cursor, on every
release from 14 to 27.2.1. RgfxGate's Metal bundle sizes the two-plane XR10
textures and logs each failure once a process. Built on the M3 Max, job
m3-max-14931, with the guest's native tests, prebuilt-check and the Ambrosia
module's bundle passing.
The kext forwards the surface's layout with its cached and deferred blocks'
SURFACE_PAGES, so both sets are rebuilt (make -C guest prebuilt, make -C
guest prebuilt-arm64e): ReimsGraphics' binaries, their hashes in set.toml
and the sources' records. The wire header's docs changed with it, so the
option ROM's record takes the header's new hash (make -C firmware
prebuilt); the ROM's bytes are the same.
Built on the M3 Max (Xcode 27.2, 27B52) in potluck job m3-max-14709, which
ran make -C guest test first and both prebuilt checks after.
Both sets take Graft 0.1.0's release build (x86-64 f3c360b6, arm64e 4cb6cd3b)
and ReimsGraphics and RgfxGate rebuilt from the tree: the ai.aneesiqbal ids
and gate property, RgfxGate's dependency on ai.aneesiqbal.graft 0.1.0 and its
void * AMFI originals, and the Metal bundle with programmable blending
answered as framebuffer reads. Built on the M3 Max with Xcode 27.2 (potluck
m3-max-13269); graft-kext, the SDK's C++ tool, stages ReimsGraphics byte for
byte as Graft 1.3.3's Python tool did from the same sources, x86-64 and
arm64e. Every executable and Info.plist in both sets changes, and
sources.toml records the vendored release.
Both ReimsGraphics binaries change: the display pipe's answer times stay on
the VBLANKs' grid and never go back (RgfxVblankClock::shownAt), and the
arm64e kext reads the two clocks together for frame info. Built on the M3
Max from 238c3f3da: guest tests, prebuilt-check and the firmware's
prebuilt-check pass, and the manifest is as before (17 Legacy imports, 24
synthesized overrides, the enqueue from library 1). RgfxGate and Graft are
byte-identical in both sets; the x86 ReimsGraphics' symbols are unchanged.
ef4fa18da's diagnostic, in both sets: the bundle counts each copy's block,
shared or its own, and the kext logs its first refusal of a shared copy block
for each reason. Built by potluck job m3-max-12223 (prebuilt-check, the
firmware's prebuilt-check, the guest tests and the arm64e manifest checks
green); Graft is unchanged in both sets.
The arm64e set's RgfxGate carries the bundle that takes an Apple GPU's
texture rules on an arm64 guest's device (2a7078b2b), and both sets'
ReimsGraphics maps whole window pages (560e96b2c). The x86 set's RgfxGate,
which carries the x86-64 bundle, is byte-identical; its ReimsGraphics
differs in code, mapping the same spans. Built by potluck job m3-max-12192.
Rebuilds guest/prebuilt and guest/prebuilt-arm64e from this branch's sources
(potluck job m3-max-12094 on d6f0a6f0a): Graft 1.3.3, the arm64e
ReimsGraphics' get_dot_pitch override and display node reuse, and the swap
dequeue, on development 46cb7f4da.
The x86-64 ReimsGraphics differs from development's by two runs of three
instructions in another order and the display name's symbol
(kRgfxDisplayName, from the shared display identity); RgfxGate by the Metal
bundle it carries; Graft is 1.3.3's, which differs from 1.3.2's only in its
version and LC_UUID. The four Boot KCs' set-check, prebuilt-check, the
firmware's prebuilt-check and the guest tests pass.
The x86-64 and arm64e sets' ReimsGraphics and RgfxGate (with the Metal bundle)
are rebuilt from the scheduled ask's sources: the kext takes SCHEDULED_ASK and
the bundle asks from waitUntilScheduled. The option ROM's bytes are unchanged;
its record names the wire header the ask's message joined.
Built on the M3 Max (potluck m3-max-11864, the 25G241 KDK): make -C guest
test, prebuilt, prebuilt-arm64e, prebuilt-check, make -C firmware prebuilt and
prebuilt-check, and set-check of the x86-64 set against the 11.7.11, 12.7.6,
13.7.8, 14.8.9, 15.8.2 and 26.7.2 Boot collections all passed.
The x86-64 and arm64e ReimsGraphics builds from the previous commit's
sources, written by make -C guest prebuilt and prebuilt-arm64e on the M3
Max (potluck m3-max-11848, where prebuilt-check and set-check on 11.7.11,
12.7.6, 13.7.8, 14.8.9, 15.8.2 and 26.7.2 passed).
Both sets carry Graft 1.3.0: x86-64 Graft ef47126b, arm64e Graft a336c87c.
Each set's ReimsGraphics is rebuilt against the new SDK.
The x86-64 ReimsGraphics changes only through its Graft manifest. The
__graft section shrinks from 0x7ea2 to 0x63e0 bytes, because the consumer
rules record no _RESERVED placeholder slots for a class with no required
list. The sections after it move with it; __text and __cstring keep their
sizes. RgfxGate is byte-identical in both sets.
The arm64e ReimsGraphics carries the synthesized display: 22 overrides,
vtable at word 0, and the class's destructors and getMetaClass carried as
required. Its IOAccelerator records 25 slots, none reserved, and it
imports no IOMobileFramebufferLegacy method but note_vbl_ISR. Its
sources.toml drops the removed local header.
Built on the M3 Max (job 11742): make -C guest prebuilt and
prebuilt-arm64e; the x86-64 set linked into 11.7.11, 13.7.8, 15.8.2 and
26.7.2 Boot KCs by set-check; make -C guest prebuilt-check, make -C
firmware prebuilt-check and make -C guest test pass.
The sets' ReimsGraphics and RgfxGate (with the Metal bundle) rebuilt from the
tree that drops superpages and the kext's superpage record. Checked on the
M3 Max (potluck m3-max-11588): both sets rebuilt, prebuilt-check, the
firmware's prebuilt-check, make -C guest test, and set-check against the Boot
KCs of macOS 11.7.11, 13.7.8, 15.8.2 and 26.7.2.
ReimsGraphics in both sets, rebuilt from the tree (Mac job m3-max-11391): its
pages counted through mach_vm_region over a kernel mapping, inside IOKit's
pageable map where the mapping lies there, with no weak import, linking
com.apple.kpi.unsupported. Graft and RgfxGate are unchanged. set-check links
the x86 set into the Boot KCs of 11.7.11, 13.7.8, 15.8.2 and 26.7.2, with
_IOIteratePageableMaps, _kernel_map and _mach_vm_region bound, and finds no
weak import.
Both sets, the x86-64 one and the arm64e one, built from the kext and bundle
that defer a surface carrying its few resident pages (SURFACE_DEFERRED_CARRY),
proved by the counted fresh test's own verdict, with their records of the
sources. OpenCore's linker injects the x86-64 set into the Boot KCs of
11.7.11, 13.7.8, 15.8.2 and 26.7.2, every import resolved, the weak page
count absent on the first three (make -C guest set-check).
The x86-64 and arm64e sets from the tree with the page count reached
through a pointer in data and the arm64e bundle's small objc stubs. Each
ReimsGraphics imports getPageCounts's three-count form weakly, from one
word of data only. Four clean arm64e builds of this tree gave one RgfxGate,
its bundle with one objc_msgSend slot. make -C guest set-check injects the
x86-64 set into the Boot KCs of 11.7.11, 13.7.8, 15.8.2 and 26.7.2.
The x86-64 and arm64e sets, built on the Mac from the tree with the fresh
test that counts compressed and paged-out pages. Each ReimsGraphics binary
imports IOMemoryDescriptor::getPageCounts's three-count form weakly.
RgfxGate's arm64e binary comes out different from the last build's (its
UUID and a span of about 24 KiB) though none of its sources changed; the
sets' check passes with either.
Safari's WebKit tiles, which the GPU alone draws, each wired 7 MiB of an
8 GiB guest at its first use on the Iris and the 780M. About 400 tiles of a
long page took WebContent's footprint past its 2 GB limit, since wired pages
count in their owner's footprint though WebKit marked the tiles volatile,
and the corpse and the memory pressure that followed stalled its frames for
100 to 800 ms (jobs m3-max-10419, m3-max-10438, m3-max-10517).
Where the host offers SURFACE_DEFERRED_ASK the kext takes it beside
SURFACE_CACHE_REFUSED and defers a fresh cacheable surface as on a GPU of
its own memory, its SURFACE_PAGES carrying ASK_CACHE and the surface's
layout. Refused, past the budget, or not fresh, it names the pages asking as
before: answered a cache, it posts them again cached; answered in place, the
device cache's entry the deferral made goes (rgfxSurfaceLocksUngate) and the
block is not cached. A deferred block's pages are wired, named and copied
only at a CPU lock that needs them, as on such a GPU.
These surfaces cannot lie in place on that host whatever their pages, so a
deferral chooses no copy over in place; it only stops eagerly wiring and
zero-filling guest pages the CPU never touches. guest/prebuilt is built
again from these sources.
ReimsGraphics keeps the guest's superpage record (selector 12, kext feature
1 << 8), and RgfxGate carries the bundle, whose pages slabs ask the kernel for
superpages only while the record is open (the commit before). Built by make -C
guest prebuilt on the M3 Max; make -C guest test and prebuilt-check pass on
it.
Graft 1.1.0's binary, and ReimsGraphics staged by its SDK: the personalities
gated by the nub's graft-bound property and the manifest's 112-byte header,
which 1.1.0 requires. Built by make -C guest prebuilt in m3-max-10354, where
prebuilt-check and make -C guest test pass.
ReimsGraphics.kext now states the GPU's PCI class as an x86 Mac's GPU states
it, and RgfxGate.kext carries the bundle whose GL lowering takes a shader's
signature where the system's LLVM lacks LLVMGlobalGetValueType, so both
binaries and the set's records change; Graft.kext is as it was.
The wire header gained RgfxVideoCaps.decode, so the kext's copy of the device
info and caps is larger, and the option ROM's record names the header. The ROM's
bytes are the same; its record's hash of the header changes. Built on the M3 Max
with make -C firmware prebuilt and make -C guest prebuilt.
The kext now names its accelerator on the framebuffer by the path as it stands,
so ReimsGraphics.kext and the set's records change; RgfxGate and the bundle
are as they were.
On macOS 12, Safari's web content process may call only the external
methods its sandbox lists on an IOAccelerator connection: 0-13, 15-18,
22-24, 28-31, 40, 42, 48, 256-265, 267, 268 and 512 in every Safari from
15.1 to 17.6. Its sandbox refused Features (0x10f) before the kext saw it,
and the bundle went on without the kext's features: it took 64-id chunks
where the kext granted 16, and the host refused the textures past each
chunk's first 16 ids (BadResourceId), so pages drew without their body and
text. Under Safari 15 and 16, SurfaceBlockRelease (0x10a) and
SurfaceRetire (0x10d) were refused too. macOS 11, and 13 and later, list
no numbers.
What the guest sees:
- New selector numbers, selector map 1: Features 3, PagesBlock 4,
TakeAnswers 7, SurfaceBlockRelease 8, SurfaceRetire 9, and a shared
event port's Export 10 and Import 11. 1, 5 and 6 stay reserved, 2 is
given to none, and the rest keep their numbers. No number of map 0
takes a new meaning, so a bundle or kext of map 0 is refused, not
misrouted.
- Features answers a third word, the selector map, and keeps its number
in every map. A bundle that meets another map has no Metal device.
- ResourceIds answers the chunk's size after its first id, and the bundle
takes its chunks at that size.
- Where the bundle's setup left a stubbed device (no features, the device
info unread or of another version, the context or the user client not
opened) or returned silently (the IOGPU base declined), the process has
no Metal device, with a log line that says why. A host's video caps of
another version still leave the device without video codecs, now
logged.
user_client_words_test holds the sandbox's set, checks every selector and
the kext's routing against it, and checks that every IOConnectCall*Method
in the bundle's sources names one of them. design.md's registry gives map
1 and what map 0 was. The kext set is built again.
The set carries Graft 1.0.0, which binds an absent weak import to what
gOSKextUnresolved holds and verifies an imports-only provider through its
anchor class, and the ReimsGraphics that sends each pipe client its
release's completion word count. Rebuilt with make -C guest prebuilt
(LC_ALL=C, SOURCE_DATE_EPOCH of the change); prebuilt-check and the guest
tests pass on it.
Graft 1.0.0 is its first release. It reorganizes the repository: the built
kext moves from dist/ to built/, and the header, start glue and build rules
move under sdk/. It also binds an absent weak import to the pointer
gOSKextUnresolved holds, and verifies an imports-only provider through an
anchor class, which kextvers needs for macOS 11 and 12.
Point the guest build, the OpenCore link check, the lane gate and the
design doc at the new paths, and rebuild guest/prebuilt from them.
The set was Lilu, ReimsGraphicsLoader, two generated shim kexts, ReimsGraphics
and RgfxGate, gated to macOS 26.4 to 26.x: the loader's tables held one
ReimsGraphics build's site offsets and one KDK's class layouts, so any kext
change needed a new loader, and no other release could bind.
Now the set is Graft, ReimsGraphics and RgfxGate, with no kernel range:
- ReimsGraphics builds for macOS 11 with Graft's consumer rules. Its build
embeds a manifest of every System-KC site and parent class, so Graft binds
it by name against the running libraries and checks their layouts, and a
kext change never needs a new Graft.
- RgfxGate is a Graft client built against the SDK's Kernel.framework and
Graft's header and start glue; Lilu's headers and MacKernelSDK are no
longer fetched.
- guest/loader, both shims, the KDK tables and fetch-lilu.sh are deleted; the
prebuilt set needs no KDK.
- prebuilt-check also verifies guest/graft against its record, and records
inputs git does not track yet. set-check links the set with OpenCore's
linker and checks with Graft's prelink.py that ReimsGraphics stays bindable;
it replaces the kext's own shim-based link check.
The set check passes on all ten matrix releases' Boot KCs (11.7.10 to 26.7.2).
What changes for the guest: on a host whose surfaces lie in place in their
pages and whose GPU lays a linear image's rows at more than 64 bytes, the
default IOSurface bytesPerRow becomes aligned to that GPU's alignment: 256
bytes on RADV hosts. The host says it in a new device-info field,
linear_row_alignment (the runtime's
minimum_linear_texture_alignment_for_pixel_format of BGRA8, written where the
GPU shares the CPU's memory, else 0), and the kext has IOSurface align the
bytes per row it works out to it at the accelerator's start
(IOSurfaceRoot::updateLimits, as a GPU's accelerator does), which
IOSurfaceGetPropertyAlignment then answers to the processes too. ANV and
MoltenVK hosts, which answer 64 or less, hosts whose GPU has memory of its
own, and older sets keep today's 64.
It stays inside what Macs answer: an x86 Mac answers 64 for
IOSurfaceGetPropertyAlignment of bytesPerRow and the M3 128, and the x86 GPUs'
own minimumLinearTextureAlignment of BGRA8 is 256 (m2v probe jobs 7349 and
7356).
What it removes: the runtime's Refusal::Pitch shadows on RADV. On the 780M a
3840x2160 surface at 15360-byte rows in place takes 1.02-1.14 ms a frame
against 2.79-3.10 ms shadowed, and the guest's 3662x2039 surface at 14656-byte
rows was shadowed (2.5-2.9 ms): the 256-byte pitch saves about 1.7-2.8 ms a
frame (m2v job 7389, Mesa 26.2.6). Measured on a cold boot of macOS 26.7.2 on
the 780M: IOSurfaceGetPropertyAlignment of bytesPerRow answers 256 (a
3662-pixel surface's rows are 14848 bytes), and the run's refused-pitch shadows
went from 1032 to 14.
guest/prebuilt and the option ROM's record are rebuilt; the ROM's bytes are
unchanged.
On a host whose GPU shares the CPU's memory a surface's textures use its pages
in place, but the runtime makes a texture over pages it cannot place one over
(rows that end inside the line the GPU writes back whole, on Intel; pages that
are more than one dma-buf, on RADV) a shadow, which every command buffer copies
in before its first use and merges back after a write. Such a surface is better
kept in an IOSurface device cache, copied only at CPU locks and unlocks, as on
a GPU of its own memory.
This adds the protocol for that choice, made surface by surface:
- SURFACE_PAGES takes RGFX_SURFACE_PAGES_ASK_CACHE with the surface's planes
(RgfxSurfacePagesLayout). The host answers OK, the block in place, or
RGFX_STATUS_CACHE, after which the kext makes the surface's device cache and
posts the block again cached, taking the view the ask made.
- The platform answers whether textures over the pages lie in place for every
access (GpuDevice::surface_pages_in_place). The Vulkan platform reads the
runtime's in-place verdicts for the pages' class and row ends, and on Linux
whether each plane's pages fit one dma-buf.
- Feature bit 29, SURFACE_CACHE_REFUSED, is what a host offers in place of
SURFACE_CACHE where it answers the ask. The kext asks only where it took the
bit, and the bundle hands the kext each block's planes.
- A host whose GPU shares the CPU's memory keeps device caches too, and makes
their transfer queue at the first cache, so one that makes none makes no
queue.
No host offers bit 29 yet, so nothing changes for the guest or the host.
guest/prebuilt and the option ROM's record are rebuilt for the wire header and
the kext; the ROM's bytes are unchanged.
The bundle now makes the GL renderer's OpenCL kernels' functions of OpenCL
mode and passes them to the host with the compute flag, and the kext offers
feature bit 27. guest/prebuilt is rebuilt from the macOS 26.7.1 KDK with the
bundle's 11.0 deployment target.
The reims-graphics device's video decodes on the host's hardware, but a
guest's encoder had no op to send. VIDEO_ENCODE_H264 and _H265 (0x4002,
0x4003) carry a source's two plane textures, the buffer and capacity its
access unit goes in, the buffer its result goes in, a frame index and flags,
and the settings where they change (RgfxVideoEncodeSettings, 96 bytes: size,
format, profile and level, rate control with its bitrates and QPs, frame rate,
keyframe interval, B-frames, entropy coder, quality and colour). The host
writes the access unit as Annex B, with its parameter sets on keyframes, then
an RgfxVideoEncodeResult (32 bytes: OK, OVERFLOW or FAILED, the size, keyframe
and parameter-set flags, the frame's index and picture type), then signals the
session's event.
The video caps gain an RgfxVideoEncodeCaps for each entry, at 0x410: the rate
controls an encode entry takes and its most B-frames, all zero for a decode
entry and from an older host, which a guest reads as no encoder.
cbindgen.toml lists the three records, and the header is cbindgen's again.
Because RgfxVideoCaps grows by 256 bytes, the ROM's record and the guest's
kext set are built again with it on m3-max (26.7.1 KDK, Xcode 27.2): the ROM's
bytes stay the same, and ReimsGraphics and RgfxGate, which read the caps,
change.