Repository navigation
media: apple: avd: VP9: one segmentation map per stream, shared by the banks - #2195
Conversation
|
Same bug and same fix on a J813 (MacBook Air 13" M5). The AVD runs the open-queue transport here ( Test streams, made with libvpx-vp9 from
"Without" is my kernel on #2135's merged head 🤖 Generated with Claude Code |
|
Blockers: 1.
The fix itself is correct. HW row: covered on J815 and J813. Add a regression line from one of those boots: 0 AVC, 0 failed units, 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
a47cddb to
a22f3eb
Compare
|
@RyanTheTide fixed: the commit is re-made with one On #2136: after this PR, its CPU memset in The regression line (0 AVC, 0 failed units, 0 new kernel errors) comes with the next J815 boot. |
|
Re-review of a22f3eb: No blockers. From the last review:
Nothing else changed since the last review, and the fix stands as reviewed there. HW row: the regression line from the J815 (or J813) boot on this commit: 0 AVC, 0 failed units, 0 new kernel errors, alongside the existing aq-mode 2/3 MD5 rows. Assisted-by: LLM (Claude:Opus 5.5) |
|
The shared VP9 segmentation map is still needed. Head |
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at verified live head a22f3eb737f6ca92834f45334b00c30e47894150 (not superseded on integration/aurora; live CI 1/1 green: host-tests).
Technical Audit
drivers/media/platform/apple/avd/avd-vp9.c(+13/-8): Clean and correct. Movingstruct avd_buf segfromstruct avd_vp9_banktostruct avd_vp9_ctx, allocating it once inavd_vp9_start()with the existingDIV_ROUND_UP(fmt_width(ctx), 8) * 24size, pointing bothset_header()"seg"slots atvp9_ctx->seg.addr, and freeing it inavd_vp9_free()(including theerr_free_ctxOOM path) fixes the queued-transport bank-alternation bug cleanly.- Live base & test interaction: Verified against current
integration/aurora(70a00e583b03):drivers/media/platform/apple/avd/tests/vp9-test.py(fail_alloc_after = 13) still hits-ENOMEMcleanly on bank 1's first allocation (1 shared + 11 bank 0 + 1 bank 1 = 13) and cleans up properly;avd-vp9-test.cis unaffected.#2136remains open, so there is no live conflict onintegration/aurora(whichever lands second will coordinate onVP9_SEG_RESET/idle clear as noted).
Checklist Summary
- §1 No model gating: PASS — applies uniformly across all AVD VP9 streams using the queued transport (single-bank unchanged).
- §2 Production-ready, no hacks: PASS — default kernel cmdline, clean minimal fix.
- §3 Safety: PASS — allocation/free symmetry and error unwind are sound.
- §4 Clean-room & attribution: PASS — single commit
a22f3eb737f6carries human author/committer (Nick <[email protected]>) and humanSigned-off-by:only (zero AI commit trailers); PR body ends with a plainAssisted-by:line. - §5 Evidence: Blocker (owed regression line) — see below.
- §6 Naming: PASS.
Blocker
- §5 Owed regression triad: Functional decode evidence is strong and independently replicated on both J815 (67-stream suite 59/59 PASS,
aq-mode 2/3bit-exact, seek, 3 concurrent decodes) and J813 (aq-mode 2/3bit-exact including 4/4 deep sleeps). However, the §5 regression run (kernel/build identifier plus0 SELinux denials[or N/A if Arch],0 failed units, and0 new kernel errors) has not yet been posted from either boot and remains open from earlier review/triage.
Verdict
REQUEST_CHANGES — 0 code/§1–§4/§6 blockers; ready to approve as soon as the owed §5 regression triad from the J815 or J813 boot is posted.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at a22f3eb737f6: the code is ready; it needs a branch update and one more row.
Blockers: none in the code. The branch now conflicts with main; update it. Missing row: avd-vp9.c runs on every AVD generation, and both rows are on M5, so before it merges it also needs the VP9 suite at the updated head on one non-M5 Mac (for example an M4 or the Neo), bit-exact. We'll run it on our J773g or J700.
Checked: thank you, this is well tested. No Apple material, no gates: one segmentation map per stream, shared by the banks. J815: the 67-stream suite passes 59/59, with aq-mode 2/3 bit-exact, seek and 3 concurrent decodes; J813 bit-exact as well.
Superseded by the review at a22f3eb
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
The approved The VP9 resize fix has landed. Please carry through your agreed update for the shared segmentation map so resizing one bank cannot clear data the other bank is using. The prior J815 and J813 results are recorded. Dj’s review names a bit-exact non-M5 regression on J773g or J700 at the updated head. |
…e banks The segmentation map is state that runs from frame to frame: a frame with temporal map prediction, or one that keeps the map without updating it, reads the map the frame before it left. With the queued transport (two banks, alternating) each bank had its own seg buffer, so a frame read the map of the frame before last. Every stream with segmentation then decoded wrong from its first non-key frame on. Keep one seg buffer per stream and point both banks at it. A frame size change (the map is cleared then) moves to a second, cleared buffer instead of clearing the one the frame still in flight in the other bank reads. Tested on J815 (MacBook Air 15" M5), frame-by-frame MD5 against libavcodec, full decode and a seek into the stream: - before: libvpx aq-mode 2 (complexity) and 3 (cyclic refresh) at 720p and 1080p, and a 360p screen-content clip, wrong from frame 1-3; - after: all of them bit-exact, with the rest of a 67-stream H.264, HEVC, VP9 and AV1 set (59 of 59 PASS; the other 8 are 10-bit and interlaced streams the driver does not expose). The single-bank transport also decoded them right, which pointed at the bank swap. Signed-off-by: Nick <[email protected]>
a22f3eb to
7f02457
Compare
|
@DjDeveloperr updated to J815 at this head, VP9 test vectors A/B against Thanks for offering the non-M5 run (J773g/J700) at this head. |
|
Verdict: FINISH, then merge at Blockers: none in the code. Dj's review found none at the earlier head. The only change since then is the forward update: a size change now moves to the stream's second, cleared seg buffer, so the frame still in flight in the other bank keeps its map. That closes the #2136 interaction. Still needed: the bit-exact VP9 suite at this head on one non-M5 Mac. I've queued it in our lab on J616s (M4 Pro, T6040 AVD), with the same A/B against |
|
7f02457 J616s (M4 Pro, T6040, non-M5 AVD open-queue transport) PASS: batched on main 7f00dc6 (0 merge-tree diffs), default cmdline; 27-clip VP9 bit-exact A/B vs stock fleet89 (main apple-avd) on identical userspace: VA-API 0 PASS->FAIL, +13 FAIL->PASS (20/20 supported clips bit-exact vs 7/20 on stock; all 13 segmented aq-mode 1/2/3 + screen + cyclic streams fixed; 7 unchanged libva resize/Profile-1 fallbacks); GStreamer v4l2slvp9dec 0 PASS->FAIL, +5 FAIL->PASS (10 vs 5); 0 AVD/DART errors, 0 failed units, Enforcing, 0 AVC, 0 new kernel errors; stock fleet89 restored. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 7f024572717a. The non-M5 row is in. On J616s, 20/20 supported VP9 vectors are bit-exact, with +13 FAIL→PASS and 0 PASS→FAIL against main's module. There are no code blockers (Dj's review and mine).
|
Merged into main. Thank you! It merged on the hardware rows at this head and a non-author review. |
What: AVD VP9 keeps one segmentation map per stream, shared by both banks of the queued transport, instead of one per bank. Before, every stream with segmentation decoded wrong from its first non-key frame. Rebased onto
mainwith #2136: a frame-size change now switches to a second, cleared map, so the frame still in flight in the other bank keeps reading the old one.Tested: J815 (MacBook Air 15" M5) at
7f024572717a: VP9 test vectors A/B with the same userspace,main's module vs this head: 0 PASS→FAIL, +2 FAIL→PASS, +4 fallback→PASS (177 PASS vs 171). codec-lab decode 21/21. Earlier head: libvpx aq-mode 2/3 and screen content bit-exact; 67-stream set 59/59. Regression at boot: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors.Risk: two-way door. VP9 decode on every AVD generation.
Not yet: the VP9 suite at this head on a non-M5 Mac (offered by the reviewers on J773g/J700).
Details
The VP9 segmentation map carries over from frame to frame: a frame with temporal map prediction, or one that keeps the map without updating it, reads the map the previous frame left. With the queued transport the two banks alternate. Each bank had its own seg buffer, so a frame read the map of the frame before last.
Change: one seg buffer per stream, used by both banks.
Changed on this head (with #2136, merged): #2136 cleared the bank's seg buffer from the CPU on a frame-size change. With one shared map, that clear could hit a map the other bank's frame is still reading. The stream now has two seg buffers: a size change moves to the other buffer and clears it, and at most one frame is in flight besides the one being set up. The map reset still goes to every frame that uses segmentation until one updates the map.
Evidence
J815, macOS 27.2 stub, this head merged with the other J815 PRs into one test kernel on
main2943fff. The A/B swaps onlyapple-avd.ko(main'savd-vp9.cbuilt in the same tree) under the same userspace.mainPer vector: 0 PASS→FAIL, 2 FAIL→PASS, 4 fallback→PASS. 26 vectors went from fallback (no frames from
main) to FAIL: 24 of them are vp90-2-21 resize vectors and 2 are vp90-2-20. The resize vectors (vp90-2-14, vp90-2-21) fail on both: libva-v4l2request drops its references across an inter-frame resize ("unavailable reference in this decoder context"). That's a userspace item, not this PR.