Repository navigation
Conversation
T6000 and T8112 run the 6070.11.1 Start and Process commands that were qualified on hardware byte for byte. Nothing tests that those bytes stay the same when the shared 6070 writer changes for another chip. Add a KUnit case that builds Start and the first two Process commands for H.264 and HEVC, at 1280x720 30/1 and 1920x1080 30000/1001, with default session parameters, and compares their CRC32 with the values the builder produces at this commit. Assisted-by: Grok 4.7 Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
Every instance creates the debugfs directory apple-ave. On a machine with two encoders the second one fails to create it and has no lifecycle_test, inject_wedge or last-command files. Name the directory apple-ave-<device name>, for example apple-ave-40d100000.video-codec, and update the two documents that give the old path. The path changes on every chip. Assisted-by: Grok 4.7 Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
|
Thanks for the T6021 encoder bring-up. The pinned-bytes KUnit case is a nice way to show T6000 and T8112 are untouched. One convention point. We select behaviour by a hardware or firmware property, not by the list of machines it was run on. If the two-session capacity comes from the larger T6021 firmware build (its bigger DATA, for example), please say so in a comment at A small note: the quarantine growth while one session stays open has no cap. A bound or a log line would help. |
|
Thanks, this is careful work. The parts that let one driver serve several encoders are general: a debugfs directory per device, a CRC and an
We will run no-regression rows for commits 2-4 on M1 Pro and M2: bind on today's loader, |
A boot loader that hands over two encoders cannot name both DATA images with the one /chosen aurora,ave-data-crc32 property, and the encoders share one TEXT reservation, so its iommu-addresses property carries one tuple per encoder. Read aurora,crc32 from each memory-region reservation and fall back to the /chosen property when it is absent. Accept several iommu-addresses tuples and use the one whose phandle is this device; a reservation with none, or with two for this device, is refused as before. Describe the reservation property in the admin guide, next to the /chosen ones. Every chip goes through this code. With today's boot loader (no aurora,crc32, one tuple per reservation) it does what it did before; only T6021 was run. Assisted-by: Grok 4.7 Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
The driver requires the extra0 register window to start on a 16 KiB boundary. On T6021 neither encoder's window does: ave0's is 0x7c44 bytes at 0x2902803e0, ave1's 0x3dfc bytes at 0x28e680228. dma_map_resource() maps the pages that contain an unaligned range and returns the IOVA of its first byte, which is the address Config takes. Drop the alignment check, and map the larger of the resource size and the variant size, so that the whole window is covered: with the variant size alone, the last 0x24 bytes of ave0's window would be unmapped. T6000's window is 0x24 bytes at a 16 KiB aligned address and T8112's is page aligned and exactly its variant size, so both map 0x4000 bytes as before. The alignment check goes for every chip: an unaligned window is now mapped, not refused. The only such window outside T6021 is on the second M1 Max encoder, which the device trees leave disabled. Assisted-by: Grok 4.7 Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
The M2 Max runs a larger build of the 6070.11.1 firmware the T6000 and T8112 support uses, AppleAVE2FW_H14C: TEXT 0xf0000 and DATA 0x134000, with the link cell at TEXT 0x423c. Its two encoders share TEXT and each has its own DATA. The coprocessor registers, boot argument and timebase are T8112's. With boot device ID 20 and device type 17 both encoders of a J475c boot, answer the handshake and encode. The identity CRC, TEXT with the link cell cleared, is 0x0d56db87; select the 6070.11.1 layout for it. Config on T6021 needs a shared area. With the pointer and size at +0x60 and +0x68 left zero, as on T8112, the firmware never answers Config. With a 64 KiB, 16 KiB-aligned area both encoders answer Config, Open and Start. Allocate it at the first boot, keep it until the device is removed, and pass it for a variant with config_shared. That is a property of the H14C build rather than of 6070.11.1: the T8112 build answers Config with both words zero. The 6070 sessions on T6021 run the T6000/T8112 commands unchanged in this commit: one constant-quality session per encoder. abi.rst said 6070 streams H.264 without B pictures; the 6070 path already offers HEVC Main and B pictures, so describe that, and say what T6021 adds and what each value was checked against. The Kconfig help now says what each chip offers. Assisted-by: Grok 4.7 Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
A session the firmware saw keeps its buffers until the coprocessor is proved to have lost power, and that happens only after the last session closes. With two sessions per boot, one long-lived stream and a second that is opened and closed again and again keep every closed session's buffers, a full set per session, with no bound. Count the sessions waiting for the reap. Once four wait, refuse a new session that would join the running firmware with EBUSY and a rate-limited warning. The refused session was never handed to the firmware, so it is freed at once. When the last stream closes, the power cycle frees all of them and resets the count. This holds for every layout; 9003 already ran two sessions per boot. Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
The 6070.11.1 layout allows one session per firmware boot, while the driver already keeps the process buffers per session. Allow two, on every SoC that runs this firmware. On a J475c, four H.264 sessions, two on each encoder, ran in real time for five minutes at their target rates, and a fifth STREAMON got EBUSY. T6000 and T8112 were not run with two sessions. When the first of two sessions closes, its buffers stay quarantined until the last session closes and the encoder is power cycled, as on 9003. Assisted-by: Claude Opus 5.5 Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
|
Thanks for the review. The updates are pushed; replies to each of your comments below. Re: There is no T6021-specific reason, so the cap is now on the layout: The quarantine is now bounded (new commit 6, Measured on the J475c (
So four stopped sessions cap the quarantine at ~130 MiB per encoder; KUnit also covers the count. Also run on the J475c: Re: two requests; no-regression rows for commits 2-4
Thanks for the commit 2-4 rows. The debugfs path in those rows is now |
|
Thanks for round 4. Putting |
|
@ludagoo, a tidy-up pass over the open PRs here. These of yours need something:
If any of these are no longer needed, closing them helps; otherwise a merge or rebase onto integration/aurora is usually all they need. Thanks! |
Both video encoders of the M2 Max, constant-quality H.264 and HEVC, and two sessions per firmware boot on every 6070.11.1 encoder.
Base:
integration/aurora0abc2f385e54. Seven commits on branchave/t6021(ludagoo/linux), tip9aadf56a25ad. Needs aurora-silicon/aura#341 (the boot loader hand-off). The encode-quality changes are #2375, on top of this one, and the device tree is #2373 and #2376.9a4f94ef751e). A KUnit case builds Start and the first two Process commands from the 6070.11.1 layout with default parameters and compares their CRC32 with the base. Every later commit here and in media: apple: ave: 6070.11.1 encode quality: H.264 references, CBR/VBR, VUI timing #2375 passes it.dce6e177789b).apple-ave-<device>, because the second encoder could not createapple-ave. The path changes on every chip; the two documents that give it are updated.851ad30ab202).aurora,crc32on eachmemory-regionreservation, with/chosenas the fallback, and severaliommu-addressestuples (the encoders share TEXT); the admin guide describes the reservation property. Every chip goes through this code. With today's boot loader (noaurora,crc32, one tuple per reservation) it does what it did before; only T6021 was run.aa930a5963ae). Neither T6021 window is (ave0 0x7c44 bytes at 0x2902803e0, ave1 0x3dfc at 0x28e680228). The mapping covers the larger of the resource and the variant size. T6000's and T8112's mappings do not change (both windows are 16 KiB aligned). The alignment check is dropped for every chip; see arm64: dts: apple: t6001, t6002: enable every video encoder #2295 for the one other unaligned window, on a disabled node.805c89fc6e67). AppleAVE2FW_H14C, a larger build of 6070.11.1 (TEXT 0xf0000, DATA 0x134000) with T8112's registers, boot argument and timebase. Sessions run the T6000/T8112 commands unchanged: one constant-quality session per encoder at this commit.b4de0709d3f8, new). A session the firmware saw keeps its buffers until the encoder is power cycled, which happens only after the last session closes. Once four wait, a session that would join the running firmware gets EBUSY with a rate-limited warning; the count resets at the power cycle. This holds for every layout (9003 already runs two sessions per boot).9aadf56a25ad).max_sessionsis 2 on the 6070.11.1 layout, so T6000, T8112 and T6021 all get it. Four on an M2 Max; a fifth STREAMON gets EBUSY.The lifecycle is upstream's, unchanged: Halt after every session, VENC power cycle before the next.
What each T6021 value was checked against on the J475c (also in
abi.rst):config_shared, because it belongs to the H14C build: T8112's build of 6070.11.1 answers Config with both words zero. The area is allocated at the first boot and kept until the device is removed.Overlap: #2218 and #1900 (T8142) and #1990 (Neo) conflict textually with this PR if they merge first (
ave.h; #1990 alsoave-abi-test.c). A rebase needs KUnit again, not hardware. #1861 merges cleanly.Tested
apple-ave(arm64, LLVM) at every commit: 44 at the base, 45 at commits 1-5, 46 at commits 6 and 7 (ave_quarantine_count: four handed sessions and one never handed, the count is four, and the reap frees them and clears it). All pass, no compiler warnings.checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on every commit.tools/asahi/run-host-tests.py --only ave: 6/6 at the base and at this tip./dev/video11= 40d100000,/dev/video12= 507100000). All VENC domains are off after boot and again a few seconds after each session.lifecycle_test10 times per encoder: 10/10 each, and the encoders encode afterwards./proc/vmallocinfolines whose caller containsdma): 393 mappings, 199901184 bytes, both times, so the quarantine is emptied. That output was read in the session; no log file was kept.echo platform > /sys/power/pm_test; echo freeze > /sys/power/state, idle after use and again while a paced H.264 session streamed: both returned, the streaming session finished all 300 pictures, both encoders encoded afterwards, and the VENC domains powered off again.The lifecycle depends on the device tree. With the
apple,t6000-ave-dmablocks next to each encoder enabled,apple-ave-dmabinds them,ps_venc_sysandps_venc1_sysstay on, the power cycle no longer resets the coprocessor, and after the first session every boot goes unanswered (10 tries, then EAGAIN). #2376 leaves them disabled.Not done yet
rmmodof the driver were not exercised on T6021.pm_test=platformwas.🤖 Generated with Claude Code