Repository navigation
media: apple: avd: apply request controls the capture buffers fit - #1511
DjDeveloperr merged 1 commit into
Conversation
The video decoder fix that Chromium needs on the hardware decoder (kernel patch 0218) is open upstream as aurora-silicon/linux#1511. The J604 results on omacom/linux-aurora#432 have an update for 1.836. Signed-off-by: Dylan Ironside <[email protected]>
A stateless client that allocates CAPTURE buffers before its first request (Chromium's V4L2VideoDecoder does) never moved the picture format control off its default: the control framework skips a set to the current value, so s_ctrl did not run and ctx->image_fmt stayed ANY. The first request then carries the real picture format, which counts as a change; CAPTURE is busy, so s_ctrl returned -EBUSY and v4l2_ctrl_request_setup() failed. The driver ignored that result and decoded with the controls left over from probing (1x1), parameter validation failed, the context was marked broken and every later buffer came back with an error. Accept the format when the allocated CAPTURE buffers already suit it: the negotiated pixel format is the one for that picture format and the compressed reference area after the picture is laid out the same. Keep -EBUSY for a format the buffers cannot hold. Also stop decoding with stale controls: keep the request setup result in struct avd_run, log it, and fail the frame for H.264, HEVC, VP9 and AV1. The host tests build the codec code against their own struct avd_run; give the two that define one the new member. Signed-off-by: Dylan Ironside <[email protected]> Assisted-by: LLM
37d4235 to
2c3c31e
Compare
DjDeveloperr
left a comment
There was a problem hiding this comment.
Codex (GPT-6.1 Sol), reviewing on @DjDeveloperr’s behalf.
No blocking findings. Accepting a request's image format requires the negotiated fourcc and compressed-reference size/offset layout to match the allocated CAPTURE buffers; incompatible changes still return EBUSY. avd_run_preamble zero-initializes the base run, so setup_err is defined even without a request. The setup error propagates before codec submission for H264/HEVC/VP9/AV1, with existing cleanup paths retained, and the two copied host fixture structs were updated. Host CI is green; the reported J604 Chromium VP9/AV1 and bit-exact ffmpeg controls are substantive hardware evidence, with exact-base build/12 AV D host checks reported separately. This does not claim Chromium HEVC slice-parameter or H264-mode support.
c630323
into
aurora-silicon:integration/aurora
The video decoder fix (our kernel patch 0218) was merged into aurora-silicon/linux integration/aurora on 2026-11-11 at 15:25 UTC. The omarchy-mac Chromium item now links it as merged. Signed-off-by: Dylan Ironside <[email protected]>
Chromium's V4L2 stateless decoder (V4L2VideoDecoder) shows green frames on the AVD, while ffmpeg/libva on the same machine decode correctly. This fixes it.
What goes wrong
Chromium allocates its CAPTURE buffers before it queues its first request. At that point the driver's picture-format control (the one that sets
ctx->image_fmt) has only ever been set to its default. The control framework skips a set to the current value, sos_ctrlnever ran andctx->image_fmtstayedAVD_IMG_FMT_ANY.The first request then carries the real picture format, which the driver sees as a format change. CAPTURE is already allocated, so
s_ctrlreturns-EBUSYandv4l2_ctrl_request_setup()fails with-16. The driver ignored that result and decoded with the controls left over from probing (1x1). Parameter validation then failed, the context was marked broken, and every later buffer completed with an error. The user sees a green video.ffmpeg/libva are not affected because they set the controls before allocating CAPTURE.
What the patch does
s_ctrlaccepts a picture format when the CAPTURE buffers that are already allocated suit it: same pixel format for that picture format, and the same layout of the compressed reference area after the picture. A format the buffers cannot hold still returns-EBUSY.struct avd_run. A failed setup is logged and fails that frame for H.264, HEVC, VP9 and AV1, instead of decoding with stale controls.Tested
All on a MacBook Pro 14-inch M4 (J604, T8132), our kernel = integration/aurora 7.3 plus the J604 series:
-EINVALfrom parameter validation and a broken context.--enable-features=AcceleratedVideoDecoder:drivers/media/platform/apple/avdbuilds with W=1 and no warnings; the AVD host tests pass (tools/asahi/run-host-tests.py --only avd, 12 of 12); checkpatch --strict reports 0 errors, 0 warnings, 0 checks. The measurements above are from our tree, not from a kernel built from this exact base.host-tests:struct avd_rungains a member, and two host tests build the codec code against their own copy of that struct (tests/program-test.py,tools/asahi/avd-av1-tail-tests.py). The commit now adds the member to both.Not tested
-EBUSY, as before (by design).