Commit Graph
1422 Commits
Author SHA1 Message Date
Anees Iqbal 054f8a71d0 🐛 Pause a VM where an NVMe or firmware-variable write fills the disk
The fork's nvme device completed a write that found the host disk full to the
guest as Write Fault, and pflash_cfi01 logged 'Could not update PFLASH' and
dropped the variable. Both now follow the drive's error action: under -drive's
default werror=enospc the VM pauses (io-error, the drive's io-status nospace,
which reims-ctl reads to name the file), and the resume runs the write again
(fork 51d47e28, 1e223049, 0beafad0).
2026-12-02 14:31:10 -08:00
Anees Iqbal 81c12ee542 🐛 Give a context's number out again once its close is answered
The kext gave each process's context a number once, counting up from 1, and
never again. A number is the top 24 bits of the context's 64-bit object ids
(RGFX_CONTEXT_OBJ_ID_SHIFT) and of its doorbell page's bind, so the 2^24th open
of a boot carried ids past 64 bits, onto other contexts' ids.

Numbers now run below 2^24, in turn from where the last was taken, wrapping
past the last to 1 and skipping those held. A number is held from its open
until both the device has answered its close OK (no framebuffer started, or a
late answer, counts as well; a refused close keeps it) and its user client is
freed, so no call of the client's, and no create it posted behind its close,
can reach the device once another process takes the number. Where every number
is held, or the 2048 the kext keeps, the open is refused with
kIOReturnNoResources, as when no unit of GPU addresses is free: the bundle
answers that process no Metal device, and a later open takes a number once one
is given back. A live number is never given out twice.

context_numbers_test pins it near the top: the last numbers below 2^24, the
wrap to 1 past those held, a number reused only after both holds drop, and
every number held refused with nothing changed.
2026-12-02 14:31:03 -08:00
Anees Iqbal 7399b4fc60 🐛 End the process at a view of several slices of a linear array
A view of a range of more than one slice of a 2D array over a buffer, made
by the linear form, answered nil. Metal asserts at it on the M3 Max and an M4,
plain and validated ("sliceRange.length == 1", measured by metal2vulkan), and
neither x86 Mac makes such an array, so every Mac on record ends the process
there. The bundle now ends it too, before anything is sent, after the view
rules both x86 Macs share.

A view of every slice named by its pixel format alone still answers nil:
Metal's answer for that form is not measured, and it goes to the oracle
probe.

For the guest: a process that asks for such a view now ends at the call, as
on a Mac, where it went on with nil. The shell test that held the nil keeps
only the pixel-format form, and a death test checks the range.
2026-12-02 14:03:22 -08:00
Anees Iqbal 4b7790b4ef 🐛 Make a linked function with its constant values, none too
A linked function made with constant values that set none of the constants
it declares, or by a descriptor without values, options or a specialized
name, reached the host with no constants. The host then made it by its name,
and the Vulkan runtime refused the pipeline that linked it, where Metal makes
that pipeline and the function reads its unset constants as undefined. Stage
functions were fixed the same way in e6d1572dd5. This was the last path that
still made a function by name.

The host now makes each linked function as it makes a stage's function: with
its constant values, even when there are none. That covers pipelines and
function handles. A function made by name that declares constants would then
be made with them undefined. So the bundle now refuses a pipeline that links
such a function, as it refuses one of such a stage function, in the same
words with the role "linked function", and sends nothing. Metal's answer for
a linked function made that way is not measured; the host's runtime refused
that pipeline before this change too.

For the guest: a pipeline that links a function made with values that set
none is made, and the function reads its unset constants as undefined, as on
Metal. The decoder test links tests/shaders/linked_optional.metal's function
by name, sent with no constants and then with one, on the Vulkan platform.
The two fake-platform tests that held the by-name make now expect the make
with constant values. The bundle's shell test checks the refusal in each list
of each creator, and the record sent for a function made with no values.
2026-12-02 14:03:22 -08:00
Anees Iqbal 5b1067a787 📝 Say Metal leaves a write into read-only memory undefined [ci skip]
No header of the macOS 27.2 SDK states what a GPU write into memory a
process maps read-only, or into a no-copy buffer of bit 24, does:
MTLDevice.h says only that newBufferWithBytesNoCopy wraps an existing part
of the address space, and bit 24 is no public MTLResourceOptions value. The
accuracy ledger's read-only-pages-written entry now says so, and words the
known gap as the planner ruled it: a GPU write into memory the guest mapped
read-only stays visible until the next commit that uses the copy.
2026-12-02 13:57:07 -08:00
Anees Iqbal 5deffb45a2 📝 Record the arm64 guest's boot on the M3 for the Mac arm [ci skip]
An arm64 macOS 27.0.1 guest's boot on the M3 (m3-max-80121) decoded seven
H.264 and HEVC streams to ffmpeg's MD5s on the arm and played and recorded a
movie of each codec with no bad frame, so formats.md's H.264 and HEVC Main and
Main 10 cells name it, and D29 gives its count of GPU-copied pictures and KiB.
formats.md also names the arm's caps_of among the arms' caps.
2026-12-02 13:55:34 -08:00
Anees Iqbal c83dc74d31 📝 Say which video caps the Mac arm writes [ci skip]
devices.md's Mac arm paragraph now says which caps entries the arm writes and
that the arm64 kext serves its paravirtual decoders from them.
2026-12-02 13:55:34 -08:00
Anees Iqbal f9af79118f 📝 Document the VideoToolbox arm on Mac hosts [ci skip]
devices.md says what the arm offers, how the host answers it and how a
picture lands; formats.md fills the M3 Max's column and narrows N2 to what is
not built; bugs.md records the GPU copy as D29 with its bytes a picture; and
conventions.md and answer.rs name the arm's counts' codes.
2026-12-02 13:55:34 -08:00
Anees Iqbal cba3a88875 📝 Say a pinned bit-24 buffer takes writes as the x86 Macs do
A no-copy buffer or heap of option bit 24 pinned in a known block of
writable pages keeps the GPU's writes. The docs and the line counted under
rt-no-copy-read-only said Metal's GPU drops them, which is the M3 Max's
answer alone: on the 5300M and the UHD 630 bit 24 does nothing, and every
GPU write lands in the buffer's pages (dgpu-oracle.md, Q38). The case is
inside what the Macs answer, so nothing changes in what it does; the docs,
the accuracy ledger and the line now say whose answer it is.
2026-12-02 13:51:13 -08:00
Anees Iqbal 0898313d14 🐛 Answer raster order groups only where rt orders them
The device answered areRasterOrderGroupsSupported yes on every host, the
M3 Max's answer. But rt's translator orders a fragment function's raster
order groups only inside the fragment shader pixel interlock, and refuses
a pipeline of them on a device without it. An RX 550 on RADV (Mesa
26.2.6) reports no pixel interlock, so a guest there that was told yes
had its raster-ordered pipelines refused.

