Repository navigation
AVD: describe the video decoder's IO-coherent DMA (T8112, T604x) - #1169
Merged
Merged
Conversation
The decoder's DMA is coherent with the CPU caches on the SoCs measured so far. Allow the dma-coherent property so a SoC description can say so. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> Assisted-by: LLM
The T8112 AVD is IO-coherent in both directions. Measured on an M2
(J413) with every cache operation skipped (V4L2_MEMORY_FLAG_NON_COHERENT
plus V4L2_BUF_FLAG_NO_CACHE_CLEAN/INVALIDATE), one picture in flight:
- CPU-dirtied CAPTURE buffers (the whole buffer written right before
QBUF) decode bit-exact, so decoder writes replace CPU cache lines;
- CPU-cached CAPTURE buffers read back bit-exact after DQBUF without an
invalidate;
- bitstream OUTPUT buffers written through a cacheable mapping and
queued without a clean decode bit-exact, so decoder reads see dirty
CPU lines.
Without dma-coherent every decoded frame is mapped uncached: a consumer
that reads pixels (VA-API image download, GStreamer copies, software
fallbacks) reads it at about 2.4 GB/s. With the property the buffers
are cacheable and need no cache maintenance.
M2, same boot, avd-bench, 16 pictures in flight, 3 passes, every frame
checked against software decode (stock -> dma-coherent -> stock):
decode fps h264 1080p 1680-1720 / 1688-1722 / 1699-1727
hevc 1080p 1921-1941 / 1921-1939 / 1890-1935
h264 2160p 438-447 / 438-443 / 438-447
hevc 2160p 485-490 / 485-490 / 486-490
read every frame 1080p 2.94 ms / 0.24 ms / 2.92 ms
2160p 11.73 ms / 1.05 ms / 11.70 ms
decode + read fps h264 1080p 318 / 1718 / 321
h264 2160p 81 / 442 / 81
Decoding alone is unchanged; every result is bit-exact.
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
The T6040 AVD is IO-coherent in both directions, measured the same way as on T8112 on a J616s: with every cache operation skipped and one picture in flight, CPU-dirtied and CPU-cached CAPTURE buffers and CPU-written bitstream buffers queued without a clean all decode bit-exact. T6041 uses the same decoder block and node. On M4 Pro the CPU already reads the uncached mapping fast (about 50 GB/s for 1080p frames), so this changes no measured speed. It describes the hardware correctly, leaves the DART mappings cacheable and needs no cache maintenance. J616s, same boot, avd-bench, 16 pictures in flight, 3 passes, every frame checked against software decode (stock -> dma-coherent -> stock): h264 1080p 1865-1893 / 1866-1891 / 1865-1894 fps hevc 1080p 2584-2610 / 2563-2594 / 2582-2603 fps h264 2160p 479-482 / 478-480 / 478-479 fps hevc 2160p 689-699 / 689-698 / 689-698 fps vp9 1080p 874-879 / 874-879 / 874-878 fps av1 1080p 2278-2308 / 2285-2320 / 2294-2315 fps Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> Assisted-by: LLM
RyanTheTide
marked this pull request as ready for review
November 7, 2026 19:08
Conflict in apple,avd.yaml: integration moved the AVD properties into per-compatible if/then branches. Take integration's file and add dma-coherent to the branch that covers the T8112 and T604x decoders. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> Assisted-by: LLM
RyanTheTide
added a commit
that referenced
this pull request
Nov 7, 2026
Brings aurora-wip up to the 11-08 morning integration tip: DT descriptions for every Mac family (#1094, #1097, #1111, #1131, #1132, #1148, #1149, #1155, #1156, #1157, #1172), the J616s scaler (#1168), the panel primaries from boot data (#1105), AVD macOS command parity (#1116), AVD dma-coherent (#1169), the M2 PMU RTC alarm (#1151), G17 admission without spinning (#1146) and the AOP map wait (#1147). Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> Assisted-by: LLM
This was referenced Nov 9, 2026
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.
Summary
The video decoder's DMA is coherent with the CPU caches, but no Apple DT says so, so Linux maps every decoded frame uncached. Any consumer that reads pixels from a decoded frame reads at about 2.4 GB/s on an M2: VA-API image download (vaapi-copy,
hwdownload), GStreamer copies when the sink has no VideoMeta, and software fallbacks. Zero-copy GPU import is unaffected. On the M2, reading each frame takes 2.9 ms at 1080p and 11.7 ms at 4K, so decode plus read tops out at 320 / 81 fps.This PR adds
dma-coherentto the binding and to the AVD nodes of T8112 (M2) and T604x (M4 Pro/Max). Buffers become cacheable and need no cache maintenance, and no userspace change is needed. Each SoC gets the line only after the probe below passes on it; T8140 (Neo) and T600x (M1 Pro) follow when those machines are back online.Proof that the AVD is IO-coherent (T8112 and T6040)
The test was run on an M2 (J413) and a J616s on fleet27 using avd-bench plus an LD_PRELOAD ioctl shim. The shim allocates with
V4L2_MEMORY_FLAG_NON_COHERENTand queues withV4L2_BUF_FLAG_NO_CACHE_CLEAN | NO_CACHE_INVALIDATE, so every cache operation is skipped. Each case was run at 16 pictures in flight and at 1 (with 1 in flight, nothing evicts the lines between the CPU access and the device access). Every displayed frame was checked against software decode:Benchmark
Same boot, no reboot, 3 passes per row. The phases ran in this order: stock module, then a test-only module that marks the device coherent at probe (the same effect as this DT line), then stock again.
Decode alone is unchanged within noise, and every row is bit-exact. There were no DART faults and no AVC denials, and SELinux stayed enforcing.
For comparison, keeping the coherent default and having userspace set
V4L2_MEMORY_FLAG_NON_COHERENTalso gives 25-29 GB/s readback. But it costs a cache clean of every CAPTURE buffer at QBUF: 200-245 us per 1080p buffer and 800-910 us per 2160p buffer of CPU time. Every consumer would also need changing. Describing the hardware as it is avoids both costs.J616s (T6040)
The probe passes the same way. On M4 Pro the CPU already reads the uncached mapping fast (50.6 GB/s for 1080p, 43.6 GB/s for 4K), so this changes no measured speed there. Same boot, stock / dma-coherent / stock, 3 passes, all rows bit-exact:
There were no DART faults and no AVC denials, and SELinux stayed enforcing. T6041 shares the same decoder node (t604x.dtsi); it has no hardware here.
Checks
dt_binding_checkfor apple,avd.yaml passes; the t8112-j413 DTB compiles withdma-coherenton avd@269080000 and gives no avd schema warnings.🤖 Generated with Claude Code