Skip to content

media: apple: avd: harden stream validation and reset recovery - #712

Closed
RyanTheTide wants to merge 4 commits into
avd/rewrite-corefrom
avd/conformance-validation
Closed

RyanTheTide wants to merge 4 commits into
avd/rewrite-corefrom
avd/conformance-validation

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Malformed tile controls and unsupported H.264 pictures can reach the video processor and stall decoding across contexts. Reject them before either codec preparation path emits a hardware program, and recover timed-out submitted frames through reset, an empty DART paging-domain switch, and backend reboot.

  • Complete the upstream AV1 context-update tile and VP9 tile-row control checks. Reject H.264 interlace, field pictures, multiple slice groups and coded dimensions above 4096x4096, plus unsupported component/capture formats. Check AV1 tile coordinates and OUTPUT payload ranges.
  • Make ordinary DART domain switches stop translation, transfer stream membership, propagate invalidation errors and restore the previous domain on failure. Preserve firmware ownership restrictions. After successful AVD recovery, retain completed results and unsubmitted slots; an inbox retry timeout fails only that frame.
  • Add a six-suite fluster kit with the public upstream scores, pinned catalogues, 33 annotated vectors, retained raw results, and commands in drivers/media/platform/apple/avd/tests/conformance/README.md. Fourteen AVC interlace marks were checked against checksum-matched public ITU archives. Marks never skip vectors or change denominators.

Validation: queue host stress passed 100,000 operations with 36,424 ordered retirements; four validation KUnit cases passed under host shims compiling the production V4L2 validators; fluster orchestration tests passed, including continuation after decoder failure and preservation of existing evidence. Added in-kernel KUnit cases cover validation and DART/queue bookkeeping.

Pending: in-kernel arm64 KUnit, the arm64 W=1 WERROR build, and live DART/reset/fluster qualification. No build or device request was issued for this task. The host shim run does not exercise the kernel control framework or MMIO.

Based on avd/rewrite-core at a11617279b458d19e7703e545604e2f1d41d55d6. The DART change is a separate commit.

Public reference: AVD v3 cover letter and conformance scores.

Complete AV1 tile validation with the context-update tile index bound,
which also rejects empty tile grids. Keep the existing descriptor-count
limit. Reject VP9 tile_rows_log2 above two before drivers use it in shifts
or tile loops.

These checks match the public AVD v3 series by Sofus Forstreuter.

Link: https://lore.kernel.org/linux-media/20261020-avd-v3-4-85cbaa2125d8@icloud.com/
Link: https://lore.kernel.org/linux-media/20261020-avd-v3-5-85cbaa2125d8@icloud.com/
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… state

Stop translation before replacing an ordinary stream's TTBRs and propagate
TLB invalidation failures. Restore the preceding domain if attachment
fails, or leave DMA disabled if restoration also fails. Balance runtime PM
on acquisition failures and move stream membership out of the old domain
only after a successful switch.

AVD recovery needs to attach an empty paging domain and detach back to the
DMA domain after resetting the decoder. Keep firmware-owned and managed
streams outside this recovery mechanism. Add KUnit coverage for two-stream
membership transfer without removing another client's stream.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Reject H.264 MBAFF/PAFF and field pictures, multiple slice groups and coded
sizes above 4096x4096 with rate-limited diagnostics. Validate component
formats across codecs and check AV1 tile coordinates and payload ranges.
Apply and validate effective request controls before either frame_ops or
the legacy builder can prepare a hardware program. Complete requests at
core retirement, including preparation failures and held-slice requests.

Recover by resetting the decoder, attaching and detaching an empty paging
domain, then rebooting the backend. Preserve completed results and prepared
slots that firmware never owned after successful recovery. Fail prepared
slots too if recovery fails, and cancel only the draining context's pending
slots during streamoff. An inbox retry timeout needs no global reset.

Require a recovery domain at probe and manage its cleanup on error paths.
Add validation KUnit cases, reset ownership tests and a portable host runner
that compiles the production V4L2 validation helpers under host shims.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Record the public upstream reference scores and annotate known unsupported
vectors without skipping them or changing raw scores. Include 14 interlaced
AVC vectors verified from checksum-matched public ITU archives and format
limits from pinned Fluster catalogues.

Run each suite after preceding failures, preserve logs and decoded output,
record catalogue hashes and return codes, and refuse to overwrite evidence.
Provide explicit V4L2 stateless decoder commands, optional ffprobe annotation,
a plan mode and host tests for failure continuation and evidence preservation.

Link: https://lore.kernel.org/linux-media/20261020-avd-v3-0-85cbaa2125d8@icloud.com/
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The stream validation, DART live paging-domain flush, and decoder reset/recovery here landed separately on integration/aurora: #758 (recovery detach/reset), #1090 and #1091 (AV1 tile-entry checks; no reset in recovery), and #1116 (macOS H.264/HEVC slice and scaling parity). The frame-op branch this was cut from is no longer used. Closing.

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.

1 participant