Commit Graph
68 Commits
Author SHA1 Message Date
Anees Iqbal 9f19151665 📝 Describe a display's smaller modes in the docs [ci skip]
The design's display rule, the architecture's window and the README said a
display offers its guest one mode. They now say what it offers after the
window's pixels, where the steps come from, and that the window keeps its
size at a smaller mode and shows it scaled to fill it.
2026-12-02 04:39:58 -08:00
Anees Iqbal 9a14d0e8c6 📝 State the pool's host-memory form as GPU memory's one exception [ci skip]
"GPU memory is the runtime's" had no word of PR 178's form, where the
pool's blocks are memfds of the library's own that rt imports as dma-bufs,
under Linux's KVM on arm64 without KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED.
conventions.md and architecture.md now state it as the rule's one
exception, rt's existing import with no new form, and its known gap: built
and unit-tested here, run only by its contributor, no lab host of its kind,
speed not measured by us. qemu.md's arm64 part says the same, and its
table names the fork's change by what it does rather than by a commit only
in the contributor's fork.
2026-12-02 02:32:58 -08:00
Anees Iqbal 839d1f0527 ✅ Run the seam's and the pool's rt tests on a Mac
Twelve tests were ignored on macOS because rt's floor refuses MoltenVK: the
seam's blit and sampler-ID tests (9) and the pool's rt-block tests (3). A Mac
now runs the rt platform over Mesa's KosmicKrisp, and cargo xtask check links
it in ../lib of each test binary's directory, so they can run there.

