Repository navigation
media: apple: avd: keep the full PP count of frames with 256 tiles or more - #3226
Conversation
… more An AV1 frame takes one PP kick per tile, and set_tiles() stored their number, tile_cols * tile_rows, in a u8. The stateless API allows up to V4L2_AV1_MAX_TILE_COUNT (512) tiles, so a frame of 256 or 512 tiles recorded 0 kicks and one of 257 to 511 tiles 256 too few. Both submission paths then kicked too few PP continuations for the segments set_tiles() had built: the legacy submit loop wrote that many EXECs, and the queued firmware's metadata asked for that many continuations. Such a frame either ends early or waits for the watchdog, whose reset fails the frames of every stream on the decoder. Keep the count in a u32 and run the legacy continuation loop from 1 without the unsigned "count - 1". A 256-tile frame now gets all 256 kicks, on the legacy path and as 255 continuations for the queued firmware. A frame with more tiles than the queued firmware takes is now refused at submission by its existing AVDQ_MAX_PP_EXTRA check, instead of being sent with a wrapped count. VP9 keeps the same counter and gets the same change; its tiles stay far below 256 at the decoder's 4096-pixel width limit. Add a host test that runs the production set_tiles(), the PP kick hook and the legacy submit hook for 1, 255, 256, 272 and 512 tiles, with the previous revision registered as the negative control: it kicks 256 and 512 tiles once and 272 tiles 16 times. Signed-off-by: DjDeveloperr <[email protected]>
|
Verdict at Blockers: none Checked:
Evidence
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
J714s (MacBook Pro 14" M5 Pro, T6050) row at
|
There was a problem hiding this comment.
Verdict: MERGE at bc4f27cc (once cancelled CI checks are rerun green)
Blockers: none (code, host tests, and two-generation hardware rows are ready; rerun the 18 cancelled CI checks before merge).
Checked:
drivers/media/platform/apple/avd/avd-av1.candavd-vp9.c: verifiedsubmit_numis widened fromu8tou32for both AV1 and VP9,pp_kicks()usesmax_t(u32, ..., 1), and legacy submit loops usefor (u32 i = 1; i < ...->submit_num; i++)(avoiding both 8-bit wrap at 256..512 tiles and unsigned underflow if 0).tools/asahi/avd-pp-count-tests.pyandrun-host-tests.py: verified productionset_tiles(),avd_av1_pp_kicks(), andavd_av1_submit()across 1, 255, 256, 272, and 512 tiles with negative control against the previous revision.- Verified exact-head (
bc4f27ccba11) hardware rows on J700 (Neo, 3/3 AV1 streams, 180/180 frames, CRCs match base, 0 DART faults) and J714s (M5 Pro, no regression).
Evidence
- Diff reviewed at
bc4f27cc(all 4 files, 257 lines). - CI at review time: 3 passed, 0 failed, 18 cancelled.
|
Merge-train status at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: An AV1 frame takes one PP kick per tile, but the driver kept the count in a
u8. Frames of 256 to 512 tiles, which the stateless API allows, were kicked 256 times too few or not at all past the first kick. Such a frame ends early or waits for the watchdog, whose reset fails the frames of every stream on the decoder. The count is now au32on both submission paths.Tested: the module builds W=1-clean (clang, arm64). The new host test
avd-pp-count-tests.pyruns the productionset_tiles(), PP kick hook and legacy submit hook for 1, 255, 256, 272 and 512 tiles, and fails at the previous revision (registered as the negative control).run-host-tests.py --only avd: 14/14, andtests/av1-test.pypasses. J700 (Neo) atbc4f27ccba11, in the combined candidate 7.3.0-neo-combined1126, which carries it unchanged: AV1 decode 3/3 streams, 180/180 frames, CRCs equal base. 0 DART faults.Risk: two-way · all Macs with AVD AV1 or VP9 decode. Frames below 256 tiles program exactly as before.
Not yet: AV1 decode CRCs against base on the M5 Pro.
Details
struct avd_av1_ctx::submit_numand the VP9 bank'ssubmit_numare nowu32.max_t()in the PP kick hooks takesu32. The legacy continuation loops run from 1 to the count, so a widened count can't underflowcount - 1.AVDQ_MAX_PP_EXTRA.-E2BIGcheck inavd_qfw_submit()before its descriptor is written. Before, it was sent with a wrapped count.tests/vp9-test.pydoesn't build onmaineither (it refers tosegandseg_clearmembersavd-vp9.cno longer has); not touched here.Evidence
python3 tools/asahi/avd-pp-count-tests.py: 1, 255, 256, 272 and 512 tiles (16x16, 16x17, 32x16, 64x8) get one segment, one PP kick and one legacy EXEC per tile.python3 tools/asahi/avd-pp-count-tests.py --ref 255761f1d55f8dcf3e2c24d17095439237ad6f72: 256 tiles get 1 kick, 272 get 16, 512 get 1.make M=drivers/media/platform/apple/avd LLVM=1 W=1 modulesagainst a configured 7.3 tree: no warnings in the changed files.