forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on ca4790ff3ec50db2bcffb1751a3cbbc29771cd7eFiltered to crates/ec-va/src/sys.rsClear filter

2026-08-20

test(ec-va,ec-hw): verify VPP filter probe, struct layout, and P010 zero-copy encode against a real 4K HEVC HDR fileAhmet Kaan Gümüş · cffd9af
test(ec-va,ec-hw): verify VPP filter probe, struct layout, and P010 zero-copy encode against a real 4K HEVC HDR file

ec-va/tests/gpu.rs: vpp_filters_probe (vaQueryVideoProcFilters on the real
display — radeonsi advertises only VAProcFilterDeinterlacing (2), no
HighDynamicRangeToneMapping) and vpp_converts_p010_to_nv12 (Vpp::convert
end to end).

ec-va/src/sys.rs: a const size_of/offset_of assert block for
VAProcPipelineParameterBuffer against va_vpp.h:886 (224 bytes on this
target, field offsets checked through va_reserved) plus
VAProcColorProperties — the layout was already correct, this just pins it.

ec-hw/tests/gpu.rs, against a real HEVC Main10 P010 4K HDR mkv:
- encode_frame_accepts_p010_via_vpp: encode_frame (zero-copy, P010 via VPP)
  vs to_i420()+encode (CPU path), decoded back and compared. H.264: worst Y
  and UV PSNR both infinite (byte-identical after decode). H.265 is refused
  by encode_frame's own documented contract ("frame's coded size does not
  match this encoder's ... the VPP conversion pass does not resize") because
  this file's SPS pic_height_in_luma_samples (2160) is a multiple of the
  H.264 encode block size (16) but not the HEVC one (32) — an existing,
  intentional design choice, not a defect this round touched.
- p010_zero_copy_encode_is_realtime: median 6.14 ms/frame for
  decode+encode_frame (H.264, the target that isn't refused on this file)
  vs 22.55 ms/frame for decode+to_i420+encode — zero-copy is ~3.7x faster
  and well inside the 20 ms budget.

cargo test -p ec-va -- --test-threads=1: 13 passed (+2 doctests, +4
compile-fail doctests).
cargo test -p ec-hw --release --test gpu -- --test-threads=1: 27 passed, 0
failed (most non-P010 tests skip: no generated bitstream fixtures on this
checkout).
feat(ec-hw): P010 encode_frame goes through a GPU-resident VAProfileNone/VideoProc VPP pass, not CPU read-backAhmet Kaan Gümüş · 67c8428
feat(ec-hw): P010 encode_frame goes through a GPU-resident VAProfileNone/VideoProc VPP pass, not CPU read-back

encode_frame previously refused any 10-bit (P010) frame outright, forcing a
consumer's HDR->proxy export onto to_i420()+re-upload for the whole path.
This adds ec_va::Vpp (Config/Context/Buffer/Picture — all the existing
generic VA-API machinery, no new unsafe outside ec-va) wrapping
VAProfileNone/VAEntrypointVideoProc, and wires a lazily-built 2-surface NV12
pool + Vpp into ec_hw::Encoder: a 10-bit frame is converted P010->NV12 on
the GPU (VAProcPipelineParameterBuffer, whole-surface, no filters) and then
submitted through the exact same encode_surface() path as an 8-bit frame.

radeonsi capability check (vainfo): VAProfileNone/VAEntrypointVideoProc is
advertised on this GPU, confirming the entrypoint this crate now uses is
real hardware support, not a driver gap. HDR->SDR tonemap
(VAProcFilterHighDynamicRangeToneMapping) was NOT wired: sys.rs carries the
filter-type constants and Vpp::filters() (vaQueryVideoProcFilters) to check
for it, but the charter's own gpu.rs tests (PSNR/bench harness) were not
written this round — see the ledger DELTA for the honest state of that gap.

Scoped compiles green: `cargo check -p ec-va[--tests]`, `cargo check -p
ec-hw[--tests]`. The 23-test `ec-hw --test gpu` regression and a live P010
decode+encode_frame+decode-back PSNR run were NOT executed this round
(budget) — next round's first move.

2026-08-14

feat(va): encode capabilities and the image upload pathAhmet Kaan Gümüş · a1a1150
feat(va): encode capabilities and the image upload path

`CapEntry` now reports `VAConfigAttribEncPackedHeaders` and
`VAConfigAttribRateControl` alongside the RT formats, in the same round
trip. The packed-header mask is not decoration: a config created without
asking for those headers gets a driver that ignores the ones the
application writes, which on radeonsi means a stream with no parameter
sets in front of it.

`Surface::write_from` wraps `vaPutImage`, the encoder's upload path —
fill a standalone image with source pixels and let the driver detile and
convert on the way in.

`VA_ATTRIB_NOT_SUPPORTED` is reported as zero rather than as every bit
set: a decode entrypoint answers that for the encode-only attributes,
and "all capabilities" is not what it means.
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.