On Windows an open of a texture's NT handle on the device that made it
stays charged to the process's GPU memory once the open, the texture and
the handle are all released. vaon12's import by NT handle is such an open,
and so was the plane draws' OpenSharedHandle: each pool stayed charged
twice, 72 MiB each time for six 3840x2160 NV12 textures, in the GPU Process
Memory counters (what Task Manager shows), which DXGI's usage does not
count. Measured on the lab's Intel UHD 630 under Windows (driver
31.0.101.2145, Mesa 26.2.7) with a program on Direct3D 12 and libva alone;
the opens alone did the same on WARP.
The pools now hand each texture to vaon12 as its ID3D12Resource
(VA_SURFACE_ATTRIB_MEM_TYPE_D3D12_RESOURCE), and the draws wrap the same
resource on D3D11On12: Direct3D 12 makes one device a process and adapter,
so the three are one. Nothing opens a pool texture by a handle any more, so
the textures are made in no shared heap and get no handle. A display whose
driver lists no resource memory type for its H.264 or HEVC decode surfaces
is refused at its open, as one is where libva does not load.
For the host: a decode session's pool no longer stays charged to the
process after it ends, which removes the same two opens the VM makes.
Verified on the lab's Intel card under Windows; expected on NVIDIA under
Windows. pools_let_go_give_back_their_memory is new and reads the process's
charge, and pool_textures_let_go_give_back_their_memory now reads it too.
README.md and docs/video/devices.md said the guest encodes in software on an
Intel UHD 630, as if another GPU could encode on Windows. The Windows arm opens
with encodes off on every GPU (open_on_rt in graphics/vaapi.rs), since rt imports
no shared Direct3D 12 texture, so no Windows host lists an encoder today.
The library wrote its counts line only at a device's reset and at the
process's exit, so a reims-ctl report made while the VM ran had none of
it in its qemu.log.
A host now asks for them with rvg_write_counts (the Rust API's
GraphicsDevice::write_counts), which writes the line before it returns,
where it changed since it was last written. QEMU's reims-graphics-pci
calls it when its new x-write-counts property is set to true over QMP
(vendor/qemu b057a987), and reims-ctl report sets it on a running VM
before it zips the logs, with a line in state.txt saying whether the
library wrote them. A trigger rather than a timer: a timer would touch
only the library, but write a line a minute into every log and still be
up to a minute old at the report; QEMU forwards no signal the library
could take, and Windows has none.
For the host: a new C API function and QOM property; QEMU's log gets the
counts line at each ask. api.md, conventions.md, qemu.md and the report's
help say so.
A VM on reims-vgpu's GPU now needs Linux 7.2 or later on a Linux host, under
any accelerator, where KVM's VMs needed 6.13: reims-ctl's start check refuses an
older kernel, naming the running one and "Linux 7.2 or later", and so does the
reims-graphics device's realize in QEMU (vendor/qemu 458f4b7b). Before 7.2 a
udmabuf over large pages is malformed, and an AMD GPU's import binds the wrong
pages of guest RAM (issue 185); 7.2 builds the table from the pages themselves
(upstream 5bf888673e0d, read from v7.2's drivers/dma-buf/udmabuf.c). The floor
holds KVM's 6.13 reason too. MIN_KVM_KERNEL is MIN_LINUX, and doctor's kernel
line shows on every Linux host.
The floor takes the place of the below-7.2 form: QEMU no longer advises guest
RAM, the device's region or its pool pieces MADV_NOHUGEPAGE, nor logs the 4 KiB
line, and the library's views of guest RAM take no advice (off_huge_pages,
huge_pages_take and linux_release_at_least go, with their tests). On 7.2 and
later nothing changes: QEMU's advice and its collapse with its share line stay.
What hosts see: below 7.2 a start is refused, where it ran with guest RAM on
4 KiB pages; on 7.2 and later the VM starts as before. README, docs/qemu.md,
docs/graphics-kext/design.md and docs/lessons.md say so.
A device loss's lines called a command buffer of the host's own just that,
with its encoders' kinds: no blit operand was recorded and no host image named,
so a report (issue 173, an RX 6600 XT whose lost command buffer was a host blit
or render at the display's start, its fault address in no rt range) could not
tell a window swapchain's image from an image of rt's own.
Objects now carry a role beside their guest id: the platform names a window
swapchain's image, and the host names the scanout's import, a presented
surface's texture and the display's view of it, the display colour's table and
ramps, the cursor's glyph, the overlay's image and a host read's target. In a
command buffer of the host's own, each encoder names its operands: a blit what
its copies read and what its copies, fills and mipmap generations write; a
render encoder the textures it binds. The list of command buffers in flight
says, for each of the host's own, what each encoder renders into, binds, reads
and writes, by role or guest id ("render into colour 0 a window's swapchain
image, blit from the scanout's import into a window's swapchain image"); the
oldest's attachments and lists name roles where there is no guest id; and the
line of a host command buffer lost in flight names its encoders the same way.
A window swapchain's clear at its retire, committed on rt outside the
platform's command buffers, is now on that list from before its commit until
its wait returns, named as such. It holds no index given back: the commit order
the platform's own indices wait on passes over it, as before it was listed.
Diagnostics only: nothing the guest or the C API sees changes, and nothing is
committed differently or at another time.
A Mac's hardware decoder answers the pictures after an H.264 picture that
does not decode with no error and an image, concealed, until the next IDR
picture (held85's damage run, potluck job m3-max-60715). Ours refused each
of them with h264::Error::Unrecovered until an I picture decoded, so the
device landed nothing in their outputs, which kept their earlier bytes.
What changes for the guest: in an H.264 stream, the pictures after one that
does not decode now decode and land in their outputs as any, predicting
from what the DPB holds, a frame the failed sample lost stood in for by a
copy of the last reference. The picture that did not decode still lands
nothing; it is still the session's warn line and is still counted in the
session's end line. On NVIDIA, an H.264 picture NVDEC fails no longer
fails the pictures after it either. HEVC is unchanged: its pictures after
one that does not decode are refused until an IRAP picture.
The codec decoder's damaged state, mark_failed and Error::Unrecovered go;
its tests now hold that the pictures after a failure come out, in decode
and in display order. Ignored hardware tests on both arms (vaapi:: and
nvidia::) decode a stream whose fourth sample is damaged and read back
every other picture. docs/video/devices.md gains what a Mac's picture holds
for a stream started at a P picture (m3-max-74665: decoded against zeros,
green), which ours leaves as the output's earlier bytes or zeros.
The Windows run is owed on the mini.
vendor/qemu 695ad62c: one fact decides the guest RAM's pages, whether the
running kernel is Linux 7.2 or later (uname's release by its leading
MAJOR.MINOR, read once; one that does not parse counts as older), and the
backend logs one line saying which it took. 7.2 is the first release whose
udmabuf builds its scatterlist from the pages themselves (upstream
5bf888673e0d); 6.11 to 7.1 bind a large folio's pages wrong in amdgpu's
import, issue 185.
What users see:
- Linux 7.2 and later: as before the revert, the guest's RAM, and the
device's region and Shared pool, advised MADV_HUGEPAGE, and the RAM
collapsed into huge pages after its prealloc, with the collapse's line
saying how much of it went on them (what a host gets depends on its free
memory as the VM starts);
- below 7.2: all of it on 4 KiB pages at every shmem_enabled, no collapse,
and a line naming the kernel's release and "before 7.2".
docs/qemu.md's section and table say so, and docs/lessons.md's entry.
reims-ctl's note on prealloc is back as it was, true again on 7.2.
vendor/qemu 1a35b9fb: the reims-graphics device advises the RAM it maps from
the library's memory, the region (BAR 2) and each Shared pool piece,
MADV_NOHUGEPAGE as it makes it. ram_block_add advises a block from a pointer
MADV_HUGEPAGE, which took back the library's advice on those memfd mappings:
a macOS 26.7.2 guest's region on a Radeon 780M held 70 MiB of 2 MiB folios
after its boot at shmem_enabled advise (VmFlags hg, ShmemPmdMapped 71680 kB,
walk m3-max-74591), and RADV takes the region's pages as udmabuf dma-bufs, so
on Linux 6.11 to 7.1 its GPU writes would land on the wrong pages as issue
185's did. The host sees the region and the pool on 4 KiB pages.
docs/qemu.md's table and section say so.
vendor/qemu 51382c20: QEMU advises a shared file-backed RAM block of base
pages, the memfd reims-ctl gives every x86-64 VM on Linux, MADV_NOHUGEPAGE in
place of MADV_HUGEPAGE, before its prealloc. The host sees the guest's RAM on
4 KiB pages at every shmem_enabled, where before it was on 2 MiB pages at
advise (CachyOS's default), always or within_size.
The guest's pages reach host GPUs as udmabuf dma-bufs of that memfd, and Linux
6.11 to 7.1 build a udmabuf's scatterlist with an entry per page that names a
large folio's head page and an offset past the page. amdgpu's import walks
that table by DMA page and binds the buffer's pages after the first to other
pages, so the GPU's writes land in other guest memory: issue 185's guest
kernel memory overwritten on a Radeon 890M with Linux 6.18.59. Upstream fixed
udmabuf in 7.2 (5bf888673e0d); hosts on the LTS lines still run the old code.
docs/qemu.md's section says so, as do docs/lessons.md's entry, which now
names the cause, and reims-ctl's note on prealloc.
On Windows a picture whose cache's planes lie over Direct3D 11 textures lands
by a draw from the texture VA-API decoded it into. Where that draw fails, the
textures are cleared to the zeros they owe and the CPU's copy lands the
picture in them instead: read back, staged, and copied into the planes'
images. Nothing counted that: on Windows a plane in such a surface never
reaches the GPU copier, so rt-video-gpu-copy-declined counts only pictures
with no surface at all, and a failed draw showed only as the landing's info
line, the first of each kind.
Each picture not drawn is now counted as video-pictures-undrawn, so a
report's degradation counts say how many pictures took the CPU's copy after a
failed draw. The guest sees nothing new.
Move vendor/qemu to de738a41, which reverts 53e76630, the commit cbdac3b3e
moved it to: once the prealloc of reims-ctl's memfd has run, QEMU no longer
collapses the guest's RAM into huge pages, on any host, and its stderr no
longer has the "after MADV_COLLAPSE" line. Nothing turns it back on.
With the collapse, a user's x86-64 macOS 26.7.2 guest on the reims-graphics
device panicked 80 to 154 s into each of 5 boots, its kernel's memory
overwritten (issue 185; a Radeon 890M on RADV, Mesa 26.1.8, Linux 6.18.59).
The reporter's bisect put it on cbdac3b3e: the device with the collapse
panicked; the prealloc with the collapse skipped ran clean for 20 minutes;
the collapse with plain VGA in place of the device ran clean.
For users: guest RAM is preallocated as before, and is on huge pages only
where the host's transparent huge page settings give them at a fault,
shmem_enabled at advise, always or within_size. At never, most
distributions' default, the guest runs on 4 KiB pages, as before cbdac3b3e.
docs/qemu.md drops the collapse's row and section and says again what was
true before it. docs/lessons.md records the trap: the collapse was proven by
one boot to the desktop at each setting, which a fault minutes into use does
not show.
The bundle sends a render pipeline create with no vertex function, or a
compute create with no kernel (library 0, no name), where the device refused
the library the program's functions were to come from: the library is nil,
and so is each function made from it. The device counted each such create as
decode-bad-reference, the guest protocol error, so a boot's counts line read
as dropped work (25 a refused library in Steam's lab boots). The create names
no library id, so the device counts what it sees: a create naming no vertex
function or kernel, under decode-no-function, a DecodeError of its own.
The refused create's warn line now names the kind of create (render, mesh
render, compute), and its log kind is the why and that kind together, so the
first of each pair is written at warn and the rest are folded under a label
that names both on the repeated-lines line; before, every create of one why
folded into one count with only the first one's type.
What changes for the host's log: the counts line carries decode-no-function
where it carried decode-bad-reference for these creates, and the refused
pipeline create lines name their kind. The guest sees no change: each create
is answered refused as before. No test held the old count; the new test
holds the new one and the lines.
Moves the runtime to metal2vulkan development efd7dbcd4d, which holds
development db3a88526b and the Shared memory coherence form the owner chose
(A-narrow, Telegram 2963). SEMANTICS moves from 2302 to 2304 and ARTIFACT from
596 to 597 (RUNTIME stays 2550), so every host translates its guests' shaders
again once, and rt's stored artifacts and pipeline caches re-key.
What changes for the guest at this pin:
- rt's floor takes a device whose host-cached memory types are none of them
host-coherent. Shared storage lives in the first host-visible, host-cached
type a buffer can use, a host-coherent one first (2c4680acea, 31ca7f6779).
Such a device is one where Mesa's Intel driver over i915 runs a GPU with no
cache it shares with the CPU, as on a user's Intel Arc (Meteor Lake) laptop,
which rt refused with rt-refused-below-floor (Missing::MemoryType). It is
now made. On it, rt flushes the Shared memory a submission's command buffers
reach before it submits them. Before the host can see a command buffer's
progress (its status, a wait, its completed handlers, a shared event's
value), rt flushes then invalidates what the command buffer may write. It
also flushes around replaceRegion, getBytes and the named bytes of an
upload. A range a command buffer reaches only through an address or a
residency set, with no binding or declaration naming it, is neither
flushed nor invalidated there (rt's known gap). The commit after this one
forwards a render encoder's useHeaps, so a used heap's memory is among what
rt flushes. On a device with a host-coherent host-cached type, every GPU our
tests and boots run on, rt takes the same type as before, keeps no ranges
and makes neither call. metal2vulkan measured what that costs there
(efd7dbcd4d's message): +43.1 user-space instructions per command buffer
on a Radeon RX 7900 XTX's burst_2000 (job 74045), and 1.0062 on burst_2000
and 1.0115 on frame_5cb on a Radeon 780M (job 74046).
- A metallib of format 2.2, whose function entries carry no MDSZ and which has
no extended header (an older toolchain's precompiled library, such as the
one a game launcher's SDL2 renderer makes), is read (4bcb58dbb1, SEMANTICS
2303). rt refused it as Container(MissingTag), and every pipeline made from
it was dropped. Its functions, AIR 1.8 with the pre-LLVM-4 metadata and
typed-pointer records (METADATA_STRING_OLD, METADATA_KIND in the METADATA
block, METADATA_OLD_NODE, INBOUNDS_GEP_OLD, LOAD and CALL without their
types), now decode as LLVM 23.1.2's reader reads them (31b3470a3e,
a68c6633c2, SEMANTICS 2304), where each stopped at its first such record.
Lane steamfix's boot of the launcher's disk on these fixes (job
m3-max-73971, um870's RTX 3090) made all 61 of its libraries, the SDL2
renderer's among them, and all 25 render pipelines made from its functions,
with rt-refused-translation 0. A METADATA_KIND record with fewer than 2
operands, or with a kind id stated twice, is now malformed, as it is for
LLVM's reader.
- A compressed copy of whole blocks that ends past a level's edge, inside the
level's last block (the one 4 x 4 block of a level of 4 x 2 texels), copies
that block (9ddd0be2a4). That covers texture to texture, buffer to texture,
texture to buffer, replaceRegion and getBytes, and matches what Metal does
(measured on an M3 Max by metal2vulkan's probe
compressed_copies_of_small_levels). rt refused those copies as
Refusal::TextureRegion (rt-refused-ours), encoding nothing. A copy between
two textures whose regions stop at different edges is now Gap::TextureCopy
(rt-refused-gap), still encoding nothing. A size past the rounded edge stays
refused as TextureRegion.
- The rest of the range is metal2vulkan's validation, probes, conformance
cases, censuses and docs. Its deadbind deletions (the indirect-command
plumbing only its deleted runtime drove, and the Y'CbCr planes chain nothing
has made since its producer went) remove 51 records from api_signatures.tsv,
and this tree names none of them.
For the host: rt's Metrics gain five fields, the Shared memory flushes and
invalidates, their bytes and the calls that failed, all 0 on a host-coherent
type. The counts line carries them from the commit after next. No other API
this tree uses changed, no rt kind of refusal, gap or note is new, and no
dependency changed: the lock, in its stripped form, is unchanged. Our docs
that named the Shared type's flags follow (gpu/identity.rs, pool.rs,
docs/api.md), and rt_platform/copied.rs says which copies rt flushes on a type
that is not host-coherent.
Checks the move cannot reach: QEMU, the option ROM, the guest's kexts and
bundle and reims-ctl build nothing of the runtime. The video crate and its arms
call nothing the move changes, so their checks do not run. The table's row owes
no boot: the move changes no death the platform ends the process on, and on
every GPU we run, rt's floor answers as before and takes the same Shared type,
with no device info, GPU family or feature query changed. Only a device with no
host-coherent host-cached type sees the floor change, and no lab GPU is one.
The Windows tests on the mini run after the merge.
On a Linux host with Iris Xe Graphics (Core i9-13900H), a page that animates once
per display refresh shows about 30% of its frames a refresh late (untraced guest
walks, 27-33% in each). The host CPU runs the graphics threads at about 1.3 GHz
under its default power policy, and the walk-behind-encode form that could have
moved the take sooner did not reach its bar in a model of the traced walk.
Known-issues readers on Intel hosts should know what to expect.
docs/qemu.md's "Windows hosts: sound" now says what vendor/qemu 207be587
and 4d205af8 do: virtio-snd has the backend write each period as it comes,
and dsound holds 60 ms past DirectSound's write cursor. It says what the
old 92.88 ms held, why its sizing counted the timer twice, and the runs on
the mini: each replayed from every start phase, with the smallest reserve
any start needed (up to 58.0 ms busy at 60 ms), the clicks, and the fill at
a period's write (97.3 to 104.0 ms at the median, against 134.2). It also
gives the Linux host's run with the kick, and what the guest's players are
told of the latency: a constant 100-frame safety offset and no latency.
docs/known-issues.md says, for users, that sound comes about 0.1 s after
video on a Windows host, and why it isn't fixed yet. docs/lessons.md has
the trap: a margin sized as a spread plus one of its parts, and a run's own
start phase hiding its worst one.
On a Windows host, a guest's sound clicked 111 times a minute at rest and
172 times busy. After the dsound change it clicks none in either. The text
records how that was measured and the cause the traces showed: QEMU wrote
audio behind DirectSound's write cursor. It describes what the voice now
does, how the 92.88 ms reserve was sized, and the latency the reserve adds,
90 ms at the median. It also says why the first run after the change is
not counted: the host's timers were slow before QEMU started.
About This Mac showed an x86-64 guest's memory as "16 GB RAM", and its
Memory sheet as slots that accept "a 0 MHz RAM memory module": QEMU's SMBIOS
type 17 says 0 MHz and Memory Type 7, "RAM", and OpenCore copies both into
the guest's tables. reims-ctl now gives -smbios type=17,speed=2666 and, where
its QEMU takes vendor/qemu's memory_type, memory_type=26: 2666 MHz DDR4, the
RAM of iMac20,1 and iMacPro1,1, the Macs a VM presents. The guest sees
"2666 MHz DDR4" in About This Mac, Settings' Memory sheet and System
Information. A QEMU without the option, which REIMS_CTL_QEMU can name, is
asked once per binary (-smbios type=17,memory_type=26 -version) and gets the
speed alone, its guest keeping "RAM".
The processor's "Unknown" stays: macOS names it by OpenCore's type 131 code,
not by the brand string (docs/qemu.md, "x86-64 macOS guests: About This
Mac").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vendor/qemu moves to 0c91b471, whose -smbios type=17 takes memory_type, the
memory devices' SMBIOS Memory Type, 1 to 255. Without the option QEMU writes
7, "RAM", as before, so nothing a guest sees changes with this move alone;
reims-ctl's command gives it next, for About This Mac's memory kind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner 2905: closing the window to close the window should show a
confirmation. A close the person asks for (the close button, Alt+F4 or the
compositor's close, the taskbar's close, and on macOS the red button, the
menu's or the Dock's Quit, and an uncaptured ⌘Q while capture is on) cut the
VM's power at once: QEMU's handler powers it off with no ACPI.
What the person at the host now sees: while the VM runs, the close first
lets every key and button go in the guest, ends any capture, and asks in
the OS's own dialog over the window: "Turn off the VM?", "The VM turns off
at once, as if its power were cut. Unsaved work in it is lost.", with Turn
Off (destructive) and Cancel, the default for Return and Escape. Turn Off
does what a close did before. Cancel leaves the VM running and nothing held
in the guest. On Linux and Windows it is SDL's message box (zenity or X11's
own on Linux, a task dialog owned by the window on Windows), run on the
windows' UI thread; on macOS an NSAlert sheet on the window, which Quit
shows once, over the key window, for every window. With capture off, ⌘Q is
the guest's, and the menu's Quit and the close button ask.
Nothing asks where nothing is lost: once the host has been told, while the
device is released or QEMU quits, without a close callback, or where the OS
shows no dialog, in which case the close goes ahead as before. There is no
setting and no "don't ask again".
The decision stays in the window crate (close.rs), so the C API keeps its
shape (only the header's words for close change) and QEMU's handler is
unchanged: the close callback now comes after Turn Off. features.md's
Leaving entries carry the new behaviour and its guards.
The owner asked for a VM whose window does not grab the mouse (owner 2893,
2895, 2900): capture stays the default, and a VM's settings can turn it
off.
With REIMS_VGPU_WINDOW_CAPTURE=0, which reims-ctl sets for such a VM, no
window captures, on macOS (AppKit's window and SDL3's) or on Linux and
Windows (SDL3's): a click into the image is sent to the guest but captures
nothing, so the window never takes the host's system keys, never grabs the
keyboard, never holds or locks the pointer and never holds its own size.
The pointer reaches the guest over the image alone, and outside it only in
a drag that began there, which ends in the guest. Keys go to the guest
while the window has the keyboard; on macOS that takes in ⌘ shortcuts, as
while captured, since nothing else could give the guest one, and the
window's menu stays in the pointer's reach. A game gets the absolute
pointer alone, which stops at the image's edge, since the guest's mouse is
driven only while captured. The title ends " — input capture off".
Unset, or any other value, capture is on as before. features.md gets the
register's "Capture off" entry and the switch, and the Capture entries say
where it applies; docs/api.md lists the variable.
The person at a Windows host saw the captured window's title say "press
Ctrl+Alt+Super to release": Windows keyboards have no key named Super. The
chord is SDL's GUI key with Ctrl and Alt, and on Windows SDL gives the left
and right Windows keys as that GUI key (VK_LWIN/VK_RWIN and scan codes
E0 5B/E0 5C to SDL_SCANCODE_LGUI/RGUI, read from SDL 3.4.18's code), so the
title there now says " — input captured (press Ctrl+Alt+Win to release)".
Linux keeps Ctrl+Alt+Super and macOS its ⌃⌥⌘.
The text is now capture::captured_suffix(HostOs), one string per OS, and
Capture::title_suffix takes the host's OS: each OS's file of native/ names
its own (HOST_OS on Linux and Windows, HostOs::MacOs in AppKit's input), so
no cfg spreads into shared code, and
the_title_names_the_release_chord_in_the_host_s_keys checks every OS's
string on every host, the Windows one included, which no test outside the
Windows mini reached before. features.md's capture entry, README.md and
the design doc name the Windows chord.
Diagnostics only: nothing the guest or the host observes changes. The
CB_COMPLETE of a buffer the walk cut into parts keeps its merged times.
A present's late-show line gave its last writer's CB_COMPLETE times as the
writer's GPU run. For a cut buffer those start at its first part's start and
end its parts' GPU time summed after that, before its last part's own end by
the GPU's gaps between parts, so "its handler entered N us after its GPU end"
counted those gaps as rt's wake, and a reading of the 5080 walk took 1,582 us
p50 for the host's share where the card's records gave 382 us.
The merge now lets the handler it runs read the last part's own GPU end
(split::last_part_end), and the completion's post carries it to the line
with the handler's entry (present::Handled). The line now says:
- for a buffer not cut, "on the GPU whole from ... to ...", and the handler's
entry after its GPU end;
- for a cut buffer, its first part's start and its last part's own end, its
parts' GPU time summed and the gaps between its parts, and the handler's
entry after its last part's GPU end; where the platform gave the last part
no GPU times, the entry against the present's take;
- where the handler did not say whether the buffer was cut, that the times
are its CB_COMPLETE's, which for a cut buffer end the summed time after the
first part's start.
Its clock tail adds the last part's GPU end and names the CB_COMPLETE's GPU
start and end as such. docs/lessons.md gets the reading trap.
On Windows a video cache's planes are rt's imports of the Direct3D 11 textures
the host's video draws its pictures into, and since metal2vulkan b68b31b54a rt
imports each with no view format but the texture's element format, the plane
image's and that one's sRGB sibling. A guest texture over such a plane in any
other format of the texel's size (an R8Uint over the luma plane, say) asked rt
for a view it refuses.
Such a texture now takes the storage shape of its extent, an image of its own
that rule 1 and the fills keep current with the plane, as a texture over a
plain shape in another format already does, so rt is never asked that view. A
texture in the plane's format or its sRGB sibling is a view of the plane, as
before. The guest sees the same pixels: the other-format case is a counted
copy where rt would refuse the view, counted in the degradation counts line as
rt-shape-drawn-format-storage-<plane format>-as-<texture format>, the first of
each pair logged, and in the shapes line. Hosts other than Windows make no
drawn planes and see no change.
The plane shapes a surface over Direct3D 11 textures adds are marked drawn
(ShapeTable::insert_drawn_plane), which the decoder asks of the shape it found
(Caches::drawn_plane). docs/video/bugs.md D26 records the copy as a known gap.
The arm64 sound devices were booted only under KVM, with a macOS 27.2.1
guest, and audio is on by default, so every arm64 VM on a Mac (HVF) or an
x86-64 host (TCG) took two virtio sound devices no guest had started there.
Under HVF and TCG the VM now has none, as before the devices came, until a
guest boots with them on each; the test checks both hosts.
From the review of the merged pull requests: the module doc gave either
machine seven xHCI ports, which vmapple has on Linux alone; docs/qemu.md named
vmapple.c's create_pcie as vmapple_create_pcie, and said the Mac's QEMU is
built without libusb, which install-ctl.sh does not ensure (libusb is an auto
feature). never_reset's doc read as if a VM stopped and started unreset had
been measured; the runs on file are a guest restart in one QEMU, and the docs
now name the stop and start as unknown.
QEMU's pull requests 16 and 17 both started at 53e76630. The second one, usb-host's
reset-on-close, was replayed onto the first as b980d0f46d, the commit the
QEMU branch and vendor/qemu now hold. 7bc47014f4 is on no branch.
An iPhone given to a VM was lost at the next start: as QEMU exited, it reset
the iPhone, and the next VM's guest asked it to switch its USB mode again
(vendor request 0xc052), after which it left the bus until it was plugged in
again. Across a guest reboot, where QEMU let go of nothing, the guest found
it in the mode the last boot set, asked no switch and drove it.
vendor/qemu moves to 7bc47014f4, whose usb-host gains reset-on-close, and
reims-ctl gives Apple's iOS devices reset-on-close=off beside guest-reset=off
(usb::never_reset, formerly keeps_its_resets), on the command line and over
QMP. Every other device keeps QEMU's defaults. A QEMU without the property
refuses the device, so reims-ctl and its QEMU come from the same commit, as
the install builds them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An iPhone given to a VM left the guest for good. QEMU's usb-host makes each
port reset the guest asks for a reset of the device, and a reset makes an
iPhone leave the bus and come back as a new device. On top of the mode switch
macOS asks of a new iPhone (vendor request 0xc052), which re-enumerates it
once, the guest's resets re-enumerated it again, and after the second mode
switch it left the bus until it was plugged in again.
Apple's iOS devices, the IDs usbmuxd's udev rule names, now get usb-host's
guest-reset=off, on the command line and over QMP, so the guest's resets never
reach them. The iPhone then re-enumerated once and the guest's own drivers
took it: usbmuxd its multiplexor, AppleUSBNCM11 its two network interfaces.
Every other device keeps QEMU's default. This changes x86-64 VMs given such a
device too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With usbmuxd off the iPhone and QEMU run on the host instead of the rootless
distrobox, the arm64 guest configured the passed-through iPhone and ran bulk
transfers on it, and QEMU followed each re-enumeration. Record that, what the
guest sends before the iPhone re-enumerates, how a udev rule keeps usbmuxd
off one iPhone, and that the container's QEMU lost every device once one had
gone. The measurements now name the trees they ran on as upstream has them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A macOS 27.2.1 guest under KVM on an M1 Pro, given an iPhone through
reims-ctl, lists the controller's 14 ports and the iPhone at 480 Mb/s on
port 3, and lets go of it when it is taken back. The iPhone stays unusable
there, since usbmuxd's claim makes each SET_CONFIGURATION fail with BUSY,
and QEMU in a rootless container never sees a device that re-enumerates,
which the lessons now say how to spot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
USB passthrough was refused for arm64 VMs, though nothing on a Linux host
keeps them from it: vmapple makes its own qemu-xhci with the keyboard and the
tablet, and QEMU's usb-host takes that controller's bus as it takes q35's.
An arm64 VM on a Linux host (KVM on arm64, TCG on x86-64) now takes the
devices reims-ctl usb and the interface give it, at start and while it runs.
They go on the machine's controller's bus, usb-bus.0, since the machine gives
the controller no id. On Linux its ports are raised to q35's seven with
-global, where QEMU's four put the second host device and those after it on
a full-speed hub. A Mac's command line is unchanged, and its VMs still take
no USB devices: reims-ctl lists them from sysfs alone. Its refusals now say
"USB passthrough is for VMs on Linux hosts". doctor checks usb-host and the
devices on arm64 Linux too.
The installer builds arm64 Linux's QEMU with --enable-libusb, which found
libusb by itself before, and offers the USB udev rule on every Linux host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
reims-ctl gave an arm64 VM no sound device, whatever its [audio] setting,
so a macOS guest found no output device. It now gives an arm64 VM with
audio on the same two virtio-sound-pci devices on the VM's backend as an
x86-64 VM (an output stream alone and an input stream alone), after the
GPU where QEMU puts them, and no HDA. The q35 devices keep their slots;
both machines make them through one function.
macOS 27's virtio PCI transport never started such a device: it spins on a
capability list QEMU links from high offsets to low, and a boot could stop
there. vendor/qemu moves to 5c42f3fce4, which links virtio-sound-pci's
capabilities in address order on vmapple, as 4a39ef8d54 does for
virtio-net-pci. That commit is steelbrain/qemu-reims-vgpu#16, which must
merge first.
On a macOS 27.2.1 guest under KVM on an M1 Pro, both devices reach
DRIVER_OK, Core Audio lists the default output and input, and afplay plays
on the host's speakers (docs/qemu.md, "arm64 guests: audio"). Refs #167.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS's kernel sets up each GIC redistributor with a pre-indexed store,
`str w9, [x8, #128]!`. Under KVM it traps with no instruction syndrome
(ISV=0) into KVM's in-kernel vGIC, which neither KVM nor QEMU's ISV=0
emulator can complete, so an arm64 guest on an arm64 Linux host panics
early in its boot. firmware/ambrosia/kvm.plist holds an Ambrosia
Kernel > Patch that writes the same values to the same two registers with
plain stores. Its four instructions are once in com.apple.kernel in each
VirtualMac2,1 kernelcache from 13.6 to 27.2.1, so it sets Expect to 1: a
kernel they leave stops at Ambrosia with a named error.
reims-ctl adds the patch to an arm64 VM's bundle where the VM runs on KVM,
after the VM's own patches; HVF and TCG bundles are unchanged.
`make config-bundle KVM=1` adds it to our configuration's bundle, and
check-boot.sh -k boots that bundle under KVM, with HVF's limits and
judgements and TCG's memfd RAM, refusing a bundle without the patch.
Booted on an M1 Pro under Fedora Asahi Remix 45: reims-ctl restored
macOS 27.2.1, its first boot made the Data volume, and after finish-eacs
it reached Setup Assistant and the desktop (docs/qemu.md). check-boot.sh
-k has not run, as its guest probes build on a Mac.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prealloc of reims-ctl's memfd gets transparent huge pages only where
shmem_enabled lets a fault take one: advise (CachyOS's), always or within_size.
At never, upstream's default and most distributions', the guest ran on 4 KiB
pages and KVM mapped it 4 KiB at a time.
Move vendor/qemu to 53e76630, which collapses a shared file-backed backend's
RAM into huge pages with MADV_COLLAPSE once its prealloc has run and before any
device is realized, 2 MiB at a time. For shmem the kernel takes MADV_COLLAPSE
at every shmem_enabled but deny (read in Linux 6.13 and 7.3); at deny, or before
Linux 6.1, it fails with EINVAL, QEMU logs it in its one line and the boot goes
on as before. docs/qemu.md says what the collapse does at each setting, with
the boots on um790 that measured it.
A diagnostic only: nothing the guest or the host observes changes. On a platform
that places pins only in its blocks (metal2vulkan-runtime), an OBJECT_DESTROY
of an object made at the platform's own address, a pin it did not keep or none,
is counted under destroys-at-rt-address-in-flight-<kind> where a command buffer
of the object's context is posted and not yet committed, or begun and not yet
complete. The count is an upper bound on the handles let go of at an address a
running command buffer may still use, so a boot's counts line tells whether
that stale-address lead applies to this class of object at all.
It costs no new lock and nothing per command buffer or per create. The object's
unkept::Live records at its make whether it lies at the platform's address,
from the pin and address made already compared there; the destroy reads it in
the table lookup it already makes, and the context's queues posted and not
committed it already reads. Only for such an object does it take the context's
drain lock, alone, to read the holds the drain keeps.
The design doc's BLOCK_RELEASE, POOL_GIVE and PRIVATE_GIVE answers, and the doc
comments of their handlers, said the answer follows the command buffers the
context committed. The code waits for the ones the decoder has begun for the
context (drain_context): a command buffer posted on a ring and not yet begun is
not waited for. Each place now says that. No code changes.
The Iris Xe run of the route's ignored test (m3-max-71683) answered what the
docs left open: iHD passes the XYUV trial at 64 bytes in whole rows, as it
does NV12 and P010, so a 1366-wide picture's rows of 5464 bytes go to the
CPU, and over 40 pictures, each byte-equal to the CPU's split, the GPU's
way took 0.57 ms of the calling thread's CPU time a picture (median)
against 12.1 ms for the read back and split.
The import check now tries XYUV beside NV12 and P010, and where it passes,
the graphics arm has the driver write a 4:4:4 picture into a scratch of its
device's and the device's GPU split it into the guest's surface; the CPU's
split through vaGetImage stays where it does not. The VA-API doc and the
device's design said the CPU split it always. They now say what the check
tries, what the arm does with its answer, and radeonsi's measured answer:
none, since its vaCreateImage refuses an XYUV image.
displayMirrorTile and displayMirrorTileList, with the struct, constant and
helper only they used (DisplayMirrorFrame, display_mirror_threads,
display_mirror_tile_changed), were the window mirror's kernels. The mirror,
reims-vgpu's graphics/mirror.rs, was deleted with VulkanPlatform, and since
then no pipeline was made from either: the only name left was a test's check
that the platform's shader library is ours, which now names
displayPresentVertex, a function the display draws with.
The metallibs are rewritten by cargo xtask metallibs (only shaders.metallib
and its line in metallibs.toml change). design.md's route 1 says its kernels
went with it.
Nothing the guest or host sees changes: no pipeline, binding or result used
these functions.
The boot diagnostics' gaps and refusals lines count rt's refusals by kind
alone, and each kind's first line names one function, so a log of 500
PartialThreadgroups refusals named one kernel of them and left the rest
unnamed. A fix built on that kernel's cause could leave others refused,
and the next log would again name one kernel a kind.
The refusal-keys line, written at exit beside those two, counts each
refusal they count by its kind, the functions its site names (each by its
role, its library's hash and its index, never its name), and, of a
PartialThreadgroups, its grid and threadgroup, of a StorageElement, its
slot, pixel format, case and backing. It names the 64 keys of the most
refusals and the rest in one tail, keeps at most 4096 keys, is counted on
the refusal's path alone, and is not written without a refusal. A
diagnostic: nothing the guest observes changes.
A compute encoder's setImageblockWidth:height: now reaches rt
(ComputeCommandEncoder::set_imageblock_size). A kernel with an explicit
imageblock runs each dispatch, direct or indirect, at the size the guest set
last on its encoder, and at 1 by 1 before the encoder sets one, as Metal does.
Before this the encoder dropped the size, and every such dispatch ran at 1 by 1
whatever the guest set: the kernel's get_width and get_height answered 1, and
its threads past the first cell reached past the imageblock.
A size rt refuses, a width or a height that is not a power of two (0 included)
or more than 1024 cells (Refusal::ImageblockSize), is counted as Metal's
refusal, rt-refused-metal, by the basis rt declares for it: Metal's validation
layer stops each such size at the call (measured on the M3 Max by
metal2vulkan's probe). The encoder's later dispatches run at the size set
before it. What Metal runs after such a size without its validation layer is
not measured. A size past 32 bits is Metal's refusal too, as the encoder's
other values past rt's 32 bits are.
The dispatch pre-pass reads the encoder's size beside its threadgroup memory
lengths and hands it to the compute state's make ahead and key: the platform's
ComputePipeline::prepare_dispatch and dispatch_variant take it now, and pass it
to rt's in place of the [1, 1] the pin commit passed. So the first dispatch at
a new size finds its pipeline made, as at a new threadgroup memory length.
Indirect command buffers run no kernel on rt (their records are draws, and a
compute encoder's execution of one is Metal's refusal), so no such path takes
a size.
Tests: mutdec_imageblock's extent at sizes set, refused and unset, direct and
indirect, on the GPU; rt's keys of an imageblock kernel's dispatches by size,
and one key whatever the size for a kernel with none; and the pre-pass's makes
ahead at each encoder's size. The kernel's metallib is in tests/shaders.
Moves the runtime to metal2vulkan development f8181e2a6c. SEMANTICS moves from
2280 to 2286, so every host translates its guests' shaders again once;
ARTIFACT stays 592 and RUNTIME 2550.
What changes for the guest at this pin:
- A sampler bound with LOD clamps of its own (setSamplerState:lodMinClamp:
lodMaxClamp:atIndex: and its vertex, fragment and range forms) samples with
the bind's clamps, as Metal does, where rt refused the bind (Gap::LodClamps).
Past 4,000 live clamp variants a bind is rt's Limit::LodClampVariants.
- A vertex function's slice and viewport index are stored as it writes them,
and as 0 where it never writes them; rt refused such a function where it
could not show the index the same at a primitive's vertices, or where the
function never wrote it.
- A storage cube or cube array written or read by face translates.
- MSL 3.2 program-scope buffer bindings translate; other program-scope shapes
are refused under their own features (Feature::ProgramScopeBinding is gone).
- A thread's array of buffer pointers indexed at run time translates in two
more shapes.
- An argument buffer's command-buffer word is plain data, and a render state
whose functions may reach indirect command buffers is made.
- A kernel with an explicit imageblock dispatches, where rt refused the
dispatch; it runs at 1 by 1 for now, since the compute encoder still gives rt
no setImageblockWidth:height: size. The next commit passes the guest's size.
For the host: a kernel keeps its first 8 pipeline variants and the 56 last
dispatched, so rt's memory for one kernel's variants is bounded, and
threadgroup memory lengths round up to 16 bytes in its keys.
The two calls into rt that changed take the imageblock size as a fourth
argument: the compute state's make ahead (prepare_dispatch) and key
(dispatch_variant), each passed [1, 1], Metal's size for an encoder that sets
none. The accuracy ledger's imageblock row and the compute encoder's docs say
what the guest sees at this pin.
The owner asked for a virtio disk beside SATA and NVMe. An x86-64 VM's
settings (disk_controller = "virtio"), `reims-ctl set --disk-controller
virtio` and the edit form's Disk controller choice now take virtio, which puts
the system disk on QEMU's virtio-blk-pci at slot 6, the first slot no other
device takes, with SATA's drive options: no discard=unmap, whose TRIMs NVMe's
disk waits on btrfs follow, and no iothread. OpenCore's image and the
installer stay on AHCI, and new VMs stay on SATA.
Measured (job m3-max-70333, homelab-um870-1's RTX 3090, the library, QEMU and
guest set of aed8655a6): installed macOS 26.7.2 moved from SATA to virtio, on
a snapshot=on overlay of its disk, answered SSH 15 s after QEMU started, as
the same boot on SATA did (m3-max-70320), showed its desktop on Metal 3 with
ReimsGraphics loaded, and shut down with QEMU exiting 0 and no fatal line.
macOS's AppleVirtIO drives the disk, and Disk Utility names it Apple Inc.
VirtIO Block Media, which the install steps now give for a VM on virtio. The
help says that only an installed macOS 26 was tried there; docs/qemu.md has
the boot, and the NVRAM's saved boot device, which still named the SATA path.
The guest now sees supportsFunctionPointers YES on every host on the Vulkan
platform, where it saw NO: the answer is rt's Device::supports_function_pointers,
which is true on every device and never chosen by vendor. Its compute
pipelines' function handles, visible function tables, sets and binds are rt's
(the previous commit), and the bundle's compileVisibleFunction: calls, which
Metal's library sends for MTLFunctionOptionCompileToBinary, now answer no
error. supportsFunctionPointersFromRender stays NO: rt makes no render stage's
tables. A kernel that reads a table through an argument buffer is still
refused (rt-refused-translation).
The bundle answers from the FUNCTION_POINTERS feature bit, which every host
offers, and this identity flag, so the guest needs no change. The identity's
tests now hold rt's answer, and design.md's list of the lane's own NO answers
names render pipelines' function pointers alone.
The Vulkan platform made no function handle or visible function table
(rt-unbuilt-function-table): each create answered nil. rt now makes them, so
the platform carries them on rt:
- a compute pipeline state's handle of each function its kernel links (rt's
function_handle), and none, Metal's nil, of any other function;
- visible function tables (rt's new_visible_function_table): gpuResourceID is
rt's device address of the table's words, which the guest writes into an
argument buffer itself; allocatedSize is those words in 4 KiB pages, as the
Macs answer for small tables; resourceOptions is Shared, tracked (512);
- sets of one entry or many, a nil entry calling nothing; a set past the table
is rt's refusal (Refusal::FunctionTableIndex, counted rt-refused-ours), and
sets none of the entries;
- the compute encoder's bind of a table at a buffer index or a range of them,
a nil table unbinding its slot.
A kernel that reads a table through an argument buffer stays rt's translation
refusal (rt-refused-translation), and render stages take no tables.
The device still answers supportsFunctionPointers NO, so the guest makes
none of these yet; the next commit takes rt's answer. Unbuilt::FunctionTable
and its code go. The rt platform's tests make tables, set and bind them, run
a kernel calling through them (nil entries, an unbinding, a set after the
encode) and refuse sets past the table; the decoder's test makes the guest's
handles and tables.
rt makes no texture over a buffer but a 2D texture of one level, sample and
slice, or a texture buffer, and refuses any other shape there as its gap
(TextureOverBuffer). The Vulkan platform's linear entry
(newLinearTextureWithDescriptor:offset:bytesPerRow:bytesPerImage:) still asked
rt for those shapes, so each one-level Managed 2D array on unified memory
counted an rt-refused-gap before the decoder fell back to a texture of its
own: four in an x86 guest's browser WebGL page, one in the GL cases on RADV
and on ANV.
The platform now answers nil for those shapes without asking rt, and counts
nothing. The guest sees nothing new: the answer is the nil rt's refusal gave,
the decoder falls back to the same texture of its own beside the CPU copy
(logged once, as before), and a guest's LINEAR_TEXTURE_FROM_BUFFER of such a
shape is refused as before. The walks' counts lose the TextureOverBuffer
refusal.
on_vulkan_a_managed_2d_array_shows_its_cpu_copy now holds that the array is a
copy of its own and that no rt-refused-gap is counted, and a new Vulkan-crate
test holds the platform's answers: a 2D texture of one level made, a 2D array
and a 2D texture of two levels nil, with no refusal counted.
NVDEC's 4:4:4 pictures were read back to the host and interleaved by the
CPU into the guest's surface. Now, where CUDA imports the device's
exportable buffers, CUDA copies each plane within the GPU into a scratch of
the decoder's. videoGather444 then writes them into a Shared buffer over
the surface's pages, and the pass is waited for. This is the route NVDEC's
4:2:0 pictures already take, which writes the surface in place.
The guest's surface holds the same bytes as before. Each picture written
this way is counted as video-pictures-gpu-gathered, and a session logs how
many at its end. A refusal before anything is written (no exportable
scratch, a plane off a 32-bit word, a plane past the surface or the
scratch, a failed pass) falls back to the CPU's interleave, and its reason
is logged once per decoder.
What the guest sees now: where the driver lists HEVCMain444 VLD with 4:4:4
render targets (iHD on Intel's Iris Xe), VideoToolbox's paravirtual
sessions of HEVC 4:4:4 at 8 bits are made, as on NVDEC. Where it lists none
(radeonsi), they are refused at their start with "VA-API: the driver has no
HEVC Main 4:4:4 decoder" in the refusal line.
The accelerator sends the range extensions' picture and slice parameters,
the base and Rext structures in the usual buffer types, and decodes into
XYUV surfaces. A frame is read back through vaGetImage and split on the
CPU into the surface's luma and Cb/Cr planes. The import check has no XYUV
answer, so no GPU route lands these pictures yet. hevc-check.sh decodes
x265's Main 4:4:4 streams where the driver lists the profile, and expects
the driver's refusal elsewhere.
VideoToolbox's paravirtual decoders refused every HEVC stream outside Main,
Main 10 and Main Still Picture. At login, an arm64 macOS 26 guest opens a
tile session of an HEVC 4:4:4 stream at 8 bits (a HEIC image's), which was
refused.
What the guest sees now: where NVDEC lists HEVC 4:4:4 at 8 bits
(cuvidGetDecoderCaps, Yuv444 output), such a session is made and its
pictures land in '444v' or '444f' surfaces, by their range. Where the arm
declines it, the session is still refused at its start, and the refusal
names the arm's reason. 4:2:2, monochrome, 12-bit and deeper 4:4:4 streams
stay refused.
The codec crate parses the range extensions of the SPS, the PPS and the
slice header, each held to its range, and splits its check: the codec's own
refusals, then the arm's. NVDEC's pictures take the range extensions' pic
params, and its decoder writes three planes. The CPU interleaves them into
the surface's two planes. The tests that held the old refusal now hold the
new answer, and hevc-check.sh expects each refusal's own reason.
Moves the runtime pin from 75c3e49bd6 to a8c1acc9a1, on metal2vulkan's
development, in a commit of its own: 25 commits. The translator's semantics
version moves 2276 -> 2277 and its artifact format 591 -> 592, so each host
makes its cached translations again once.
For the guest:
- An upload into a Depth32Float texture, or into Depth32Float_Stencil8's depth
(replaceRegion:, a Managed texture's upload, a blit copy from a buffer), is
now the device's copy into the depth aspect, where it was refused before. A
GL shadow-map compare over such a texture read 0 where 0.5 was uploaded, on
every card, since the move to the runtime. Within [0, 1] a value is kept
exactly, except that a device may store a denormal or -0.0 as +0.0. Outside
[0, 1] it is the device's: RADV and ANV clamp it, NVIDIA keeps it, and Metal
keeps it. The accuracy ledger has the row.
- A threadgroup load, store or atomic at a constant offset outside the arena
(undefined in Metal too) is a zero load, no store, or an atomic that writes
nothing and returns zero. 18 functions in 4 libraries that failed to
translate now translate.
- Compute function pointers are built in the runtime. The device does not
answer them yet, so no guest reaches that path.
For the host: the runtime's Gap::FloatDepthUpload is gone. Nothing of ours
named it except the blit module's doc, which now says what the copy does.