Repository navigation
v0.0.3
Fixed
- correct VA-API test assumptions (surface-id sentinel + VAProfileNone)
Other
- refresh to current status, drop per-round changelog cruft
- round 10: codec_id_for_profile — reverse lookup over the family table
- round 9: drop unused EntrypointMatrix import in test
- round 9: EntrypointMatrix — one-shot (profile, [entrypoints]) snapshot
- lift codec id → VAProfile family map into public module
Added — Round 10 (reverse lookup: codec_id_for_profile)
Complements the round-8 forward map (codec_profiles(id) -> &[i32])
with the reverse direction: given a raw VAProfile value (or a typed
[VaProfile]), return the codec id of the family it belongs to.
This is the primitive callers need when iterating an
[EntrypointMatrix]'s advertised profile list and bucketing each
profile by codec — e.g. building a (codec, [profile]) index for the
HEVC / VP9 / AV1 adapters planned in the README roadmap. Without it,
each row has to re-scan KNOWN_CODECS by hand; the helper lifts the
scan into the table module so callers stay single-line.
- New
profiles::codec_id_for_profile(raw: i32) -> Option<&'static str>
— O(KNOWN_CODECS · max_family_len) scan; returns the codec id of
the row that containsraw, orNonefor unmapped values
(VAProfileNone, future/vendor-specific values). - New
profiles::codec_id_for_va_profile(VaProfile) -> Option<&'static str>
— typed wrapper around the raw variant; same semantics, drops a
.raw()at the call site. - Both helpers re-exported at the crate root.
- 6 new unit tests in
src/profiles.rscovering: H.264 / HEVC / VP9
/ AV1 family resolution,NoneforVAProfileNoneand out-of-range
values, typed-vs-raw parity across every table entry, and the
forward-reverse round-trip (every profile in the table maps back to
a codec id whosecodec_profilesslice contains it). - New
tests/round10_codec_id_lookup.rs(6 tests, skip-friendly on
hosts with no render node):reverse_lookup_covers_every_table_entry— pure table sweep.reverse_lookup_returns_none_for_va_profile_none/
_for_unknown_value— sentinel + range guards.typed_and_raw_variants_agree_for_every_table_entry.matrix_advertised_profiles_bucket_by_codec_without_panic/
matrix_codec_id_lookup_matches_table_for_recognised_profiles
— driver-touching parity checks against a real
EntrypointMatrix.reverse_lookup_zero_collision_across_families— guard against
two rows accidentally claiming the same profile.
Added — Round 9 (EntrypointMatrix — one-shot (profile, [entrypoints]) snapshot)
Lifts the (profile, entrypoint) membership check out of
vaQueryConfigEntrypoints FFI traffic and into an in-memory snapshot
that callers consult freely. The naive shape — repeatedly calling
Display::is_supported(profile, entrypoint) for each codec family
and each entrypoint we care about — issued one
vaQueryConfigEntrypoints per pair. On a 25-profile driver with
seven codec families this came out to roughly fifty round-trips per
engine_info() invocation. With the matrix it's roughly twenty-five
(one per advertised profile) plus zero per query.
- New
display::EntrypointMatrixtype — aVec<(VaProfile, Vec<i32>)>wrapped behind a small public API:profiles() -> impl Iterator<Item = VaProfile>— advertised
profile list matchingDisplay::profiles()exactly.len()/is_empty()— trivial accessors.entrypoints_for(profile) -> &[i32]— entrypoints advertised for
a single profile; empty slice if the profile isn't in the matrix.is_supported(profile, entrypoint) -> bool— O(rows) membership
check, equivalent toDisplay::is_supportedbut no FFI.profiles_with_entrypoint(entrypoint) -> Vec<VaProfile>—
equivalent toDisplay::profiles_with_entrypoint, again FFI-free.any_supports(&[i32], entrypoint) -> bool— "any profile in this
list advertises this entrypoint" — the codec-family check shared
betweenengine::collect_codecsandprofiles::host_supports_codec_decode.
- New
Display::entrypoint_matrix() -> Result<EntrypointMatrix, VaError>
— single-call constructor that issuesvaQueryConfigProfilesonce,
thenvaQueryConfigEntrypointsonce per advertised profile. engine::probe_nodenow builds the matrix once per device and
threads it throughcollect_codecs+max_dims_across. Both
functions drop theirDisplay::is_supportedcalls in favour of
matrix lookups;max_dims_acrosskeeps itsvaGetConfigAttributes
calls because those answer a different question (per-pair max
dimensions, not "is the pair advertised").profiles::host_supports_codec_decodebuilds and consults the
matrix internally — saves N-1 FFI calls on multi-profile families
(h264 = 4, hevc = 6). Newprofiles::host_entrypoint_matrix() -> Option<EntrypointMatrix>factors out the "open/dev/dri/renderD128- build matrix" plumbing; new
profiles::codec_decode_supported
andprofiles::codec_encode_supportedtake a&EntrypointMatrix - codec id so multi-codec pre-flights share one matrix.
- build matrix" plumbing; new
- New
tests/round9_entrypoint_matrix.rs(9 tests, skip-friendly on
hosts with no render node):- Round-trip checks: matrix
profiles()==Display::profiles()
and matrixis_supported(VLD)==Display::is_supported(VLD)
for every advertised profile. - Bulk-filter parity: matrix
profiles_with_entrypoint(VLD)==
Display::profiles_with_entrypoint(VLD). - Negative paths:
any_supportsover a bogus profile list returns
false,entrypoints_foron an unadvertised profile returns an
empty slice,codec_*_supportedover an unknown codec id returns
false without touching the matrix. - Convergence:
codec_decode_supported(&matrix, "h264")agrees with
host_supports_codec_decode("h264")— the two spellings of the
same question. - Skip-friendly contract:
host_entrypoint_matrixreturnsNone
on no-render-node hosts without panicking.
- Round-trip checks: matrix
Added — Round 8 (codec-id → VA-API profile family map, shared by engine.rs + register())
Lifts the private CODEC_FAMILIES table that used to live inside
engine.rs into a public profiles module so codec adapters (today
just H.264, tomorrow HEVC and VP9) can consult one source of truth
for "which VAProfile values does codec id X refer to?".
- New
pub mod profiles(always compiled — noregistrygate)
exposing:pub const KNOWN_CODECS: &[CodecFamily]— the codec id →
VAProfilefamily table. 8 entries:h264/hevc/av1/
vp8/vp9/mpeg2/vc1/jpeg. Ordering is ascending
capability — the last entry is the "headline" profile used for
vaGetConfigAttributes(MaxPictureWidth/Height)queries.pub fn codec_profiles(codec_id) -> Option<&'static [i32]>—
look up the family by id.pub fn headline_profile(codec_id) -> Option<VaProfile>— last
entry of the family list.pub fn host_supports_codec_decode(codec_id) -> bool— opens
/dev/dri/renderD128, checksVAEntrypointVLDagainst every
family profile, returnsfalsefor unknown ids / sandbox CI
hosts / drivers that don't accelerate the codec.
register()inlib.rsnow calls
host_supports_codec_decode("h264")instead of the private
host_supports_h264_decode()helper (which is removed). Same
semantics; any future codec adapter that needs the same
pre-flight gets the helper for free.engine.rs::collect_codecsconsumesKNOWN_CODECSdirectly —
the privateCodecFamilystruct + table are removed in favour
of the shared one inprofiles. Net delta inengine.rs:
−60 LOC.- New
tests/round8_codec_profiles.rs(6 tests) covers the codec
id round-trip (KNOWN_CODECS↔codec_profiles), the headline
profile choice for H.264 / HEVC, the unknown-codec fallback, the
skip-friendly no-libva path, and (crucially) that every codec id
surfaced byengine_info()is present inKNOWN_CODECS— i.e.
the refactor doesn't drift between the two consumers. - New
jpegrow inKNOWN_CODECS(one entry:
VAProfileJPEGBaseline) —engine_info()will now surface a
jpegHwCodecCapsblock on hosts where the driver advertises
the JPEG baseline profile (e.g. Intel iHD's MFX JPEG decoder).