The device now answers yes where rt's device creation enabled
fragmentShaderPixelInterlock, and no elsewhere, as Metal has a GPU
without raster order groups answer; the bundle's SPI raster order groups
feature follows the same flag. The answer stays yes on the 780M, the RX
7900 XTX, the Iris Xe and the NVIDIA cards, and is now no on the RX 550
(RADV POLARIS12) and on a Mac host over KosmicKrisp, which lists neither
VK_EXT_fragment_shader_interlock nor the feature. x86-64 and arm64 guests
read the same flag, so both are told no there.
The AMD Radeon Pro 5300M and the Intel UHD 630 answer yes (macOS 26.7.1,
oracle_caps, potluck jobs m3-max-79873 and 79874); neither lacks them.
raster_order_groups_are_rt_s_answer holds the answer; no test held the
old one.
2026-12-02 13:49:00 -08:00
Anees Iqbal 65cbf3220e 🐛 Make a pages block's view after its answer on a worker of its own
Where the guest took IMPORT_ADDRESSES_LATER, a pages block's SURFACE_PAGES was
answered as soon as its runs were carried out, and its view was then mapped
and imported on the same surface worker job before the block settled. The
surface worker runs at most four threads, so four blocks' view makes held
every thread, and the next block's SURFACE_PAGES waited for one behind them,
however short its own carry-out. On the RTX 3090's gcl boot (rowb-3090,
m3-max-79853) carry-outs took at most 2.1 ms, view makes 14.9 ms at the
median and up to 351 ms, and 64 answers took over 50 ms, up to 133 ms: of the
225 over 20 ms, 163 waited while four or more other blocks' views were being
made.

The view made after the answer now runs on the views worker
(reims-vgpu.graphics-views-<i>), a worker of its own under the block's key,
which holds the block's settle until the view is made: the messages that
name the block wait for it as before, and the surface worker's thread goes
on to other blocks' SURFACE_PAGES. A job of the block's on the surface worker
(its BUFFER_OVER_PAGES, or its next SURFACE_PAGES) that finds one of the
block's on the views worker runs behind it there (Worker::behind, one step
under the worker's lock), so the block's jobs keep their order across the two
workers; a SURFACE_PAGES run there makes its view itself, so no views
worker's job hands one to the views worker. The views worker runs at most
POOL_THREADS (4) threads, as every worker does, and holds at most
VIEWS_WAITING (256) jobs waiting (Worker::bounded): a hand-over that finds
that many waits on its surface worker's thread until one is taken, counted
and logged at debug. The busiest 100 ms of the same boot carried out 140
SURFACE_PAGES. No setting changes either number. The view's make takes the
reset gate shared, recursively, as the surface worker's jobs do, and where
the device was reset since the SURFACE_PAGES' begin it makes nothing.

What the guest observes: a LATER SURFACE_PAGES is answered without waiting
for other blocks' views; its own block's later messages wait for its view as
before. What the host observes: raise_interrupt may come on a views worker's
thread (a SURFACE_PAGES or a BUFFER_OVER_PAGES run behind a view there posts
its answer or its command buffer's failure), named in reims_vgpu.h, api.md
and RAISE_THREADS. QEMU's raise_interrupt callback takes a call from any of
the library's threads (the irqfd's write, the WHPX request under msi_lock, or
a BH), as it does from the surface workers', so its side needs no change.
Nothing changes where the guest did not take IMPORT_ADDRESSES_LATER.

Tests:
- a_pages_block_s_answer_waits_for_no_other_block_s_view: four blocks' view
  imports held, a fifth block's SURFACE_PAGES is answered, no surface worker
  cap hit, the views worker at four threads, and a BUFFER_OVER_PAGES over a
  held block made only after its view.
- a_reset_ends_pages_views_made_after_their_answers_cleanly: a reset waits
  for the view being made; the view waiting on the views worker and the
  buffer behind it make nothing after the reset; both blocks settle.
- a_device_released_while_pages_views_are_made_after_their_answers_ends_clean:
  the release waits for neither view, and the device's control goes once
  both views' jobs end.
- worker: a_bounded_worker_s_hand_over_waits_for_room,
  a_job_behind_a_key_runs_after_its_jobs_or_here_where_it_has_none.
2026-12-02 13:39:08 -08:00
Anees Iqbal 3d37c928b4 🐛 Keep every write the kext refuses in order until it goes
A refused write into an object was lost. An indirect command buffer's
records and slots and a visible function table's entries were dropped with a
log line, and a shared event's setSignaledValue: was dropped with none. The
kext refuses a control-ring post once its ring has stayed full for 5 s, or
once the device has stopped. Later command buffers then ran the ICB's old
commands or the table's old entries. A buffer already posted that waited on
the event's value never ran, even once the host read again.

Row 318's queue of refused Managed notes now holds every such write, in one
first-in-first-out order: ICB_WRITE, ICB_SLOTS(_IN_PAGES), FUNCTION_TABLE_SET
and SHARED_EVENT_SET_VALUE besides the range, region and didModifyData. A
waiting write is posted before the next write, a destroy or a commit, and
from a timer once a second while any waits. The timer means an event's value
still reaches the host when nothing else is posted. A destroy now waits behind
the waiting writes, since a record or a table entry may name its object, and
drops the writes into its own object. A refused ICB_SLOTS of several buffers
waits as one message for each buffer. The device's stop ends the timer and
drops what waits.

What changes for the guest: while such a write waits, a commit fails its
command buffer unposted with MTLCommandBufferStatusError and
MTLCommandBufferErrorInternal, as for a refused Managed note before. Once the
kext takes posts again, the writes go in order before the next buffer. At
most 4096 writes or 16 MiB wait. Past that, a write is lost and every later
commit fails Internal. After the device's stop every commit fails the same
way. A write is never dropped while later work runs. Nothing changes where
the kext takes every post.
2026-12-02 13:39:07 -08:00
Anees Iqbal d39e13c4cf 📝 Say the guest answers the info's threadgroup memory [ci skip]
The bundle now answers maxComputeThreadgroupMemory from the device info, so
the oracle table's row gives the device info's answer for each guest instead
of the Metal base's 65536. This lands in one batch with the bundle's getter.
2026-12-02 13:14:23 -08:00
Anees Iqbal baf08a4d11 🐛 Give an x86-64 guest's device info its threadgroup memory limit
The device info's max_compute_threadgroup_memory slot carried the
platform's 65536 bytes, Metal's on the M3 Max, on every host, while the
runtime refuses a kernel's threadgroup memory past
maxThreadgroupMemoryLength, which the device answers as rt's told limit
(32,752 or 32,768 bytes). Both x86 Macs answer the two alike, 65536 and
65536 (AMD Radeon Pro 5300M and Intel UHD 630, macOS 26.7.1, oracle_caps,
potluck jobs m3-max-79873 and 79874), so an x86-64 guest's framework may
size a kernel by either.

For an x86-64 guest the slot now holds the device's
maxThreadgroupMemoryLength; an arm64 guest's keeps the platform's 65536,
the M3 Max's pair. No guest reads the slot yet: the guest's
maxComputeThreadgroupMemory is still its Metal base's 65536, until the
bundle answers it from the slot.
compute_threadgroup_memory_follows_the_guest holds the new slot; no test
held the old one.
2026-12-02 13:14:23 -08:00
Anees Iqbal 5a2b9f99f7 🐛 Answer no to the texture write rounding modes
The device answered supportsTextureWriteRoundingMode: yes for modes 1
and 2, the M3 Max's answer. No pipeline create on the wire carries a
rounding mode, so the host's pipelines round as the runtime's default,
toward zero, whatever the descriptor asks: a guest told yes for mode 2
(round to nearest even) got a pipeline that rounds toward zero, and the
bundle logged the mode as unsupported.

The guest's device now answers no for modes 1 and 2, for both guests and
on every host, as the AMD Radeon Pro 5300M and the Intel UHD 630 answer
(macOS 26.7.1, oracle_caps, potluck jobs m3-max-79873 and 79874). The
answer is the lane's, in device_info's table, until a pipeline create
carries the mode to the runtime, which takes it. No test held the old
answer; no_texture_write_rounding_mode_is_carried holds the new one.
2026-12-02 13:14:22 -08:00
Anees Iqbal e3d002fae7 🐛 Answer no to the raw primitive types 5 to 9
The device answered supportsPrimitiveType: yes for the raw types 5 to 8,
the M3 Max's answer, but the runtime draws only the public types 0 to 4
and refuses a draw of any other as a primitive type Metal has none of. A
guest framework told yes would have encoded draws that drew nothing.

