Where the host's video imports device caches (NVDEC), every device cache was
made exportable, whatever its surface. The video writes only two-plane surfaces
(NV12, P010), so a window's or a layer's cache gained nothing from it and paid
for it: metal2vulkan makes each exportable buffer a dedicated allocation, to
which it binds no image, so every texture over every cached surface was a
shadow, copied in before and back after each command buffer that used it.
On a GPU of its own memory the cache maker knew only the first plane's byte of
the layout a cached block's SURFACE_PAGES carries. CacheLayout now carries the
surface's plane count too, and only a cache whose layout gives two planes is
made exportable and gives the video its identity. A cache of one plane, or of
a surface whose pages carry no layout, is made as any other cache.
Measured with a macOS 26.7.2 guest at 3648x2038 on GPUs behind a Thunderbolt 3
link (PCIe x4 Gen3), each step Launchpad or Mission Control held open, ABBA on
one host, development 9e2f9e90f (A) against this change on it (B):
GPU run Launchpad held take-to-show Mission Control held
RTX 2080 A1 24.5/s 66.2 ms 52.1/s
B1 56.8/s 14.9 ms 59.9/s
B2 56.9/s 6.9 ms 60.0/s
A2 24.4/s 66.6 ms 52.1/s
RTX 3090 A1 23.1/s 70.7 ms 51.9/s
B1 55.7/s 20.1 ms 59.8/s
The 3090's B2 and A2 did not run: its Thunderbolt link failed during B2 (a
fatal PCIe error at the dock's bridge, Xid 79). A walk of this change with
video on that 3090 held Launchpad at 56.8/s, 6.9 ms. On the 3090 the shadow
copies went from 151M texels in and 165M back a present to 23M to 36M in and
next to none back. NVDEC still lands every picture in its output's exportable
cache, by the hardware.
What the host observes: timing alone; the guest sees nothing else change. The
exportable allocations and their exports are made for the video's caches
alone, and the caches' count line's "made exportable" counts those. No
degradation kind changes; the warning for a carried layout that does not lie
in its surface now says its cache is made, not placed, as with none.
AppleGVA's decode flow takes every query of a decode for its completion
and reads no status or error from it (read from its code on macOS
26.7.1); the one failure it reports to VideoToolbox is a failed
schedule. The driver answered a query of a decode the host was still
running as running and never looked at its token again, so a host
failure that came after the query was lost: the guest got the untouched
surface as a decoded frame and no error. Only a failure the host had
already reported at the query failed the session's next schedule, two
pictures late.
Now the schedule of an HEVC picture waits for the host's verdict on it,
out of the lock that orders the sessions' pictures, and fails where the
host failed it. What changes for the guest: an HEVC decode's
ScheduleCommands returns once the host has decoded the picture, and a
picture the host fails gets kVTVideoDecoderMalfunctionErr itself, from
that frame on, instead of two frames later or never. H.264 is unchanged:
AppleGVA's H.264 pipelines keep no decode's result, so its schedule waits
for no verdict (docs/video/bugs.md D25, now H.264's alone).
The tests that held the deferred failure (failsLaterSchedule,
queryReport) change with it, and checkHostVerdict drives the schedule
through a host that fails one picture.
The HEVC decode entries said 15 for max_references on both arms: the size of
VA's ReferenceFrames, and the DPB bound on NVDEC. Neither host decodes a
picture with more than 8 pictures in its current reference sets. VA-API's
decoder refuses it (va.h: NumPocTotalCurr "should be equal to or smaller than
8"), and radeonsi decodes one wrongly when it is sent. NVDEC's
CUVIDHEVCPICPARAMS holds 8 a set, so 8 in all is the most with which every
picture decodes there. kvz-720p-ref15 is refused from its tenth picture, with
9 current references.
The guest now reads 8 for max_references in its HEVC decode entry on both
arms. H.264's 16 stays: the hosts take a reference list of 16 frames
(ReferenceFrames[16], NVDEC's dpb[16]), which is the standard's bound.
The host's video was five crates: core, codec, conformance, and the VA-API
and NVIDIA backends, with the examples and tools split between two of them.
One device uses them, from one library. They become one crate,
crates/reims-vgpu-video, with the modules core, codec, vaapi and nvidia, the
last two built on Linux alone. The conformance readers and writers, which only
the examples use, stay a crate of their own beside it, at
crates/reims-vgpu-video/conformance (reims-vgpu-video-conformance). The files
move with git mv, their paths rewritten, with no re-exports left behind. The
NVIDIA examples build on every host, as a stub off Linux.
Dead code goes with them: NVDEC's VP9 path and the codecs nothing asks it for
(NvdecCodec is H.264 and HEVC), and the Vulkan platform's listing of the
host's GPUs (host_gpus::hardware_gpus and gpu_device_gpu), which nothing
called, with its serde_json dependency.
AGENTS.md, development.md, docs/video and the nextest filter name the one
crate.
A picture's copy out waited for its decode holding the decoder's handle, so
the decoder's next picture reached NVDEC only once the copy was done: each
picture's decode and copy ran one after the other. The status of the decode
is now asked with the handle held for each ask alone, and the map, copies and
unmap hold it as before, so a session that decodes while it copies (the
reims-graphics device's) has the next picture decoding on NVDEC meanwhile.
Sessions that copy each frame before the next decode see no change.
Measured on the RTX 5080 (potluck 6864, decode_md5 over our device, two boots
of each build in both orders, every frame's md5 matching): 1080p H.264 1443 to
2118 frames a second (+47%), 1080p HEVC 1499 to 2053 (+37%), 4K H.264 614 to
635 (+3%), 4K HEVC 604 to 615 (+2%).
The paravirt video devices, their JPEG engine and scaler, and Vulkan Video
are gone, so docs/video says only what is left: the reims-graphics device's
video on NVDEC or VA-API, and the crates under it.
- devices.md: what the device answers the guest (the caps, the layouts,
OUTPUT_CACHED where NVDEC lands pictures in device caches) and what a
decode does, on each arm.
- backends.md: the two arms, their crates and traits, and the conformance
suite, which is VA-API's h264-check.sh and hevc-check.sh.
- core.md, vaapi.md and nvidia.md: the crates as they stand; vaapi.md adds
the 2026-11-07 runs of both scripts on the Iris Xe and a Radeon 780M.
- bugs.md keeps the entries the code and the other docs cite that still
hold, rewritten without the deleted devices; B26 is condensed.
- scaler.md, videotoolbox.md, hardening.md and vulkan.md go.
- AGENTS.md's video rows name the arms, the docs and the two scripts.
AppleGVA's H.264 decoder reports no failure a driver can answer. Measured on
the guest with the RTX 5080 host, every picture failed on the host: a failed
schedule (answered 5, 1 or 7, once or for every schedule after), the query's
status 0, 3 or 4, its field_08 or field_14 set, and a failed query call each
left all 60 frames decoded for VideoToolbox. A picture whose schedule failed was
never decoded. So failing an H.264 session's next schedule for a failure on the
host reported nothing and dropped the picture after the failed one. Now only an
HEVC session's next schedule fails, as AppleGVA's HEVC decoder reports it.
The docs said the failure came one picture late. For HEVC it comes two pictures
late, as AppleGVA schedules a picture before it queries the one before (58
errors of 60 where every picture failed). For H.264 it never comes.
The guest's kext set is built again with it on m3-max (25G241 KDK, Xcode 27.2):
RgfxGate, which carries the bundle, changes.
A picture landed in the output's pages, by DMA, or else by the CPU. Where
CUDA imports the runtime device's exportable buffers, which the arm learns
once as the video opens, it now lands in device caches instead. The caps say
RGFX_VIDEO_CAPS_OUTPUT_CACHED, the device makes its caches exportable as it
makes them, and each picture is one copy within the GPU into the cache's
memory, imported into CUDA once a cache and let go of as the cache goes.
Where the import is refused, a picture lands as before.
On the RTX 5080 Laptop GPU (job m3-max-5974, built with the overlap of the
NVIDIA crate's decode and copy beneath it), HEVC 4K decoded at 616 fps
against 30 into the pages, and the 300-frame soak streams at 2059 to 2247
against 42 to 56.
The deletion of the paravirt devices left the NVIDIA crate code that
nothing calls, under a crate-wide expect(dead_code): NVDEC's VP9 and AV1
picture parameters and their bit-fields, CUDA's device memory
(DeviceMemory, cuMemAlloc), the paravirt decoders' error mapping
(backend_error), AV1's tile offsets (Slices::Tiles), the decoder's
check_not_stalled, PictureReadBack::copy_to, Picture::set_size and
usize_of, and the spinning kernel that only the deleted tests of the waits
ran (cuda/spin.rs). They go, and so does the expect, so that the lint
holds the crate to its callers again.
CuvidCodecSpecific keeps its size, as its CodecReserved member is the
largest (4096 bytes). NVDEC's codec IDs for VP9 and AV1 stay:
decode_capabilities still answers them. cuMemFree stays, with an
expectation of its own: the NVDEC arm's writes into memory another API
imports free their mappings through it.
reims-vgpu-video-nvidia is the host's codecs on an NVIDIA GPU on Linux:
NVDEC and NVENC over the CUDA driver API, loaded at run time, with nothing
above them, and JPEG on nvJPEG's hardware decoder where libnvjpeg is
installed. Its handles are released once on every path, NVDEC takes each
picture's bitstream by borrow, NVENC's buffers live in their session, an
answer comes within one deadline of its first wait, and the frames after a
failed decode fail as Apple's AVD does. docs/video/nvidia.md records what an
RTX 5080 Laptop GPU answers.
Source: c5b409362 eb70a2030 f4e6e4bd4 773de8c18 e3d5616a4 60d08c4f4 c4c476643
31bad2301 fe105edcb 0cf450ef9 cf4c40cff 95032e033 e772d3352 dc8d5f453
c21cff4fb 17d62b909 ef26f02e1 d27a5f48a 7bbfdf888 203585632 8cbf706bb
31ffd8de7 5ff2dd73f b4fc832ed 52fba93c9 b5f40ad74 73d7e9c85 d01bbdc9e
541d46a0e 0dcca7ff7 601c23067 eef22173d bc6fcdaa7