Commit Graph
928 Commits
Author SHA1 Message Date
Anees Iqbal 38640a5e54 🐛 Answer gpuCoreCount on an x86-64 guest as the x86 Macs: not at all
Neither x86 Mac's Metal device responds to gpuCoreCount: the AMD Radeon
Pro 5300M's and the Intel UHD 630's answer respondsToSelector: NO under
macOS 26.7.1 (oracle_caps, m3-max-37201 and 37202). The bundle has
answered it on every guest since f692b4de0, from the M3 Max's answer,
the one device it was measured on then.

What the guest now sees: an x86-64 guest's device does not respond to
gpuCoreCount, and a call raises an unrecognized selector, as on the
x86 Macs, where it answered the host's count (a GPU's CUs or SMs, 0 on
Intel). An arm64 guest's device, an Apple GPU's, answers the host's
count as before.
2026-11-16 15:57:15 -08:00
Anees Iqbal 15a0a5228b 🐎 Give a UMA GPU's surface caches half its memory budget
On a GPU that shares the CPU's memory every IOSurface device cache fitted
the deferred blocks' budget, a quarter of the GPU's memory budget at the
device's start. On a Radeon 780M with an 8 GiB guest that is 1385 MiB, and
Safari's and a WebGL page's surfaces went past it (454 blocks): those late
surfaces lay in place in the guest's pages, and the WebGL page's frames
fell from 33.0 to 24.6 a second, below development's 32.6. With no bound
the caches held 1762 MiB at most and the frames ran at 33.0 (jobs
m3-max-38032, 38033 and 38034).

The caches now fit half of the budget, twice the deferred blocks', which
stay at a quarter, so the DEFERRED_BUDGET registers read as before. The
budget is read past the guest's RAM, which QEMU preallocates, so the caches
stay bounded on a small host.
2026-11-16 15:41:08 -08:00
Anees Iqbal 701d70218c 📝 Say that every host caches each surface the kext caches [ci skip]
Decided 14 and the feature bits now say what the device answers since
4cd77f6aa. A host whose GPU shares the CPU's memory offers SURFACE_CACHE
and SURFACE_DEFERRED, as a Mac on an Intel GPU keeps its own copy of each
IOSurface (the UHD 630's lock, fill and memory numbers, jobs m3-max-37817
and 37822), within the caches' budget. No host offers
SURFACE_CACHE_REFUSED now, and the decoder's module docs and the video
device doc say so.
2026-11-16 15:41:08 -08:00
Anees Iqbal e9a494d34b 🆕 Lay out the archive's functions in a committed link order on Linux
On the desktop, the device's lanes walk WindowServer's command buffers at
about 120 us per render encoder on a Zen 4 host, and the walk is bound by
instruction fetch: the code it runs is spread over far more 4 KiB pages
than the L2 iTLB holds. Placing that code in the order lld's call-graph
clustering gives it, from a profile of the desktop, makes the walk faster.

Linux's dist now reads crates/reims-vgpu-c/link-order.txt, the library's
functions one a line as GNU nm -C prints them without crate
disambiguators, and in the objcopy call that localizes the archive's object
renames each listed function's section to .text.sorted.NNNNNN in the
list's order. GNU ld's default script sorts those by name ahead of the
rest of .text, so make qemu and install-ctl.sh's QEMU get the order with
the compiler's default linker; a linker that does not sort them keeps the
order it had. dist prints how many of the list's functions it placed: a
function no longer in the archive is skipped, so a stale list loses speed
and never fails the build. The list survives a metal2vulkan pin move,
whose crates change only their disambiguators.

cargo xtask link-order BINARY CALL_GRAPH (Linux) writes the list from a
QEMU lld linked with --call-graph-ordering-file, after this tree's dist;
docs/development.md, "The link order", says how to refresh it. With no
list the archive is as before.
2026-11-16 15:33:06 -08:00
Anees Iqbal bb4474c601 🆕 Decode VideoToolbox's paravirtual sessions on NVDEC, offering bit 52
An arm64 guest's VideoToolbox now decodes H.264 and HEVC on an NVIDIA host's
GPU, as it does on VA-API. The NVIDIA arm answers a GuestDecoder for each codec
NVDEC decodes: a decoder of whole access units of its own, whose picture lands
in the IOSurface the kext lent, laid out as the kext read it and checked
against its memory (GuestTarget). The GPU writes it there, one cuMemcpy2D a
plane into the view of the surface's pages registered with CUDA, as it writes
an x86-64 guest's output pages; where CUDA refuses the view, the picture is
read back and copied by the CPU, each reason logged once a decoder. NVIDIA's
errors reach VideoToolbox as bad data, unsupported or a malfunction.

What changes for the guest: on an NVIDIA host, where NVDEC decodes H.264 or
HEVC, the device offers VT_MESSAGES, and a macOS 26 or 27 arm64 guest's
VideoToolbox lists our decoders as hardware (VTIsHardwareDecodeSupported is
true for avc1, and for hvc1 where NVDEC decodes HEVC) and decodes on them.
Before, an NVIDIA host offered no bit 52 and listed no decoder, so they
decoded in software. An x86-64 guest takes no bit 52, as before.
2026-11-16 14:51:32 -08:00
Anees Iqbal 09a9f8867a 🔀 Merge GitHub's development (pull request #159)
Brings in pull request #159, for a Windows host on an AMD CPU: 245a1ebb6
keeps the window's swapchain when its remake refuses before the create, and
9db299bdb takes vendor/qemu's 40257041, which keeps an Intel guest's MSRs
that Hyper-V refuses on an AMD host. A merge commit by the owner's one-time
exception (2026-11-16).

vendor/qemu moves to e8ae598e, the merge of this branch's 500d30fb with
GitHub's steelbrain/reims-vgpu-rebase-2 (5970afb4, pull request #15), so it
holds both WHPX changes. swapchain.rs, docs/lessons.md and docs/qemu.md
merged without conflicts.
2026-11-16 14:47:00 -08:00
Anees Iqbal 193583164f 🆕 Answer VideoToolbox's encoder sessions on an encoder backend
The host's side of VideoToolbox's paravirtual protocol gains encoder sessions
(`+enc`), the half C2's VA-API backend encodes on:
- the properties a guest's compression session sets (`esup`, `ecop`, `eset`,
  `emul`), in the shape Apple's hardware encoder answers them, made into the
  codec's EncoderSettings on a 90 kHz clock;
- `esta`, which opens the backend's encoder at the frames' size, rounded down
  to even, and asks for video-range source buffers (`Epba`);
- `efrm`, which encodes the frame's lent surface and holds it until the frame
  is both encoded and emitted; `ecfr` and `einv`;
- emission: `Efds` for each new configuration record, then `Eemt` with a
  sample buffer of the guest's own times, in 16 KiB fragments.