The guest's device now answers yes for 0 to 4 and no for 5 to 9, as the
AMD Radeon Pro 5300M answers (macOS 26.7.1, oracle_caps, potluck job
m3-max-79873); the Intel UHD 630 answers yes for 5 to 9 (m3-max-79874).
The answer is the same on every host and for both guests.
a_roomy_device_answers_metal_s_counts held the old answer.
2026-12-02 13:14:22 -08:00
Anees Iqbal 456e995096 🐛 Fail commits behind a Managed write the kext did not take
A Managed texture's replaceRegion:, a texture's didModifyData and a Managed
buffer's didModifyRange: tell the host to copy the CPU's bytes to the GPU's
copy. The kext refuses a post once its control ring has stayed full for 5 s
(a host that stopped reading), and also once the device has stopped. On a
refusal the bundle dropped the message without a word: the region and
didModifyData always, and the range when the held messages would not fit
with it. Every command buffer committed afterwards read a stale GPU copy.

Such a write now waits in the serializer (postWaitingNotes). It goes first
at the next such write and at each commit, and is dropped when its object is
destroyed. What changes for the guest: while a write waits, a command
buffer's commit fails it unposted with MTLCommandBufferStatusError and
MTLCommandBufferErrorInternal, as a buffer behind a held create already
fails. Once the kext takes posts again, the writes go before the next buffer,
which runs as before. Past 4096 waiting writes, the next one is lost and
every later commit fails. Nothing changes where the kext takes every post.
test_commit_behind_an_untaken_managed_write_fails covers each kind.
2026-12-02 13:14:22 -08:00
Anees Iqbal c0dcc030cd 🐛 End a commit's wait for ring room at the device's stop
A commit that found its queue's submission ring full waited for the host to
take from it, with no deadline: on the host's room record where the device
holds SUBMIT_ROOM, else in sleeps between looks. Once the device stopped,
the host took nothing more, and the ring may already be gone from the
process with the context's window, so the committing thread looked at it for
good. The same held for a waiting thread's scheduled ask.

A queue's reader now stops the ring's room events with itself
(RgfxReplyReader::stop). A post waiting for room ends there, and a post
after it answers at once, looking at no ring word and ringing no doorbell
(RgfxRingWriter::post). Every queue now has room events, as the stop's
channel; whether the post waits for room records still follows SUBMIT_ROOM,
so the waiting is unchanged.

What changes for the guest: a commit waiting for room on its queue's ring
at the device's stop returns, and its command buffer fails with
MTLCommandBufferErrorInternal ("Discarded (victim of GPU error/recovery)"),
as a buffer committed after the stop does (previous commit). Before, the
commit never returned. serializer_tests' new test runs the writer's wait
across the stop with and without room records, and queue_tests' new test
runs a commit's.
2026-12-02 13:14:22 -08:00
Anees Iqbal ac7885c79b 🐛 Fail a queue's buffers in flight at the device's stop
When the kext closed a process's completions (the device's stop, or the
context's release), the completion thread ended and left its readers
undriven, so each wait for a command buffer took the queue's ring itself.
No record could come there any more, and the kext also takes the context's
window, the rings in it, out of the process. waitUntilCompleted,
waitUntilScheduled and commitAndWaitUntilSubmitted spun on the ring for
good, -commandBuffer polled it every millisecond for slots the buffers in
flight never gave back, and the queue's finish slept for good, where they
did not read memory the process no longer mapped.

The completion thread now stops every reader at that point, and each one
added after (RgfxReplyReader::stop). A stopped reader reads its ring no
more and fails every command buffer it still awaits, in ring order, as a
GPU recovery's victim. A buffer committed after the stop fails at its
commit, with nothing put on its ring. Such a failure touches nothing of
the buffer's surfaces or copies.

What changes for the guest: at the device's stop, each command buffer in
flight or committed afterwards completes with MTLCommandBufferStatusError
and MTLCommandBufferErrorInternal ("Discarded (victim of GPU
error/recovery)"), the bundle's answer for work a stopped device never
took. Its scheduled and completed handlers run, and every wait for it
returns. Before, the buffer never completed. A buffer committed after
the stop no longer goes on its ring, and its waiter no longer takes
records from the ring.

shell_tests' test_completion_thread_stops held the old behaviour (a buffer
committed after the stop completed from a record its waiter read off the
ring). It now holds the failure, and keeps the ring-taking waiter for a
destroyed thread. queue_tests' new test runs every wait above across the
stop, alone with `shell_tests --waits`.
2026-12-02 13:14:22 -08:00
Anees Iqbal c9e1b356b5 🐛 Fail a buffer whose cache fill gets no command buffer
What the guest observes changes. A fill of a surface's device cache from its
pages, or of a new shape from the cache, that the platform made no transfer
queue or command buffer for was left unmade with nothing said: the command
buffer whose begin asked it ran over the cache's older bytes, or the shape's
zeros, and completed with no error. A fill whose command the platform refused
already fails that buffer with MTLCommandBufferErrorInternal (ac5b41b2ed), so
the fill no command buffer could carry now takes the same answer: the buffer
fails with the internal error, the miss is counted under surface-copy-refused,
and the cache keeps its older generation, or the shape owes its fill still,
for the next use to make. A refused buffer memory keeps OutOfMemory.

This is the fill half of the class 3f446e1e70 fixed for downloads (ledger row
1193). Two fake-platform tests: red at c1de973e24 (m3-max-79907, both failed
on the missing count), green with the fix (m3-max-79910, the surface, shape,
pages, order, command buffer, video and graphics tests, 668 passed).
2026-12-02 13:06:15 -08:00
Anees Iqbal 216197c62a 🐛 Answer a download refused where no copy into its pages is made
What the guest observes changes. A SURFACE_DOWNLOAD whose copy of a device
cache into the surface's pages got no transfer queue or command buffer from the
platform, or whose cache's buffer the platform refused its memory, was answered
RGFX_STATUS_OK at once, over the pages' older bytes: the CPU lock that asked
went on reading what the CPU had last written, without the GPU's writes. rt
answers no command buffer at a wait for room on its own handler thread, where
a download carried out in a writer's finish can ask for one, and on a quiesced
device.

Such a download is now answered failed (RGFX_STATUS_REFUSED, the kext's
existing copy-refused path) where the pages lack a write of the cache's,
counted under surface-copy-refused as a refused copy is since aaedba617b, and
the cache stays written, so the next download or release copies it. A cache
whose buffer holds no memory, so no work wrote it, and whose shapes hold no
write is answered done as before: the pages hold all it holds. A release's
copy so is logged, as a refused one's is.

