kernel: register H.264 DECODE_MODE + START_CODE menu controls #4
Reference in New Issue
Block a user
Delete Branch "noether/kernel-h264-menu-ctrls"
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?
Symptom
With firefox-fourier playing H.264 YouTube through the daedalus daemon path, every Firefox process logs (once per context init):
Cause
libva-v4l2-request-fourier sets two H.264 device-wide controls in
src/context.c:577–589at context init time, before any per-request controls are bound:V4L2_CID_STATELESS_H264_DECODE_MODE = FRAME_BASEDV4L2_CID_STATELESS_H264_START_CODE = ANNEX_BThe call is
v4l2_set_controls(video_fd, -1, dev_ctrls, 2), cast to(void)— libva treats failures as best-effort and continues. But ourdaedalus_stateless_ctrls[]registers SPS/PPS/SCALING_MATRIX/PRED_WEIGHTS/SLICE_PARAMS/DECODE_PARAMS only — not these two menu controls. v4l2-core'sS_EXT_CTRLSvalidate step then returns EINVAL for both, producing the noisy warning.No functional impact: the daemon already operates as FRAME_BASED + ANNEX_B (it consumes a full frame per
REQ_DECODEand the H.264 SPS/PPS synthesiser prepends Annex-B-delimited NAL units), and the per-request SPS/PPS/SCALING_MATRIX/DECODE_PARAMS batch lands fine — Firefox playback through the daedalus path on Pi CM5 succeeds despite the warning.Change
Register both as
v4l2_ctrl_new_std_menuwith the single value each the daemon actually accepts; mask out the unsupported alternate (SLICE_BASED, NONE). This matches the rkvdec / hantro pattern. Capacity hint onv4l2_ctrl_handler_initbumped toARRAY_SIZE(daedalus_stateless_ctrls) + 2.Verification
6.18.29+rpt-rpi-2712on higgs (Pi CM5).daedalus_device_runis unchanged).daedalus-v4l2-dkmsbump).Closes the cosmetic gap surfaced during 2026-05-21 Pi CM5 verification (Phase 8.10 chain alive end-to-end after DKMS rebuild).
libva-v4l2-request sets V4L2_CID_STATELESS_H264_DECODE_MODE and V4L2_CID_STATELESS_H264_START_CODE on the device fd at context init (see libva-v4l2-request-fourier src/context.c:577 — best-effort call, result is (void)cast). Our ctrl_handler did not advertise either control, so v4l2-core returned EINVAL on validate; userspace logged the noisy v4l2-request: Unable to set control(s): Invalid argument (error_idx=2/2 ioctl-level) at every Firefox/ffmpeg context creation, despite decode itself succeeding (the daemon already operates as FRAME_BASED + ANNEX_B and the per-request SPS/PPS/SCALING_MATRIX/DECODE_PARAMS batch lands fine). Register the two as v4l2_ctrl_new_std_menu with the only value each the daemon actually supports — FRAME_BASED for DECODE_MODE, ANNEX_B for START_CODE — and mask out the unsupported alternates (SLICE_BASED, NONE). Pattern matches rkvdec / hantro. Update the handler-init capacity hint to ARRAY_SIZE(daedalus_stateless_ctrls) + 2 to cover the additions. Verified: builds clean on 6.18.29+rpt-rpi-2712 (Pi CM5) DKMS source tree.