The pool's three tests take the platform's device and passed on the M3 Max as
they were. The seam's nine failed: seam::test_device made rt's own instance,
whose loader search found no Vulkan loader on the Mac ("rt's instance: no
Vulkan loader: dlopen(libvulkan.dylib ...)"), and would have found only
MoltenVK where it did. test_device now makes the platform's instance
(os::rt_instance), which is rt's own instance off the Mac, as before, and over
KosmicKrisp on it.

Tests only: nothing the guest or the host sees changes.
2026-11-22 01:18:25 -08:00
Anees Iqbal 298283ea71 📝 State a pool piece's length as its block's, on 64 KiB
pool_add's doc said a piece's length is a multiple of 2 MiB, but a piece is
its block's length: the length asked rounded up to the block source's granule,
64 KiB on rt (or the GPU's bufferImageGranularity where that is larger), and
HostBlocks' unit or 2 MiB. On rt an x-pool-grow of a length not whole 2 MiB
maps such a piece, and so does every guest take that fits no piece and is not
whole 2 MiB: every one over 16 MiB, and smaller ones where no piece has room.
Benchmark boots mapped up to 98 of them.

Nothing relies on whole 2 MiB lengths: first_fit starts the next piece at the
first 2 MiB boundary past one, carves stay on 64 KiB, and QEMU's add and its
populate take any page multiple (the populate's last slice ends at the
piece's end). The header's pool_add comment, its Rust source and pool.rs now
state that rule, and a test on a source of 64 KiB blocks, as rt's are, holds
it. No change in behaviour.
2026-11-21 19:14:42 -08:00
Anees Iqbal d7fec652de 🐛 Let a decoder's state go off rt's completion thread at a loss
At a device's loss the table walk (fault_walk) upgrades each decoder's
Weak<Shared> on the thread that read the first failed command buffer, rt's
completion thread among them. Where the decoder went during the walk, the
walk's hold was the last one, and the decoder's objects were dropped there: a
drop that waited for a command buffer's completion would hang the thread that
completes it.

TableWalk::each now hands a last hold to a thread of its own,
reims-vgpu.graphics-tables-let-go, through the platform's threads, so a
refused spawn ends the process as theirs do. The test drops the decoder in
the walk's callback and checks that its state went on that thread, and that a
walk of a decoder that outlives it spawns nothing. The host sees only a new
library thread name; nothing the guest sees changes.
2026-11-21 19:14:23 -08:00
Anees Iqbal 741ca9d519 🐎 Hand back the heap a heavy pipeline make left free
On Linux with glibc, a pipeline make's translation frees nearly all it used
as the make returns. glibc, though, keeps the free chunks below its heaps' tops
resident, so the VM's process stayed at its largest make's level, up to about
450 MiB. Now each compile-pool make of 250 ms or more asks a thread of its own,
reims-vgpu.heap-trim, to run malloc_trim(0). One trim runs at a time, and the
asks made while it runs become one more trim.

For the host, resident memory falls after heavy creates (the ledger's kernel:
158 MiB to 32 MiB). The first trim is logged at info and later ones at debug,
each with resident bytes before and after and the trim's time. The counts line
carries heap-trims, heap-trim-us and heap-trim-returned-kib.

Nothing changes for the guest. No reply, value or order it sees moves, and the
compile's thread only asks for the trim. macOS, Windows and musl do nothing.

What is left: a trim takes each glibc arena's lock in turn, so a thread the
guest waits on (a make's or the ring's) that allocates meanwhile can wait up to
the trim's own time. That was 5.04 ms at most in a cold launch of the modelling
app on a 780M, and the contention itself was not measured.
2026-11-21 13:39:25 -08:00
Anees Iqbal 42d93ec745 🎨 Rewrap the lines the runtime's rename ran past 100 columns
The rename of metal2vulkan-rt to metal2vulkan-runtime lengthened each mention
by five columns, and 43 lines of comments, docs and string literals ran past
the tree's 100 (the C API's two paragraphs were rewrapped in a16076ff37). Each
moves its last words to the next line of its paragraph, cascading where that
line runs over in turn; no word changes. A string literal moves words only
across its backslash-newline continuations, so every string reads as before:
each file's comment words, code tokens and decoded strings were compared
before and after, all equal. No log line, message or test changes.
2026-11-20 10:03:54 -08:00
Anees Iqbal 11055c78d5 ⬆️ Build on metal2vulkan development 82e7c39216
Moves both metal2vulkan revs from d83fb05624 to 82e7c39216, 65 commits on its
development branch, named green by its checks (m3-max-59311). The runtime's
crate takes its published name there (9a1c8fe6dc): metal2vulkan-rt 0.0.0 is
now metal2vulkan-runtime 0.2.0, its library metal2vulkan_runtime. The
dependency key, the crate's paths (each still `as rt`), the lock's entry and
the docs, comments, log lines and scripts that named the crate follow it. The
rename changes no API.

On rt:
- A command buffer waiting for a shared event's value whose signal is
  submitted is Scheduled as it is submitted (4730af16e7): its scheduled
  handlers run on the submit thread then, and its queue's later command
  buffers are no longer held behind it. A wait for a value that neither the
  host set nor a submitted signal promises stays held, Committed, as before
  (counted in Metrics::event_holds, fb4b77048c). GPU order and completion are
  unchanged. The docs that said rt's completion thread runs a held command
  buffer's scheduled handlers now say its submit thread does.
- Copies over buffers are tracked by the memory a buffer lies in, never its
  id (7e38a29b69): a texture over one buffer sees a draw through a texture
  over another buffer over the same bytes, in one command buffer and across
  a held group.
- A kernel that reads buffers through an argument buffer's pointer members,
  or through a gpuAddress the CPU wrote into a constant buffer, now makes
  (3cdca62567, c0403a1c98); the translator refused it (IdentityDomains).
- A refused kernel input names its kind (98895eb6d2, 1c26e1dc54):
  Gap::KernelInput { kind }, so the refusal's text, in the log and in the
  NSError's description, carries the kind. It is still counted as
  KernelInput.
- Memory goes back sooner. The release of a texture or block that an unsent
  upload holds sends the upload at once (0277c68696). A texture longer than
  a 16 MiB block has its block to itself and gives it back at its release
  (61949e8ba4). Every free of device memory on a normal path is made by the
  block-maker thread, and counted against the submits it meets (4c808ffa6d,
  09735ad792). New gauges tell texture blocks apart from the consumer's
  Private takes (b3f6c859dd).
- ComputePipelineState::dispatch_variant, the key of the VkPipeline a dispatch
  runs (82e7c39216), which this tree does not call yet.
- The translator's old path is deleted (0b94d919d9 to 16c831165d): its
  profile comes from Vulkan queries alone, with no policy switches and no
  driver-fact tables. SEMANTICS_VERSION goes from 2201 to 2203 and
  RUNTIME_VERSION from 2540 to 2541, so rt's shader and pipeline caches miss
  once: the first run on each host translates its pipelines again.

The rest is metal2vulkan's own: its conformance declarations and ledger, its
generated documents and the tests of each change. The NSError texts the guest
receives, and the comments of the wire header and the guest's sources that the
prebuilt kext sets and the option ROM record, keep the old name here; commits
of their own change them.
2026-11-20 09:41:45 -08:00
Anees Iqbal 2e5bda92d7 🐎 Zero a take's own piece while the host maps it
A take that grew the pool was carved only once the host said its piece was in,
and its worker zeroed it after that, so the host's add and the zeroing ran one
after the other on the take's path: on the 2080's gate walk the zeroing of
context 39's 560320 KiB take took 22.78 ms, and a 256 MiB add took 2.3 ms on
the 780M (11-19).

Now the pool's thread carves the take at its piece's first byte as it places
the piece, before it asks the host's add, and the take's worker zeroes the
carve while the host maps the piece; the take is still answered only once the
host said the piece is in. The zeroing's time counts as the take's zeroing
(pool-take-wait-zero-ns), and only the rest of its wait for the piece as its
growth (pool-take-wait-growth-ns and the pool-take-waited line), so the wait
codes' test checks the growth with the zeroing.

For the guest: a take that grows the pool is answered at its own piece's first
byte. Before, it took the first fit once the piece was mapped, which under a
race could be bytes another take freed meanwhile, or, with another context's
take carved first in the new piece, a further piece of its own.
2026-11-20 07:43:48 -08:00
Anees Iqbal a299f41355 🐎 Take a take's own block off the pool's thread
A take that fits no piece waited for its own piece on the pool's one thread,
which served every ask in turn: the headroom's 16 MiB blocks from rt (each up
to 72 ms where rt's maker makes one), then the take's own block, and a piece
going back blocked the thread until its holds and the host's remove were done.
On the 2080's gate walk, context 39's take of 560320 KiB waited 271.54 ms for
its piece, of which 139.5 ms was rt's allocation of its block; the rest was
the wait behind that thread's other work and the add.

Now the take's worker takes the block of its own length from the source, with
the pool's lock let go of, so only that take waits for its allocation. A new
thread, reims-vgpu.graphics-pool-ahead, takes the blocks of the pool's own
asks (the headroom and the host's pool_grow). The pool's thread places the
takes' blocks before the taker's, and gives a piece back a step at a time: it
asks the host's remove once no hold is left and gives the block back once the
host removed it, waiting for neither, with the 1 s warning kept.

For the host: pool_add and pool_remove stay on reims-vgpu.graphics-pool, one
at a time, in the order the pieces are placed, each add before its remove.
A take's block may now be placed ahead of headroom blocks asked before it,
so the order of the adds, and the pool offsets the guest's takes get, can
differ under a race from before. The new tests fail on the code before this
(job m3-max-58851): another context's take, the headroom and a give-back now
go on while a take's own block is being made.
2026-11-20 07:43:48 -08:00
Anees Iqbal 8c40add9ac 📝 Say what the tree runs on now the old platform is gone [ci skip]
The cutdel branch deletes VulkanPlatform, metal2vulkan-runtime and the rt
feature, so RtPlatform over metal2vulkan-rt is the only platform. These
docs still described the old one: its answer policies, its exact
switches, MoltenVK on the Mac, its in-place guest memory, its records
cache, its device recovery and its Metal-answer tests.

- conventions.md: the guest-memory-in-place rule is replaced by the rt
  rule (rt allocates GPU memory, the device maps its blocks into the
  guest, textures sync at the guest's events, and there is one VkDevice
  per process). The degradation codes are now rt-unbuilt and rt-refused,
  and the deleted codes are dropped.
- accuracy-ledger.md: restated for rt, which has no switches. It keeps
  the device's own arithmetic notes (tagged as measured before rt), the
  19 unbuilt pieces and rt's refusal kinds, and device loss.
- api.md, README.md: REIMS_VGPU_EXACT, _CENSUS_DIR and _TRACE_DEGRADE
  are gone, and STRICT now covers running out of memory only. The let-go
  and the quiesce describe one platform.
- architecture.md, development.md, testing.md, qemu.md: KosmicKrisp in
  place of MoltenVK; RtPlatform, rt_window and RtBlocks in place of
  VulkanPlatform, the old window sink and HostBlocks; no Metal-answer
  comparisons and no opt-in GPU-fault tests.
- lessons.md: the four lessons about deleted code only (the Metal
  comparison after MoltenVK, the runtime's shadows, device recovery and
  the in-place check) are dropped. The lessons that still bind mark
  their deleted names.
- video/vaapi.md, graphics-kext/design.md: the GPU plane copy and the
  compositor mirror are marked as gone.
- AGENTS.md: only the Vulkan platform's "Where things are" row changes.
2026-11-20 07:08:46 -08:00
Anees Iqbal 3a550ab291 🐎 Let go of released device caches off the surface worker
A released block's device cache was dropped on the surface worker under its
block's key, and so were the views and the SURFACE_PAGES and BUFFER_OVER_PAGES
jobs, on the worker's four threads. A video session's caches go together at its
end: on Windows each is a Direct3D 11 target pair whose drop flushes both
immediate contexts under the plane draws' lock, 6 ms at the median and up to
100 ms under that contention. On the UHD 630 the held pass's 240 pairs kept all
four threads busy, and the next session's first SURFACE_PAGES, taken 15-19 ms
after its open and done in 0.02 ms, waited 512-586 ms for a thread to post its
answer; the guest's first copy took 516-600 ms.

The caches now go on a worker of their own, reims-vgpu.graphics-let-go-<i>,
each block's in its order: at a BLOCK_RELEASE, and once a block is named again
without a cache, whose drop ran inline on its ring-0 lane before. Their drops
answer nothing and no job waits for them, so a pages job no longer waits behind
them. The Linux arms' caches, VA-API's dma-buf imports and NVDEC's, go the same
way through the same let-go. A view's drop stays on the surface worker under
its block's key, as its mapping may go back to the idle pool the block's next
SURFACE_PAGES takes.
2026-11-20 06:39:52 -08:00
Anees Iqbal 7905f732f3 🐎 Make each pool piece one metal2vulkan-rt unit
The pool asked its source for 64 MiB pieces. metal2vulkan-rt's unit is 16 MiB:
a take of up to a unit lands in a unit rt's block maker made ahead, with no
Vulkan call, while a longer take makes an allocation of its own length on the
pool's thread and rt frees it as one call once it has been idle 250 ms. A
driver may hold the device's submissions for the whole of such a call, longer
the longer it is: on an RTX 3090 a free on rt's slow path held a submit 72 ms
for 64 MiB and 20.6 ms for 16 MiB, and rt's ALLOCATION_LEN records a 16 MiB
Shared allocation holding one 3.3 ms at the median and one of 256 MiB 51 ms
(measured).

A piece the pool asks for itself is now one unit, BLOCK_LEN, read from rt
(MemoryClass::Shared.block_len()). The headroom keeps the bytes it kept, 64 MiB
(HEADROOM), as four empty pieces: the pool asks a unit for each piece the
headroom is short, counting the asks its thread has yet to serve and the one it
serves, and gives back only the empty pieces above the lowest 64 MiB of them. A
take longer than a unit still has a piece of its own length.

What the host sees: pool_add and pool_remove carry 16 MiB pieces where they
carried 64 MiB ones, four adds at the guest driver's take of POOL where there
was one, and, as the guest's use grows and shrinks, up to four times the adds
and removes for the same bytes, each piece a mapping of its own (QEMU: an
unmergeable RAM region, a KVM memory slot in each address space).

What the guest sees: a block's offset in the pool, and its GPU address where
the guest took POOL_ADDRESSES, follow the 16 MiB pieces. Blocks that shared a
64 MiB piece now lie in up to four, and a take longer than 16 MiB, which fitted
the old piece, has a piece of its own past the headroom's.

The tests that held the one 64 MiB piece count the headroom's pieces, and
a_piece_is_one_rt_unit pins the unit, the headroom's bytes and the long take's
own piece.
2026-11-20 06:03:27 -08:00
Anees Iqbal 3c038ee9be 🔥 Take no shape's block ahead of its image
A large surface's whole-extent shape had its block taken ahead, on a worker
pool of its own after its SURFACE_PAGES answer, so that the ring could place
the shape's image in it instead of taking a block at the make. On a 3090 walk
(the desktop, a browser and a 3D benchmark), no placement into a block taken
ahead saved a make: 33 images placed so at 2648x1618 took 1.47 ms each,
against 1.21 ms for the 8 of that shape made with a block taken at the make;
2 at 3648x2038 took 1.64 ms against 1.67 ms; and the two shapes whose makes
took longest were never placed so. 54 blocks were taken ahead (1755 MiB), and
19 of them went back unused (1141 MiB).

The take ahead, its worker pool (reims-vgpu.graphics-shape-blocks-<i>),
ApiPlatform's shape_block and placed_shape_image_in, rt's ImageBlock, and
their codes (rt-shape-blocks-ahead*, rt-shape-image-makes*) are removed. A
new shape's image is made on the thread that asks for it: it is placed in a
block taken at its make where its fill copies more than zeros, and is the
platform's own otherwise, as before the take ahead. The guest sees the same
values.
2026-11-20 00:47:12 -08:00
Anees Iqbal 1e88f5d90b 🐎 Circulate the two kept staging pieces, with no top-ups
The staged copies' spare pieces were topped up on a thread of their own
after each copy. One 780M walk made 72 scratch pieces beside 27 spares
topped up, and on the 780M a buffer make holds the process's submits
through the driver's lock (6 submits, median 6.50 ms, max 9.76 ms), so a
make on any thread holds up the guest's work.

The two kept pieces now circulate instead. The first two pieces made are
whole 16 MiB pieces, kept; a copy takes an idle kept piece and gives it
back to the kept ones when its command buffer completes. Nothing is made
after a copy, and the top-up thread
(reims-vgpu.graphics-staging-spares-<i>) is gone. A copy that finds no
kept piece idle makes a scratch piece of the length it needs on its own
thread and lets it go once its copy is done, counted as before. Scratch
pieces given back under the caches' lock are let go of after it.

What changes for the guest: its copies make no staging buffers but the
first two kept pieces and the scratch pieces of copies that find none
idle, and nothing makes buffers between copies; the first two copies
make a whole 16 MiB piece where they made the length they needed.

Counters: rt-staging-spares-unused is gone; rt-staging-spares-dropped
(-kib) counts kept pieces let go of without coming back, and
rt-staging-piece-get-ns and -max-ns time each copy's getting a piece.
2026-11-19 23:16:04 -08:00
Anees Iqbal a71bbb8934 🐎 Make video caches' D3D11 surfaces ahead, as deep as decodes
On Windows a video cache's surface over two Direct3D 11 textures is made at the
guest's first texture over one of its planes, on the ring-0 thread that carries
that texture make out, and the guest's next messages wait for it. A player that
holds every picture it decoded takes a new IOSurface, and so a new surface, for
each picture. Measured on the UHD 630 (2026-11-19, a macOS guest's 4K playback,
pictures held): the targets' make took 9.3 to 9.8 ms on the ring and their
import about 0.7 ms a picture between the HEVC stream's decodes, of a 26 to 33
ms gap from one decode op to the next, as the guest keeps one HEVC decode in
flight; the H.264 stream's first round made them in 14.7 to 18.2 ms.

Each ask now takes a spare made ahead for the same plane shapes, formats and
device recoveries, where one is kept, and hands the makes that bring its spares
back up to the depth to a thread of their own
(reims-vgpu.graphics-drawn-spares-<i>), which nothing waits for; an ask that
finds none makes its own as before. The depth is the guest's decodes in flight
at its last decode (the session's value less its event's signalled value), at
least one and at most 8 spares in all, which bounds their memory; the makes run
one at a time under the device's reset gate held shared. The guest sees the
same surfaces: only the thread and the time of their make change. Counted as
video-drawn-spares-used, -missed, -made and -dropped.
2026-11-19 23:15:49 -08:00
Anees Iqbal b6942d9e74 🐎 Take a large shape's Private block ahead, off the ring
On rt, a cache's first shape over rt's 16 MiB unit makes its image in a
Private block of its own, taken on the decoding thread: a 34.5 MiB image's take
took 24.6 ms on a ring on a Radeon 780M, and the longest of rt's takes in a boot
45.7 ms, each a stall on the guest's path. A cache's surface pages give its
whole-extent shape before a draw needs it, so after the SURFACE_PAGES answer the
device asks a worker pool of its own (four threads, keyed by the block) to take
that shape's block, holding the reset gate shared. The ring places the shape's
image in the block when the take has landed, and makes its own as before when it
has not: it never waits for the take. A block no image takes is given back.

New codes count the shape images the ring makes (all, over rt's unit, and in a
block taken ahead: count, ns and longest), the blocks taken ahead (count, ns,
longest and KiB), and those that came late, did not fit, were refused or went
unused.
2026-11-19 19:53:23 -08:00
Anees Iqbal 9dde645e8a 🐎 Top the staged copies' spares up on a thread of their own
A staged copy that found no spare made its piece on its own thread, and on a
Radeon 780M 55 first copies of caches did, 124 ms in all, the longest 17.1 ms
(rpstage2's walk). Making the pieces at each cache's make instead moved that
wait into the guest's SURFACE_PAGES answer. Now a copy whose takes leave no
whole piece among the spares hands a top-up to a worker of the spares' own,
which nothing waits for: it makes whole pieces until the spares hold their cap
of two, under the device's reset gate, letting go of shorter ones to fit. A
copy that still finds no spare makes its piece as before, counted as before.

The trigger is a drained spare set, not every take: a take that leaves a whole
piece kept is served again once its own piece comes back, and a top-up after
it would make one piece and let one go per copy (2209 takes on that walk).

The top-ups are counted: pieces made, their time and KiB, pieces let go of,
those a top-up made and no copy took, and the most the spares held. A test's
spares hold their top-ups until it lets them run, so the copies' tests keep
what a copy does with no top-up ahead of it.
2026-11-19 15:50:22 -08:00
Anees Iqbal bbeb3d39b3 🐎 Land staged downloads on threads of the caches' own
On the rt platform every cache's copies are staged, and a download's command
buffer ended in a completed handler that copied the staging buffer into the
pages on the host's CPU. The platform sees every queue's completions on one
thread, so a large surface's copy held all of them: 144 MiB at 3 GB/s is
48 ms, and every completion of every queue behind it waited that long.

The handler now hands the copy into the pages, the copy's landing and the
answers that wait for it to a worker of the caches' own
(reims-vgpu.graphics-into-pages-<i>), keyed by the block, so a block's copies
land in the order their command buffers completed, and returns. Only what
waits for the pages waits for that thread: the download's or release's
answer and the threads that wait for the copy to land.

For the host: raise_interrupt is now also called on those threads, which the
header, docs/api.md and the raise list now name. QEMU's callback already
takes any of the library's threads, so its side needs no change. The tests
that check a staged download's answer now wait for the worker, and a new
test shows another queue's completion going through while the copy waits.
2026-11-19 10:12:58 -08:00
Anees Iqbal 0566d4b0ef 🆕 Ask a pool piece ahead when the guest's driver takes the pool
The pool started with no piece, so the guest's first take waited while the
pool's thread made a block and the host mapped it: 47.7 to 58.7 ms on a
Windows host, where the block's pages are touched one by one. The pool now
keeps its one empty piece from the moment the guest's driver takes POOL.

What the host observes: the first piece's pool_add now follows the guest's
DRIVER_FEATURES write that takes RGFX_FEATURE_POOL, from the pool's thread,
instead of following the first POOL_TAKE. A driver that does not take POOL
gets no piece. A take of POOL after a reset asks none while a piece the
guest may use is empty or one is asked. pool_add still never comes before
the device's make returned. The guest's first take is carved from that
piece where the host mapped it by then.

The device tells its host through a new Host::pool_taken, called inside
the write each time the bit goes from not taken to taken; the graphics host
answers it with the pool's headroom rule, the test State::use_piece makes.
The tests that took a block first now map the piece the take of POOL asked
for before the take.
2026-11-19 05:33:30 -08:00
Anees Iqbal f4692c7179 🐛 Take a pool piece out of the guest before its block goes back
The pool gave an empty piece's block back to its source and left the
guest's mapping to the source's unmap hook (BlockMappings::unmap), which
the source called before it freed the block, on the pool's thread or its
own. The metal2vulkan runtime deletes that hook, so the pool keeps the
promise itself: it gives a block back only once no thread of the device
holds it and the host has said its piece is out of the guest's address
space, and its close gives every block back only after every hold has
ended. The source may then free any block it gets back at once.
HostBlocks loses its mappings field, and Pool::new takes the source
itself.

What changed for the host: pool_remove comes on the device's pool thread
as the pool gives a block back (an empty piece past RELEASE_DELAY), never
on the source's thread; and a block the source hands out again is placed
and gets a new pool_add, where it used to keep its piece and mapping.
QEMU's x-pool-grow boot (8 asks of 256 MiB) now shows 8 adds and 7
removals (m3-max-49284), where it showed 5 removals before
(m3-max-49031). The release waits for the device's own holds before it
frees the blocks. The guest sees nothing new.

The tests that held "a block taken again keeps its piece" now hold that
it is mapped anew. New tests hold that a piece goes back only once the
host removed it and its hold ended, that one given back before the
host's add answered still waits for its remove, that ready blocks past
two are freed with no word to the host, and that the release gives a
held piece's block back only once the hold ends and asks the host
nothing. All ten fail on the code before this commit. QEMU's comment now
says pool_remove comes on the pool thread.
2026-11-18 18:42:29 -08:00
Anees Iqbal 16ad40298e 🆕 Size the guest's Shared pool's range from all the GPU's heaps
The guest's Shared pool's range of guest physical addresses, which QEMU
reserves and gives the firmware as etc/reserved-memory-end, is now the sum of
the host GPU's memory heaps, every heap, rounded up to 2 MiB and at most the
room the host gives, where it was the heap of the GPU's host-visible,
host-coherent and host-cached memory type alone. A heap's size is how the
driver accounts for memory, not the most it allocates: on a 780M, RADV puts
that type on a 5.52 GiB heap beside an 11.05 GiB device-local one over the same
system memory, so the guest's pool stopped at about 5.5 GiB, while the runtime
takes Shared blocks until the driver refuses one. A guest on a 780M now gets
about 16.6 GiB of pool addresses, on an RTX 3090 about 46 to 47 GiB, on an
RX 7900 XTX about 38.6 GiB; on an Iris Xe, with one heap, 23.24 GiB as before.

GpuDevice::shared_heap_size becomes memory_heaps_total, which sums the heaps
of VkPhysicalDeviceMemoryProperties and needs no buffer to ask which types a
buffer can use. A GPU that answers no heap still gives no pool. The library's
pool line now also logs the room the host gave, so a boot's log shows whether
the room clamps the range. QEMU's code is unchanged: vendor/qemu moves to a
commit that rewords its comments.
2026-11-18 17:54:51 -08:00
Anees Iqbal 706353df2c 🆕 Size the guest's Shared pool's range from the GPU's Shared heap
The pool's range was a fixed 64 GiB of guest physical addresses, whatever the
host GPU: more than a GPU whose Shared heap is 24 GiB can ever fill, and less
than one whose heap is larger. The range now follows the heap the pool's
blocks come from: metal2vulkan-rt's Shared memory type, the first type with
HOST_VISIBLE, HOST_COHERENT and HOST_CACHED that a buffer of the device's
usage can use, on the GPU device the library opens. The bound is the heap's
size, not VK_EXT_memory_budget's budget: the range is address space held for
the VM's life, while a budget is momentary, moved by other processes, and on
Intel's Windows driver answered past its heap's size; RAM is bounded at each
block's take.

The config's pool range is now the room the host can give. The create opens
the GPU device, takes the heap rounded up to 2 MiB of that room (warning once
where the room is smaller, and giving no pool where no type is host-cached),
and rvg_graphics_device_pool_range answers what it took. The range is read
after the create rather than asked of the library before it, which would open
the GPU device twice or keep one alive without a device. QEMU offers the room
from pci-hole64-end to three quarters of the guest's physical addresses, then
reserves the range the library took, rounded up to 1 GiB, in
etc/reserved-memory-end, still at realize before the firmware runs. The
x-pool-size property goes; 0 and 0 still mean no pool in the C API.

What the guest sees changes: the firmware's reserved-memory-end, and so where
OVMF may put its 64-bit PCI window, follows the host GPU's Shared heap instead
of a fixed 64 GiB.
2026-11-18 16:52:12 -08:00
Anees Iqbal aa28476e9d 📝 Name Windows beside Linux and macOS in the window and OS docs [ci skip]
The swapchain, the window's presenter, the display's sink and the window
system's extensions present on Windows too, through SDL's Win32 surface
(os/windows.rs's WINDOW_SURFACE_EXTENSIONS), but their docs said "either OS"
or named Linux and macOS alone. rust-toolchain.toml still named the Metal
platform, deleted on 11-07. caps.rs's table gave a host's naming of its
device by Metal's registry ID (open_device, a handshake) as the reason for
the stand-in; no host names its device so now, and the reason that holds is
that Metal's core count and driver sizes for that GPU are found by that ID.
Comments and docs only.
2026-11-18 14:56:42 -08:00
Anees Iqbal 5d38c7e825 📝 Say the library's hosts are Linux, Windows and macOS [ci skip]
The owner's word (Telegram 1924, relayed by metal2vulkan): the hosts are
Linux, Windows and macOS, and on macOS the library runs on Vulkan, not Metal.
README and the crates' and docs' notes said VMs run on Linux and that the Mac
build was for development and tests. They now say x86-64 guests run on Linux
and Windows hosts and arm64 guests on Apple silicon Macs, and that the Vulkan
platform runs natively on Linux and Windows and over MoltenVK on macOS.
rust-toolchain.toml names Windows' target as shipping too, and a reims-ctl
test's note says the test, not the installer, is Linux-only. AGENTS.md waits
for the owner's own word.
2026-11-18 14:28:11 -08:00
Anees Iqbal 6f3d1ca802 📝 Describe the guest's Shared pool in the architecture and QEMU's head
Architecture 7.3 names the pool's thread and 15.1 says how the pool places,
keeps and gives back its blocks, and the order of its release. QEMU's
device file lists the pool's range among what the device gives the guest,
and its teardown's taking the pieces out.
2026-11-17 06:35:09 -08:00
Anees Iqbal dd9778ab21 🆕 Write a Windows fault's module, offset and callers on stderr
QEMU on the UHD Graphics 630 host ended with exit status 0xc0000005 as one
4K H.264 session followed another, and nothing said where: Windows Error
Reporting wrote no report and no event for it. The panic hook's install now
adds a vectored exception handler that writes, once per site, the faulting
module and offset, the callers the modules' unwind tables name, and the
thread's name, then leaves the exception to the process's other handlers, so
the process ends or goes on as before. Its first lines named D3D12Core.dll,
called from Intel's igd12dxva64.dll under vaEndPicture.

The lines are diagnostics, which the contract leaves free. The test faults a
child process on purpose and reads its lines.
2026-11-17 02:25:05 -08:00
Anees Iqbal b28e5b874d 📝 Name install.ps1 where the docs list the installer [ci skip]
AGENTS.md's table and its row for reims-ctl's checks, the layouts in
architecture.md and development.md, and qemu.md's opening now name
scripts/install.ps1, Windows' installer, beside install-ctl.sh, which it runs
in MSYS2's CLANG64 shell.
2026-11-16 05:07:24 -08:00
Anees Iqbal 7590a54120 ✅ Check that every path the tree tracks checks out on Windows
aux.rs (ad3b37b8e) kept every Windows checkout of development out from
25ff40427 on, through every check, as none checks the tree out on Windows.
`cargo xtask paths`, now the first step of `cargo xtask check`, reads every
path `git ls-files` lists, reims-ctl's and reims-restore's workspaces among
them, and fails on what git for Windows refuses or Windows' file systems
merge: a device name Windows keeps (CON, PRN, AUX, NUL, COM1 to COM9, LPT1
to LPT9, CONIN$, CONOUT$) with or without an extension, a character Windows
refuses (<>:"|?*, a backslash, a control character), a name ending in a dot
or a space, and two paths or directories that differ only by case. Its tests
hold bad names of each kind, aux.rs among them, and names that only start
like a device's.

docs/lessons.md records the trap, and the one beside it: reims-ctl's new
dependency, built for Windows only on Windows.
2026-11-16 02:38:30 -08:00
Anees Iqbal ce0d6bf5d3 🆕 Name a display node for each display in our arm64 configuration
Ambrosia 0.1.3 adds a /arm-io node for each display a revision 2 module
reports, from a list of names in Graphics > DisplayNode. Our configuration
now gives that list, reims-display0 to reims-display3, so one bundle serves a
device of any count, and an arm64 guest drives each display. Ambrosia 0.1.1
and 0.1.2 refuse a list, so the bundle needs Ambrosia 0.1.3 or later; this
lands once 0.1.3 is released.
2026-11-16 02:15:57 -08:00
Anees Iqbal f75c2aca51 🆕 Report the device's displays to Ambrosia's revision 2
Ambrosia's graphics driver interface gains revision 2, in which the
framebuffer's reserved word becomes Displays: how many displays the device
drives, so Ambrosia can add a display-subsystem node under /arm-io for each
one its configuration names. IOMobileFramebuffer.framework counts those nodes
to know how many framebuffer services to wait for, so an arm64 guest can drive
a display past the first only once each has a node before the kernel starts.

The module now takes MULTI_DISPLAY where Ambrosia gives revision 2 and the
device offers the feature, so DISPLAYS lists every display, returns their
count, and fits its mode to display 0's scanout room as the host splits the
span. Under revision 1, or on a device of one display, it takes no feature and
leaves the word zero, as before, so every Ambrosia from 0.1.1 on still boots
it. The configuration's DisplayNode stays the one string: Ambrosia releases
before revision 2 refuse a list.
2026-11-16 02:15:57 -08:00
Anees Iqbal aa98cd1977 ✅ Clippy-check the video crate's tests for Windows too
cargo xtask check's Windows clippy left the video crate's own tests and
examples out, since its fuzzers' CPU-time clock was clock_gettime's alone. They
build for Windows now, so the exclusion goes, and the check type-checks every
workspace target for x86_64-pc-windows-gnullvm.
2026-11-15 09:47:37 -08:00
Anees Iqbal 3a6a25885c ✅ Clippy-check the Windows target in cargo xtask check
Every library crate builds for x86_64-pc-windows-gnullvm since 11-15, but
nothing in the check saw Windows, so the next Unix-only call in shared code
would break the Windows build unnoticed. The check now runs clippy for that
target on the Mac and on Linux, as the Mac already does for Linux: SDL left
unbuilt, nothing linked. The video crate's own tests and examples stay out,
since their CPU-time clock (codec/fuzz_support.rs) is clock_gettime's; its
library is still checked as reims-vgpu's dependency.

rust-toolchain.toml lists the target, so rustup installs it on every host,
and a test keeps the check's cross targets in that list.
2026-11-15 09:07:15 -08:00
Anees Iqbal 4ba8eb34f2 🆕 Write the library's dist tree on Windows, its archive renamed
`cargo xtask dist` refused on Windows. Run in MSYS2's CLANG64 environment, it
now builds reims-vgpu-c for x86_64-pc-windows-gnullvm, the MinGW target whose
archive QEMU's Windows build links, and writes the tree as on Linux: the
archive, lib/libreims_vgpu.dll, the header, and reims-vgpu.pc, whose
Libs.private is rustc's native-static-libs note for the target.

The archive bundles SDL3, whose 3203 SDL_* globals a host's own SDL (QEMU's
-display sdl, SDL 2) would bind to. Linux links the objects into one and makes
every global but the C API's local; COFF has no such link: lld makes no
relocatable object, and GNU ld -r resolves the objects' COMDAT sections into
static symbols in section 0 that lld refuses ("GCC_except_table36 should not
refer to special section 0"), after writing a plain COFF object of 156110
sections that no tool read until given --oformat pe-bigobj-x86-64. So the
objects stay as built, and llvm-objcopy --redefine-syms gives every global they
define but the rvg_* functions the suffix .rvg, with its __imp_ name, in every
object: no C name of a host's is one of them, and each reference in the archive
binds where it did. rustc's 1832 raw-dylib import members stay as built. dist
fails where the objects keep another global.

The DLL is linked from the archive with a module-definition file that exports
the rvg_* functions alone, and not --whole-archive, which would define each
crate's import descriptor of a DLL again. No import library is installed, so
-lreims_vgpu and meson's static lookup take the archive. What Linux and Windows
share (rustc's note, nm's listing, the C API's names and the globals check)
moves from linux.rs to dist/archive.rs.
2026-11-15 08:39:56 -08:00
Anees Iqbal 17c164836e 🎨 Move the window's SDL thread out of native/linux
The SDL3 window on the library's own UI thread (its thread and queue, the
render thread, input, the keymap and the SDL window's side) holds nothing of
Linux's but the Wayland surface's dma-buf feedback, and Windows runs the same
code. It moves to native/sdl_thread, which native.rs picks for Linux, and asks
the OS file for the compositor's GPU (`compositor_device`); native/linux keeps
the feedback alone.

The files move unchanged but for the module docs and that one call, so Linux
behaves as before. features.md's entries are unchanged: only their guards'
module paths follow the tests to native::sdl_thread.
2026-11-15 07:24:29 -08:00
Anees Iqbal d3cd30088b 🔥 Delete the import twins, the files of zeros and their budget
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.
2026-11-14 09:27:31 -08:00
Anees Iqbal 5a31c8ab28 🔥 Delete the host-OS surfaces and the checks only they reached
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.
2026-11-14 09:27:31 -08:00
Anees Iqbal 28250f0bed 🐎 Route plain queue doorbells to KVM where the guest asks apart
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.
2026-11-13 09:50:12 -08:00
Anees Iqbal bcbdf0572b 📝 Say the last release lets go of the GPU [ci skip]
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.
2026-11-11 10:35:17 -08:00
Anees Iqbal f131db7751 🔇 Relay each heard degradation once, and write every kind's count
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.
2026-11-11 03:44:57 -08:00
Anees Iqbal e91c159484 🆕 Have Ambrosia place display 0's node in the device tree
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.
2026-11-09 09:41:26 -08:00
Anees Iqbal 22ec2795ff 🐛 Hand Graft the discriminators of Legacy's superclasses too
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.
2026-11-09 09:41:26 -08:00
Anees Iqbal f4c78a91da 🐛 Have Ambrosia hand over IOMobileFramebufferLegacy's discriminators
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.
2026-11-09 05:29:20 -08:00
Anees Iqbal 24fa54079b 🐎 Copy VA-API pictures into the guest's planes on the GPU
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).
2026-11-08 06:52:46 -08:00
Anees Iqbal 8b0acb7671 📝 Document our configuration's boot check and a TCG run's needs [ci skip]
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.
2026-11-08 02:56:41 -08:00
Anees Iqbal 5a4418c894 📝 Say that core is the Vulkan crate's module [ci skip]
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.
2026-11-08 01:55:07 -08:00
Anees Iqbal 6fb33ecd27 🎨 Rename the reims-graphics crate to reims-vgpu-graphics
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.
2026-11-08 01:37:50 -08:00
Anees Iqbal ae6f0ec656 📝 Say how the Ambrosia module is built and boots [ci skip]
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.
2026-11-08 00:28:39 -08:00
Anees Iqbal 7638d2ea0e 🐎 Offer the guest modes a multiple of 16 pixels wide
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.
2026-11-08 00:03:13 -08:00
Anees Iqbal 61b1aac9ec 🎨 Make the window's FrameSink one trait
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.
2026-11-07 23:59:51 -08:00