Ledger row "a SURFACE_DOWNLOAD whose copy gets no command buffer, or whose
buffer memory is refused, is answered done" (audit, 12-02). Two fake-platform
tests: red at b7ff9acca9 (m3-max-79892, both failed), green with the fix
(m3-max-79896, the surface, shape, pages, order and command buffer tests,
411 passed).
2026-12-02 13:06:15 -08:00
Anees Iqbal 22cfe51a54 📝 Delete B96; say how each arm decodes resizing VP9 [ci skip]
B96 is fixed: one NVDEC decoder, or one VA context and pool, takes a VP9
stream's frames at every size up to the largest so far. nvidia.md says what
NVDEC still refuses (an inter frame larger than every frame before it, which
libvpx never codes) and lists the new test; vaapi.md says how the context grows,
with radeonsi's wrong frames under a context for each size (potluck jobs
m3-max-79740 and m3-max-79744), and where the resizing stream decodes (a Radeon
780M, m3-max-79777; the Iris Xe, m3-max-79848); backends.md lists the stream.
2026-12-02 12:46:12 -08:00
Anees Iqbal f6955b031f 📝 Cite an arm64 guest's 4:2:2 export on the Iris Xe [ci skip]
The listing of HEVC Main 4:2:2 10 came back with its hold's lift, and its
ordinary proof is a guest's export of that format on the Iris Xe: an arm64
macOS 26 guest's hardware session coded 10 frames at 640x360 that decoded back
frame for frame at 65.1 to 68.3 dB luma and 59.0 to 60.7 dB chroma, with no
engine reset in the host's kernel log (potluck job m3-max-79800). formats.md's
row and text cite it.
2026-12-02 12:46:12 -08:00
Anees Iqbal 108a8bcb8a 📝 Keep NVDEC's per-set current references off as D28 [ci skip]
An HEVC decode entry answers 8 current references on both arms, and the guest's
video driver fails the schedule of a picture whose sets name more. NVDEC holds 8
pictures in each of its three sets, so lifting the bound there was on the list as
a per-set wire field. Such a picture lies outside the profiles the host lists:
va.h bounds NumPocTotalCurr at 8, and the one stream here that names more,
kvazaar's --ref 15, does what Main does not allow (vaapi.md). So the change, a
wire field with the kexts and both prebuilt sets, buys nothing a listed profile
reaches, and it is put off with what would lift it.
2026-12-02 12:46:12 -08:00
Anees Iqbal 1bb64aaa55 🆕 List HEVC Main 4:2:2 10 for arm64 guests on the Iris Xe again
The hold on HEVC Main 4:2:2 10 (b675d53fff) waited for one encode of the arm64
guest's session that hung the Iris Xe's render engine (boot m3-max-79085:
640x360, a constant QP of 10, a Quality of 0.9, VA quality level 2), run under
the quality-level fix (201d165e47), which renders the level alone and codes at
the nearest level the driver takes. With the owner's word, that case ran once on
the Iris Xe (iHD 26.3.5, Linux 7.3.1, potluck job m3-max-79699): the driver
refused level 2 and took 1, the 10 frames, each repacked by the GPU, coded a
Main 4:2:2 10 stream that decoded back at 65.1 to 68.3 dB luma and 59.5 to 60.2
dB chroma, and the kernel logged no hang or reset. So the refused level was the
trigger, and the hold comes off.

repacked_profiles again keeps Main 4:2:2 10 where the runtime device's GPU makes
an encode session's filler, and leaves it out, said once, where it makes none.
B102 is deleted; formats.md lists the profile as offered on the Iris Xe, and the
lesson on the quality level cites the run.

For the guest: an arm64 guest's paravirtual HEVC encoder lists Main 4:2:2 10
again where the host's VA-API driver encodes it (the Iris Xe's iHD), and a
session of HEVC_Main42210_AutoLevel encodes in hardware. Other profiles and
hosts see no change.

Tests: Main 4:2:2 10 is listed where the device makes a filler and left out
where it makes none, the driver's other profiles listed either way (a unit
test). Build, unit tests and clippy on Linux and the Windows target: potluck
jobs m3-max-79811 and m3-max-79842; rustfmt passes with 68b40ffd56 on top
(m3-max-79842). An arm64 macOS 26 guest booted on the Iris Xe with the change
(m3-max-79800) listed the profile, and its VideoToolbox session of
HEVC_Main42210_AutoLevel, which requires hardware, coded 10 frames at 640x360
on the paravirtual encoder that decoded back frame for frame at 65.1 to 68.3 dB
luma and 59.0 to 60.7 dB chroma; the boot passed its 17 checks, and the host's
kernel logged no engine reset.
2026-12-02 12:46:12 -08:00
Anees Iqbal e76d7e3ab1 📝 Delete B95, fixed by early completion; B41 becomes D27 [ci skip]
B95 said a VA-API reference picture's command buffer completes only once
video processing has copied the picture into its output. 359ac7817e (11-19)
posts the CB_COMPLETE of a command buffer holding only that decode as the
decode is done and the copy issued (runs_behind_the_decode's decoded_now,
Landing::decode_done, ahead_at_decode), and readers of the output wait for
the copy and its acquire at the buffer's platform end: the fix B95 named.
Boots on a Radeon 780M then counted 893 decodes completed ahead and no
buffer or present held (walks 55149 and 55141). The 4K start's first long
gap, read by refresh, was 198.4 ms with it and 197.7 without; its share of
surface makes, first decodes and first video-processing runs is in the
ledger, unmeasured since 6bdfdcd49e and ff96c37f07. The decode wait's cost
B95 held (Iris Xe, m3-max-78524) moves to vaapi.md's zero-copy paragraph.

B41, a truncated slice decoding on VA-API with no error, is put off as D27,
as decided on 2026-12-02: a Mac's hardware H.264 decoder does the same
(measured, D25); a Mac's answer for HEVC is not measured. Its citations in
nvidia.md, vaapi.md and T3 now name D27.
2026-12-02 12:46:12 -08:00
Anees Iqbal 29de5f36e0 🐛 End the commit order's waits at a device reset
A buffer answered CB_SUBMITTED on its doorbell's thread keeps its ticket in
the commit order on its queue until its begin. Where the device's reset ends
the queue before the queue's thread takes the buffer, it is never begun, and
its ticket is given back only as the control thread's reset drops the
queue's tables, holding the reset gate. A walk of the same process on
another queue, begun after that answer, waits at its commit for the ticket
(Sequencer::wait_for, or wait_for_ranges for a range message behind it)
while it holds the gate. The control thread's reset then waited for the walk
and the walk for that reset: on development a deadlock of the reset, and
with the host's settle waiting for the walks begun before the reset, a
death at its 30 s bound. A reboot between a doorbell's answer and its
queue's take meets it, as when the queue's thread is still walking the
buffer before it in place.

The sequencer's two waits now take the decoder's count of resets
(commit_order::Cancel) and end while a reset is under way, or once one came
since they began, as the waits for COMMIT_ORDER, SURFACE_ORDER and the video
caches already did. Decoders::resetting, which both the settle and the
control thread's reset call before they wait, wakes them (Sequencer::wake,
under the order's lock, so no waiter misses it). Its doc already said every
wait for another queue's buffers ends; these two did not.

What the host observes: a reset that comes between a doorbell's answer and
its queue's take no longer deadlocks the control thread's reset, nor ends
the process at the settle's bound ("the device's reset: after 30s, ... queue
walks begun before the reset"). Nothing changes outside a reset.

Tests:
- sequencer::a_reset_ends_a_commit_s_wait_for_tickets_and_range_messages: a
  wait under way as a reset begins ends, one begun during it does not wait,
  and waits wait again once it has ended, for tickets and range messages.
- reset_walks::a_reset_ends_a_walk_s_wait_for_a_buffer_answered_at_its_
  doorbell: queue 1's short buffer walked in place and held, the asking
  buffer behind it answered at its doorbell, queue 2's buffer waiting for
  its ticket, the control thread's reset held; the reset returns inside its
  bound.
