Repository navigation
media: apple: avd: enable firmware-gated T6040 HEVC and retain request ownership - #698
Closed
RyanTheTide wants to merge 3 commits into
Closed
RyanTheTide wants to merge 3 commits into
RyanTheTide wants to merge 3 commits into
Conversation
…ership Let an independent context prepare its next decode request while one context owns the hardware. Retain explicit buffers and per-context codec state after releasing the m2m scheduler, route IRQs through the hardware owner, and drain released ownership before streamoff/free. Keep one hardware owner because PP completion is untagged, one request per context for VP9/AV1 dependencies, and the existing H.264 held-capture scheduling contract. Serialize retirement with watchdog cancellation and reset/IRQ/mailbox drain. Fail closed after reset failure and fail partial submission explicitly. Include the empty-mailbox guard from the public fix proposed in #640 so a repeated PP word cannot retire a new owner. Preserve PM references until retirement and pause/drain requests across system suspend. Enable HEVC in T6040 match data with its existing v5 header, requiring firmware CODECS:h265 support for HEVC while retaining legacy admission of other codecs. No pixel, firmware-overlap or throughput qualification is claimed. Add KUnit ownership transitions and host ASan/UBSan tests executing production decode paths, OF match data and firmware capability parsing with negative controls. Hardware validation remains a separate step. Link: #640 Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Do not boot firmware on runtime resume after reset failure has marked the device broken. Submission admission already rejects this state; keep the same boundary when an autosuspended device is accessed again. Execute the production runtime-resume function in the host fixture and check that broken admission performs no firmware boot, while normal resume retains its boot path. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A submission error can leave a CPU instruction table referencing buffers that the codec's error completion then drops. Free and clear that table before error completion so a following H.264 continuation cannot reuse stale instructions. Successful held-capture requests keep their table. Remove the fixture's implicit table cleanup so it exercises production retirement. Check validation and partial-submission failures, successful held capture, and a mutation that retains the failed table. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Contributor
Author
|
Closing per the one-PR-per-series rule. The branch stays and gets integrated into the AVD rewrite, which lands as one PR once it works on hardware. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
T6040 match data now admits HEVC with its existing v5 header only when the loaded firmware's CODECS trailer advertises
h265. Legacy firmware keeps H.264/VP9/AV1 admission. Other matches and pacing policies retain their behavior. The empty-mailbox protection from #640 is included because repeating a PP completion would invalidate ownership.The m2m scheduler currently waits for PP completion before another context can prepare a request. This patch retains explicit source/capture buffers and codec state after scheduler release, letting one independent context prepare on the CPU while the previous context owns the hardware. IRQs use that hardware owner; streamoff/release and suspend drain it. Watchdog/PP completion has one retirement winner, partial submission fails explicitly, and reset failure prevents subsequent FIFO reuse and firmware boot on runtime resume.
This is a draft for host-side review and hardware qualification. Hardware remains serialized because PP completions have no request tag. Each context retains one request; H.264 keeps its held-capture scheduling path. This does not claim single-stream acceleration, concurrent firmware requests, correct HEVC pixels, or qualified hardware recovery. The extra retirement workqueue hop also needs performance measurement. The failed-reset host case proves later submissions and firmware resume are rejected; it does not prove a failing physical reset has quiesced DMA. That device-recovery boundary still needs hardware review.
Validation:
c7edee0: arm64 Clang 22.1.6,W=1,CONFIG_WERROR=y, AVD and both KUnit translation units. All ten outputs are AArch64 ELF objects, with no warnings or errors in the captured build log. Source, resolved config, compile flags and output hashes were independently verified.Reproduce host validation from the source root:
The compile command is in
tools/asahi/avd-request/README.md. The host mocks do not emulate kernel scheduling, DMA or SMP memory ordering. No target was modified for these results.For the hardware lead: first build and boot the exact candidate with the device's matching config through the controller, retaining the existing one-shot bootguard fallback and original kernel/module/firmware hashes. Keep the installed firmware unchanged. Source, ownership and resource admission must succeed. Use an approved controller upload to place the existing decode kit at
/tmp/avd-kit; neither the private kit nor lab records belong in this PR.Submit the following shell body through
hw_request(capability="execute", device="j616s", mode="exclusive", task=TASK, timeout="30m", args=[SCRIPT]), whereSCRIPTis the complete block andTASKis the live qualification task. This is a command for the lead, not an execution performed by this PR. Keep hardware protection active. It opens no audio output. Retain full logs/failures privately and publish only scrubbed summaries.The correctness pass streams normalized 8/10-bit planar frames into hashes and compares every frame size/hash/count against software decoding of the identical compressed bytes. The geometry checks deliberately reject layouts with unhandled row padding. Concurrent correctness and teardown/restart run outside throughput timing. Unsupported hardware elements fail instead of using software fallback.
After any actual timeout or VP fault, preserve the controller result and kernel fault log, then rerun the
validate_row h264 1080 recovery-h264command in a fresh output directory to check continued decoding. A reset failure requires the device's approved bootguard rollback/recovery operation; do not keep submitting frames. The teardown test does not force a hardware watchdog timeout: that hardware fault/recovery case still needs separate qualification. Compare baseline/candidate with identical samples, count completed frames, keep wall and PLAYING-to-EOS timing separate, and reject lossy traces. The adapter also handles built-in versus module probe symbols. The old trace analyzer cannot assign overlapping host runs to requests, so do not interpret its per-request latencies when it flags ambiguity.