Skip to main content

Module vaapi

Module vaapi 

Source
Expand description

VA-API hardware sessions on a DRM render node, driven through libva directly. VA-API hardware sessions on a DRM render node for every video codec, driven through libva directly.

The session owns what a hardware encoder needs owned: the surfaces, the parameter buffers, and, for the codecs that take them, the packed headers, so it also owns each picture’s reference lists. A frame a client lost is left out of the predictions the way NVENC and libx264 allow (encoders/reference.rs): H.264 and HEVC keep the decoded picture buffer the level admits and name the newest surviving frame in the slice header, VP9 and AV1 address their eight buffer slots, and VP8 steers its three buffers. A driver that writes its own slice headers predicts from the previous frame alone, so such a session declares a one-frame buffer.

Pixels reach the codec on a VA surface – a Wayland dmabuf imported in place, or a packed host frame uploaded – and the video processor converts to the surface format on the GPU, so no colorspace conversion happens on the CPU. Chroma follows video_fullcolor where the codec carries 4:4:4 (HEVC, and VP9 as profile 1), and the sample depth video_bit_depth where the driver encodes the codec’s 10-bit profile (HEVC Main 10 and Main 4:4:4 10, VP9 profiles 2 and 3, AV1), a session staying at 8 bits where it does not. A 4:4:4 session tries the surface formats the driver allocates and its video processor renders, read through a VAProfileNone configuration, until one survives the surface pool, the convert, and the codec open. Every session converts with the BT.709 matrix the sRGB source’s own primaries and transfer belong to, at limited range, and declares it; VP8 is held to BT.601, the only matrix its bitstream can name. libva itself is loaded at run time, so the host’s copy serves the driver it was built for, and a test can put its own functions behind the same table.

Structs§

VaapiEncoder
One VA-API encoder session, hardware, for one capture.

Enums§

Input
How frames reach a session: a Wayland DRM-PRIME dmabuf, or packed host pixels in B,G,R,A (rgba: false) or R,G,B,A (rgba: true) byte order.