What the decoder and encoder sessions share (the session's handle, its thread
and queue, the host's requests) moves out of decoder.rs into session.rs.
SampleBuffer gains a writer that its reader reads back.

Nothing changes for the guest: the encoder list names encoders only for a host
given an encoder backend, the device gives none, so `encs` still lists none
and `+enc` is still refused with kVTCouldNotFindVideoEncoderErr.
2026-11-16 13:56:00 -08:00
Anees Iqbal d3c65ecd83 🐛 Encode QEMU's screendumps off the BQL
vendor/qemu moves to 500d30fb: QMP's and HMP's screendump copy the console's
surface under the BQL, then encode and write the copy on a thread of the
pool with the BQL let go. Encoded under the BQL, a PNG of 2880x1620 held it
about 120 ms on the Mac mini 2018 (a busy desktop's up to 1.7 s). A vCPU
that touched another device's MMIO, which takes the BQL, waited as long, and
an on-screen app's frames with it. That happened even with the device's
interrupts and doorbells off the BQL (the two commits before this): a
present_probe run lost 116.7-157.9 ms at its screendump in 4 of 5 runs, and
a build that logged the BQL's waits found a vCPU waiting 127 ms at another
device's register (0x806492b4) while the present loop stalled 133-283 ms.

For the host, a screendump's file is the same: the frame the console's
update left, now copied before the BQL is let go. reims-ctl's terminal
viewer, which takes PPM screendumps, no longer holds the guest's vCPUs while
each is written. docs/qemu.md says so and corrects the measured numbers of
the commit before this, which were 2 runs that missed the wait.
2026-11-16 13:54:20 -08:00
Anees Iqbal 0db91636f3 🐛 Let WHPX's vCPUs ring the device's doorbells without the BQL
The commit before this sent the device's interrupts off QEMU's main loop on
WHPX. It left the gap: a QMP screendump in PNG still cost an on-screen app
116.6-133.7 ms of frames on the Mac mini 2018 (UHD 630), against 128-148 ms
before. The vCPUs were the ones waiting. WHPX's vCPU loop took the BQL
before each run of a vCPU, so a vCPU that exited to the device's lockless
BARs, to ring a doorbell, waited the 111-123 ms png_save held it. A build
that logged those waits measured them at every screendump, while 8191 of
8192 interrupts went out directly.

vendor/qemu 0fdbf381: with kernel-irqchip and no interrupt request pending,
whpx_vcpu_pre_run skips its locked section, as kvm_arch_pre_run does with
KVM's in-kernel irqchip. With both commits, the probe's gap max at the
screendump is 33.7-34.0 ms, 60.0 fps and 0 dropped, the same as KVM's on
ms01's Iris Xe (33.3-33.7 ms). What the guest sees is the same interrupts
and the same MMIO answers, with no wait while QEMU's main loop is held.
2026-11-16 13:54:20 -08:00
Anees Iqbal 7aac6f4f97 🐛 Raise the device's interrupts on WHPX without QEMU's main loop
On Windows the device sent every interrupt through a BH in QEMU's main loop,
since WHPX has no irqfds. A QMP screendump in PNG of the 2880x1620 display
held the main loop about 120 ms in png_save. For that long the guest took no
completion and an on-screen app's nextDrawable blocked: a 117-145 ms gap
(7 refreshes) in all 6 present_probe runs on the Mac mini 2018 (winbench,
11-15). The same screendump under KVM, where the irqfd injects the
interrupt, cost no frame on ms01's Iris Xe (6 of 6 runs, gap max 33.3-33.7
ms, m3-max-37378).

vendor/qemu 243971f2: on WHPX with the hypervisor's APIC the raising thread
requests the vector's MSI from the hypervisor itself, with no BQL, keeping
the BH for a masked vector, disabled MSI-X and a refused request. What the
guest sees is the same interrupt, sent sooner when the main loop is held.
2026-11-16 13:54:20 -08:00
NailecMC 245a1ebb66 🐛 Keep the window's swapchain when its remake refuses before the create
The remake retired the old swapchain whether or not the new one was made,
and the make can refuse before vkCreateSwapchainKHR, where the window's
surface has no pixels for now. Vulkan was never handed the old one, so it
stayed the window's, and each later remake, with no current swapchain to
pass as oldSwapchain, made one beside it, which Windows refuses while the
old one lives (VK_ERROR_NATIVE_WINDOW_IN_USE_KHR). On a Ryzen 5 5600G host
with an RTX 3060 the window kept the macOS installer's last frame from the
guest's reboot on, while QMP's screendumps followed the guest, and drew
nothing on a minimize and restore; the log held the one refusal a refusing
swapchain logs.

A make refused before the create now leaves the old swapchain the current
one, stale, so the next remake hands it over; one refused by the create or
the wrap of its images retires it, as before. No unit test reaches the
swapchain without a window system, and the fix is not yet checked on a
VM boot; docs/lessons.md records the trap.
2026-11-16 22:46:46 +01:00
NailecMC 9db299bdba ⬆️ Take WHPX's MSRs of an Intel guest on an AMD host
A macOS guest under WHPX on a Ryzen 5 5600G stopped at the Apple logo with
no progress bar: Hyper-V on an AMD host answers with #GP the kernel's write
of a 64-bit address to IA32_SYSENTER_EIP and its read of IA32_MISC_ENABLE,
and the kernel panicked before its console was up. vendor/qemu's 40257041
intercepts such a #GP by default where the host is not Intel's and keeps
those MSRs as KVM does for an Intel guest on AMD. The guest then reached
Recovery, installed macOS 26 and reached Setup Assistant on that host.

docs/qemu.md records the commit, the panics, and the TSC deadline timer
Hyper-V gives such a guest no register for, which the VM's CPU flags drop
for now (-tsc-deadline).
2026-11-16 22:46:39 +01:00
Anees Iqbal 0bef142272 🆕 Decode VideoToolbox's paravirtual sessions on VA-API, offering bit 52
An arm64 guest's VideoToolbox now decodes H.264 and HEVC on the host's GPU.
The host offers VT_MESSAGES where VideoToolbox's paravirtual path lists a
decoder: where the video arm lands decodes in the surfaces the guest lends,
on VA-API. Each decoder session decodes on a GuestDecoder of the arm, through
the VA crate's decoders, and lands its picture in the lent IOSurface through
a view of its guest RAM pages: written there by the driver's video
processing where its import check takes the surface's layout, else read back
and copied by the CPU. A session keeps the views of the last eight surfaces
it landed in.

What changes for the guest: on a VA-API host, a macOS 26 or 27 arm64 guest's
VideoToolbox lists our decoders as hardware (VTIsHardwareDecodeSupported is
true for avc1 and hvc1) and decodes on them. The arm64e kext publishes the
service on macOS 26 and later alone, so macOS 14 and 15 decode in software
as before. Before it lends a surface, the kext takes a read-write CPU lock of
it and lets it go, as a process would: the surface's seed moves, and a
device cache of it is filled from its pages again at its next use, once the
host's picture is there. An NVIDIA host, whose arm lands no such decode yet,
offers no bit 52 and lists no decoder; an x86-64 guest takes no bit 52.
2026-11-16 13:31:30 -08:00
Anees Iqbal 74869d936c 🐛 Answer the device's compile of a visible function as the x86 Macs
macOS 12 and 13 guests' iconservicesagent and com.apple.dock.extra send
the device's private compileVisibleFunction:withDescriptor:error: at
start-up, from Metal's own link of Core Image's kernels, and the bundle
answered it unsupported while supportsFunctionPointers answers YES (17
boots of 11-15/16). Both x86 Macs answer each of its three forms with no
error for any function and descriptor, keep the function in the archive
of the archive form, and call the handler form's one-argument handler
with nil on the caller's thread (oracle_binfn, macOS 26.7.1, Q47).

What the guest now sees, where the host makes function pointers:
- the three compile forms answer as the Macs do and compile nothing,
  as the host compiles a binary function where a pipeline links it;
  the archive form keeps the function as addFunctionWithDescriptor:
  keeps it, and the handler runs before the call returns;
- newComputePipelineStateWithAdditionalBinaryFunctions:error: answers
  the pipeline itself, as the AMD 5300M's does (the Intel 630 makes
  another; the Macs diverge), where it answered nil and an error;