Job m3-max-79774 (homelab-um870-1, fake platform): green, 178 passed (the
sequencer's, reset_walks', reset_chain's, commit_order's and the answer,
doorbell and range tests); red, with the waits not ended, both new tests
fail, the reset dying at the bound. fmt, the header's check and clippy on
the host and the Windows target are clean (79783, after the fmt fix); the
workspace's 3169 tests pass on homelab-um870-1's Radeon 780M (79801).
2026-12-02 12:46:12 -08:00
Anees Iqbal 1e8853cd04 🆕 Keep the AIR of states rt refuses for unsupplied draw input
REIMS_VGPU_REFUSED_AIR_DIR kept the AIR and record of a pipeline state only
where the translator refused it. A state rt refuses as reading what a draw or
a dispatch does not supply yet (Gap::RenderPipeline, Gap::KernelInput, such
as DrawInput) names no cause: it is one of a function table, a translation
table, a long parameter block, an unfilled push field or an unnormalized
constexpr sampler, which only the functions' AIR tells apart. A usdz preview
in Quick Look on an x86-64 guest met one (DrawInput) that no log could
explain.

The switch now keeps those states' AIR and records too. It is a diagnostic,
off by default: nothing the guest or host observes changes.
2026-12-02 12:28:20 -08:00
Anees Iqbal ea27c4943e 🐛 Make a heap's texture buffer over the heap's bytes
A guest's texture buffer (MTLTextureTypeTextureBuffer) placed in a heap was
refused: rt makes a texture buffer only over a buffer its consumer places, and
the platform passed the heap's to rt's heap-texture calls, which refuse it
(Refusal::TextureBufferNotOverBuffer). A usdz preview in Quick Look on an
x86-64 macOS 26.7.2 guest showed it six times: the size query was refused,
the bundle laid the texture out by its own bound, and the posted
TEXTURE_CREATE stood refused, so the guest's texture named nothing on the
host and what bound it bound nothing.

What the guest gets now:
- heapTextureSizeAndAlignWithDescriptor: of a texture buffer answers the
  bytes of its row of texels rounded up to the format's texture-buffer
  alignment (minimumTextureBufferAlignmentForPixelFormat:), at a heap
  buffer's alignment of 256 or that alignment, the larger; one of no texels
  stays Metal's refusal.
- MTLHeap newTextureWithDescriptor:offset: of a texture buffer makes it as
  the device's is composed: rt's texture over a buffer of the heap's bytes at
  the offset (rt's new_heap_buffer), answering the heap's modes and tracked
  as the heap. Its texels are the heap's bytes there, in a Private or a
  Shared heap, as a texture buffer's are its buffer's. Bytes past the heap's
  end stay Metal's refusal.
2026-12-02 12:28:20 -08:00
Anees Iqbal f07e99e0d2 🐛 Refuse an x86-64 guest's Shared heap as its Mac makes none
The x86 Macs' Metal makes no Shared heap: newHeapWithDescriptor: of one ends
the process at the descriptor ("Heap Descriptor Validation / Shared storage
mode disallowed") on the AMD 5300M and the Intel 630 under macOS 26.7.1, for
both heap types, with and without the validation layer (m3-max-79571/79572).
The guest's bundle already ends an x86-64 guest's process there, sending
nothing, but the host made a raw HEAP_CREATE of a Shared heap over rt's
Shared memory for any guest, so once rt places textures in Shared heaps an
x86-64 guest could have had textures its Mac cannot make.

What changes for an x86-64 guest: a HEAP_CREATE of a Shared heap now stands
refused, unmade, and the platform is never asked for it, where it was made.
No bundle sends one: the x86 bundle ends the process first, and the arm64
bundle lays its Shared heaps over the pool or the region. An arm64 guest's
device still makes it, as the M3 Max's Metal does. The heaps the bundle lays
over its own Shared memory (HEAP_OVER_POOL, HEAP_OVER_HOST_MEMORY,
HEAP_OVER_PAGES), which hold its Shared buffers and the textures over them,
are made for either guest as before.

The answer lives in device_info beside the other answers about the Mac the
device imitates (makes_shared_heaps), and the device tells the decoder at its
make. a_create_the_platform_refuses_makes_nothing placed its texture in a
Shared heap of an x86-64 guest's device, now refused; it uses a Private heap.
2026-12-02 12:07:50 -08:00
Anees Iqbal 74d3e23de6 📝 Say why a CPU lock's waits inside IOSurface's sync have no bound [ci skip]
Row 322 of the bug ledger noted that op 2's waits run unbounded under
IOSurface's lock. Read at 25488bee35, every such wait (the writes' buffers, a
download's answer, another lock's download, a deferred block's naming, the
block's release) already ends at the device's stop and at the locking
thread's abort, and the bundle's retire after the device's completion keeps
its 2 s bound. The rest is the host's own time, which f1da7c780d left
unbounded on purpose: at a bound the lock read whatever bytes the pages held.
So no code changes; design.md's section on how a waiter waits now says this,
which closes the row.
2026-12-02 12:07:50 -08:00
Anees Iqbal 82d7064f04 🐛 Release reims-graphics at a quit of a VM that was not running
vendor/qemu moves to f8a1f0c5 on the fork's steelbrain/reims-vgpu-rebase-2
(a60aa2b3 before it).

A quit of a VM that QEMU was not running (paused by QMP's stop or by a full
disk, never started past -S, or paused by a shutdown whose action pauses)
stopped no running VM, so the device's VM state handler never tore it down.
The device stayed to the exit, the library's quiesce at the end of QEMU's
cleanup answered that it still held a GPU device, and QEMU ended with _exit.
reims-ctl's stop of a VM paused for a full disk quits such a VM.

QEMU's cleanup notifier now first tears down each device no teardown ran for,
BAR 2 out of the guest's address space first, as at a stop. The release lets
go of the GPU device, the quiesce answers true, and QEMU ends with exit().
Only a device a display's read kept (a GPU that stopped answering) still
ends QEMU with _exit. docs/qemu.md and docs/api.md say so.

What changes for the host: such a quit ends by exit(), with its exit handlers
run. The guest sees nothing: it no longer runs.
2026-12-02 12:07:44 -08:00
Anees Iqbal 2a0064a9bb 🆕 Write the degradation counts again each minute they changed
The library writes its degradation counts line at a device's reset, at the
process's exit and when the host asks (reims-ctl report). A QEMU killed or
crashed writes nothing at its end, so its log held counts only as of the
last reset or ask, often the boot's start: a report of such a run had
nothing to read its degradations from.

The first device made on the process's platform (GraphicsDevice::new, as
the C API makes QEMU's) now starts a thread, reims-vgpu.counts, that every
COUNTS_REWRITE, a minute, folds rt's metrics in and writes the counts line
where it changed since the library last wrote it, and nothing else: the
repeats' line and rt's diagnostic lines stay the reset's, exit's and ask's.
Each write is an entry, so the thread parks for good once the process's
exit began. A killed or crashed QEMU's log now holds counts at most a
minute old. A diagnostic: free under the contract. A test's platform runs
no such thread.
2026-12-02 12:07:15 -08:00
Anees Iqbal 68701c61bf 🐛 Wait at a reset for the queue walks begun before it
The device's reset waits, in the host's settle, for the GPU work the guest
committed before it, so none of that work writes the guest's memory after the
reset returns. A queue walk begun before the reset could still commit work
after the settle looked: the control thread's reset waits for it (the reset
gate), but the settle cannot take that gate, as ring 0's queue creates and
destroys hold it and may wait for the BQL that QEMU holds around the reset. The
walk's GPU work then ran, and wrote the guest's pages, after the reset returned.

The settle now waits, within 30 s of its start, as for the decoder's locks, for
the queue walks begun before the reset (walks.rs: a ticket taken in
begin_command_buffer before the walk asks whether its poster is stale, so a
walk that begins after the reset ends at once and is not waited for). First it
cuts short every wait the control thread's reset cuts short, so no walk waits
for that thread: for other queues' buffers and their events
(Decoders::resetting; commit_order::Cancel now nests, as the two resets may
overlap), for compiles outside the process (GpuDevice::reset_begins, whose
stage-fill suspends nest) and for pipelines still compiling
(Pending::resetting, which nests too). After the walks it releases the events
and surface timelines again, for what the walks made or waited for meanwhile,
then waits for the GPU as before, on progress: the command buffers it waits
for are those committed by then, the walks' among them. Ring 0's block-lane
downloads and cache copies stay out of it. A walk past 30 s ends the process
at "the device's reset", naming the oldest. The settle's line now reads "the
device's reset waited X ms for the W queue walks begun before it (Y ms) and
the N command buffers committed to the GPU before it, Z ms at most with none
of them completing".

What the host observes: rvg_graphics_device_reset and a STATUS write of 0
return only once the queue walks begun before them have ended, which the
header's reset doc and docs/api.md now say. Two tests held the old behaviour
and change with it. a_reset_during_a_walk_comes_after_it had the reset return
with the walk in flight; it now resets on a thread of its own and checks that
the reset waits. reset_chain's stage-fill test had the fill go on through the
settle, cancelled only by the control thread's reset, with the settle setting
the writer's timeline on the CPU; now the settle cancels the fill, the walk
ends with its dispatch refused and commits the writer's buffer, and the settle
waits for it and the reader's on the GPU. Its compile test now moves the clock
past the bound where the reset has not returned, so a red run dies there
rather than hanging.

Tests (tests/reset_walks.rs), each with the control thread's reset held behind
a ring-0 message whose platform call is held, standing for the BQL:
- a_reset_waits_for_a_walk_begun_before_it and
  a_reset_whose_walk_runs_past_the_bound_ends_the_process;
- one per wait class a walk can sit in, each ending inside the bound: a
  COMMIT_ORDER wait, a begin's SURFACE_ORDER wait (whose buffer then waits on
  the GPU for a timeline the settle sets after the walks), a stage's fill and a
  pipeline still compiling.
