Skip to content

media: apple: avd: repair the VP9 host control fixture - #2972

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
fix/avd-vp9-host-control-copy
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
fix/avd-vp9-host-control-copy

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

The VP9 host fixture no longer builds after the decoder started copying request controls under the V4L2 control lock.

Change

Model the control lock and copy in the host fixture. Run the busy-bank check through the decoder's normal entry point so it also exercises cleanup.

Testing

The VP9 fixture passes under ASan and UBSan on integration/aurora and against the merged decoder in a4b51cd.

Host test details

The original fixture failed to compile against the merged decoder. The repaired fixture exercises the existing dependency, bank ownership, probability adaptation, early-release and legacy fallback cases. LeakSanitizer stays enabled and the busy-bank case returns EBUSY with no new bank assigned.

Assisted-by: LLM (Codex)

The VP9 decoder copies request controls under the V4L2 control lock.
Provide lock and allocation shims so the standalone host test builds.
Exercise the busy-bank check through avd_vp9_run() so it also checks
the production cleanup path under the sanitizers.

Signed-off-by: Ryan Murray <[email protected]>

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 4b0be5d. No blockers. The mock now requires the lock around the control copy, and the busy-bank case enters through avd_vp9_run(), which performs normal cleanup. I reran the exact fixture against the exact-head source with ASan and UBSan. Dependency, bank ownership, adaptation, early release and legacy fallback all passed. This repairs host coverage without changing the decoder.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR checklist audit at live head 4b0be5d855d1244f0438842caddbcfc4d54ee3f1.

Technical Audit (drivers/media/platform/apple/avd/tests/vp9-test.py)

  • Decoder contract match (avd-vp9.c): Matches avd_vp9_run_preamble() lines 859–866 (v4l2_ctrl_lock(ctrl) -> kmemdup() of hdr->p_cur.p and ctrl->p_cur.p -> v4l2_ctrl_unlock(ctrl)) and avd_vp9_run() lines 954–957 (kfree() of const run.decode_params and run.prob_updates).
  • Lock & memory shims: v4l2_ctrl_lock()/v4l2_ctrl_unlock() assert balanced single-lock discipline (assert(!locked_ctrl) / assert(locked_ctrl == ctrl)), and kmemdup() asserts assert(locked_ctrl) before copying exact size bytes into a malloc() buffer. #define kfree(p) free((void *)(p)) avoids -Wdiscarded-qualifiers under -Wall -Wextra -Werror on const pointers.
  • Busy-bank cleanup check: Switching the busy-bank case from direct avd_vp9_run_preamble(&ctx, &attempt) to avd_vp9_run(&ctx) exercises the production out: kfree() cleanup path on -EBUSY so LeakSanitizer stays clean while still asserting == -EBUSY and !dst[2].bank.
  • Non-blocking note: drivers/media/platform/apple/avd/tests/vp9-test.py is not currently wired into tools/asahi/run-host-tests.py, so CI host-tests did not execute vp9-test.py directly; consider adding it in a follow-up so future avd-vp9.c control changes are caught automatically in CI.

Checklist (§1–§6) & CI

  • §1 No model gating: Pass (host test fixture only).
  • §2 Production-ready, no hacks: Pass.
  • §3 Safety: Pass (no decoder code modified).
  • §4 Clean-room & attribution: Pass — commit 4b0be5d855d1 carries human author/committer (Ryan Murray <[email protected]>) and human Signed-off-by: only, with zero AI trailers in commits; PR body discloses Assisted-by: LLM (Codex).
  • §5 Evidence: Pass — host-fixture-only repair verified locally under ASan/UBSan/LSan on integration/aurora and against a4b51cdff0a7.
  • §6 Naming: Pass.
  • Live CI (4b0be5d855d1): 1/1 check COMPLETED / SUCCESS (host-tests: 463/463 passed).

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit 377060f into integration/aurora Nov 23, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the fix/avd-vp9-host-control-copy branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants