Commit Graph
7980 Commits
Author SHA1 Message Date
YXC0915 e0cb092b03 ffi: export the suspend functions in the generated C header runtime-e0cb092 2026-12-01 09:47:41 +08:00
YXC0915 9e0d1bc1a0 build: pin suspend-capable QEMU and record runtime features 2026-12-01 09:41:13 +08:00
YXC0915 bcd18d6485 Apply reims-vgpu-snapshot-replay
Reims-Go-Patch: reims-vgpu-snapshot-replay.patch
2026-12-01 09:40:17 +08:00
YXC0915 6aa417aef6 Apply reims-ctl-qcow2-l2-cache
Reims-Go-Patch: reims-ctl-qcow2-l2-cache.patch
2026-12-01 09:40:16 +08:00
YXC0915 b1e8f45e9e Apply reims-ctl-virtio-discard-iothread
Reims-Go-Patch: reims-ctl-virtio-discard-iothread.patch
2026-12-01 09:40:16 +08:00
YXC0915 53b6af7574 Apply reims-ctl-win32-random-bytes
Reims-Go-Patch: reims-ctl-win32-random-bytes.patch
2026-12-01 09:40:16 +08:00
YXC0915 c8213cb933 Apply reims-vgpu-display-fixed-mode
Reims-Go-Patch: reims-vgpu-display-fixed-mode.patch
2026-12-01 09:40:15 +08:00
YXC0915 d1637583ba Apply reims-vgpu-win32-unicode-input
Reims-Go-Patch: reims-vgpu-win32-unicode-input.patch
2026-12-01 09:40:15 +08:00
Anees Iqbal 3731afd9b1 📝 State the preset bar as settled and H.264's miss as its rate [ci skip]
The bar was settled after the run: a slower preset earns its time when it
gains 0.5 dB at one of the two sizes and loses nothing at the other, its
encoder within 3% of P1's rate at both. H.264's P2 and P3 gain 0.78 and
0.92 dB at 2160p but run 3.4% and 6.2% under P1's rate at 1080p, so they
miss on the rate, not the gain; HEVC's P2 and P3 code P1's streams. The
mapping stays at P1.
runtime-3731afd-p4 runtime-3731afd-p3
2026-11-27 16:59:57 -08:00
Anees Iqbal 6319405ea9 📝 Record why NVENC's slower presets don't earn their time [ci skip]
preset_of keeps P1 for the device's middle quality. One host-only run on the
RTX 3090 with the settings AppleGVA's plug-in forces on an x86 guest's encodes
(constant QP, an IDR every 60 frames, no B-frames) found no slower preset that
gains 0.5 dB of luma at equal bits while the encoder stays faster than the
guest round trip at both 1080p and 2160p. AGENTS.md puts a measured platform
fact in the doc of the code that relies on it, so the doc now holds the best
rows, the noisy source's note, HEVC P4 against P1, and which part of the gap to
the host's own P4 encodes is inferred rather than measured.
2026-11-27 16:58:34 -08:00
Anees Iqbal 03c3314845 📝 Record H.264's hard data-rate limit as not held [ci skip]
A 1080p H.264 session in an x86 guest, at 8 Mbit/s with a limit of
1,000,000 bytes a second, runs 18.3% to 19.4% over the limit in its
busiest second on all three vendors. On the XTX the stream is the same,
byte for byte, as the stream without the limit. The guest's H.264
encoder is driven by macOS's AMD path: that path counts the limit but
codes no frame over again, and on our device its planning changes no
frame. The 2019 MacBook Pro's 2.3% is from macOS's Intel path, which
does code frames over again. No AMD-only Mac has been measured, so the
known issue keeps the Mac's number scoped, and B101 records the trigger,
the first step and the unfilled third length-record word as a lead only.