- the device's functionHandleWithFunction: and its resource-index form
  raise an unrecognized selector, as both Macs' devices do, where they
  answered nil.
Where the host makes none, each answers the unsupported error as before.
2026-11-16 12:56:26 -08:00
Anees Iqbal 35b54bfff8 🆕 Lend VideoToolbox's IOSurfaces to the host until its rels
A decoder session writes each picture into a buffer the guest's VideoToolbox
lends with its message. The arm64e kext's service now looks up each IOSurface
ID a send names in the client's task, holds the surface with its memory
wired, and carries it in the VT_MESSAGE as an RgfxVtSurface record (the
lend's name, the surface's ID, pixel format, size and two planes) and the
runs of its pages. It lets go of a lend when the host's rels names it, of a
message's lends at once where the message never reached the ring, and of
every lend at its stop.

The device reads each record with its runs and checks that the record's lend
is the one the message names. reims-vgpu hands the lent surfaces to the
paravirtual host, which lets go of them where no session takes the message,
and sends their rels itself where the message's runs lie outside guest RAM.

The host still offers no VT_MESSAGES, so no guest sends any: nothing changes
for a guest or the host until a backend lands in the lent pages.
2026-11-16 12:47:35 -08:00
Anees Iqbal 1e0e76ab3f 📝 Say what reads VideoToolbox's messages, not where they were [ci skip]
Item 17 of the design pointed at an old doc at a tag for the list of
VideoToolbox's paravirtual messages. The doc now says what carries them and
what reads them on the host: the device's rings and reims_vgpu_video's
paravirt module.
2026-11-16 12:47:35 -08:00
Anees Iqbal 1cd119ce1a 🆕 Run VideoToolbox decoder sessions over a backend on the host
The paravirtual route's second piece: the host's side of a guest decoder's
session, so that a backend over the host's video arm can serve VideoToolbox's
decodes next. reims_vgpu_video::paravirt gains:

- decoder: a `+dec` session on a thread of its own. dsta starts it once from
  the format description's avcC or hvcC, refusing 3-byte NAL unit lengths and
  H.264 field pictures, and sends Dpba first; dfrm asks the guest for a buffer
  (Dbuf), has the backend decode the sample's access unit into the surface it
  lends, emits the frame (Demt) and lets go of the surface (rels), Dfub
  naming a buffer left unused; the guest's replies go straight to the request
  that waits for them. dsup, dcop, dset, dcan, dinv and the rest are answered.
- image_description and sample_buffer: readers of the =fds and =sbf
  parameters, with the serializer's known keys; plist reads binary property
  lists within bounds of ours.
- Host::with_backend, under which a create of a listed codec opens a session,
  and a close ends it.

Nothing changes for a guest: the device's host makes its Host without a
backend, so every create is still refused, and no host offers VT_MESSAGES.
2026-11-16 12:47:35 -08:00
Anees Iqbal 2d7ce10ea0 🆕 Add the VT_MESSAGE op and the arm64e kext's VideoToolbox service
An arm64 guest's VideoToolbox runs its codecs in a guest only where it finds
an AppleVideoToolboxParavirtualizationDriver service: it then sends the host
side `vtpv` messages, and lists and runs the host's decoders as hardware ones.
This is the first slice of that route (design.md, "Decided", 17).

The device gains feature bit 52, VT_MESSAGES: ring 0's VT_MESSAGE carries a
message in guest RAM runs to the host, and the control completion ring's
VT_STATUS answers it and VT_MESSAGE brings the host's messages back. The
arm64e kext publishes the service under display 0's framebuffer where the
guest took the bit and the host's caps list a decoder, with the user client
of Apple's kext's five selectors, read from its 15.0.0 build. The host's side
is reims_vgpu_video::paravirt: it answers the decoder list and each codec's
capabilities from the decoders the caps list, an empty encoder and motion
estimation list, and refuses session creates for now.

No host offers the bit yet: the host's caps code turns it on with decode
sessions, the next slice, so guests see nothing new. The x86 kext is
unchanged, and the option ROM's bytes too; its record takes the new header.
2026-11-16 12:47:35 -08:00
Anees Iqbal 5707aa1c08 🐎 Cut no part while work the queue committed is incomplete
Every part a walk cuts is a submission to the driver and a job of its
scheduler, and a part cut while the queue still has work out starts no sooner
for it: on the RX 7900 XTX, Geekbench 7 cut 1,437 parts for Particle Physics'
111 buffers and 2,631 for Fluid Simulation's 882, 1,256 and 1,703 of those cuts
behind a part not yet seen complete, where the host's own Vulkan pass ran 111
and 882 jobs. On the Iris Xe, WindowServer's frames took 8.96 parts a buffer,
22,155 of 25,856 cuts behind incomplete work.

A queue now counts its command buffers committed and not seen complete
(QueueCounts::out; a place joins it at its commit and leaves it with its
completion handler). A walk cuts a part only while that count is 0, and goes
on into the part it is in otherwise; a buffer whose walk starts behind such
work is dealt in two chunks, one a thread, rather than a chunk each 4 KiB.

