AppleGVA's H.264 encoder now reaches the host's VA-API or NVENC encoder
through our video driver, the AMD vendor route it already drives for decode.
What the guest sees, where the host's caps list an H.264 encoder with a rate
control: the accelerator publishes IOGVAH264EncodeCapabilities (VTRating 350,
VTQualityRating 50, an AMD Mac's), the driver lists encode function 0x20,
sub-ID 0x800 (NV12 in, bitstream out), and VideoToolbox lists
com.apple.videotoolbox.videoencoder.h264.gva as hardware. A session that
requires hardware is made at 720p, 1080p and 2160p, and its frames are
encoded on the host: the driver sends each as an ENCODE_H264 op over the
source surface's planes, and puts the access unit in AppleGVA's bitstream
ring with its end cursor and length in bits. AppleGVA's own SPS, PPS, NAL
header and per-frame QP set the stream; the parameter sets in the format
description are the host encoder's.
HEVC encode stays unlisted, also on a host that encodes HEVC: no hevc.gva,
and a session that requires hardware fails -12908, as on a Mac without an
HEVC encoder. A host with no encoder, or one listed with no rate control,
publishes and lists nothing for encode, as before. An arm64 guest's arm64e kext
publishes no encode ratings on any host, as it names no video driver there
(kRgfxGuestVideoDriver), so an arm64 guest still lists no hardware encoder.
The driver's checks gain the encode listing (in a process of its own, since the
block is filled once a process), context creates, the pixel pools and frames
through the ring; the kext's gain rgfxH264Encode, in both architectures' rules.