av1: populate V4L2_CID_STATELESS_AV1_SEQUENCE in codec_set_controls (#11 libva side) #12
Reference in New Issue
Block a user
Delete Branch "claude-noether/libva-v4l2-request-fourier:noether/av1-set-controls-bug-11"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements the libva-side portion of #11 — replaces #10's no-op AV1 dispatch with a real
av1_set_controlsthat populatesV4L2_CID_STATELESS_AV1_SEQUENCE(struct v4l2_ctrl_av1_sequence) fromVAPictureParameterBufferAV1.Why only the libva side here
Issue #11 spans three components — libva, daedalus-v4l2 kernel module, daedalus daemon. This PR is the libva side only (~150 LoC); the kernel module's
daedalus_collect_av1_meta+ the daemon's OBU sequence-header synthesiser are operator-track follow-ups, scoped at ~30 LoC and ~400 LoC respectively per the issue body. After this lands the libva backend queues a populated SEQUENCE ctrl viaS_EXT_CTRLS; the daemon track is the consumer that turns it into bytes libdav1d can parse.The hardware path (RK3588 vpu981) doesn't read the SEQUENCE ctrl either, so this is a no-cost no-op on that target — vpu981's driver parses the OBU stream directly.
Touch points
src/av1.{c,h}(new)av1_set_controls— VAAPI → V4L2 sequence ctrl mappingsrc/surface.hav1leaf insurface->params(picture only; slice params intentionally absent — daemon reads slice OBUs from OUTPUT directly)src/picture.cRenderPicture; replace #10's no-op incodec_set_controlswithav1_set_controls(...)src/meson.buildav1.c228 lines added across 5 files (90 LoC of which are header copyright + a long explanatory comment block in
av1.c).Sequence-field mapping coverage
12 of 18
V4L2_AV1_SEQUENCE_FLAG_*bits + the four scalars (seq_profile,order_hint_bits,bit_depth,max_frame_width/height_minus_1) all map 1:1 fromseq_info_fields.fields.*. Six bits don't have a sequence-level mirror in VAAPI (WARPED_MOTION,REF_FRAME_MVS,SUPERRES,RESTORATION,SEPARATE_UV_DELTA_Q,ENABLE_FILTER_INTRA's edge-cases) — same VAAPI-blindspot family as the HEVC SPS fields and the H.264 profile/level fields (see issue #8 triage). They stay clear in the SEQUENCE ctrl; per-frame consumers read them from the OBU_FRAME_HEADER that's already in the slice buffer. Daemon-side OBU synth (issue #11 daemon track) carries the SEQUENCE bytes verbatim, so libdav1d still sees the bitstream truth for the per-frame bits via the OBU_FRAME stream.Test plan
sizeof(struct v4l2_ctrl_av1_sequence) == 12).vainfoagainst patched .so enumeratesVAProfileAV1Profile0via the daedalus_v4l2 slot (video_fd=5 media_fd=6), all 8 codec profiles intact, no init regression.nmconfirmsav1_set_controlssymbol present.Reviewer questions
vp9.c's pattern (_Static_assert(sizeof(...) == 12, "...")). Keep, or do you prefer it gated on a debug build?bit_depthtranslation: VAAPI'sbit_depth_idx∈ {0, 1, 2} → V4L2 plain {8, 10, 12}. Helper returns 8 on out-of-range (spec-illegal) input — passes through rather than failing loudly so a reviewer / test can spot the bug. Acceptable, or want arequest_logwarn on the illegal case?