What the guest sees is unchanged: the same work in the same order on the
queue, the same events and read-backs in their parts, one CB_COMPLETE per
buffer after its last part. A buffer's parts are fewer and longer, so its
GPU span has fewer gaps. The cut tests keep their cuts through a test knob
(set_cut_behind_work); a_walk_cuts_no_part_while_work_its_queue_committed_is_out
tests the rule.
2026-11-16 12:30:43 -08:00
Anees Iqbal ee7c8627bd 📝 Say which encoders arm64 macOS 26 lists as hardware [ci skip]
The docs said an arm64 guest lists no hardware encoder and refuses a session
requiring one -12908, as measured on arm64 macOS 27.0.1. Arm64 macOS 26 under
TCG lists Apple's own AVE encoders (ave.avc, ave.hevc) as hardware and fails
such a session -12903, with the arm64e set before H.264 encode and after
(m3-max-37133, m3-max-36944): the OS's own answer, with no encoder behind them
in a VM. devices.md and design.md now say so.
2026-11-16 12:10:32 -08:00
Anees Iqbal 156596754e 🐛 Feed AppleGVA's rate control the access unit's bits
An H.264 stream the guest encoded on the host came out at about 83% of the
average bitrate asked: 6.6 Mbit/s for 8 Mbit/s at 1080p, 25.9 for 30 at 2160p.
AppleGVA's rate control reads a word of the length record the driver fills,
at +0x3c, whose name nothing states; the driver wrote only the access unit's
length in bits at +0x6c, so with 0 there AppleGVA kept one QP a session.

The driver now writes the access unit's bits at +0x3c too. What the guest
sees: AppleGVA moves its QP each frame toward the session's average bitrate,
as on an AMD Mac. On a macOS 26.7.2 guest on an Iris Xe host (m3-max-37343):

  asked                    came out   per second over 10 s
  8 Mbit/s 1080p, 120 f    8.42
  4 Mbit/s 1080p, 120 f    4.22
  6 Mbit/s 1080p, 300 f    6.17       7.11, then 5.87 to 6.25
  30 Mbit/s 2160p, 300 f   30.44      35.37, then 29.07 to 30.24

A Radeon Pro 5300M Mac's streams came out at 100% to 104% of the asked. Of
each word from +0x04 to +0x68 written alone, only +0x3c moved the QP; of the
values tried there (the bits, the bytes, the QP, 1), the bits came closest to
the asked bitrate (m3-max-36997, m3-max-37146).

The driver's checks gain +0x3c's bits on a published frame and 0 on a failed
one.
2026-11-16 12:10:32 -08:00
Anees Iqbal 7338abf05a 🐎 Grow a class's chunked slabs to 16 MiB, buffers to 4 MiB in them
Each slab of the process's own pages is a pages block the host maps as a
view of its own and imports once, and RADV and ANV on i915 list every
live import in every kernel submission. A class's slabs stopped at 2 MiB
and every buffer past 1 MiB took a slab of its own, so a process with
many large buffers held as many imports. Where the kext gives chunks, a
class's slabs now grow, doubling, to 16 MiB (256 chunks, one dma-buf at
udmabuf's stock limits), each one heap, and a buffer of up to 4 MiB lies
in them; the region's slabs, and slabs of plain pages, keep their 2 MiB.
A class's slab past 2 MiB is never plain pages: where the kext gives no
chunks it is the region's, of 2 MiB at most.
2026-11-16 11:41:25 -08:00
Anees Iqbal bf31c11cf9 🐎 Mark a command buffer's parts but its last to join the next
A guest command buffer the walk cuts into parts went to the GPU as one
kernel submission a part: on the Iris Xe's animation page a waited buffer
took about 11.6 vkQueueSubmit calls of about 180 us each on ANV. Nothing
observes a part's completion but its own handler, which notes its GPU times
and error for the last part's record and lets its place among its queue's
command buffers go; the last part carries every record, ticket and signal
the guest sees.

So each part but the last is marked to join the next one's completion
(CommandBuffer::set_completion_joins_next), and the runtime may send up to
four of a queue's parts found ready together, and the part behind them, in
one submission. Never marked: the last part; a part that waits for or
signals an event, by an op or from the buffer's begin (a device cache's fill,
another queue's buffer in the surface order); and a part the platform keeps
whole, whose commit is the whole's. The guest still sees its command buffer
complete at its last part's own end, with the same GPU times and the first
failed part's error.

Tests: a_buffer_s_parts_but_its_last_join_the_next_completion_unless_they_
signal and a_first_part_that_waits_from_its_begin_is_not_marked; the dealt
and kept-whole tests check which parts are marked.
2026-11-16 11:41:25 -08:00
Anees Iqbal 60d64cc47d 📝 Say a crossing holds a hidden cursor's pointer for the second [ci skip]
The window's doc of tell_pointer still said the device holds a crossing's
positions for up to 100 ms; it is a second since the hold became the arm64e
kext's longest crossing. The design now says what that means for a cursor
the guest keeps hidden: it never shows on the pointer's display, so its
crossing holds the positions the whole second, while a captured game, which
drives the guest's mouse, is not held.
2026-11-16 11:25:19 -08:00
Anees Iqbal feff9bb156 🐛 Hold a crossing's pointer for as long as the guest's crossing
A crossing held the pointer's positions over the new display back from the
guest's tablet until the guest's cursor showed there, for 100 ms at most.
An arm64 guest under TCG had not shown it on display 1 100 ms after the
POINTER_OVER while the pointer went on over display 1's window: the
positions handed on then were scaled over display 0, where the cursor was,
and left it at their mirror there for good (macOS 26.6.2 at two displays,
potluck job m3-max-37089). The arm64e kext's crossing takes up to four posts
250 ms apart.

What changes for the host: CROSSING_HOLD_NS is a second, so a crossing
holds the positions until the guest's cursor shows on the pointer's display,
for a second at most; a position whose buttons changed still goes on at
once. x86-64 crossings, under a millisecond, and arm64 ones under HVF, under
40 ms, end the hold as before. The kext keeps its 100 ms bound for a
landing that may show the tablet's move, which still holds for a position
whose buttons changed; its comments and the design say so. features.md's
crossing entry says a second.
2026-11-16 11:25:01 -08:00
Anees Iqbal bd284b98aa 🐛 Tell a missed crossing anew once the pointer is back
The device told a crossing onto a display once, until the guest's cursor
showed there. A crossing the guest did not carry out stayed told, so later
crossings onto that display were never told. On 15.6.1 under TCG
(m3-max-36608), a crossing onto display 1 that the kext missed left the
next uncaptured crossings and the captured drag onto display 1 untold. The
tablet put the cursor at the pointer's spot on display 0. The window began
driving the guest's mouse 130 ms into the drag, because the stale crossing
was minutes old and the crossing's hide counted from it.

