Repository navigation
arm64: dts: apple: t8103: mark the video decoder dma-coherent - #3839
Conversation
The T8103 AVD is IO-coherent in both directions. Measured on an M1 MacBook Air (J313) with every cache operation skipped (V4L2_MEMORY_FLAG_NON_COHERENT plus V4L2_BUF_FLAG_NO_CACHE_CLEAN and V4L2_BUF_FLAG_NO_CACHE_INVALIDATE): - CPU-dirtied CAPTURE buffers (poisoned with 0xA5 before QBUF) decode bit-exact against software decode on both H.264 1080p60 and HEVC 1080p60, so AVD writes snoop/invalidate CPU cache lines; - CPU-cached CAPTURE buffers read back bit-exact after DQBUF without cache invalidation; - Bitstream OUTPUT buffers written through cacheable mappings and queued without cache clean decode bit-exact on H.264 1080p60, H.264 4K60, and HEVC 1080p60, so AVD reads see dirty CPU cache lines. Because the M1 generation does not report CLIDR_EL1.LoC == 0, omitting dma-coherent maps every AVD buffer uncached. On J313 P-cores, CPU frame readback drops to ~116-119 MiB/s (228.6 ms/frame at 4K, 52.5 ms/frame at 1080p), capping ffmpeg -hwaccel v4l2request decode+readback to ~19 fps on 4K60 H.264. Marking the shared t8103.dtsi avd node dma-coherent lifts CPU readback to ~19.2 GiB/s (~162-166x faster) across all T8103 Macs (J274, J293, J313, J456, J457) with zero DART faults and bit-exact output. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Approved at f0674cb. This matches every other AVD node in the tree (t600x, t604x, t8112, t8122, t8132, t8140). The coherency proof is the right one: NON_COHERENT bufs, a 0xA5 poison, and NO_CACHE_CLEAN/INVALIDATE on both queues still give bit-exact output for H.264 and HEVC. Leaving avd_dart without dma-coherent is consistent with the other SoCs. Follow-up, not a blocker: rows on the remaining T8103 boards.
|
Merging at |
What: Mark the shared T8103 video decoder node (
avd@269080000int8103.dtsi)dma-coherent, matching every other Apple Silicon SoC (t600x,t604x,t8112,t8122,t8132,t8140), so CPU pixel readback maps AVD buffers cacheable (~19 GiB/s instead of ~116 MiB/s on M1 P-cores).Tested: J313 M1 MacBook Air 13-inch at
f0674cbd19cb(7.3.0-t8103-avd-coh+): boots cleanly with/proc/device-tree/soc/avd@269080000/dma-coherentpresent, 0 new kernel errors, 0 DART/AVD faults,s2idle [deep]; 4K60 H.264 CPU readback rises from115.7 MiB/s(228.61 ms/frame) to18,868.0 MiB/s(1.40 ms/frame, 163x faster) and decode+readback rises from19 fps(0.31x) to93 fps(1.56x, 4.9x faster), bit-exact MD5 vs SW decode; 1080p60 H.264 (19,047 MiB/s) and HEVC (19,118 MiB/s, up from119.1 MiB/s) both bit-exact MD5.Risk: two-way door · M1 (T8103) Macs (J274, J293, J313, J456, J457)
Not yet: J274, J293, J456, J457 live
dma-coherentdecode runs (all sharet8103.dtsiavd@269080000and passeddtbs_checkwith 0 warnings)Details
cf04ed335f2c,3ab7b67be044), M1 (T8103) does not reportCLIDR_EL1.LoC == 0, so Linux maps AVD DMA buffers uncached unlessdma-coherentis declared in DT.dma-coherentby forcingV4L2_MEMORY_FLAG_NON_COHERENTonVIDIOC_CREATE_BUFS, poisoning every CAPTURE buffer with0xA5right beforeQBUF, and settingV4L2_BUF_FLAG_NO_CACHE_CLEAN | V4L2_BUF_FLAG_NO_CACHE_INVALIDATEon both OUTPUT and CAPTUREQBUF/DQBUFso every kernel cache maintenance operation is skipped:0xA5, no cache ops): bit-exactMD5=52eac167d093f87a7b6a17167b38a7f9(19,176.8 MiB/s).0xA5, no cache ops): bit-exactMD5=bb5b1fc266fcc22a61b70fed0f90816a(19,296.1 MiB/s).MD5=bf2079d5546252ee54a18c90cc025d46(19,181.6 MiB/s).t8103.dtsiis shared by all five T8103 boards (t8103-j274,t8103-j293,t8103-j313,t8103-j456,t8103-j457), addingdma-coherentthere covers every M1 Mac uniformly.Evidence
Exact-head J313 (
air) same-machine A/B atf0674cbd19cb(7.3.0-t8103-avd-coh+, P-corecpu4)ffmpeg -hwaccel v4l2request, P-corecpu4)dma-coherent)f0674cbd19cb(dma-coherent)115.7 MiB/s(228.61 ms/frame)18,868.0 MiB/s(1.40 ms/frame)bf2079d5546252ee54a18c90cc025d46)19 fps(0.31x,15.98 s)93 fps(1.56x,3.21 s)19,047.2 MiB/s(0.35 ms/frame)52eac167d093f87a7b6a17167b38a7f9)119.1 MiB/s(52.54 ms/frame)19,118.0 MiB/s(0.33 ms/frame)bb5b1fc266fcc22a61b70fed0f90816a)Linux air 7.3.0-t8103-avd-coh+ #3 SMP PREEMPT_DYNAMIC aarch64,/proc/device-tree/soc/avd@269080000/dma-coherentpresent,mem_sleep: s2idle [deep], 0 DART/AVD faults, 0 new kernel errors (only pre-existingaurora-touchid-setup.servicefactory calibration message)../scripts/checkpatch.pl --strict -g HEAD:0 errors, 0 warnings, 0 checksCHECK_DTBS=y DT_SCHEMA_FILES="apple,avd.yaml"ont8103-j274.dtb,t8103-j293.dtb,t8103-j313.dtb,t8103-j456.dtb,t8103-j457.dtb: 0 warnings