Commits
Commits on
82ca712e6d5c42a165016ddb1ef4ad9aba4e2cd2Filtered to crates/ec-va/src/error.rsClear filter2026-08-14
feat(va): hand-written libva FFI with RAII handles and picture typestateAhmet Kaan Gümüş · 0eac457
feat(va): hand-written libva FFI with RAII handles and picture typestate Minimal VA-API bindings for the hardware-video lane, no bindgen and no build-time tooling. `sys` transcribes the libva 1.23 subset the family needs; everything above it is safe. - ABI: struct layouts asserted at compile time against numbers printed by abi-probe.c compiled against the system headers; `vaInitialize` version guard refuses libva older than 1.23 at runtime. Together these close the header-drift trap that broke the incumbent bindings at 1.23. - Soundness: C enums stay `i32` in `sys`; the safe `Profile`/`Entrypoint` mirrors carry an `Unknown(i32)` arm, so a value from a newer driver can never be transmuted into an invalid Rust enum. - RAII: Display/Config/Surface/Context/Buffer each destroy exactly what they created, and children hold an `Arc` of their parent, so libva's destruction order is a borrow-checker fact. Image and buffer mappings unmap on drop; PRIME exports own and close their descriptors. - Picture typestate: New -> Rendering -> Ended -> Synced, transitions consume the picture; out-of-order submission does not compile. - Caps probe reports per-pair RT formats plus driver-legal surface sizes (radeonsi refuses below 64x64) instead of assuming them. 55 unsafe blocks, every one SAFETY-commented. Tests run against the real GPU: 11 live tests (caps table vs vainfo, 100 pool create/destroy cycles under an RSS bound, PRIME fd ownership, derive/map/unmap round trip) plus 4 compile_fail doctests pinning the typestate on E0599.