Now a pointer over the cursor's display ends a told crossing and drops one
still owed, so the next move over the other display is told anew. Each
re-entry gives the guest a fresh POINTER_OVER for display 1, and the hide's
second counts from that one.
2026-11-16 11:25:01 -08:00
Anees Iqbal 64c9412805 🐛 Wait for a landing past the image over an edge as long as any
A post near its display's edge can show the cursor's image on the display
beside it before its own landing. The crossing waited only 50 ms on that
image before it posted again. Under TCG the landing comes later than that.
On 15.6.1, a captured drag back onto display 0 posted at its right edge.
The image showed at display 1's first pixel 7 ms after the post. After the
50 ms wait the crossing posted again, beside display 1. Display 0's landing
came 139 ms after the first post and was taken for the second post's
(potluck job m3-max-36695). In job m3-max-36608 such a landing agreed with
the second post's placement. Display 0 was confirmed right of display 1 and
the host was told so; its log shows it then sent the pointer back onto
display 1.

A post held by the image now waits for its landing as long as any post
does, 250 ms after the post, and at least 50 ms after the image. A
rearrangement still teaches a new place on the first crossing whose post is
held at the old place's edge. The tests that held the 50 ms wait change
with it, and a new one holds the drag-back case.
2026-11-16 11:25:01 -08:00
Anees Iqbal 6ef9d72743 🐛 Keep a crossing's hidden cursor from driving the guest's mouse
The guest hides its cursor on the display it leaves before it shows it on
the next. A captured window takes a cursor hidden on every display for 50 ms
for a game's, and hands its motion to the guest's own mouse, which the guest
accelerates. An arm64 guest under TCG showed the cursor on the next display
up to 491 ms after the POINTER_OVER, so every captured drag across displays
switched to the guest's mouse mid-drag: the cursor flew to a display's
corner or stayed on the display it left, and each show let the pointer go
one pixel outside the edge's reach, where the next move left again (potluck
jobs m3-max-36283, m3-max-36434 and m3-max-36435; x86-64's crossings, under
a millisecond, never switched).

What changes for the host: while a POINTER_OVER has yet to show the cursor
on the pointer's display, PointerLink::cursor_hidden_for counts the hidden
cursor from one second after it at the earliest (CROSSING_HIDE_NS), the
arm64e kext's crossing being at most four posts 250 ms apart. A game that
hides its cursor with no crossing under way drives the guest's mouse as
before; one that hides it while a crossing never shows it, a second later.
2026-11-16 11:25:01 -08:00
Anees Iqbal 80775403ce 🐛 Learn no arm64 place from a landing past the host's hold
The host holds its pointer's positions back from the tablet for 100 ms
after a POINTER_OVER (CROSSING_HOLD_NS), or until the cursor shows on the
pointer's display. Under TCG a post's landing can come after that, and the
cursor it shows may then be where the tablet moved it after the post. On
15.6.1 under TCG a captured drag back onto display 0 posted at its right
edge showed the cursor 130 ms later, 26 points short; taken for the post's
landing, it and the landing before it sized display 0 1005 by 628 points, a
later landing confirmed that, and the host was told it (potluck job
m3-max-36292).

What changes for the guest: a landing kRgfxCrossingHoldNs or more after
the POINTER_OVER its post is for, dated from the POINTER_OVER's arrival on
the work loop, confirms the placement it was posted by where it agrees with
it on both axes, and otherwise changes nothing: no corner, no size, and it
is not kept as the display's last landing. Landings inside the hold learn
as before.
2026-11-16 11:25:01 -08:00
Anees Iqbal 968f87c763 🐛 Take a post's outcome only from a cursor shown after it
At a post's deadline the arm64 kext looks at what each display shows to tell
whether the post was held at an edge, and posts again beside another display
where it was. A display's last MOVE_CURSOR from before the post said nothing
of it: on 15.6.1 under TCG a captured drag left the cursor at display 1's left
edge, the crossing onto display 0 posted there, and at the deadline, the post
not yet shown, display 1 still showed the cursor where that post's point is
held. The crossing took it for the post's outcome and posted beside display 1,
and the first post's late landing, taken for that one's, placed display 0
right of display 1 (potluck job m3-max-36173). Every later crossing went
wrong from there.

What changes for the guest: the kext numbers each MOVE_CURSOR it posts, and
only one numbered after the post counts as what the post did. A post with no
such evidence leaves the crossing unsure, which learns no place from a later
landing, as for a post that showed nothing at all.
2026-11-16 11:25:01 -08:00
Anees Iqbal da1abad53f 🐛 Learn no arm64 display's place from a refuted or unsure landing
On 27.0.1 the first post after the displays were rearranged showed nothing
in 250 ms (potluck job m3-max-35865); the next, beside display 1, held the
cursor at display 0's edge, and the learner took that placement on the axis
held at the edge, putting display 0 past display 1, so every later crossing
missed and the host was told no new place.

Two rules now: an axis where a landing is held at the display's edge keeps
the display's own place, since the post's point lay past the display there;
and a crossing whose post showed nothing, with no display showing the cursor
where its point lies or is held at, learns no place from a later landing,
which may be that post's, late, at the pixel every post aims at. The
crossing still ends on its display's landing. What the guest sees: such a
crossing leaves the places as they were instead of placing a display
wrongly; what the host sees: no DISPLAY_BOUNDS from such a landing.
2026-11-16 11:25:01 -08:00
Anees Iqbal 3ccecbe752 🐛 Keep the cursor's display off its image's part over an edge
On an arm64 guest a cursor near the edge between two displays shows on
both: WindowServer gives each display the part of the image on it, and the
display not holding the hot spot a part whose hot spot is held to the
image's column at that edge (27.0.1, potluck job m3-max-35746). Its
MOVE_CURSOR, often the later of the two, made the device take that display
for the cursor's, so the next crossing onto it was never told, and the
tablet put the cursor at its mirror on the display it was on.

The device now takes such a MOVE_CURSOR, by the display's last SET_CURSOR,
as where the cursor is only while the display the cursor is on hides it,
or where that display shows the image's edge too and a crossing told the
guest the pointer is over this one.