Job m3-max-79627 (homelab-um870-1) ran them on the fake platform three ways.
Green: all pass, with the progress rule's and the chain's tests (88). Without
the walks wait: the two walk tests, a_reset_during_a_walk_comes_after_it and
the SURFACE_ORDER test, whose timeline is set only after the walks, fail.
Without the settle's cut-shorts: each wait class's test and both chain tests
die at the bound. fmt, the header's check and clippy on the host and the
Windows target are clean (79627); the workspace's 3167 tests pass on
homelab-um870-1's Radeon 780M (79647).
2026-12-02 12:06:18 -08:00
Anees Iqbal 161cf78cf4 🐛 Let a reset wait while the GPU work before it completes
The device's reset waits for the GPU work the guest committed before it, so
none of that work writes the guest's memory after the reset returns. It waited
a flat 30 s, and ended the process past that. A guest that is busy, with
nothing stuck, could reach it: the settle waits for every command buffer
committed before the reset, and a backlog of long ones, each well within the
drivers' watchdogs, can sum past 30 s. Nothing of ours bounds that backlog.

The wait now runs on progress. The set of command buffers it waits for is
fixed as it begins. It waits while they complete, each within 30 s of the one
before (or of its start), and 10 min at most in all: the time cap of the helper
process that runs pipeline compiles and stage fills, read from its definition
(os::compile_helper's TIME_MOST, exported as COMPILE_HELPER_TIME_MOST), not a
new constant. The decoder's locks the settle takes keep their flat 30 s. Each
settle logs the longest it waited with none of its command buffers completing.

What the host observes: rvg_graphics_device_reset and a STATUS write of 0 wait
while that work completes, past 30 s, and end the process only once 30 s pass
with none of it completing, or at 10 min. A reset still waiting 2 s on writes
one line on stderr, whatever REIMS_VGPU_LOG says ("reims-vgpu: reset waiting:
for the GPU work committed before it, N command buffers, 2 s on"), and one
once it is done ("reims-vgpu: reset waited: S s for the GPU work committed
before it"). The death's line says which bound it passed. reims-ctl's
interface reads the first line from QEMU's log, and shows the VM's state as
"reset: waits for GPU", with the line in its pane, until the second comes. The
header's reset docs, docs/api.md ("Waiting", "Deaths", the threads table and a
new "The reset's lines") and docs/known-issues.md ("A stuck GPU closes the VM
when it restarts": one command buffer running past 30 s on a driver that never
ends it is a stuck GPU to the reset) say so.

GpuDevice::settle takes SettleBounds and a waiting callback and answers
Settled; rt's Flights::settle restarts its bound on each command buffer that
completes, on the platform's clock, as the testkit's World::settle does on
virtual time.

Tests: a_reset_waits_on_while_its_gpu_work_completes (three buffers, one
completing every 20 s: the reset returns, having said both lines) and
a_reset_whose_gpu_work_completes_past_the_most_ends_the_process (one buffer
every 29 s, 22 of them: alive after 20, dead at the ceiling); rt's
a_settle_waits_while_its_command_buffers_settle_within_the_quiet_bound on a
virtual clock; reims-ctl's a_vm_whose_reset_waits_for_its_gpu_shows_it.

Red, job m3-max-79515 (homelab-um870-1, fake platform): with the settle's
ceiling set back to the flat 30 s, both reims-vgpu tests fail (the reset ended
40 s on, with its GPU work completing; it ended before the most it waits).
Green: the same tests pass (79515); fmt, the header's check and clippy on the
host and the Windows target (79539); the workspace's 3156 tests on
homelab-um870-1's Radeon 780M (79546); make check-ctl on the Mac (79521).
2026-12-02 12:06:18 -08:00
Anees Iqbal 6716d98745 🆕 Add reims-ctl start --headless, a start with no window
The owner asked for a headless start for viewer-only use: a VM used through
reims-ctl view alone, on a host or over SSH. Until now that took the VM's
variable REIMS_VGPU_WINDOW=0, saved in its settings and named nowhere but the
README.

reims-ctl start NAME --headless opens no window for that start and saves
nothing: on reims-vgpu's own device QEMU gets REIMS_VGPU_WINDOW=0 over any
value the VM's variables give, and VMware SVGA's QEMU -display none. Each
display offers macOS the VM's resolution at 60 Hz: no screen of the host
shows the guest, so there is no screen's rate to follow.

What the user sees: the start prints "NAME: headless, with no window:
`reims-ctl view NAME` shows its screen in the terminal" after its pid;
reims-ctl show and the VM's pane say "running headless (pid N), with no
window: reims-ctl view NAME shows its screen", read from the line the start
writes at the head of its QEMU log; reims-ctl list adds that note below its
table, and its JSON "headless": true. A VM kept headless by its variables is
told the same way. start --help, the interface's help, view --help, doctor's
hint, the resolution settings' help, the README row and docs/qemu.md name the
flag.
2026-12-02 12:06:17 -08:00
Anees Iqbal cbd87bd547 🆕 Offer a headless display the VM's resolution as its mode
A device with no window (REIMS_VGPU_WINDOW=0, or another display of
QEMU's) offered every display 1920x1080, whatever QEMU's resolution
property said: the property reached the library only inside a window
config. A VM started for its viewer alone therefore ran at 1920x1080
whatever its settings named.

The C API's RvgGraphicsDeviceConfig grows headless_mode_width and
headless_mode_height (its seventh version), read only where window is
NULL, and the Rust API's GraphicsConfig grows headless_mode. A display
without a window offers that mode first, its width rounded down to a
multiple of 16 and its height to even as a window's size is, at 60 Hz;
0 in either, or a host built before the fields, keeps 1920x1080. QEMU's
reims-graphics-pci passes its resolution there (vendor/qemu 0f7f65ae).

What the host's user gets: a VM started without a window now offers its
guest the resolution its settings name.
2026-12-02 12:06:17 -08:00
Anees Iqbal b15371a007 📝 Say ANV imports a view's dma-buf from metal2vulkan d122da6ae3 [ci skip]
metal2vulkan-runtime's dma-buf rule now takes, where the first type a dma-buf's
query offers is device-local, the first offered type that is listed,
device-local, host-visible and host-coherent (edad2e31fb): type 1 on the Iris
Xe of RPL-P, where it refused before. So ANV imports a view's pages as a
dma-buf from this pin on, and only NVIDIA's driver still maps views from their
files. The surface pages' module doc, the device's design and the QEMU notes
said ANV was refused.
2026-12-02 11:48:57 -08:00
Anees Iqbal 53e7385993 📝 List the core counts About This Mac names a CPU at [ci skip]
About This Mac says "Unknown" where Apple's table of Intel names has none
for the host's family at the core count macOS reads, the VM's vCPUs
rounded up to a power of two, as a VM of 4 vCPUs on a Core i9 host. The
known issues list the vCPU counts each family is named at, how to pick
one, and that an AMD host reads as the Intel family of the same rank,
macOS having names for Intel processors only.
2026-12-02 11:00:02 -08:00
Anees Iqbal 24d78a3619 📝 Say how an x86-64 guest's About This Mac names its CPU [ci skip]
docs/qemu.md said the name came from OpenCore's own pick, which macOS
named "Unknown", and that model-id changed nothing in About This Mac. It
now says how macOS makes the name, from type 131's family and the core
count machdep.cpu.core_count reads, the vCPUs rounded up to a power of
two, where Apple's table has the pair, what reims-ctl writes for the
host's CPU and the model-id it gives, and the values measured on macOS
26.7.2: by hand (m3-max-79231), and before and with the change on a
Core i9 and a Ryzen 7 host (m3-max-79299, 79300, 79321 and 79342).
2026-12-02 11:00:02 -08:00
Anees Iqbal 0209935005 📝 Document HEVC 4:2:0 range extensions decode on iHD [ci skip]
The formats table lists 4:2:0 range extensions at 8 and 10 bits as offered on
the Iris Xe, with its conformance runs, and drops N3, which those were. The
devices and VA-API docs say what iHD lists for HEVCMain12 and which of its
surfaces such a stream decodes into, P012 with the samples at the top, and how
a frame lands: an 8-bit one narrowed by the CPU, each sample's top byte, and a
10-bit one copied as P010.
2026-12-02 11:00:02 -08:00
Anees Iqbal 201d165e47 🐛 Send VA's quality level alone, and the nearest the driver takes
iHD 26.3.5's HEVC encoder takes quality levels 1, 4 and 7 of the 7 its config
lists, and answers success for a render that carries another level with a packed
header after it, then codes at the refused level (read in its source:
media_ddi_encode_hevc.cpp's ParseMiscParams, RenderPicture and
EncodeInCodecHal). An arm64 guest's session at a Quality of 0.9, level 2, hung
the Iris Xe's render engine (boot m3-max-79085, bugs.md B102). The refused level
is the likely trigger, unconfirmed.

The VA crate now renders the quality level alone, first, where a picture sends
its misc buffers (IDR pictures and a rate control change), so the driver's
answer to it is its own. A refused level gives way to the nearest level the
driver takes, the better quality first at a tie, before the picture's other
buffers, and the session keeps the level taken. VA-API's text allows the form:
a picture's buffers go in as many renders as the caller makes, and va.h's own
misc parameter example renders one alone. The choice is the driver's answer
alone, with no driver name, version or card in it, and a driver that takes
every level sees the same buffers, the level in a render of its own.

For the guest: a session asks the same quality as before. Where the driver
refuses that level, the stream codes at the nearest level the driver takes
rather than at the refused one: on the Iris Xe's HEVC, 1 for 2, 4 for 3 and 5,
and 7 for 6. reims-vgpu counts such a session as
video-encode-quality-level-adjusted and logs it once a session. x86-64 guests'
encoder asks level 4, which iHD takes, so they see no change, nor does a session
on radeonsi, which takes every level. iHD's H.264 encoder copies the level into
the sequence as it parses the sequence buffer (read), so its first sequence now
takes the asked level too, where it took the context's earlier one. HEVC Main
4:2:2 10 stays held back (B102).

Ledger (bugs.md B102 and U37). Read from code: iHD's masked refusal, above, a
lead until the guest's 4:2:2 case encodes under the fix, which waits for the
owner's word. Run: a fake driver modelled on that read gives the refused level's
render a failure and the next choice is taken (red m3-max-79207 at the masked
path, green m3-max-79223 with rustfmt and clippy). No report on file names an
Intel host's HEVC encode at a level iHD refuses but boot m3-max-79085's: the
Intel rows on file (B98 to B101) are x86-64 guests', at level 4.

Run on hardware: on the Radeon 780M (radeonsi) the VA encode tests and the new
one, asked level 2 and taken 2, 52.0 to 54.9 dB luma (m3-max-79243,
m3-max-79256; m3-max-79318 with the commits after it). The RTX 3090's VA driver
lists no encoder, so no level reaches it (m3-max-79247), and NVENC takes no VA
buffer: its encode tests pass (m3-max-79251). On the Iris Xe (iHD 26.3.5), one
encode of the 4:2:0 HEVC Main test asked at level 2: taken 1, 52.5 to 53.2 dB
luma, and no GPU hang or reset in the kernel's log (m3-max-79388).
2026-12-02 11:00:01 -08:00
Anees Iqbal ef9fed73df 📝 Document HEVC Main 4:2:2 10 encode and its hold [ci skip]
The formats table lists HEVC Main 4:2:2 10 encode on the Iris Xe as built and
held back (B102), with the GPU repack a frame costs, and drops N4 from what is
not built. bugs.md's B102 records the arm64 guest's session that hung the Iris
Xe's render engine (boot m3-max-79085), what the source read says of its likely
trigger, and that its confirming run waits for the owner. vaapi.md describes the
VA crate's Main 4:2:2 10 encode: EncSlice alone, a Y210 input imported at the
layout's bytes. lessons.md records the declared-size trap.
2026-12-02 10:44:57 -08:00
Anees Iqbal 14eb1b4b2b 📝 Say which recordings and shares keep the normal pointer [ci skip]
An x86-64 guest's kext now reports where its hidden cursor goes, so the
window keeps the normal pointer through macOS's own screen recording, and a
game played in one gets it too. Screen Sharing hid no cursor in the proof
boot. Other apps' shares are not measured, and an arm64 guest's kext reports
no hidden places, so the release chord stays the way out there.
2026-12-02 10:19:17 -08:00
Anees Iqbal 4145fe7989 🐛 Ask where the hidden cursor goes from every window's pointer
The device sent POINTER_LOOK from PointerLink::pointer_at, which a window's
pointer calls only through tell_pointer, and reims-vgpu gives a window that
only on a device of several displays. So in a VM of one display no look
went, the guest never reported its hidden cursor following the tablet, and
no hide of a guest that reports hidden places counted as a game's: in the
proof boot on gem10's 3090 (potluck job m3-max-79110, x86-64 macOS 26.7.2),
the disassociated game's moves stayed the tablet's in every round.

The look is now PointerLink::tablet_moved, and every window's pointer
callback calls it (tell_tablet), before tell_pointer's hold where a device
has several displays, so an event held back from the tablet asks nothing.
A one-display window's test drives it through the window the device opens.
2026-12-02 10:19:17 -08:00
Anees Iqbal aa5f0596f4 🐛 Report where the x86-64 guest's hidden cursor goes when asked
The device counts a hide as a game's once the guest reports its hidden
cursor following the tablet (the commit before). WindowServer moves a hidden
cursor with no setCursorState, so the kext must read its place itself: the
framebuffer's shared cursor state, which the tablet moves while a game hides
the cursor and which a system recording leaves where it hid it (lane
sharecur, potluck jobs m3-max-78716 and m3-max-78811, x86-64 26.7.2).

Once its mouse is up after each start, the x86-64 kext sends HIDDEN_PLACES.
On each POINTER_LOOK it looks every 10 ms, for 150 ms past the last one, at
each display whose cursor the last MOVE_CURSOR hid, and reports each new
place as a MOVE_CURSOR with visible 0, in MOVE_CURSOR's terms (the shared
place plus the hide's difference from it). Reports and setCursorState's
posts share a lock, so none lands after a show. Nothing is read while the
cursor shows or outside those looks.

For the guest: none of this shows. A recording keeps the host's absolute
pointer, and a game's mouse is driven a move later.
Mixed, new kext with an old host: the host answers HIDDEN_PLACES
UNKNOWN_COMMAND, which no thread waits for, and sends no POINTER_LOOK, so
the kext never looks (hidden_cursor_test, "no POINTER_LOOK: no look").
Mixed, old kext with a new host: it sends no HIDDEN_PLACES, and every hide
counts as before (the host's
a_guest_that_reports_no_hidden_places_hides_as_before).
The arm64e kext is unchanged.
2026-12-02 10:19:17 -08:00
Anees Iqbal 39da9779ea 🐛 End a reset's settle within its bound, and none inside a raise
The reset batch hung on a_raise_may_call_the_device_at_once, past its 540 s
slow mark, on every leg. Its raise resets the device, as the header lets it.
On the doorbell's thread, inside mmio_write_taking, the raise comes as a
CB_SUBMITTED is answered, with the decoder's contexts' lock held. The reset's
new settle (Host::reset_settles) then took that same lock and waited for it
for good: gdb's stacks in job m3-max-79063 show the thread blocked in
release_waits_for_reset on the lock it holds. api.md section 5 lists that
lock, a context's table read and the device caches' lock among those the
library may hold around a raise, and said no function of the device takes
them. The settle took all three.

A behaviour change the host observes, in two parts:

- A reset made inside the device's raise, on the raising thread, asks for no
  settle and waits for no GPU work, so that work may write the guest's memory
  after the reset returns: the one reset without the settle. That thread may
  hold what the settle takes, and the work it raises for began before the
  reset and ends only once the reset returns. The device crate counts the
  raises on each thread (raise_through) and skips Host::reset_settles inside
  one. QEMU's raise never resets the device or writes STATUS.
- The 30 s bound now covers every wait of the settle. Before, it covered only
  the GPU wait, and the hang was a lock taken before that wait, which no timer
  reached. The settle now takes the contexts' lock, each context's table read
  and the caches' lock in 10 ms slices against the same bound, on the
  platform's clock. Past the bound the process ends with the bound's death,
  naming the lock.

The raise rule widens with this: no raise_interrupt, on any thread, may wait
for a lock the host holds around a reset. The settle waits for locks the
library may hold around any raise, not only for the threads that run completed
handlers. QEMU's raise waits for none: reims_graphics_pci_raise_interrupt_cb
writes the vector's irqfd, or takes msi_lock, which the vector's mask and
unmask hold under the BQL and which waits for nothing else, or schedules a
bottom half.

The header's raise and reset docs and docs/api.md sections 1 and 5 say so.
Tests: a_raise_may_call_the_device_at_once, unchanged, hung before this change
and passes now; a_reset_inside_a_raise_asks_for_no_settle (device crate); and
a_reset_whose_settle_waits_past_the_bound_for_a_lock_ends_the_process.
2026-12-02 10:19:13 -08:00
Anees Iqbal 70698aef1c 🐛 Wait at a reset for the GPU work the guest committed before it
A behaviour change the host and the guest observe. design.md says nothing
begun before a reset reaches the guest after it, as a GPU's reset stops its
DMA. But the reset returned while the guest's command buffers committed
before it were still on the GPU: they and the completed handlers that merge
copied ranges back went on writing the rebooted guest's memory.

Now the reset, on the thread that resets (rvg_graphics_device_reset, which
QEMU calls under its BQL, or the guest's STATUS write of 0 on the vCPU),
ends with Host::reset_settles. reims-vgpu first sets every event the
guest's buffers could wait for past every value, and each deferred device
cache copy's event to its number, so no buffer waits for a signal nothing
will send any more. Then it waits for every command buffer committed before
to complete and run its completed handlers (GpuDevice::settle). It waits
for no thread of the device's: a route callback on ring 0's thread or the
control thread takes the BQL. It logs its time and how many it waited for.

The settle is bounded at 30 s, and past it the process ends: a new death,
"the device's reset". Only a GPU no driver recovered reaches it. The drivers
end hung work as a lost device, whose command buffers rt then completes,
failed: amdgpu at 2 s (lockup_timeout's default), and i915's last resort,
its heartbeat's engine reset, at most 25 s after work hangs (a pulse at the
next 2.5 s tick, raised one level a tick to the highest three ticks later,
then twice the 7.5 s preempt timeout; read from intel_engine_heartbeat.c).
The code is absent from the counts of the last good boots, as a new one is.

The BQL's hold grows by the settle. Typically that is the time the GPU
takes to finish what the guest committed before the reset: a settle over
a 1 MiB fill committed just before it took 1.3 ms on an RTX 3090, and one
with nothing in flight waits for none. At worst it is 30 s, only on a GPU
no driver recovered. The host gains one rule: raise_interrupt on the
platform's thread that runs a completed handler must not wait for a lock
the host holds around a reset. QEMU's waits for none: the irqfd's write,
msi_lock, which waits for nothing else, or a bottom half.

The header, docs/api.md (sections 1 and 4, and 5's locks around
raise_interrupt), design.md's Reset and qemu.md's BAR 0 say so. Tested by
a_reset_returns_once_the_guest_s_command_buffers_before_it_have_completed,
red before this change (the reset returned with the buffer on the GPU), and
a_reset_whose_gpu_work_runs_past_the_bound_ends_the_process.
2026-12-02 10:19:11 -08:00
Anees Iqbal f9d334b0c0 📝 Say how dsound trims its reserve and rate [ci skip]
qemu.md's "Windows hosts: sound" says what vendor/qemu 364cd364 does: the
trim of a dsound voice's margin to 15 ms and of its rate to the device's
clock, through the mixing engine's resampler. It also says why
DirectSound's own frequency was not used (each change of it shifted the
audio, a click). It gives the mini's base and fix runs, with the drift
phase, beside the Linux host's wait to PipeWire's ring, and the A/V lead a
player now shows on each host. known-issues.md's "Sound comes after video
on Windows" gives 0.07 s for 0.1 s, and the Linux host's 0.03 to 0.05 s.
lessons.md records the SetFrequency trap and how to spot the next one.
2026-12-02 10:19:10 -08:00
Anees Iqbal 8a470a3874 📝 Say the create refuses a memory map whose ranges overlap [ci skip]
The config's memory_map said only that its ranges may not overlap, and
api.md's status table did not list the refusal. The create refuses, with
RVG_ERR_INVALID_ARGUMENT, a map whose ranges overlap or run past the
address space (core's MemoryMap::new), and one whose ranges are NULL but
counted (the C API's memory_map). The field's doc, the header and the
table now say so.
2026-12-02 09:50:13 -08:00