Repository navigation
media: apple: ave: 26A428: 60 fps and no-B sessions, B-picture flags - #2218
Conversation
213d8cf to
5046194
Compare
5046194 to
9f9abda
Compare
|
Blockers: 2. I checked the three new commits on top of #1900.
Also, the commit message of 9f9abda justifies the change by how the macOS encoder driver builds its commands internally ("one AppleAVE2 kext builds these commands for every firmware on the layout"). Please base the argument on our own traces instead: the Start/Process words captured on the M5 match across 30/60 fps and B/no-B sessions. Leave out statements about how Apple's binary works. HW row: J815 on this head with item 1 fixed: the same 30-case set plus an HEVC Assisted-by: LLM (Claude:Opus 5.5) |
9f9abda to
c5fc7c7
Compare
c5fc7c7 to
bf6356a
Compare
|
@RyanTheTide both blockers are fixed.
The rebase onto cc14570 met integration's The two new words go through checkpatch flags the macro's two parameters as unused. Their uses are in other hunks of the same macro. HW row (30-case set + HEVC |
|
Re-review of bf6356a: No blockers. Earlier points:
What changed since: the rebase onto the base's HW row: Assisted-by: LLM (Claude:Opus 5.5) |
|
PASS on a 14-inch MacBook Pro (J714s, M5 Pro/T6050, G17S B1), kernel Candidate The merged heads were #2906 AVE firmware The command line matched the default. SELinux was disabled. Earlier J714s rowJ714s (M5 Pro, T6050) Hardware Row —
|
| Case | Codec / Path | Res & FPS | Frames | Decoded | Picture Types | Size (B) | MD5 (prefix) |
|---|---|---|---|---|---|---|---|
gst_h264_1080p30_b2 |
GStreamer v4l2h264enc (B=2) |
1080p30 | 60/60 | ok | I=2,P=58 |
1,008,266 | 15ec74768775ff5c |
gst_hevc_1080p30_b2 |
GStreamer v4l2h265enc (B=2) |
1080p30 | 60/60 | ok | B=42,I=3,P=15 |
1,082,100 | 830f3b57e0a590ee |
gst_h264_1080p60_b2 |
GStreamer v4l2h264enc (B=2) |
1080p60 | 60/60 | ok | I=2,P=58 |
523,771 | 8894d30a8af1dd37 |
gst_hevc_1080p60_b2 |
GStreamer v4l2h265enc (B=2) |
1080p60 | 60/60 | ok | B=42,I=3,P=15 |
578,864 | edb84b0fb46d8e20 |
gst_h264_1080p60_b0 |
GStreamer v4l2h264enc (no-B) |
1080p60 | 60/60 | ok | I=2,P=58 |
523,771 | 8894d30a8af1dd37 |
gst_hevc_1080p60_b0 |
GStreamer v4l2h265enc (no-B) |
1080p60 | 60/60 | ok | I=2,P=58 |
568,790 | e1a434a06f9e2092 |
gst_h264_1080p30_b0 |
GStreamer v4l2h264enc (no-B) |
1080p30 | 60/60 | ok | I=2,P=58 |
1,008,266 | 15ec74768775ff5c |
gst_hevc_1080p30_b0 |
GStreamer v4l2h265enc (no-B) |
1080p30 | 60/60 | ok | I=2,P=58 |
1,049,761 | 755379e15c6fb04b |
gst_h264_default_30 |
Stock GStreamer v4l2h264enc |
1080p30 | 60/60 | ok | I=2,P=58 |
1,008,266 | 15ec74768775ff5c |
gst_hevc_default_30 |
Stock GStreamer v4l2h265enc |
1080p30 | 60/60 | ok | B=42,I=3,P=15 |
1,082,100 | 830f3b57e0a590ee |
gst_h264_default_60 |
Stock GStreamer v4l2h264enc |
1080p60 | 60/60 | ok | I=2,P=58 |
523,771 | 8894d30a8af1dd37 |
gst_hevc_default_60 |
Stock GStreamer v4l2h265enc |
1080p60 | 60/60 | ok | B=42,I=3,P=15 |
578,864 | edb84b0fb46d8e20 |
ffmpeg_h264_1080p30 |
FFmpeg h264_v4l2m2m |
1080p30 | 60/60 | ok | I=5,P=55 |
1,025,026 | 8302e98985b01537 |
ffmpeg_h264_1080p60 |
FFmpeg h264_v4l2m2m |
1080p60 | 60/60 | ok | I=5,P=55 |
532,979 | d2c523ec9e2cf948 |
ffmpeg_hevc_1080p30 |
FFmpeg hevc_v4l2m2m |
1080p30 | 60/60 | ok | I=5,P=55 |
1,023,688 | fd336e0e1e25f3c5 |
ffmpeg_hevc_1080p60 |
FFmpeg hevc_v4l2m2m |
1080p60 | 60/60 | ok | I=5,P=55 |
557,631 | e2230c0d03adcf81 |
- Regression line: 1080p30 H.264 (
1008266 B,15ec74768775ff5c) and HEVC (1082100 B,830f3b57e0a590ee) are byte-identical to baseline; GPU Vulkan liveness passed before and after.
There was a problem hiding this comment.
Reviewed head bf6356a0fb6252d1dd3449036b21c3985d443017 against pre-pr-checklist.md.
Verdict: Request Changes (blockers remain before merge)
Blockers
- Stale
s->bframeflag onave_sess_output()error paths (drivers/media/platform/apple/ave/ave-sess.c:1451,1518,ave-v4l2.c:1148-1156):ave_sess_output()clears*keyframe = falseat entry, but does not clears->bframebefore its early error returns (-EFAULT,-EIO,ave_sess_decode_result(),-EPROTO), andave_sess_prepare_slot()does not clears->bframeon slot reuse.- In
ave_deliver(), whenave_sess_output()returns an error (state = VB2_BUF_STATE_ERROR),dst->flagsis still populated froms->bframe. Reusing a slot whose previous picture was a B-frame will stamp a staleV4L2_BUF_FLAG_BFRAMEonto an errored CAPTURE buffer. - Fix: clear
s->bframe = falsealongside*keyframe = falseat the top ofave_sess_output()(or passbool *bframeas an out-parameter likekeyand dropbframefromstruct ave_slot, sinceave_deliver()is its only reader).
- Unmerged base PR
#1900:- Commit 1 (
1a4cbee1a2690558e1b947341e85331b98adeaa0) belongs to#1900, which is still OPEN (targetingintegration/aurora) and still owes its J815 27.2 + 27.0 stub regression HW row.#1900should be verified and merged first (or#2218rebased after#1900lands) so#2218does not pull#1900in ahead of its 27.0 regression check.
- Commit 1 (
- J815 (T8142) hardware row on current head
bf6356a0fb62still owed:- The T6050 (
26A428) coverage gap is now closed by the J714s 16/16 PASS row on exact headbf6356a0fb62(#issuecomment-7068611954: pre-patch1080p60failure control, 30/60 fps H.264/HEVC with B and no-B, byte-identical 1080p30 baseline, 0 DART faults, 0 AVE errors, 0 oops/WARN, 0 SELinux AVCs, 0 new failed units). - However, as the PR body notes, the J815 run on the rebased head
bf6356a0fb62(30-case set + HEVC/H.264-bf 3verifying CAPTUREV4L2_BUF_FLAG_BFRAMEagainstffprobe, plus the regression line: 0 SELinux AVCs, 0 failed units, 0 new kernel errors) has not been posted yet.
- The T6050 (
Non-blocking nits
drivers/media/platform/apple/ave/ave-sess.c:1188: H.264slice_typeis only defined for0..9(1and6are B slices);type == 1 || type == 6is stricter thantype >= 0 && type % 5 == 1on malformed input.- Commit
ff9e684544dbmessage and PR body say the+0xcf8low-delay word is on "the 6070 layout", whereas.low_delay = 0xcf8is onave_layout_9003_78_0(ave-layout.c:265), notave_layout_6070_11_1.
Verified clean
- Bitstream parser & KUnit (
ave_au_bframe,ave_hevc_bframe_extra_bits): Emulation-prevention removal (00 00 03),ue(v)leading-zero bound (> 31), HEVC PPSnum_extra_slice_header_bitsparsing (H.265 7.3.2.3.1), key-frame scanning for PPS learning, and slice header parsing (H.265 7.3.6.1 / H.264 7.3.3) all check out; hand-decoded the KUnit test vectors and confirmed they exercise the 2-extra-bit path as described. - Firmware probe & layout isolation (
ave-fw.c,ave-layout.c,ave-writer.c):ave_fw_probe()fails closed on unknown or cross-chip CRCs;AVE_LAYOUT_26A428_FIELDS(0x320c, 0xce4)vsAVE_LAYOUT_26A428_FIELDS(0, 0)keeps26B123(M3/M4),9003, and6070untouched, and0x320cmatches the0x1ealready in the 26A428 Start ledger at 30 fps. - Checklist rules 1–4: No board/model gates (firmware-ABI layout/CRC selection), default cmdline, no hacks, clean-room commit messages, human-only
Signed-off-by: Nick <[email protected]>on all 4 commits, and PR body ends withAssisted-by: LLM (Claude:Opus 5.5). - CI:
host-tests1/1 green (note: repokunitworkflow is path-filtered and does not trigger ondrivers/media/platform/apple/ave/**; author reports 48/48 AVE KUnit locally).
bf6356a to
0b40dfa
Compare
|
@DjDeveloperr thanks for the review, and for the J714s row.
Nits, both taken:
Against Checks:
#2547 is rebased on top. |
|
Re-review of 0b40dfa: no blockers. Earlier points:
Against bf6356a the third commit is unchanged and the first two only differ by the above, so the J714s (T6050) row on bf6356a still covers the layout-wide 60 fps and no-B change. HW row still owed: J815 on 0b40dfa, the 30-case set plus HEVC and H.264 Assisted-by: LLM (Claude:Opus 5.5) |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
@DjDeveloperr updated to
J815 rows at this head (in the body):
One observation, not a blocker: 60 fps CBR with B-frames overshoots its 6 Mb/s target by 35-42% on the high-motion clip (screen content: within 4%). |
6070 firmware writes the parameter sets to a buffer of their own. On a J475c (T6021) the SPS there had no VUI timing, and with B-frames off no VUI at all, so a raw Annex B reader guessed 25 fps. When an SPS from that buffer has no timing_info, rewrite it in the output buffer: set timing in an existing VUI, or add a minimal one. The timing is the client's timeperframe exactly, not the integer rate the firmware gets: H.264 gets num_units_in_tick equal to the denominator and time_scale twice the numerator, with fixed_frame_rate_flag, which is how H.264 codes a frame rate; HEVC gets vui_num_units_in_tick equal to the denominator and vui_time_scale equal to the numerator. The rate is taken in lowest terms, so 60/2 gives the bytes of 30/1, and 30000/1001 gives 1001 and 60000 (H.264) or 1001 and 30000 (HEVC). ffprobe on a raw H.264 stream prints the field rate (60/1 at 30 fps) and an MP4 mux reports 30/1. When twice the numerator does not fit 32 bits, H.264 halves an even denominator instead; with an odd one there is no exact form and the SPS is left as written. The rewrite is keyed on the stream, not on a SoC or firmware flag: an SPS that already has timing is left alone, and so is one this walk cannot follow (scaling lists, POC type 1, more than one HEVC sub-layer, more than 256 bytes). Firmware that puts its parameter sets in the coded buffer (9003, 26A428) is not touched. The SPS is read with the RBSP reader of the T8142 slice-type probe in aurora-silicon#2218 (struct ave_rbsp, ave_rbsp_init(), ave_rbsp_bit(), ave_rbsp_ue()), with ave_rbsp_get() and ave_rbsp_get_ue() added and the buffer raised to 256 bytes so a whole SPS fits. Whichever of the two lands second drops its copy. The rewrite's two scratch buffers (704 bytes) are allocated for the call rather than kept on the stack; if that fails the SPS is left as written. Signed-off-by: Lucas Goossen <[email protected]>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Code approved at b3e6c51a4b5f. The output parser clears the B-frame flag before it can return an error, and #1900 has landed. The J815 passed all 30 encodes and its flagged B frames matched ffprobe. Before merge, verify the existing J714s result carries forward to this build or record a second-generation encode.
Superseded by the review at b3e6c51
|
Merged into main. Thank you! It merged on the hardware row at this head and the approving review. |
media: apple: ave: 26A428: encode HEVC Main 10 (on #2218)
|
Post-merge J773g (M4 Mac mini, T8132 AVE, 27.2 firmware) row at How it was run: two guarded one-shots on the default cmdline.
Encodes: 60 frames of 1280×720 NV12 (
The picture types come from the coded stream. Each CAPTURE buffer's KEYFRAME, PFRAME or BFRAME flag was matched to its access unit by byte offset. Health: 0 AVE or DART errors on either kernel, 0 failed units, and the same set of error-level kernel lines on both (0 new). No audio. |
What: on the 26A428 layout (M5, T8142), the AVE encoder runs other frame rates and sessions without B-frames, writes the two Start/Process words macOS 27.2.1 sends for them, and flags B pictures on the coded buffers (every chip).
Tested: J815 (MacBook Air 15" M5) at
b3e6c51a4b5f: encode set 30/30 OK, all run natively (60 fps, no-B, CBR, H.264 Baseline/Main/High, HEVC Main, 360p-1440p).-bf 3: the buffers flagged B match ffprobe exactly (H.264 26/60, HEVC 42/60). Regression at boot: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors; 0 AVE/DART warnings during the encodes.Risk: two-way door. AVE encode on 26A428 (M5, M5 Pro/Max); B flags on every chip. 26B123 (M3/M4 27.2) passes 0 for the two new words and is unchanged.
Not yet: nothing blocking. 60 fps CBR with B-frames on the high-motion clip overshoots its 6 Mb/s target by 35-42% (screen content: within 4%); that's rate control, not admission.
Details
B pictures are flagged on the coded buffers. The firmware reorders B-frame sessions itself, so every non-key picture used to be flagged
V4L2_BUF_FLAG_PFRAME. The driver reads the first slice'sslice_typefrom the bitstream: a few bytes, emulation prevention removed, plus HEVC'snum_extra_slice_header_bitsfrom the last PPS. Key-frame access units are scanned too, since they carry the PPS. Anything unexpected falls back to P, as before.ave_sess_output()clearss->bframewith*keyframeat entry, so an errored CAPTURE buffer never carries a stale B. H.264 B is exactlyslice_type1 or 6.Two Start/Process words macOS 27.2.1 writes on the M5:
ave_layout_9003_78_0, has it at +0xcf8).At 30 fps the first is the
0x1ethe 26A428 Start ledger already holds, and the second only applies to the sessions the next change admits. So 30 fps sessions with B-frames send the same commands as before.26A428 runs other frame rates and sessions without B-frames (
any_gop, as on 26B123), instead of the refusal being deleted, so a future counted layout without rows is still refused. Our traces of macOS 27.2.1's Start and Process commands for 60 fps and no-B sessions match what the driver sends, apart from words that also differ on a qualified 30 fps B-frame session.T6050 shares the layout: DjDeveloperr's J714s row on
bf6356a0covers it (16/16 at 30 and 60 fps, with and without B, a failing pre-patch 60 fps control, 1080p30 byte-identical).Changed on this head: rebased onto
main(#1900 merged, so this is its three commits). The KUnit layout cases followmain's 26B123/T8112 changes. No AI attribution in the body or the commits.Evidence
J815, macOS 27.2 stub (AVE firmware 26B123 on the 26A428 layout), this head merged with the other J815 PRs into one test kernel on
main2943fff. Encode set: codec-labencode --quick, AVE and a software reference per case, PSNR/SSIM against the source.All 30 AVE cases OK; the table leaves out the 720p and 360p cases and the into-tree and screen VBR variants (28.1-41.5 dB).
-bf 3B flags: H.264 60 CAPTURE buffers, 26 flagged B, ffprobe 26 B pictures; HEVC 60, 42 flagged, ffprobe 42.