What the host sees: the display the device takes as the cursor's follows
the hot spot, not a display showing only the image's part over an edge, so
a crossing's POINTER_OVER and its hold, and the window that draws the
cursor, stay with the display the cursor is on. features.md's crossing
entries say so and name the new test.
2026-11-16 11:25:01 -08:00
Anees Iqbal 2462a4dd45 🐛 End a crossing whose post finds the cursor there already
A post at the pixel the cursor is at shows no move, as nothing changed. The
crossing took that for a point held where the cursor was and posted again
beside another display, so a crossing the device told while the cursor was
on its display already (it took the image's part over the edge for the
cursor) moved the cursor off it. Now, where the crossing's display last
showed the cursor at the post's pixel, the crossing is over.
2026-11-16 11:25:01 -08:00
Anees Iqbal 44fa0d7495 🐛 Learn a display's place only from a landing aimed at it
On arm64 14.6.1 under TCG, a guest shows a crossing's landing 18 to 153 ms
after the POINTER_OVER, past the host's 100 ms hold, so the tablet's
positions reach the guest first and move the cursor on the display it is
on. The kext took that move for the post's landing and placed the display
it showed on over the other (display 1 learned at 0,0), and later posts
went to display 0. On 27.0.1 the cursor's image over an edge also showed
its hot spot at the next display's first pixel, not past it, and was taken
for a landing.

Now only the display a post aims at learns from it, by the placement the
post was made with, which a landing that agrees with it confirms. On
another display only the pixel where the post's point lies, or is held at
its edge, counts: the crossing posts again, after 50 ms more where the
point lies within a cursor's reach of that edge. A post that shows no move
in 250 ms (held at the pixel the cursor was at) posts again. The crossing
is bounded by its four posts alone: cut off at the host's hold, a slow
guest's crossing learned nothing of a moved display and missed it on every
crossing after.
2026-11-16 11:25:01 -08:00
Anees Iqbal 4f0de30580 🐛 Take no landing from a cursor shown past its display's edge
A cursor near one display's edge also shows on the display beside it,
where WindowServer shows the part of its image that reaches over the edge.
That display's MOVE_CURSOR puts the hot spot past its edge. On arm64
27.0.1, a crossing back onto display 0 at 1915,600 got display 1's
MOVE_CURSOR first, with its hot spot at x -5. The kext took it as the
landing and posted again beside display 1, which left the cursor at
display 0's right edge instead of at the pointer (job m3-max-35450).

A MOVE_CURSOR whose hot spot lies past its display is now no landing: the
crossing waits for the display that holds the hot spot.

The test's model of WindowServer now holds a point past every display at
the edge of the display the cursor is on, as measured in the same job,
rather than at the nearest display's edge.
2026-11-16 11:25:01 -08:00
Anees Iqbal 0c8e29324f 🆕 Move the arm64 cursor across displays and tell their places
An arm64 guest at two displays or more now takes POINTER_OVER and
DISPLAY_BOUNDS, as the x86-64 kext does. The host's pointer moving into
another display's window moves the guest's cursor onto that display, and a
captured drag on Linux goes on past an edge where the guest placed another
display. Before this, the arm64e kext took neither bit: its cursor stayed on
the display it was on, and a captured drag stayed at the edge (design.md A3).

The move is the x86-64 kext's own, IOHIDSystem::extPostEvent with
kIOHIDSetCursorPosition. Measured on arm64 27.0.1 under HVF and on 14.6.1,
WindowServer follows it as on x86-64. But WindowServer tells an arm64
guest's kernel nothing of where it placed each display: no screens
registered with IOHIDSystem, and no bounds on an IOMobileFramebuffer. So
the kext learns each display's rectangle from its own posts
(RgfxDisplayPlaces.hpp):
- Each landing, the first MOVE_CURSOR that shows the cursor after a post,
  checks the rectangle held for the display it shows on. Rectangles start
  from WindowServer's first-boot arrangement.
- A crossing posts again beside the other displays where the cursor landed
  elsewhere: at most four posts, within the host's 100 ms hold, and
  otherwise the cursor stays put, counted in RgfxCrossingsMissed.
- Only rectangles a landing confirmed are told the host.

The bits go with MULTI_DISPLAY: with fewer than two display nodes, or on a
device of one display, the feature word written is the same as before.
2026-11-16 11:25:01 -08:00
Anees Iqbal 1da52c3f23 📝 Record the 27.x unlock boots on Graft 0.4.0 [ci skip]
The design's BaseSystem trust bullet cited a boot on a development build of
Graft; it now cites the boots on the released Graft 0.4.0: the unlock screen
on 27.0.1 and 27.2.1, and the desktop drawn with Metal 3 on our device.
2026-11-16 10:42:00 -08:00
Anees Iqbal 7f318b120b 🐛 Hand the trust query back to Sandbox once the unlock leaves
The BaseSystem's install pass turned the rootless trust answer on and nothing
turned it off. FileVault's unlock moves the boot to the full system by a
userspace reboot, with the kernel and RgfxGate still loaded, so the hook kept
answering "trusted" for our bundle's path on the full system, where the
comment and the design said the Sandbox policy answers.

Each install pass now clears the answer first and only the BaseSystem's pass
sets it, so the watch's pass on the full system's Data volume, which runs
before the full system's WindowServer reads the accelerator, hands the query
back to the Sandbox policy.

What the guest sees: on the full system after an unlock, the Sandbox policy's
own answer for our bundle, as on a boot straight into the full system. arm64e
only; x86-64's RgfxGate is unchanged.
2026-11-16 10:29:18 -08:00
Anees Iqbal d6ca938139 🐛 Trust our GPU bundle in arm64 macOS 27's BaseSystem
On arm64 macOS 27, FileVault's unlock screen was never drawn. IOGPU loads a
GPU bundle only from a trusted path, and libsystem_sandbox asks the Sandbox
policy, through mac_syscall(2) call 2, whether writing the bundle's path is
rootless protected for the storage class KernelExtensionManagement. 14, 15
and 26 answer yes for the tagged bundle on the BaseSystem's tmpfs Data
volume; 27 answers no, so WindowServer found no Metal device and aborted
every 30 s.

RgfxGate's arm64e build now routes the Sandbox policy's policy_syscall
through Graft 0.4.0, in a route call of its own so the earlier routes stand
if it is refused. While the root is the BaseSystem, the hook answers yes for
exactly that query (call 2, a path subject, file-write-data,
KernelExtensionManagement, a path under
/Library/GPUBundles/reims-graphics.bundle) and passes every other call, and
every call on a full system, to the Sandbox policy's own handler. A failed
copy in or out passes the call on. The classifier is unit-tested in
match_test.

What the guest sees: on arm64 macOS 27, the FileVault unlock screen draws on
our Metal device and the password unlocks it. On 14, 15 and 26, which already
answer yes, the answer is unchanged. x86-64's RgfxGate is unchanged: the new
code is arm64e only.
2026-11-16 10:17:01 -08:00
Anees Iqbal 3f348db981 🆕 Encode the guest's H.264 on the host's encoder
AppleGVA's H.264 encoder now reaches the host's VA-API or NVENC encoder
through our video driver, the AMD vendor route it already drives for decode.

