kernel: bind request controls to p_cur via v4l2_ctrl_request_setup #2
Reference in New Issue
Block a user
Delete Branch "noether/kernel-ctrl-request-setup"
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?
The other half of issue libva-v4l2-request-fourier#8 — actually fixes H.264 decode end-to-end on higgs
Bug
device_run was reading
ctrl->p_cur.p_h264_*directly to populatestruct daedalus_h264_metafor the wire protocol. But v4l2-m2m's request scheduler does NOT auto-bind the in-flight media_request's control values to p_cur — drivers have to callv4l2_ctrl_request_setup()explicitly. cedrus / rkvdec / hantro all do this from their device_run; daedalus didn't.Result:
daedalus_collect_h264_meta()read stale or default values (whatever the prior request had left, orv4l2_ctrl_new_custominitial state if no prior request had completed) instead of theS_EXT_CTRLS V4L2_CTRL_WHICH_REQUEST_VALvalues libva-v4l2-request-fourier had just set for THIS frame.Evidence
libva PR #9 / marfrit-packages PR #52 landed an instrumentation log line at
h264_set_controlsentry on higgs. Smoking gun side-by-side:Libva sent num_ref_frames=1, ctrl handler returned 0. Libva sent rich pic_fields, ctrl handler returned all-zero flags. That's the missing setup.
Fix
One new call in
daedalus_device_run, right aftervb2_plane_vaddrand beforedaedalus_collect_h264_meta:Pairs with the
v4l2_ctrl_request_completecall already present indaedalus_complete_resp_frame(the completion-path half).After-fix on higgs (Pi CM5, kernel 6.18.29+rpt-rpi-2712)
Daemon journal, same test stream as before (libx264 baseline 320x240 testsrc):
error while decoding MBlines.reference frames exceeds maxlines.Daemon-side change
Small log-level promotion: the per-frame
h264 SPS/PPS prepended ...trace went fromlog_debugtolog_infoso the journal shows what's being shipped into libavcodec without needing a daemon rebuild with --debug. Matches the libva-side h264_set_controls instrumentation already in libva PR #9.Scope of remaining issue #8 work
Profile_idc / level_idc still come from libva's session-derived hardcoded values (
h264_profile_to_idc+h264_derive_level_idc). For this test stream they happen to match (Constrained Baseline session profile → profile_idc=66 matching the bitstream). In general, a stream-accurate profile/level would need SPS-NAL parsing in libva — separate operator-design call, deferred per the libva PR #9 description.Generated with Claude Code