Commit Graph
164 Commits
Author SHA1 Message Date
Anees Iqbal 2221d7004d 📝 Fill the UHD 630's cells and record the restore's wait on the Iris [ci skip]
vainfo -a on the UHD 630 (m3-max-78560) lists vaon12's decoders: H.264, HEVC
Main and Main 10, and VP9 profile 0 and profile 2 at 10 bits, 4:2:0 up to
8192x4352, and no encoder, AV1 or range extensions. The Windows column's
open cells (Q3) now say that, and Q3 is gone.

The planner kept the restore of H1: the decode's wait VA-API asks for before
a read stays. Its remainder on the Iris Xe against issuing the runs with no
wait, 0.2 to 0.7 ms a decode with the guest's numbers equal (m3-max-78524), is
recorded in B95 as its cost.
2026-12-02 07:18:17 -08:00
Anees Iqbal 9bdd4c633b 📝 Name the x86-64 guest's -19092 as its own synchronous wait [ci skip]
With the paravirtual service published, x86-64 macOS 26.7.2's framework
returns at once from a reply wait whose timeout is above 2.147 s, and a
synchronous decode's waits are 10 s: each synchronous frame fails -19092 as it
is sent. The same decode with asynchronous decompression handed 60 of 60 AV1
and 60 of 60 VP9 pictures on the 780M (m3-max-78509). The docs said what fails
was not known; F3 and F4 now say what the service, which x86-64 guests stay
off, decodes. devices.md also said the host answers dfin kVTUnimplementedErr,
which it no longer does.
2026-12-02 07:18:17 -08:00
Anees Iqbal 4b019b5bfd 🐎 Issue a VA-API frame's processing runs right behind its decode
bbe52c1aae made the zero-copy write wait for the frame's decode before it
issued the video-processing runs that read it, because nothing in va.h or
va_vpp.h promises that a driver orders a run on another context after a
pending decode of its input. That text is silent; it asks for one wait
only, before the planes are read (vaExportSurfaceHandle), which the runs'
own wait is. The drivers do order it: radeonsi's winsys schedules each
submission after earlier flushed ones on other rings that use one of its
buffers (RADEON_USAGE_SYNCHRONIZED, read from Mesa's code), and the
hardware test of the old order passed on the Iris Xe (iHD) and the Radeon
780M. The wait cost about 1.9 ms a landing on the Iris (B 6.68/6.27 ms
against A 4.01/4.03 in m3-max-78259; a decode sync of 608 us mean, issue
225 us, runs 1812 us in m3-max-78313).

The runs now go right behind the decode again, the decode is waited for
between their issue and their wait (runs_behind_the_decode), for its error
and its word that it is done, and the runs are waited for once. The
call-order test now holds that order, and the hardware test is again
runs_issued_right_behind_a_decode_write_what_it_decoded.

For the guest: a reference picture's landing starts its copy as the GPU
finishes the decode instead of a CPU round trip after it; what lands is
unchanged, and a failed decode's error is still the frame's.
2026-12-02 07:18:17 -08:00
Anees Iqbal 70d02fed49 📝 Name each video format's proof run, and close JPEG and ProRes [ci skip]
Part 4's table now says how each offered cell was shown: the job of a run in
which a guest decoded or encoded the format on that card, a card test, the
driver's listing alone, or no run on file. The x86-64 rows take today's walks
(H.264 and HEVC Main playback, and the HEVC and H.264 encode rows of
319f54dabb); the arm64 rows take the runs devices.md already names.

VP9 profile 2 at 12 bits on the RTX 3090 is offered on its card test (job
m3-max-78301: every frame libvpx's), not yet a guest run, and known-issues says
which formats each GPU decodes. JPEG on Intel Mac guests is the guest's own,
as a real Intel Mac's is. ProRes has no route: no lab card's driver lists it.
The x86-64 encoders' AppleGVA paths are named under the table.
2026-12-02 07:18:17 -08:00
Anees Iqbal a774a7fcf2 📝 Settle the JPEG and HEVC range extensions encode cells [ci skip]
Part 4's Q1 and Q2, answered by a read of an Intel Mac's video plug-ins,
registry and shared cache (potluck job m3-max-78260) and of the arm64 HEVC
encoder's Info.plist as macOS 27.0.1 ships it.

JPEG is the guest's own on both arches. VideoToolbox's JPEG plug-ins load only
where Apple's JPEG engine's key is in the registry, and AppleGVA has no JPEG
path an app uses. No GUI or VT route ever asks a GPU.

HEVC 4:4:4, 12-bit and SCC encode are the guest's own as well: VideoToolbox
names no profile for them. On x86-64 no encoder takes 4:2:2 either. On arm64
the paravirtual encoder lists the range extensions profile, so Main 4:2:2 10
on the Iris Xe becomes N4, sized and waiting for the planner.
2026-12-02 07:18:17 -08:00
Anees Iqbal 221d6933e6 🆕 Decode VP9 profile 2 at 12 bits on NVDEC where its caps list it
The owner's order is to offer what the host lists. An RTX 3090's NVDEC
lists VP9 at 12 bits, 4:2:0 (m3-max-77186), but the NVDEC arm declined
every 12-bit profile 2 stream at its paravirtual session's start, so an
arm64 guest decoded none on an NVIDIA host, while iHD's already land in
`tv20`.

What changes for the guest: on an NVIDIA host, an arm64 guest's
paravirtual VP9 session of profile 2 at 12 bits, 4:2:0, is now taken
where NVDEC's caps of VP9 at 12 bits, asked at the session's start as
HEVC's range extensions are, list it at the stream's size. Its frames
decode into P016 (the samples at the top of their words) and land in
`tv20` as HEVC's 12-bit 4:2:0 pictures do. Elsewhere the session is
refused at its start as before, its reason named.

vp9_s_caps_are_nvdec_s_answers_and_decline_what_they_lack held the old
answer (12 bits declined) and now holds the new one: taken where the
caps list it; declined where they do not, write no P016, or lack the
size. It fails with the 12-bit branch cut off (m3-max-78250, msi). The
new ignored NVIDIA-host test a_12_bit_profile_2_stream_decodes_to_libvpx_frames
checks the codec module's 12-bit libvpx stream against vpxdec's MD5s, to
run on an RTX 3090. docs/video/formats.md's cell reads "listed, not run"
until it does.
2026-12-02 07:18:17 -08:00
Anees Iqbal 78b3bc8ac6 📝 Table every video format by guest and host route [ci skip]
Part 4 asks for one table of what the lab's cards decode and encode
against what the device gives each guest: for each format, guest route
and host arm, offered, a finding with its evidence, or not built with its
reason. docs/video/formats.md is that table, from the drivers' lists of
2026-11-27 (m3-max-77185 to 77188) and the arms' caps code.

It shows one format the code could offer and does not (G1: VP9 profile 2
at 12 bits on NVDEC, which the RTX 3090 lists), and three cells no lane
has studied (JPEG on x86-64 guests; HEVC range extensions and SCC encode;
the UHD 630's formats past H.264 and HEVC Main 10).
2026-12-02 07:18:17 -08:00
Anees Iqbal 584d57e6c4 🐛 Issue a VA-API frame's processing runs once its decode is done
A frame written by video processing had its runs issued right behind its
decode, before the decode was waited for, resting on the driver to order a
run on another context after a pending decode of the surface it reads.
Nothing in va.h or va_vpp.h promises that, and va.h's own example of a
surface handed on waits for the decode first. The write now waits for the
decode, then issues the runs and waits for them, as runs_after_the_decode
orders it.

Its fake call-order test, a_frames_runs_are_issued_once_its_decode_is_done,
fails on the old order and passes on the new one (job m3-max-77975). The
hardware test that held the old order, now
a_write_asked_as_its_decode_is_issued_writes_what_it_decoded, checks that a
write asked while its decode runs still writes what it decoded.

For the guest, a reference picture's landing starts its copy one CPU round
trip after its decode ends instead of as the GPU finishes it; what lands is
unchanged. A failed decode is still copied, and its error is the frame's.
2026-12-02 07:18:16 -08:00
Anees Iqbal 3221bd66ad 🐛 Hold a decode until its output's earlier users on its queue end
A video session's decode writes its output off the device's queues as the host
walks the decode's command buffer, so the queue's order of its buffers' GPU work
did not hold it: a buffer of the decode's own queue that read the output,
committed before the decode and not yet finished, read the next picture or a mix
of the two (the video lane's hand-over table, row 15, and its harness's first
seed). The host waited on the CPU only for the other queues' buffers the
guest's order named.

Now each committed command buffer that used a device cache and held no video op
leaves a mark in the cache: for its queue, the value its queue's end event
reaches as it ends, and its value again where it may write the cache. Before a
decode writes a cache, it waits on the CPU for every queue's mark, its own
queue's among them; an encode, which only reads its source, waits for the
writers' marks alone. The queues' end events are shared events now, so the CPU
can read and wait on them (a recording names newSharedEvent where it named
newEvent for them).

The record is bounded at one mark a queue a cache: a queue's later buffer
replaces its mark, as the queue's end event reaches the later value only after
the earlier, and marks reached go at the queue's next mark, at each wait, and
for a queue gone at the sweep of its end event. A device recovery clears them.
A test fills one queue past that bound with three reads and shows the decode
waiting through the first two reads' ends for the third's.

Counted on the caches' summary line: the waits that found an end not reached,
the longest, and the other queues' uses found in flight then. Tests: the seed's
red test, a decode waiting for another queue's read it does not name, the bound,
and an encode held by a writer of its source and not by a reader.

What the guest sees: a decoded picture is no longer written under its own
queue's earlier reads of it. The residual, an output in the pages and no device
cache, which keeps no marks, is in docs/known-issues.md. Whether this fixes the
green frames the guest's screen recording was reported to make is not known: no
red recording has turned clean with it.
2026-12-02 07:18:16 -08:00
Anees Iqbal 2525fc4ac2 🐛 Charge a kept decoder by its pool's format and its own measured bytes
An idle epoch's 64 MiB bound charged each kept context 16 bytes a coded pixel
for each pool surface, twice Y412's eight and over ten times NV12's 1.5, so
no 4K decoder was ever kept (one surface's charge, 127 MiB, is past the
bound) and a 1080p one only with two surfaces. A kept context is now charged
its pool's surfaces at their format's bits a pixel, and its own allocations
at the 34,905,201 bytes DXGI's local count grew by for each 4K H.264 context
kept on the UHD 630 (m3-max-61642, in vaapi.md), scaled by its coded pixels.
A one-picture 4K session (context and two NV12 surfaces, 59.8 MB) is kept;
the bounds stay 16 contexts and 64 MiB.

The display counts the contexts taken back, and the cache's end logs the
count. The cache's hardware tests decode our own stream (target_check's
H.264, its level now sized to its picture, 240x144 still at level 3) instead
of an MP4 an environment variable named, and a measurement times one-picture
sessions at 720p, 1080p and 2160p with and without a cache. The lifecycle's
items, the idle bounds and the lock order are documented, the call thread's
taking the lifecycle gate inside the display's gate among them.
2026-12-02 06:47:28 -08:00
evanlau1798 c0d05f86f3 fix: retain bounded VA-API decoders between Windows sessions
Keep compatible idle decoder contexts under a device-owned epoch with entry and pixel-charge bounds. Serialize creation reservations with teardown dispatch, roll back failed creation, and drain retained resources when the final owner ends. Cover reuse, failure ordering, late frames and terminal cleanup.

(cherry picked from commit 2cb0352a4a)
2026-12-02 06:40:48 -08:00
Anees Iqbal 085a511242 🆕 Count a session's pictures whose cache copy was not made
A picture whose copy into its output's device caches the platform did not
make (no blit encoder for it, or a staging copy it refused) fails to land,
counted among a session's failures since the two commits before. It is now
also counted apart, as its own class: the session's end line says how many of
its failed pictures were such, so a report tells that class from a driver's
failure without a pixel read. The landing sets the class as its copy fails
(Stage's unmade, taken at each landing's failure) and the session counts it.

The two tests of those failures check the count:
a_copy_into_caches_the_platform_makes_no_blit_encoder_for_fails_the_landing and
a_staging_copy_into_caches_the_platform_refuses_fails_the_landing (job
m3-max-77893 at this content).
2026-12-02 06:09:59 -08:00
Anees Iqbal c86344623c 🐛 Fail a picture's landing where the platform refuses its copy
What the guest observes changes. Before, a staging copy of a picture into its
output's device caches that the platform refused recorded nothing and the
picture still counted as landed: metal2vulkan-runtime counts such a refusal
under rt-refused-<kind> and goes on, and the host's landing could not tell, so a
reader was handed the caches' earlier bytes, a new output's zeros, as the
picture. Now the copy answers an error, as a copy with no blit encoder does
since the commit before: its command buffer goes uncommitted, the picture fails
to land (its command buffer completes failed) and counts as a failure; an
encode's copy of its source out of the caches fails the frame. Its warn line
names itself a staging copy, so a log tells it from a guest blit's.

To tell, the platform's blit encoder answers whether it recorded each command:
BlitEncoder::encode returns Encoded, a type of its own in
core::platform::encoded, named for no encoder so another encoder's commands can
answer it later. The rt platform answers refused where it stopped the command
(Metal's refusal, an unbuilt piece, rt's own), the fake where its script answers
nil for it. Every caller takes the answer: Encoded is #[must_use] and the
workspace now denies unused_must_use, so an ignored one does not compile. The
guest's own blits and every other host copy keep today's behaviour exactly,
saying so with go_on(): a refused command is counted where it stopped and the
work goes on.

Red first: a_staging_copy_into_caches_the_platform_refuses_fails_the_landing
failed on the tree before (job m3-max-77886: the picture counted as landed) and
passes with this, with every video_host and graphics::decode test but the
own-queue seed test, red until its fix (job m3-max-77893, the last at this
content but for rustfmt).
2026-12-02 06:09:59 -08:00
Anees Iqbal cb9898918b 🐛 Fail a picture's landing where its cache copy has no encoder
What the guest observes changes. Before, where the host's video landing found
no blit encoder for its copy of a picture's staged planes into the output's
device caches, the copy was skipped and the picture counted as landed: its
value was signalled and the command buffer waiting for it completed as for any
landed picture, so a reader was handed the caches' earlier bytes, a new
output's zeros, as the picture, with no error to the guest. 7ca9d53fa4 made
that skip; this puts back the failure it replaced.

Now the copy answers an error, as an encode's copy out of the caches already
does: the landing fails through the path of any picture that did not land.
The planes owed zeros are cleared, the command buffer that waits for the
picture completes failed (Metal's internal error, which the guest's video
driver answers as a decode error), and it counts as a failure to land. The
warn line now says the picture does not land; the library's logger keeps it to
the process's first, the rest at debug, counted, as the docs say.

On metal2vulkan-runtime the case is not reached today: it refuses a blit
encoder only on a committed command buffer or one with another encoder open,
and this one is made the line before. The test changes with the behaviour:
a_copy_into_caches_the_platform_makes_no_blit_encoder_for_fails_the_landing
replaces ..._is_skipped.
2026-12-02 06:09:59 -08:00
Anees Iqbal a7d2230a33 📝 Record an x86-64 guest's video with no paravirtual service [ci skip]
The control boot of the host that lists an x86-64 guest no paravirtual
decoder: x86-64 macOS 26.7.2 on a Radeon 780M lists AppleGVA's H.264 and
HEVC decoders and encoders again, decodes and encodes both on the host and
decodes HEIC's tiles there, and has no AV1 or VP9 decoder (m3-max-77840).
2026-12-02 02:46:27 -08:00
Anees Iqbal 42ba8b4ed8 📝 Say why an x86-64 guest gets no paravirtual video
The docs said x86-64 macOS 26 takes AV1 and VP9 from the host through
VideoToolbox's paravirtual path. The host now lists an x86-64 guest no
paravirtual decoder or encoder, and the docs say what the boots with the
service published measured: H.264 and HEVC sessions taken off AppleGVA,
AppleGVA's H.264 decoder and encoder gone with AV1 and VP9 alone listed,
and every paravirtual session failing -19092.

The run under WHPX that the service was offered on is cited as the
contribution's, not measured here. Safari's sandbox rule for the service
is described rather than quoted, and the docs say that reims-ctl's VMs
hide the VM from kern.hv_vmm_present, so Safari there would be denied the
service until reims-util#4. The user-facing known issue says what an Intel
Mac guest gets for VP9 and AV1.
2026-12-02 02:46:27 -08:00
Anees Iqbal 2d2a277048 📝 Say which guests' VideoToolbox runs the paravirtual sessions
The paravirt module's row in the video docs and the VideoToolbox backend's
module doc named an arm64 guest alone. An x86-64 guest's VideoToolbox runs
them too, for AV1 and VP9 decodes alone, as the host lists it.
2026-12-02 02:46:27 -08:00
Rudraksh Chatterjee 6e6323d40f 🆕 Serve VideoToolbox's paravirtual decoders to x86-64 guests
x86-64 macOS 26's VideoToolbox carries the same paravirtual support as arm64's
(VideoToolboxParavirtualizationSupport, which looks for AppleVideoToolboxParavirtualizationDriver),
so the x86-64 kext now publishes the VideoToolbox service the arm64e kext does: it carries
VT_MESSAGES and VT_RING, RgfxVtService is in both kexts' link, and a VT_MESSAGE's VT_STATUS
answers its waiter on both (before, every send of the x86-64 kext answered
kIOReturnUnsupported). The host needs no change: it offers VT_MESSAGES wherever its arm lists a
decoder.

Measured on x86-64 macOS 26.7.1 (iMac20,1) under WHPX, Intel Core Ultra 5 225H, vaon12:
VTIsHardwareDecodeSupported answers true for avc1, hvc1 and av01, and Safari plays YouTube's
1920x1080 AV1 on the host's GPU where it decoded VP9 in software. The features and lifecycle
answers tests follow both kexts; docs/video/devices.md and docs/known-issues.md say what an
x86-64 guest now gets, and what Safari's sandbox asks of it.

(cherry picked from commit 0a3aa3ada2)
2026-12-02 01:46:11 -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 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 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 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 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 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 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 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 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 2134eafd44 📝 Say the video crate's VA-API module builds on Windows too [ci skip]
The module table in docs/video/backends.md labelled vaapi as Linux only.
lib.rs builds it on Linux and Windows (cfg(any(target_os = "linux",
windows))), where its pool surfaces are Direct3D 12 textures, as vaapi.md
says.
2026-11-27 01:30:10 -08:00
Anees Iqbal 8e6e84b53e 📝 Word the NT-handle open's charge by what moved with it [ci skip]
Say the measure, not the absolute: the charge an open of a texture's NT
handle on its own device adds to the GPU Process Memory counters never
comes down, even past the device's last release, and available physical
memory, the commit charge and DXGI's usage did not move with it (over 1440
MiB of charge, the lab's UHD 630 and WARP, potluck job m3-max-75692). The
lesson turns over: such a figure is not a leak until one of those moves
with it, which the first job reads. d3d11_surface.rs keeps its own figures
for rt's import, and gains only what was measured on the open.
2026-11-26 16:15:47 -08:00
Anees Iqbal 5a8ed0eb05 🐛 Hand pool textures to vaon12 and the draws as resources
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.
2026-11-26 16:00:53 -08:00
Anees Iqbal 4c07913bc7 📝 Say a Windows host encodes the guest's video in software on every GPU [ci skip]
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.
2026-11-26 13:18:48 -08:00
Anees Iqbal d2c27d16be 🐛 Land the H.264 pictures after one that does not decode
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.
2026-11-25 19:14:48 -08:00
Anees Iqbal d3fa8fe257 🐛 Give a texture over a drawn plane in another format its own shape
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.
2026-11-23 21:41:42 -08:00
Anees Iqbal c27625e28c 📝 Record iHD's XYUV answer and the 4:4:4 route's cost [ci skip]
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.
2026-11-23 10:29:53 -08:00
Anees Iqbal 3d5ff13d0a 📝 Say how VA-API's 4:4:4 pictures reach the guest [ci skip]
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.
2026-11-23 09:50:52 -08:00
Anees Iqbal 3d53248877 🐎 Write NVDEC's 4:4:4 pictures into their surfaces on the GPU
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.
2026-11-22 23:13:08 -08:00
Anees Iqbal fa1636f312 🆕 Decode HEVC 4:4:4 at 8 bits on VA-API where the driver lists it
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.
2026-11-22 23:13:08 -08:00
Anees Iqbal e38755158d 🆕 Decode HEVC 4:4:4 at 8 bits on NVDEC
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.
2026-11-22 23:13:08 -08:00
Anees Iqbal bb22b845a7 📝 Record the copier at rows that end inside a word [ci skip]
The ignored VA test now copies every picture of the 1366x768, 854x480,
642x362 and 426x240 streams on the RX 550 and the 780M, equal to the CPU's
copy, where the copier before this branch declined them. Cold boots playing
such clips show the pictures land by the hardware in their caches' exported
surfaces on both GPUs, so no walk on these cards reaches the copier.
2026-11-22 21:25:18 -08:00
Anees Iqbal f5ac226627 🐎 Copy on the GPU a picture whose rows end inside a word
The GPU's copier declined a picture whose planes' rows are not whole 32-bit
words, an NV12 picture 1366, 854, 642 or 426 wide, its rows 2 bytes past a
word, and those pictures took the CPU's copy: the frame read back, copied
into staging and blitted row by row. On an RX 550, whose radeonsi imports
no CoreVideo layout in place, that is every picture of such a stream.

The copier now hands the kernel each plane with no margin (unit 0): a row's
last word takes the row's bytes and keeps the cache's others, by an atomic
AND and OR, so the cache holds the bytes the CPU's copy writes, as before.
It still declines a plane whose first byte or pitch is off a word, and now
a plane whose last row's last word would end past its buffer. Rows of whole
words, 1080p's among them, copy as they did.
2026-11-22 21:09:09 -08:00
Anees Iqbal a19cbf4fdd 🐛 Acquire a stalled landing's caches once its kept work is let go
A picture whose landing in its output's device caches ran past the
hardware's deadline (a stall) was signalled with the caches never acquired:
the backend kept the work, which may still write them, and the device's
reads of the caches came after the signal with no acquire of what the
hardware wrote, then or later. The guest's next command buffer read them
regardless.

Each arm now takes a mark on the landing's thread before the hardware call
that may stall (VA-API's sync of a decode into a cache, and its video
processing's write into one; NVDEC's copies into CUDA's imports of the
caches), and a stalled landing (Landing::failed_in_caches) waits for the
work its thread kept since the mark to be let go, the device done with it,
then acquires the caches and signals the failure. The VA-API arm drops the
frame first, which keeps its target where its pool stalled. The wait is
bounded: STALL_HOLD, 10 s on the session's clock, past the hardware's own
5 s; past it the process dies at a fault of the decode, since the caches can
be neither read before their acquire nor waited for unbounded.

For the guest: a stalled decode's command buffer completes failed, as before,
once the hardware is done with the caches rather than at once, with the
caches acquired, so its reads and the next picture's see what the hardware
left; a hardware that is not done 15 s after the frame's first wait ends the
process. A stall that kept nothing (a decoder stalled on an earlier frame,
which writes nothing more) is acquired at once. Tests:
a_failed_landing_in_a_cache_says_it_written_before_its_signal (its stall now
acquired before the signal),
a_stalled_landing_in_a_cache_says_it_written_once_its_kept_work_is_let_go,
a_stalled_landing_whose_kept_work_is_not_let_go_ends_the_process.
2026-11-22 02:01:32 -08:00
Anees Iqbal b65568bf02 🐛 Acquire a video cache a failed landing wrote before its signal
Since rt copies a texture over an exported block in only at a change of the
block's bytes (the pin's bef2ec1df4), a cache's acquire (external_write_done)
is the one change a write by the host's video makes. A picture that failed
to land in its cache returned before the acquire, so the device kept reading
the cache's bytes from before the hardware's write. The paths: VA-API's
frame.sync() error for a picture decoded into its cache, and the video
processing's write_in_place error into a cache; NVDEC's write_into_device
outer error.

Each now ends through video_host::failed_in_caches, which says the planes
written as the landing would have, then fails with the landing's own error,
so it is logged and counted as any failure and its signal follows the
acquire. Where the error is a stall, the work may still write past its
deadline, so no acquire is said. A refused acquire is logged. A test pins
the pattern: a stopped failure acquires once before its value is signalled,
a stalled one acquires nothing, and both count as failed with their command
buffers completing failed.

The session's end line also counted a picture that the VA-API arm's GPU
copier landed from its scratch as "in a device cache, by the hardware". It
now counts it as "staged by the hardware and copied" (Landing::copied_by_gpu,
Way::Staged), with a test.

What the guest observes changes only where a landing fails: its texture reads
what the hardware left in the cache, as it would on a Mac, rather than the
cache's last picture. The rest is diagnostics.
2026-11-22 02:01:31 -08:00
Anees Iqbal 2c65a71fcb 🐎 Fill no video planes at their make; their first decode takes it
A video cache's planes took their fill at their make: a clear of each on the
transfer queue, which the first decode op into each new surface then waited
for on its thread before the hardware could write. A macOS guest's walk of
1080p H.264 and HEVC and 4K 10-bit HEVC measured that wait at every new 4K
10-bit surface's first op on a Radeon 780M over VA-API, 14 of 14, 1.9 ms at
the median and 2.6 ms at most (26.1 ms in all), and on 12 of 14 on an RTX
3090 over NVDEC (0.23 ms, 0.32 ms at most); 4 of 21 and 7 of 28 of the 1080p
surfaces' first ops waited, up to 0.9 ms.

The planes now owe their fill as any new shape does. A decode that takes a
new cache's first fill as met takes the planes' fills as met too, on every
host (on Windows it did already), so its begin fills nothing and its op
waits for no fill. The guest reads the same zeros wherever no picture
lands:
- a picture short of the planes has the host's video zero the rest
  (the commit before this one);
- a picture that fails to land in planes whose fill its decode took has
  them cleared whole by the session, on its queue, before its value is
  signalled (SurfaceTarget::zeros);
- a decode op that fails, at any step after its command buffer's begin,
  makes the cache's fill from its pages, as one that answers no picture
  does (Caches::decode_failed);
- planes that a video command buffer landed no picture in owe a fill from
  the buffer, which a use makes by clearing them where the buffer holds no
  memory, from the surface's own clear passes, rather than making the
  buffer's memory to copy its zeros: SurfaceCaches::fill_shapes now clears
  wherever the fill at the planes' make did.

What changes for the guest: a decode's first picture into a new surface
starts without that wait. A picture that fails to land in a new surface
now leaves its planes all zeros, where the hardware's partial write over
the make's zeros showed before. The counts line names the plane fills a
decode took ("taken as met by a decode over zeros"); its "filled at their
make" and "owing theirs past their make" counts are gone.

Tests: the tests that held the fill at the make now hold the planes owing
it and the decode taking it, with no wait (surface_shapes); new tests hold
the clears of planes no picture landed in, and a failed landing's clears
(video_host).
2026-11-22 00:39:13 -08:00