What the guest sees, where the host's caps list an H.264 encoder with a rate
control: the accelerator publishes IOGVAH264EncodeCapabilities (VTRating 350,
VTQualityRating 50, an AMD Mac's), the driver lists encode function 0x20,
sub-ID 0x800 (NV12 in, bitstream out), and VideoToolbox lists
com.apple.videotoolbox.videoencoder.h264.gva as hardware. A session that
requires hardware is made at 720p, 1080p and 2160p, and its frames are
encoded on the host: the driver sends each as an ENCODE_H264 op over the
source surface's planes, and puts the access unit in AppleGVA's bitstream
ring with its end cursor and length in bits. AppleGVA's own SPS, PPS, NAL
header and per-frame QP set the stream; the parameter sets in the format
description are the host encoder's.

HEVC encode stays unlisted, also on a host that encodes HEVC: no hevc.gva,
and a session that requires hardware fails -12908, as on a Mac without an
HEVC encoder. A host with no encoder, or one listed with no rate control,
publishes and lists nothing for encode, as before. An arm64 guest's arm64e kext
publishes no encode ratings on any host, as it names no video driver there
(kRgfxGuestVideoDriver), so an arm64 guest still lists no hardware encoder.

The driver's checks gain the encode listing (in a process of its own, since the
block is filled once a process), context creates, the pixel pools and frames
through the ring; the kext's gain rgfxH264Encode, in both architectures' rules.
2026-11-16 10:08:16 -08:00
Anees Iqbal 8742a21507 🐛 Log the bundle's lines with their text public
macOS 26's unified log shows an NSLog argument that is an object or a string
made at run time as <private>, so the bundle's diagnostics named nothing there:
RealityKit's usdz Quick Look preview logged "RGFX: <private>: no reflection
(<private>); answered nil" and no more. The bundle's Objective-C sources now
log through rgfxLogLine, which formats the line as NSLog does, logs it as one
public string on the bundle's subsystem at the default level NSLog used, and
writes it to stderr where NSLog wrote there too (the death checks read a
death's words there). bundle_log_check.sh fails a bundle that calls NSLog.
2026-11-16 09:41:07 -08:00
Anees Iqbal d406890f6c 📝 Record that a guest's block numbers are its release's [ci skip]
The arm64 display was built from 27.0.1's captures of WindowServer's ICC
blocks, and 26.6.2's boot showed every block refused: 26.6.2 numbers each
block one below, 14.6.1 and 15.6.1 send curve blocks of other sizes, and
14.6.1's stages sit one lower. The replays of 27.0.1's captures passed
throughout. The lesson says how to spot the next value that is a release's own.
2026-11-16 09:18:38 -08:00
Anees Iqbal 26822914e9 📝 Record that a setting sent in pieces is judged by its pairs [ci skip]
The arm64 display's ICC chain arrives a block at a time. Judged whole after each
block it is off the identity inside each half, and its curves paired by form
fail for Generic RGB, though each half is the identity. docs/lessons.md says how
to spot the next one.
2026-11-16 09:18:38 -08:00
Anees Iqbal a29b9cb650 ✅ Check that the arm64 display takes WindowServer's ICC chain
check-boot gains icc: the boot's log has no "Failed to set ICC curve" line and
at most one "Failed to set ICC matrix", the cursor's layer 1, whose
standard-sRGB source the display's blend space does not invert. Before the
display took the ICC blocks, a login logged 20 to 32 such lines. The read
counts only where log show printed its header, so a read that fails is not a
pass (docs/lessons.md).
2026-11-16 09:18:38 -08:00
Anees Iqbal 862db5fb09 🆕 Take arm64 ICC blocks that keep the display's chain the identity
WindowServer sets an ICC chain on an arm64 display by set_block: per layer a
Src2XYZ and an XYZ2Blend curve and matrix, and for the display a Blend2XYZ
and an XYZ2Device. IOMobileFramebufferLegacy answers every block
kIOReturnUnsupported, and WindowServer logs "Failed to set ICC" for each
refused colour-space block: 20 to 32 lines a login on 14.6.1 to 27.0.1.

In every burst measured (27.0.1 at login and after switching the display's
profile to Generic RGB, Display P3 and back; 14.6.1, 15.6.1, 26.6.2 and
27.2.1 at login), layer 0's half and the display's half are each the
identity: WindowServer composites in the profile's space. The display applies
no chain, so it takes a block only where the chain it leaves is the identity.
WindowServer sends each half's first block before its second, so the halves
are judged as pairs: the first is held, and the second is taken where it
inverts it (the matrices' product, and the curves' composition at 1025
inputs, within 2^-14, in Q32 integer math, as the kext does no floating
point). User gamma is refused whatever it holds, the other locations are
taken where the block alone is the identity, and the rest is refused as
before (RgfxMobileICC.hpp).

The blocks' numbers are the release's: 14.6.1, 15.6.1 and 26.6.2 number each
block one below 27.0.1, the curve block is 0x248 bytes on 14.6.1 and 0x258 on
15.6.1, and 14.6.1's curve stages from Blend2XYZ on sit one lower. The display
reads a block in its release's numbering, by the kernel's major version, maps
only the locations measured on that release, and refuses every block of a
release not measured.

What changes for the guest: set_block answers 0 for those blocks. A login logs
one "Failed to set ICC matrix" at most, for the cursor's layer 1, whose
standard-sRGB source the display's blend space does not invert (0.0024 off),
or for layer 0 in the one swap after the display switches to its own colour
space before layer 0's source follows. Nothing is posted to the host. set_block
is an optional override: a release without it keeps the class's refusals.
2026-11-16 09:18:38 -08:00
Anees Iqbal 60273f5170 🐛 Answer imageblockSampleLength 0 off an Apple GPU
A render pipeline answered the host platform's imageblockSampleLength, 4 for
one BGRA8 colour attachment, on the x86 guest's device too, where the AMD
5300M and the Intel 630 answer 0 for every pipeline: they have no tile memory.
The x86 guest's device now answers 0, and an Apple GPU's device, the arm64
guest's, keeps the host's answer, the M3 Max's 4.
2026-11-16 09:10:29 -08:00
Anees Iqbal 49b1040a2e 🐛 Name no video driver to an arm64 guest's AppleGVA on any host
On an arm64 guest on a host that decodes H.264 and HEVC, the arm64e kext
published AppleGVA's video-driver keys (IODVDBundleName, IOGVACodec,
IOVARendererID) and HEVC decode (IOGVAHEVCDecode and its capabilities), as the
x86-64 kext does. The vendor-driver route our bundle's video driver serves is
x86-64's, and on arm64 the keys brought no session to it: VideoToolbox answered
VTIsHardwareDecodeSupported true for HEVC, yet a session requiring a hardware
HEVC decoder failed -17692 and one requiring H.264 -12906, no encoder was
hardware while one requiring a hardware encoder failed -12903, and every other
session decoded in software, none reaching the host (arm64 macOS 14.6.1 on a
VA-API host, m3-max-36575).