B100 had two claims the same rows now disprove. It said the real Mac ran
at another keyframe interval, but m3-max-77623 ran HEVC at the guest's
interval and stayed under the limit in every second. Its "the plug-in's
default" interval was the probe's 60. The HEVC paragraph in known-issues
said the runs don't compare; they now do, both on macOS's Intel path.
2026-11-27 16:40:57 -08:00
Anees Iqbal 391edf9731 📦 Rebuild both sets and the ROM's record for HEVC encode
make -C guest prebuilt and prebuilt-arm64e, and make -C firmware prebuilt,
from the guest sources and the wire header of the commit before (m3-max-77590,
which also ran the guest's tests and both prebuilt-checks): ReimsGraphics
publishes the HEVC encoder only where the host codes a frame in place, and
RgfxGate carries the Metal bundle, which sends a retried HEVC frame in place
of the last. The ROM's bytes are unchanged; its record follows the wire
header, which gained the in-place flags.
2026-11-27 16:26:01 -08:00
Anees Iqbal 319f54dabb 🆕 Encode an x86-64 guest's HEVC on the host's encoder
An x86-64 guest's hardware HEVC encoding never reached our GPU: macOS's HEVC
encoder plug-in drives only an Intel GPU's driver, found by name, so an app that
required hardware failed at its create (-12908) and others encoded in software
(m3-max-77632, development's set on this host). What the guest sees now, where
the host's video arm lists an HEVC encoder of Main and Main 10 with a constant
QP that codes a frame in place of the last (Linux hosts' VA-API, and NVENC where
its driver codes a frame without advancing its state):

- the accelerator publishes an IntelAccelerator child of its own with
  IOGVAHEVCEncode and IOGVAHEVCEncodeCapabilities (Main and Main 10, up to
  the encoder's level), so VideoToolbox lists a hardware HEVC encoder
  (hevc.gva);
- RgfxGate keeps the Intel driver path the plug-in loads from
  /Library/GPUBundles a hard link to the bundle's executable, at every boot;
- the bundle's video driver takes the plug-in's encode commands (function
  0x20, sub-ID 0x1000), codes each frame on the host (ENCODE_H265) at the QP
  the plug-in's rate control chose, an IRAP picture as a keyframe, Main from
  an 8-bit source and Main 10 from a 10-bit one, and hands back the access
  unit with 4-byte start codes, whose VPS, SPS and PPS make the session's
  format description;
- a frame the plug-in codes again over its data rate limit, at a higher QP,
  is sent in place of the last one (RGFX_VIDEO_ENCODE_IN_PLACE): a P
  picture of the last frame's order count and source surface; a keyframe
  coded again is sent as a new IDR picture;
- a session of a size the host does not encode is refused at its create,
  so an app that allows software encodes in software as before.

A host whose encoder has Main alone gets no nub: VideoToolbox hands the
plug-in a Main 10 session whatever profiles the nub lists, and the driver
learns a session's profile only from its first frame. Nor does one that
codes no frame in place, where a retry would predict from the frame it
replaces. H.264 encode and both decodes are as before on either. The
plug-in's per-CTU QP map (its pool 27) is not applied, and its frame
statistics record is not supplied. The route is macOS 26.7.1's plug-in's,
booted on 26.7.2. Windows hosts list no encoder, so encode in software as
before.

Rows (macOS 26.7.2 guest, 1080p, 300 frames at 8 Mbit/s, decoded back by
VideoToolbox; the rate band is vboot's RATE_BAND_PCT, 6%, both codecs), the
same with the frames in place (m3-max-77615, m3-max-77613, m3-max-77614),
byte for byte but for 205 bytes of the Iris Xe's Main stream:
- RX 7900 XTX (m3-max-77475): Main 105.1%, 45.02 dB; Main 10 104.8%, 45.17 dB
- Iris Xe (m3-max-77476): Main 103.5%, 48.04 dB; Main 10 98.1%, 48.86 dB
- RTX 3090 (m3-max-77477): Main 100.7%, 44.81 dB; Main 10 106.1%, 45.06 dB,
  where NVENC's own lands 104.6%: known-issues and video/bugs.md B97
At a data rate limit of 1 Mbyte a second, the plug-in coded 2 to 30 frames
of a session again, each sent in place: no gap in the order counts, all 300
frames decoded back, and the most bytes in a second 1.7% to 3.0% over the
limit (RX 7900 XTX m3-max-77611, RTX 3090 m3-max-77609, Iris Xe
m3-max-77627; video/bugs.md B100, to be read on a user's report). With a
keyframe every frame the stream comes to 4.1 to 5.0 times the asked rate, as
a real Intel Mac's comes to 5.7 times with the same QPs frame for frame
(m3-max-77635; design.md, known-issues); every frame decodes back.
Main 10 from a retained pool and from the app's own 8-bit buffers decodes as
from the pool taken per frame on all three. A real Intel Mac's hevc.gva
(macOS 26.7.1, m3-max-77481) replaces the session's pool at the third Main 10
frame, as ours does. Speed (Iris Xe, m3-max-77497): 94 to 118 fps at 1080p
against software's 3.3; 10.3 to 10.8 at 8K against 0.5 (B98, B99).

Tests: the kext's publish condition and its pairing with a host that codes
no frame in place (video_codecs_test: the caps of both decoders and encoders
without the flag publish no HEVC encode and the rest as before), the link's
update on real files (rgfxgate alias_test), and the driver's listing, create
refusals, settings, keyframes, write-back, failures, refused sources and the
frames it sends in place, and those it does not: never a keyframe, so a
session of keyframes from one reused surface sends none (video_driver_tests;
m3-max-77590). Development's set on this host (m3-max-77632) encodes H.264 to
the same bytes as this one and decodes as before. Docs: design.md and
devices.md, video/bugs.md B97 to B100, and known-issues.md's HEVC encoding
line, which now says which GPUs encode HEVC for an Intel Mac guest, and its
section on HEVC over the bitrate asked.
2026-11-27 16:26:01 -08:00
Anees Iqbal 80eea13d5d 🆕 Code an encode frame in place of the last one on the host
A guest that drops a frame's access unit and has the same frame coded again
had no way to say so: each encode was a new frame of the stream, coded after
the dropped one and predicting from it. macOS's HEVC encoder plug-in does that
over its data rate limit, at a higher QP, and the stream broke: gaps in its
order counts and VideoToolbox decode errors -17694 on 151 and 166 of 300
frames (macOS 26.7.2 guest, RX 7900 XTX host, m3-max-77530).

What the guest and host observe now:

- the wire: an encode op's flag RGFX_VIDEO_ENCODE_IN_PLACE codes the frame in
  place of the session's last one, from the references the last one was
  coded from, with its order count and frame_index, at the QP the settings
  give now; the caps' RgfxVideoEncodeCaps::flags gains
  RGFX_VIDEO_ENCODE_CAP_IN_PLACE where the host does so (zero from an older
  host);
- VA-API: every encode entry has the flag. The VA crate's encoder holds its
  last picture back from the accelerator's stream (Accelerator::keep) until
  the next frame or a flush, and codes a frame in place again into the same
  reconstructed surface (Encoder::encode_in_place); a stream without B
  pictures or our hard limit, which is every one the x86-64 guest makes;
- NVENC: the flag where NVENC answers NV_ENC_CAPS_DISABLE_ENC_STATE_ADVANCE
  for every profile of the codec and a session of it with a state buffer
  codes a frame, the frame again in place and a frame after it at the
  device's start (checked_in_place); a driver that refuses either leaves it
  off. Such a session codes each frame without advancing NVENC's state and
  takes the state after it (nvEncRestoreEncoderState) as the next frame
  comes (NvencEncoder::new_in_place);
- a frame that cannot be coded in place fails (RGFX_VIDEO_ENCODE_FAILED):
  with no frame to replace, with B pictures, with the VA crate's hard limit,
  of another frame_index, or asking a keyframe in place of a frame that is
  not one. No later frame predicts from the dropped one: on VA-API the next
  is an IDR picture, on NVENC it is coded from the state before the dropped
  one.

A frame without the flag is coded as before; the VA crate keeps its last
picture one frame later, which nothing outside it observes. No guest sends
the flag yet: the x86-64 guest's HEVC route, next, does.

Tests: the codec encoder's frames in place (the stream is the one without the
retry but for its QP; twice in a row; after and of an IDR picture; each
refusal, after which the next frame is an IDR picture), the session handing
the flag to its backend, each arm's caps flag, and on the hardware, frames in
place decoding back on the driver's own decoder (RX 7900 XTX, radeonsi,
m3-max-77595) and on NVDEC above 35 dB (RTX 2080, m3-max-77597; RTX 3090,
m3-max-77618), and the device-start check leaving no NVENC session on its GPU,
which runs alone (.config/nextest.toml): it adds a median of 61.9 ms on the
RTX 2080 and 56.9 ms on the RTX 3090, five checks each.
2026-11-27 16:26:01 -08:00
Anees Iqbal 5f857584b5 ✅ Name each VP9 format stream before it decodes
Clippy allows std::panic::catch_unwind only in the testkit's named places,
and the format-stream test caught each stream's panic to name the stream
that failed. It now prints each stream's name before it decodes it, so a
failure names its stream without a catch, and the test stops at the first
stream that fails.
2026-11-27 16:18:07 -08:00
Anees Iqbal 40dadf7f77 📝 Document VP9 profiles 1 and 3 on arm64 guests [ci skip]
The host now takes VP9's profiles 1 and 3 and profile 2 at 12 bits where the
driver decodes them. devices.md gets a section on which hosts take which, how
the pictures land, the Iris Xe's boots and the 1080p rate; vaapi.md the
surfaces, iHD's lists and its 4:2:2 failure, and the new streams' card runs;
nvidia.md, backends.md and design.md drop the refusal of profiles 1 and 3 they
stated; known-issues.md names the formats each tested GPU decodes.
2026-11-27 16:15:45 -08:00
Anees Iqbal 6816f76f9a 🆕 Decode VP9 profiles 1 and 3 and 12-bit 2 for arm64 guests
An arm64 guest's VideoToolbox hands a VP9 stream of every profile to the
host, and arm64 macOS has no VP9 decoder of its own. The host's dsta refused
profiles 1 and 3 and profile 2 at 12 bits at the session's start (-12910), so
those streams had no player in the guest.

The codec now takes profile 1 (4:2:2 and 4:4:4 at 8 bits), profile 3 (the
same at 10 and 12 bits) and profile 2 at 12 bits. VA-API decodes them on
VAProfileVP9Profile1 to 3 into the surfaces HEVC's range extensions use (P012,
YUY2, Y210, Y212, XYUV, Y410, Y412), and their pictures land in the guest
formats the range extensions already land in (tv20, 422v, x422, tv22, 444v,
x444, tv44). The caps still list profiles 0 and 2, the wire is unchanged, and
no guest format is new: dsta decides from the arm's own answers, naming why
it refuses.

The VA decoder now also refuses, at its configure, a stream whose surfaces
the driver's decoder does not list. iHD's profile 1 and 3 decoders make 4:2:2
render targets but list no 4:2:2 surfaces, and fail every 4:2:2 frame in any
surface (measured on the Iris Xe, job m3-max-77586), so a 4:2:2 stream is
refused at dsta there. NVDEC and radeonsi refuse profiles 1 and 3 and 12
bits by their own answers. 4:4:0 and VP9's RGB colour space are refused by
the codec on every host.

On the Iris Xe under arm64 macOS 26.6.2 and 14.6.1, the guest's pictures of
libvpx's streams of profile 1 at 4:4:4, profile 2 at 12 bits and profile 3 at
4:4:4 at 10 and 12 bits equal vpxdec's frame by frame, and a profile 1 4:4:4
stream at 1080p decodes at 85% of profile 0's rate (job m3-max-77567). The seven
streams (352x288, 20 frames, two superframes each) and vpxdec's MD5s are
committed for the card tests.
2026-11-27 16:09:37 -08:00
Anees Iqbal 8ed3d1e7fd 📝 Name the arm64 guest's 4:2:2 run on NVIDIA as untested [ci skip]
NVDEC's HEVC 4:2:2 decode landed on a proof run on an RTX 5080 Laptop GPU
from the host alone: no arm64 guest has run on that card. bugs.md's untested
list now says so, and when the guest's side is to run: a user's report of
HEVC 4:2:2 on an NVIDIA 50-series host, or an arm64 guest's disk reaching
such a card for another reason.
2026-11-27 16:03:53 -08:00
Anees Iqbal 0b62f02f56 📝 Record the RTX 3090's 4:2:2 refusal by its caps in a boot [ci skip]
A boot of an arm64 macOS 26 guest on the RTX 3090 at the change that takes
HEVC 4:2:2 where NVDEC's caps list it (potluck job m3-max-77572) refused
each 4:2:2 session by the caps' answer and decoded the card's other range
extensions in hardware as before, every picture the same as the guest's
software decode. devices.md quoted the refusal's old wording.
2026-11-27 15:53:08 -08:00
Anees Iqbal 9d69b44da1 🆕 Take HEVC 4:2:2 sessions on NVDEC where its caps list them
What the guest sees: on an arm64 guest of an NVIDIA host whose NVDEC lists
HEVC 4:2:2 at the stream's depth and size, as the RTX 5080 Laptop GPU's
does at 8, 10 and 12 bits, a VideoToolbox session of an HEVC 4:2:2 stream
now decodes on the GPU, each picture copied into the surface's 422v, x422
or tv22 (or full-range twin) with no conversion by the CPU. Its dsta was
refused before, and the guest decoded the stream in software. On a card
whose caps lack it, as the RTX 3090's do, the session is still refused at
its start, and its warning now names the caps ("NVDEC does not decode HEVC
4:2:2 at 10 bits") where it said "NVDEC's decoders here land no HEVC 4:2:2
pictures".

declines_range_extensions takes the caps' answer for 4:2:2 as it does for
4:2:0 and 4:4:4, the decoder's output being NV16 at 8 bits and P216
deeper, and the VideoToolbox decoder checks a picture's chroma format
against the surface's from the picture itself.

Shown on the host, not from a guest on that card: the card test
(an_hevc_picture_lands_in_its_guest_format_as_the_software_decode_has_it)
on the RTX 5080 Laptop GPU decoded our x265 streams of 4:2:2 at 8, 10 and
12 bits through the arm's VideoToolbox decoder into pool-laid surfaces,
every picture byte for byte as ffmpeg's software decode, beside 4:2:0 and
4:4:4 at each depth, and landed 1920x1080 4:2:2 pictures at 344 to 384 a
second (potluck job m3-max-77563). The seam test holds the session-start
decision on the 5080's and the 3090's recorded caps.
2026-11-27 15:43:36 -08:00
Anees Iqbal 6450aee5e8 🆕 Decode HEVC 4:2:2 on NVDEC into NV16 and P216
NVDEC lists HEVC 4:2:2 on newer cards: the RTX 5080 Laptop GPU decodes it
at 8 bits into NV16 and at 10 and 12 bits into P216 (nvidia-probe). The
HEVC accelerator refused every 4:2:2 SPS, as no output of it was mapped.

Make a 4:2:2 decoder for an SPS of chroma_format_idc 2, into NV16 at 8 bits
and P216 deeper, laid out as NV12 and P016 with the chroma as tall as the
luma: a mapped frame's chroma rows start at the crop's first row and are as
many as the luma's (Mapped::of), a decode surface counts twice the luma's
samples, and AnnexBPicture::chroma names a picture's chroma format for its
callers. A card whose caps lack HEVC 4:2:2 still refuses the decoder at
its make.

No guest sees this yet: the graphics arm still refuses HEVC 4:2:2
sessions at their start, and a host video session's decoders refuse the
range extensions.
2026-11-27 15:43:19 -08:00
Anees Iqbal a4e6095322 📝 Name macOS 14.6.1 among the releases AV1 decodes on [ci skip]
The AV1 route had only been checked on arm64 macOS 26.6.2. An arm64 macOS
14.6.1 guest on an RTX 3090 now decodes our svt-main8 stream to its
reference frame by frame, in a session that requires hardware (potluck job
m3-max-77531, at the tree this commit follows). The same boot decoded VP9,
HEVC and H.264 there with no errors. Docs only: nothing changes for the
guest.
2026-11-27 15:24:07 -08:00
Anees Iqbal b5d5caf63a ✅ Give back the release test's own block, not offset 0
The release test took one block for each of contexts 1 to 4 on a fresh piece
and gave back context 1's at offset 0, which holds only when context 1's take
is carved first. It need not be: the zeroer claims a fresh piece's first chunk
last, a take whose first fit holds bytes of the claimed chunk waits for it on
its worker, and the zeroer lets its claim go before it wakes that worker. A
later take carried out in between carves offset 0 at once, so context 1's
block lies past it and the give of offset 0 finds another context's block:
the "not given" a loaded merge run met once.

The test now gives back the block context 1's take answered. A new test forces
that order (a claim set with the zeroer shut, a take waiting for it, the claim
ended, a second context's take): it failed on the old test's give, and holds
with the fix. No behaviour change: the pool carved and answered so before,
and a context's takes are still answered in its order by its one worker. The
"Zeros ahead" doc said a block lies where it would with no zeroer; it now says
what the code does.
2026-11-27 15:15:55 -08:00
Anees Iqbal e5b03f2d8b 🐛 Refuse paravirtual H.264 and HEVC sessions of sizes the host lacks
An arm64 guest's VideoToolbox session of a 4:2:0 H.264, HEVC Main or Main 10
stream whose coded size lies outside the host decoder's own, as HEVC under
NVDEC's least size of 144x144, was started, and its pictures failed in the
host's decoder: NVDEC refuses to make a decoder of that size, and VA-API's
surfaces or context refuse it. A client that allowed software decoding got
failed frames rather than pictures.

For the guest: such a session's dsta is now refused with
kVTVideoDecoderUnsupportedDataFormatErr, its warning naming the stream and the
decoder's sizes, as the x86-64 route refuses it at create (5dfe92be1), and the
guest's VideoToolbox decodes the stream in software. That covers an H.264
stream wider than 4096 on iHD, as 4112x2160: iHD's H.264 config lists
8192x8192 but its surfaces take 4096x4096 at most, so such a session started
and its pictures failed. Streams inside the sizes start as before.

The sizes are each arm's own. On NVDEC, its caps of the codec at 4:2:0 and the
stream's depth: nMinWidth and nMinHeight up to nMaxWidth, nMaxHeight and
nMaxMBCount, the checks its decoder's make runs. On VA-API, the decoder the VA
crate's decoder picks for the stream, whose profile choice the video crate now
exports (h264_decoder_profiles, hevc_main_decoder): from its surfaces' least
size, none where they list none, up to the least of its config's and its
surfaces' largest, and H.264's 65,535 blocks. The range extensions' check takes
that bound too.
2026-11-27 15:14:14 -08:00
Anees Iqbal f09b4f3116 🎨 Take each arm's paravirtual declines from caps it is handed
Both video arms decide at a VideoToolbox session's start whether they decode
its stream: NVDEC by asking its caps of HEVC's range extensions inline, VA-API
from a field of its range extensions configs. The decision is now a function of
the arm's own caps, handed in: NVDEC's through a closure over
decode_capabilities, VA-API's as the driver's decoder configs, which now list
H.264's and HEVC Main and Main 10's too. A size check both arms share,
DecodeSizes (graphics/decode_sizes.rs), holds a decoder's least and largest
sizes and its bound on blocks, and both range extensions checks go through it
with the lines they wrote before.

Nothing changes for the guest or the host: the same streams are declined with
the same reasons, and every 4:2:0 stream is taken as before. The next commit
checks 4:2:0 streams' sizes there.
2026-11-27 15:13:55 -08:00
Anees Iqbal 132868d988 🆕 Offer VP9 decode to arm64 guests
The hosts' drivers list VP9 decode at profiles 0 and 2, and an arm64 macOS
26 guest has no VP9 decoder of its own: every VP9 session fails -12906
without one from the host. The previous commit gave the host VA-API
and NVDEC decoders; this one offers them to the guest.

What the guest sees: the device's video caps gain a VP9 entry, codec 3
(RGFX_VIDEO_CODEC_VP9), where the host's arm decodes VP9, listing profile 0
into NV12 and profile 2 into P010 as the driver answers them, at the arm's
sizes up to 16384 a side, and level 62 (6.2, as vpcC numbers it). On the
paravirtual route (RGFX_FEATURE_VT_MESSAGES) the host then lists a vp09
decoder, reims-vgpu-video.videodecoder.vp9, with those profiles; once a
process registers VP9 (VTRegisterSupplementalVideoDecoderIfAvailable, as on
a Mac) the guest's VideoToolbox decodes VP9 on the host's hardware. A sample
is a frame or a superframe whole, which the host splits. A stream the host
does not decode (profiles 1 and 3, 12 bits) is refused at its session's
start, as an HEVC format the arm lacks is, and the guest has no VP9 decoder
of its own to fall back on: known-issues.md says so. No encoder of VP9 is
listed.

The guest's pictures of the two libvpx streams equal vpxdec's, frame by
frame, on an RX 7900 XTX, an Iris Xe and an RTX 3090 under macOS 26.6.2 and
on the 3090 under macOS 14.6.1, and VP9 decodes as fast as HEVC on the same
route at 1080p and at 8192x4352 (devices.md, with the guest's CPU emulated).

The wire change is additive. An x86-64 guest's kexts read no caps entry past
HEVC's, and the device takes no session of codec 3. An older host's caps
have no VP9 entry, so a newer guest's VideoToolbox lists no vp09; a newer
host's caps list H.264's and HEVC's entries as before, beside VP9's
(vt_decoders_list_vp9_beside_the_others_where_the_caps_decode_it). The
header's hash moves in the option ROM's and both kext sets' source records;
their bytes are unchanged.
2026-11-27 14:57:30 -08:00
Anees Iqbal 4b8d51d09e 🆕 Decode VP9 on VA-API and NVDEC
The hosts' drivers list VP9 decode (radeonsi, iHD and NVDEC at profiles 0
and 2), and the owner's order is to offer the guest what the host lists. This
is the host's half: the decoders. Nothing offers them to a guest yet, so no
guest sees a change.

The codec module (codec/vp9) does on the host what VP9's hardware APIs leave
to the caller: it splits a superframe into its frames, reads each frame's
uncompressed header and keeps what persists between frames (the colour
configuration, the loop filter's deltas, the segmentation's features and the
eight reference slots), derives the quantizer scales and filter levels, and
hands each frame whole to an accelerator that decodes the compressed header
and the tiles. It refuses profiles 1 and 3 and 12 bits before anything
reaches a driver, and a frame that predicts from an empty slot is a picture's
error, after which a key frame decodes. Every field is checked against the
bytes before it is used: the CPU tests feed it truncated and hostile streams
and superframe indexes (the fuzz targets vp9-streams and vp9-samples).

VA-API's arm (vaapi::va::vp9) fills VADecPictureParameterBufferVP9 and the
slice parameters per frame, with a context per run of one format and size.
NVDEC's (nvidia::nvdec::vp9) fills CUVIDVP9PICPARAMS, whose bit-fields are
held in words of our own naming and checked against NVIDIA's header with the
rest of the layout. NVDEC makes a decoder at a frame's exact size, and a
frame that predicts from one of another decoder, a resized stream's, is
refused as a picture's error (bugs.md B96).

Two streams libvpx made from a synthetic source (640x360, profile 0 and
profile 2 at 10 bits, three superframes each) and vpxdec's per-frame MD5s
are committed; the ignored card tests decode them bit-exact on the RX 7900
XTX's radeonsi, the Iris Xe's iHD and the RTX 3090's NVDEC.
2026-11-27 14:57:30 -08:00
Anees Iqbal 5c30529e18 🎨 Build the AV1 helpers only where their callers build
On the Mac target clippy found AV1 helpers dead whose callers build on other
hosts alone. The card tests' judgement, the streams' grain statistics and
the decoder's film grain alteration serve the VA-API and NVIDIA card tests,
which build on Linux; the arms' AV1 limits and declines serve the VA-API and
NVDEC arms, which build on Linux and Windows. Each is now built under the
cfg its callers build under.
2026-11-27 14:50:54 -08:00
Anees Iqbal aab864f3ef 🆕 Offer arm64 guests' VideoToolbox an AV1 decoder
What changes for the guest: an arm64 guest's VideoToolbox now lists an av01
decoder, profile 0 at level 19 as Apple's own lists, wherever the arm's
capability query lists AV1 Main (VA-API's AV1Profile0, NVDEC's AV1 at
4:2:0), and decodes AV1 sessions on the host's GPU. Before, it had no AV1
decoder at all, and a session asking for one failed -12906.

A session of another profile, or past the depths or sizes the arm lists
(NVDEC's caps, VA-API's AV1 surfaces), is refused at its start with a
warning that names why. A picture the hardware reports failed reaches the
guest as a decode error, as H.264's and HEVC's do on this route.

AV1's codec number is the host's own: the device's caps, its wire and the
option ROM are unchanged, and x86-64 guests get no AV1, as AppleGVA decodes
none. Measured on a Radeon 780M, AV1 decodes at 0.87 of HEVC's rate at
1920x1080 and 1.02 at 8192x4352 (medians, emulated guest CPUs).
2026-11-27 14:37:07 -08:00
Anees Iqbal abd59e673b 🆕 Decode AV1 on VA-API and NVDEC
VA-API's AV1Profile0 decoder and NVDEC's cudaVideoCodec_AV1 decode the codec
module's frames, at 8 and 10 bits into NV12 and P010 (NVDEC's P016, which
holds samples as P010 does). The hardware applies
film grain into a second surface, which is what the caller gets, while the
frame without grain stays the reference.

NVDEC takes its references by surface: ref_frame_map, each ref_frame[] and
primary_ref_frame name the surface a slot holds. A slot's number in
primary_ref_frame, with ref_frame[] left zero on key frames, faulted
libnvcuvid inside cuvidDecodePicture on the RTX 3090; a frame naming a slot
that holds no frame is now refused before NVDEC sees it.

The ignored card tests decode the committed streams on the hardware, frame
by frame against libdav1d's MD5s. A frame the hardware reports failed is
allowed and counted; a wrong frame delivered as decoded fails, on any card.
Grain of the driver's own synthesis, iHD's, is held to the specification's
by its residual's mean, deviation and block variances, with grain of other
parameters shown to fail the same check. On the RTX 3090 NVDEC reports a
superres stream's inter frames failed (bugs.md U36).
2026-11-27 14:35:48 -08:00
Anees Iqbal cc07738ab0 🆕 Read AV1 streams in the video crate's codec module
An arm64 guest's VideoToolbox asks for AV1, and both arms decode it in
hardware, but the hardware takes only a frame's tile data: the syntax above
it is ours to read, as H.264's and HEVC's is. The codec module now reads
AV1's OBUs, av1C records, sequence and frame headers and tile groups, keeps
the eight reference slots, works out the frames each temporal unit shows,
and hands an Accelerator each frame's tile data with its parameters.

It refuses at a sequence header what no arm decodes or what the arm's
limits exclude: profiles other than Main, monochrome, spatial layers, and
frames larger or smaller than the arm's capability query lists. A record
without a sequence header is read from its first sample.

Eleven small streams of ours (aomenc, SVT-AV1 and rav1e from ffmpeg's
synthetic sources, and an AVIF still's item) are committed with the MD5 of
each shown frame from libdav1d's decode, and the CPU tests decode, truncate
and fuzz them through a recording accelerator. The card tests' judgement,
film grain's by its residual's statistics, lives here too.
2026-11-27 14:35:33 -08:00
Anees Iqbal 0227e6624c 🐛 Encode the 8-bit 4:2:2 conformance stream at 8 bits
x265's main422-10 profile writes 10 bits unless told the output depth, so
main422-8-360p came out a 10-bit stream checked against an 8-bit reference,
and failed on a driver that decodes it. Pass --output-depth 8 for the 8-bit
range extensions streams.
2026-11-27 14:34:05 -08:00
Anees Iqbal 54bb7b0b4c 🆕 Decode HEVC's range extensions for arm64 guests on the host's GPU
An arm64 guest's VideoToolbox paravirtual decoders now take HEVC's range
extensions, 4:2:0, 4:2:2 and 4:4:4 at 8, 10 and 12 bits, wherever the host
arm's own query lists a decoder of the stream. Until now they took 4:4:4 at
8 bits alone and refused the rest at the session's start.

What changes for the guest:
- dsta and dsts take a range extensions stream where VA-API lists the
  decoder of its profile with the render targets and surfaces it needs.
  iHD on an Iris Xe lists all six profiles, but its Main 12 has P012 and
  P016 surfaces alone, so 4:2:0 at 8 and 10 bits stays refused there.
- They also take it where NVDEC's caps list its chroma format, depth and
  size: 4:2:0 and 4:4:4 on an RTX 3090.
- Where nothing lists the stream, the refusal stays as before and names
  the stream and the arm's reason. radeonsi lists no decoder of them.
- Each picture lands in the format the guest's own software decoder gives
  the stream, which Dpba names: 420v/x420/tv20, 422v/x422/tv22,
  444v/x444/tv44 and their full-range forms.
- NVDEC's 4:2:2 is not built: the 3090 lists none, and those streams stay
  refused there.
- The x86-64 caps are unchanged.

The codec takes the range extensions at 4:2:0, 4:2:2 and 4:4:4 and at 8,
10 and 12 bits, with their tools. It still refuses extended precision and
high precision weighted prediction offsets past 8 bits. Its CPU tests
decode streams of each chroma format and depth, and an SPS cut at every
length or with any bit flipped is refused or decoded whole, with no panic.

VA-API decodes on the stream's range extensions profile into P012, YUY2,
Y210, Y212, XYUV, Y410 or Y412 surfaces. The CPU splits the packed ones
into the guest's two planes; the GPU still splits XYUV where its import
check passed. NVDEC's 4:2:0 lands as Main 10's, and the CPU interleaves
its 10 and 12-bit 4:4:4 planes. Each picture the CPU converts is counted
as video-pictures-cpu-converted.

CoreVideo has no format with the layout of Y210, Y212, Y410 or Y412, and
the Mac's decoders answer 422v, not yuvs, for 4:2:2 at 8 bits, so the
conversions stay. Under TCG on the Iris Xe, hardware sessions took 0.36
to 0.66 s for 30 pictures at 1080p of every listed profile, against 1.88
to 5.32 s for the guest's software decode (docs/video/devices.md). The
conformance suite decodes x265's streams of every listed profile.
2026-11-27 14:34:05 -08:00
Anees Iqbal fb22fcfba6 📦 Rebuild both sets for the HEVC decode size refusal
make -C guest prebuilt and prebuilt-arm64e at 5dfe92be1 (m3-max-77407, which also
ran prebuilt-check): RgfxGate carries the Metal bundle, whose video driver now
refuses an HEVC decode of a size the host does not decode at its create. The
other kexts' bytes are unchanged.
2026-11-27 14:23:23 -08:00
Anees Iqbal 5dfe92be18 🐛 Refuse HEVC decodes of sizes the host lacks at their create
An x86-64 guest's HEVC stream smaller than the host decoder's least size (64x64
and 128x96 on the RTX 3090's NVDEC, lane vhevcenc's leg m3-max-77366) got a
session, and the host refused each picture at its schedule: AppleGVA reports
that as kVTVideoDecoderMalfunctionErr for the frame and every frame after it,
so a client that allows software decoding got no frame at all. CreateContexts
names the coded size, so the driver now refuses HEVC there as it refuses
H.264 (cffc93097), and VideoToolbox decodes such a stream in software. The
per-picture check stays for a stream whose SPS changes its size.

For the guest: an HEVC VTDecompressionSessionCreate of a coded size the host
does not decode fails at create, so VideoToolbox falls back to its software
decoder where the client allows it; before, the session was made and every
frame failed with -12911. checkDecodeSizeAtCreate replaces
checkH264SizeAtCreate, which held that an HEVC create of any size is made.
2026-11-27 14:10:48 -08:00
Anees Iqbal bd2a54f3f0 📝 Say only our VMs lack the JPEG hardware the guest looks for [ci skip]
The JPEG line said any virtual machine has neither Apple JPEG nor scaler
hardware. Our boots show only that ours have neither, so the line now says that.
2026-11-27 13:20:50 -08:00
Anees Iqbal e6a0ceb632 📝 Say arm64 guests decode JPEG in software [ci skip]
Lane vjpegdec's boots of macOS 14.6.1 and 26.6.2 (780M, Iris Xe, 3090) show no
route an app uses reaching the device's JPEG decoder: ImageIO and VideoToolbox
look for Apple's JPEG and scaler drivers by name, find none, and decode in
software. The finding joins the other video formats our GPU gets no route to.
2026-11-27 13:20:14 -08:00
Anees Iqbal 2269acc352 📦 Rebuild both sets for the bundle's log lines off stderr
make -C guest prebuilt and prebuilt-arm64e at 70088b78b (m3-max-77309, which also
ran prebuilt-check): RgfxGate carries the Metal bundle, whose log lines now go
to the unified log alone. The other kexts' bytes are unchanged.
2026-11-27 13:15:07 -08:00
Anees Iqbal 70088b78b1 🐛 Keep the bundle's log lines off the process's stderr
Every line of the Metal bundle's (rgfxLogLine) went to the unified log and also
to the process's stderr wherever NSLog writes there. So a command-line program
in a guest that joins its stderr to its output printed the bundle's lines among
its own: a user's script showed "RGFX: feature profile 10002: ..." in its
output. A Mac's Metal writes nothing there of its own.

rgfxLogLine now logs to the unified log alone. The words of a death, which the
process ends at next and which Metal writes on stderr at the same calls, go
through rgfxLogDeathLine, which still writes them there; the death checks read
them.

shell_tests runs itself again with --log-line, its stderr a pipe, and checks
that a logged line writes nothing there. It fails with the old rgfxLogLine.

What changes for the guest: a program's stderr carries none of the bundle's
lines except a death's words; the unified log keeps them all, as before.
2026-11-27 13:07:40 -08:00
Anees Iqbal cf3c32173d 📝 List the video formats our GPU gets no route to [ci skip]
The owner asked for every video format the host's GPU offers to reach the
guest. For these, a boot or a read of the guest's frameworks found no route,
so the guest keeps its own software decoder, or has none:
- VP9 decode on x86-64 guests: AppleGVA sends whole frames to our driver but
  never names the picture's output surface (boots m3-max-77225, 77247);
- AV1 decode on x86-64 guests: AppleGVA and the x86 plug-ins have no AV1;
- HEVC encode on x86-64 guests: the encoder plugin picks the Intel vendor,
  even for a session that names our GPU, and -12903s (m3-max-77226);
- HEVC range extensions on x86-64 guests: AppleGVA hands our driver a 4:2:0
  destination at 10 bits or fewer, which cannot match the full picture the
  guest's software decode gives (m3-max-77246, 77257);
- MPEG-1/2, MPEG-4 Part 2, VC-1 and VP8 decode, and VP9 and AV1 encode: no
  key or codec entry in the guest's frameworks a GPU driver can serve.
2026-11-27 12:28:29 -08:00
Anees Iqbal 353709e1a0 📦 Record the sets' sources after the mouse's transport moved
773b0b97f moved the arm64 mouse's HID transport name into
RgfxPointerMotion.hpp. Both sets were built again from the tree (potluck job
m3-max-77235: make -C guest prebuilt, prebuilt-arm64e and prebuilt-check):
the kexts' bytes are unchanged, and only the records of their sources change.

What changes for the guest: nothing.
2026-11-27 12:10:33 -08:00
Anees Iqbal 773b0b97fb ✅ Test the HID transport the guest's mouse names
8277faa32 named the arm64 mouse's HID transport, "Virtual", so a lookup of
it through the mouse's parents stops before display 0's framebuffer and the
dictionary IOMobileFramebuffer keeps under the same key, which killed macOS
26.6.2's WindowServer at each start. The name lived in RgfxPointerDevice.cpp,
which no native test compiles, so taking it out would fail only a boot.

The name moves into RgfxPointerMotion.hpp as kRgfxMouseTransport, and
pointer_motion_test checks it in both builds: IOHIDKeys.h's Virtual where the
arm64e kext builds it, none where the x86-64 kext does.

What changes for the guest: nothing; the kexts name the same transport.
2026-11-27 12:03:57 -08:00
Anees Iqbal 8c8e3a0971 🐛 Give the console back its modes after an update's installer
In a Windows Terminal, after reims-ctl's update ran the install script, the
console wrote reims-ctl's line ends and escape sequences as characters:
"Updated. Starting the new reims-ctl..." between two glyphs, then the new
reims-ctl's interface as text. Its output mode had line ends, escape sequences
and wrapping off. Which program of the install left it so is not known: the
installer's own console commands, run so in a pseudoconsole, left the modes as
they were.

reims-ctl now keeps the console's input and output modes while the install
script and the update's git run, and gives them back before it writes anything
or starts the new reims-ctl; a program the interface runs in the terminal
(less) gets the same. The interface turns line ends, escape sequences and
wrapping on as it starts, whatever ran on the console before.

The tests run, in a pseudoconsole, as Windows Terminal's console is, a stand-in
program that leaves the output mode so and the input mode changed: through the
update's runner and run_in_terminal the console's modes come back as they were,
and the interface's start turns the output mode's back on.
2026-11-27 11:49:11 -08:00
Anees Iqbal 4b2e92f518 📝 Say arm64 guests' video is VideoToolbox's, and VA-API encodes
docs/video/devices.md said an arm64 guest is offered no codec on any host:
true of AppleGVA's route alone, and stale since 2d7ce10ea, after which the
arm64e kext serves the guest's VideoToolbox its paravirtual path, which
decodes H.264 and HEVC, and on Linux hosts encodes H.264 and HEVC Main and
Main 10, on the host's video arm. The paragraph now says so, keeping the
measured no-decoder case. video_choice.rs said VA-API decodes alone, stale
since ad8ef4392, which answers the driver's encoders on Linux; Windows still
decodes alone. A listing of the hosts' video formats read both as written.

[ci skip]
2026-11-27 11:42:46 -08:00
Anees Iqbal c64fd3b900 ✅ Move QEMU to a test of virtio's capability order
vendor/qemu moves to 4571bc5f on steelbrain/nonvm-dsound-ring, one commit
on 1600825b. Issue 167's fix (78c220238 with the fork's 5c42f3fc) has
vmapple link virtio-sound-pci's PCI capabilities in address order, which
macOS 27's virtio transport needs to start the device. Only an arm64 macOS
27 boot that listens for sound saw that half, and no pin leg runs one.

The fork's tests/qtest/virtio-pci-caps-test.c reads virtio-sound-pci's and
virtio-net-pci's capability lists under qtest with x-ascending-capabilities
on and off, and fails with virtio-sound-pci's reordering taken out of its
realize. The fork's unit-test job builds qemu-system-x86_64 for it.
2026-11-27 11:38:20 -08:00
Anees Iqbal 24c281a610 ✅ Test that checkouts keep LF whatever autocrlf says
A user's install of the development channel on Windows stopped in cargo
xtask dist: Git for Windows' installer sets core.autocrlf=true, the clone
held CRLF .metal sources, and reims-vgpu-vulkan's build script found the
committed metallibs built from other bytes. 5fdd3c05f's .gitattributes
(* text=auto eol=lf) keeps LF in every checkout, but nothing checked that
the attribute holds for the files read byte for byte.

xtask's new test asks git check-attr for text and eol of a .metal source,
the C header and a guest Info.plist, and wants auto and lf for each. With
the attribute line taken out it fails: eol is unspecified.
2026-11-27 11:30:01 -08:00
Anees Iqbal 6a1d3d77a5 ✅ Test that a Windows install builds C with clang alone
A user's install of development on Windows stopped in sdl3-sys's CMake
build: their environment's CC named Visual Studio's cl.exe, which CMake
took. bd239b6dd made install-ctl.sh export CLANG64's clang, clang++ and
llvm-ar, and MSYS Makefiles, as CC, CXX, AR and CMAKE_GENERATOR and their
x86_64-pc-windows-gnullvm forms, on Windows. No test read those exports,
so a cl.exe in the environment could reach the build again unseen.

install.rs's new test takes the exports of the script's Windows toolchain
block and runs them over an environment naming cl.exe and lib.exe, and
reads each of the eight variables back. With the fix taken out it fails:
the environment's cl.exe stays.
2026-11-27 11:30:01 -08:00
Anees Iqbal 691b228c26 ✅ Move QEMU to a test of dsound's playback arithmetic
vendor/qemu moves to 1600825b on steelbrain/nonvm-dsound-ring, one commit
on b057a987. The sound-pop fixes on Windows hosts (01dc355d7, 851b1c433)
gave QEMU's dsound voice a 60 ms reserve past DirectSound's write cursor,
its cursors in whole frames and a count of the bytes left to play, all in
dsoundaudio.c, which builds only on Windows, so no test held them.

The fork moves that arithmetic unchanged into audio/dsound-ring.h, which
dsoundaudio.c calls, and tests/unit/test-dsound-ring.c holds it on any
host, failing with the reserve at half the buffer (before 4d205af8) or the
cursors unrounded (before 0c0ac356). The fork's unit-test job runs it with
test-cutils. What a Windows host plays does not change.
2026-11-27 11:23:18 -08:00
Anees Iqbal fe59c3b9b1 ✅ Test that QEMU's configure keeps the shell's pkg path
Pull request 186 (21951eaf8) made install-ctl.sh hand QEMU's configure the
library's pkg-config directory first and the shell's own PKG_CONFIG_PATH
after it: on a host whose pkg-config finds its libraries only through that
variable (NixOS in a nix-shell), a configure handed the library's directory
alone found no glib-2.0 and stopped. No test read that line, so the shell's
path could be dropped again unseen.

install.rs's new test takes the script's configure line, the one after its
"Configuring QEMU" message, and runs it with a configure that prints the
variable it was handed: the library's directory then the shell's, and the
library's alone, with no empty entry, where the shell has none. With the
fix taken out it fails on the first.
2026-11-27 11:10:29 -08:00
Anees Iqbal b31d3441ec 📝 Name the 150% scale guard in the window's register
The register's entry for telling the guest a screen's content scale (a
user's report: a Windows screen at 150% told the guest 1x, fixed by
4420e9cc4) named two tests that pass with that fix taken out: units.rs's
reads pixels_per_point's answers and geometry.rs's that a layout carries
the scale it is given. They test parts of the feature and stay. The test
that sees the fix, the render thread's
the_guest_is_told_its_screen_s_scale (09598dc7e), turns red with either
half of it out, so the entry now names it first. It exists on Linux and
Windows hosts, where SDL's sizes are pixels; features_md_guards_exist
reads sources, so it finds it on every host.
2026-11-27 08:15:00 -08:00