iHD 26.3.5's HEVC encoder takes quality levels 1, 4 and 7 of the 7 its config
lists, and answers success for a render that carries another level with a packed
header after it, then codes at the refused level (read in its source:
media_ddi_encode_hevc.cpp's ParseMiscParams, RenderPicture and
EncodeInCodecHal). An arm64 guest's session at a Quality of 0.9, level 2, hung
the Iris Xe's render engine (boot m3-max-79085, bugs.md B102). The refused level
is the likely trigger, unconfirmed.
The VA crate now renders the quality level alone, first, where a picture sends
its misc buffers (IDR pictures and a rate control change), so the driver's
answer to it is its own. A refused level gives way to the nearest level the
driver takes, the better quality first at a tie, before the picture's other
buffers, and the session keeps the level taken. VA-API's text allows the form:
a picture's buffers go in as many renders as the caller makes, and va.h's own
misc parameter example renders one alone. The choice is the driver's answer
alone, with no driver name, version or card in it, and a driver that takes
every level sees the same buffers, the level in a render of its own.
For the guest: a session asks the same quality as before. Where the driver
refuses that level, the stream codes at the nearest level the driver takes
rather than at the refused one: on the Iris Xe's HEVC, 1 for 2, 4 for 3 and 5,
and 7 for 6. reims-vgpu counts such a session as
video-encode-quality-level-adjusted and logs it once a session. x86-64 guests'
encoder asks level 4, which iHD takes, so they see no change, nor does a session
on radeonsi, which takes every level. iHD's H.264 encoder copies the level into
the sequence as it parses the sequence buffer (read), so its first sequence now
takes the asked level too, where it took the context's earlier one. HEVC Main
4:2:2 10 stays held back (B102).
Ledger (bugs.md B102 and U37). Read from code: iHD's masked refusal, above, a
lead until the guest's 4:2:2 case encodes under the fix, which waits for the
owner's word. Run: a fake driver modelled on that read gives the refused level's
render a failure and the next choice is taken (red m3-max-79207 at the masked
path, green m3-max-79223 with rustfmt and clippy). No report on file names an
Intel host's HEVC encode at a level iHD refuses but boot m3-max-79085's: the
Intel rows on file (B98 to B101) are x86-64 guests', at level 4.
Run on hardware: on the Radeon 780M (radeonsi) the VA encode tests and the new
one, asked level 2 and taken 2, 52.0 to 54.9 dB luma (m3-max-79243,
m3-max-79256; m3-max-79318 with the commits after it). The RTX 3090's VA driver
lists no encoder, so no level reaches it (m3-max-79247), and NVENC takes no VA
buffer: its encode tests pass (m3-max-79251). On the Iris Xe (iHD 26.3.5), one
encode of the 4:2:0 HEVC Main test asked at level 2: taken 1, 52.5 to 53.2 dB
luma, and no GPU hang or reset in the kernel's log (m3-max-79388).