The arm64e kext (RGFX_GUEST_ARM64) now publishes no video key on any host
(kRgfxGuestVideoDriver; rgfxDecodesVideo and rgfxHevcDecode answer false), and
logs once that it names none. The x86-64 kext is unchanged.

What an arm64 guest sees on every host: VTIsHardwareDecodeSupported false for
every codec, no hardware encoder listed, sessions requiring a hardware decoder
or encoder refused as on a Mac without one (-12906, -12908), and every other
session in software, as an arm64 guest on a host with no video arm already
answered (arm64 macOS 27.0.1 on the M3, m3-max-36519).

video_codecs_arm64_test checks the arm64e kext's rules: no video driver and no
HEVC decode for caps of H.264 and HEVC, H.264 alone or HEVC alone.
2026-11-16 08:34:53 -08:00
Anees Iqbal e8552ccf68 📝 Say which toolchain a Windows install builds with [ci skip]
docs/qemu.md said a Windows host whose rustup has another default host builds
with it, untested; install-ctl.sh now pins the gnullvm toolchain there, and a
scratch install with an MSVC default (m3-max-36662) built with it and left
the user's default as it was. README says the same for users. docs/lessons.md
records the handle-inheritance trap behind reims-ctl's detached QEMU on
Windows, which nextest's LEAK found.
2026-11-16 07:56:51 -08:00
Anees Iqbal 28a3f4c8a3 🐛 Name no video driver to AppleGVA where the host decodes none
On a host with no video arm (the Windows mini's UHD 630), the accelerator
still named the bundle as AppleGVA's video driver (IODVDBundleName,
IOGVACodec, IOVARendererID). VideoToolbox then answered
VTIsHardwareDecodeSupported(avc1) true and listed AppleGVA's H.264 encoder as
hardware, yet a session requiring a hardware decoder failed -12913 and one
requiring a hardware encoder -12903: no session could have either.

The accelerator now sets the three keys in publishVideoCodecs, only where the
host's video caps list a decoder (rgfxDecodesVideo: a decode entry of H.264 or
HEVC with a profile), and logs once that it names none otherwise.

What the guest sees on a host with no video arm: VTIsHardwareDecodeSupported
false for every codec, no hardware encoder in VTCopyVideoEncoderList, and
sessions requiring hardware refused as on a Mac without it (-12906
kVTCouldNotFindVideoDecoderErr, -12908 kVTCouldNotFindVideoEncoderErr).
Sessions that allow or default to hardware decode and encode in software, as
before. A host with an arm is unchanged: its caps list a decoder, and the keys
are set as before, ahead of registerService.

Measured on a macOS 26.7.2 guest on the mini with a scratch kext without the
keys (m3-max-36420) against the tree's (m3-max-36369).
2026-11-16 07:33:48 -08:00
Anees Iqbal bfeba3252b 🐎 Bind several runs of guest RAM through one dma-buf a view
A no-copy buffer's or heap's pages in several runs of guest RAM took a piece
of each 64 MiB region's dma-buf, bound in a sparse buffer. RADV maps each
chunk of a sparse buffer as a GPU VA operation of its own, and amdgpu updates
its page tables for each, at the bind and again at the release. Since the
kext's slabs became runs of 64 KiB chunks (f5b6cd95a), slab buffers took that
route: on the RX 7900 XTX, Geekbench 7.1.0's Metal compute pass ran 181,391
of the kernel's SDMA jobs (3.62 s), 137,742 of them page-table updates,
against 45,115 (1.21 s) before the regions, and Video Filter took 1.17 times
its native time against 1.10.

A region piece now answers one run inside one region alone. Pages in the
runs of one of the library's views take a piece of one dma-buf of the
view's runs (UDMABUF_CREATE_LIST), made at the first such request while none
is alive and shared by its Arc, so the view's buffers and heaps are bound
plainly in one import of it. The backing table numbers each record of runs,
so a run recorded over part of a view, another record's, is never answered
with the view's pages. A view past one dma-buf (udmabuf's limits, at most
64 MiB) leaves its requests to dma-bufs of their own. A dma-buf of each
request's own was tried first: it ended the page-table jobs, but the device
held about three times the imports, each in every submission's list, and
Super Resolution and Face Tracking ran slower (1.40 and 1.21 times native
against 1.36 and 1.17).

Measured on 2026-11-16 (RADV of Mesa 26.2.6, Linux 7.3.3, a 26.7.2 guest):
- RX 7900 XTX, the traced warm pass, two runs (m3-max-36273, -36274) against
  one on development (m3-max-36097): the kernel's SDMA jobs 12,583 to 15,030
  (0.46 to 0.56 s), 2,172 to 2,386 of them page-table updates, against
  181,391 (137,742); 3 sparse buffers against 453, and 466 to 467 imports
  made against 901 (1,258 with a dma-buf each); the pass's geometric mean
  1.236 to 1.242 times native against 1.258 (1.256 before the regions);
  Video Filter 1.06 against 1.17, Feature Matching 1.51 to 1.54 against
  1.58, Face Tracking 1.16 against 1.17, Super Resolution 1.37 to 1.38
  against 1.36, none outside the spread of the runs before the regions but
  for those that improved. MANAGED_BUFFER_CREATE's ring-0 time came back
  with the kernel's jobs: Path Tracer 0.014 s, Photo Filter 0.020 to 0.024,
  Feature Matching 0.016 to 0.026, Video Filter 0.028 to 0.029, against
  0.095, 0.085, 0.132 and 0.102 (0.026, 0.031, 0.031 and 0.141 before the
  regions).
- Radeon 780M, the desktop walk (Finder, Launchpad three times), two walks
  each (m3-max-36227, -36228 against -36128, -36129): Launchpad's last steps
  ended with 234 to 242 imports against 225 to 234, at 54.2 to 54.4 presents
  a second against 54.2 to 54.5 and 6.0 to 6.6 ms of submissions a present
  against 5.9 to 6.9. Geekbench's pass, one run (m3-max-36229): 1.033 times
  native against 1.062 before the regions, no workload slower.

Nothing changes for the guest: each buffer and heap lies at the same address
over the same pages, and the host only imports them otherwise.

Tests: a region piece is one run inside one region; pages in one view's runs
share its dma-buf, made again once none lives, a run recorded over the view
splitting it; a view past one dma-buf gives none; pages in several runs take
one dma-buf of their own, and past the list limit chunks; the table's runs of
one record keep its number through cuts and protects; and on the GPU two
buffers over one view of guest RAM in two runs are one import, the second
joining it, with no sparse buffer, reading the view's pages in order (it
fails on development: one sparse buffer over a region's piece).
2026-11-16 06:04:09 -08:00