Skip to content

arm64: dts: apple: t8103: mark the video decoder dma-coherent - #3839

Merged
RyanTheTide merged 1 commit into
mainfrom
feat/t8103-avd-dma-coherent
Dec 1, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
feat/t8103-avd-dma-coherent

Conversation

@sithglan

@sithglan sithglan commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

What: Mark the shared T8103 video decoder node (avd@269080000 in t8103.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-coherent present, 0 new kernel errors, 0 DART/AVD faults, s2idle [deep]; 4K60 H.264 CPU readback rises from 115.7 MiB/s (228.61 ms/frame) to 18,868.0 MiB/s (1.40 ms/frame, 163x faster) and decode+readback rises from 19 fps (0.31x) to 93 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 from 119.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-coherent decode runs (all share t8103.dtsi avd@269080000 and passed dtbs_check with 0 warnings)

Details
  • Like M1 Pro/Max/Ultra (cf04ed335f2c, 3ab7b67be044), M1 (T8103) does not report CLIDR_EL1.LoC == 0, so Linux maps AVD DMA buffers uncached unless dma-coherent is declared in DT.
  • Bidirectional hardware IO-coherency was verified on J313 before adding dma-coherent by forcing V4L2_MEMORY_FLAG_NON_COHERENT on VIDIOC_CREATE_BUFS, poisoning every CAPTURE buffer with 0xA5 right before QBUF, and setting V4L2_BUF_FLAG_NO_CACHE_CLEAN | V4L2_BUF_FLAG_NO_CACHE_INVALIDATE on both OUTPUT and CAPTURE QBUF/DQBUF so every kernel cache maintenance operation is skipped:
    • H.264 1080p60 (60 frames, poisoned 0xA5, no cache ops): bit-exact MD5=52eac167d093f87a7b6a17167b38a7f9 (19,176.8 MiB/s).
    • HEVC 1080p60 (60 frames, poisoned 0xA5, no cache ops): bit-exact MD5=bb5b1fc266fcc22a61b70fed0f90816a (19,296.1 MiB/s).
    • H.264 4K60 (60 frames, no cache ops): bit-exact MD5=bf2079d5546252ee54a18c90cc025d46 (19,181.6 MiB/s).
  • Because t8103.dtsi is shared by all five T8103 boards (t8103-j274, t8103-j293, t8103-j313, t8103-j456, t8103-j457), adding dma-coherent there covers every M1 Mac uniformly.
Evidence

Exact-head J313 (air) same-machine A/B at f0674cbd19cb (7.3.0-t8103-avd-coh+, P-core cpu4)

Workload (ffmpeg -hwaccel v4l2request, P-core cpu4) Stock (no dma-coherent) f0674cbd19cb (dma-coherent) MD5 vs SW decode
H.264 4K60 CPU readback (60 frames, 156 Mbps peak) 115.7 MiB/s (228.61 ms/frame) 18,868.0 MiB/s (1.40 ms/frame) Bit-exact (bf2079d5546252ee54a18c90cc025d46)
H.264 4K60 decode + CPU readback (5 s / 300 frames) 19 fps (0.31x, 15.98 s) 93 fps (1.56x, 3.21 s) Bit-exact
H.264 1080p60 CPU readback (60 frames) (uncached) 19,047.2 MiB/s (0.35 ms/frame) Bit-exact (52eac167d093f87a7b6a17167b38a7f9)
HEVC 1080p60 CPU readback (60 frames) 119.1 MiB/s (52.54 ms/frame) 19,118.0 MiB/s (0.33 ms/frame) Bit-exact (bb5b1fc266fcc22a61b70fed0f90816a)
  • Boot & health on J313: Linux air 7.3.0-t8103-avd-coh+ #3 SMP PREEMPT_DYNAMIC aarch64, /proc/device-tree/soc/avd@269080000/dma-coherent present, mem_sleep: s2idle [deep], 0 DART/AVD faults, 0 new kernel errors (only pre-existing aurora-touchid-setup.service factory calibration message).
  • Static & schema checks:
    • ./scripts/checkpatch.pl --strict -g HEAD: 0 errors, 0 warnings, 0 checks
    • CHECK_DTBS=y DT_SCHEMA_FILES="apple,avd.yaml" on t8103-j274.dtb, t8103-j293.dtb, t8103-j313.dtb, t8103-j456.dtb, t8103-j457.dtb: 0 warnings

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>
@sithglan
sithglan requested review from a team as code owners December 1, 2026 21:52
@sithglan
sithglan requested review from Acelogic and malik-na December 1, 2026 21:52
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at f0674cbd: not ready yet

Check Detail
CI at head running running: dt-checks, host-tests
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok in the PR body at f0674cbd
Conflicts ok none
PR text ok Risk: two-way · M1 (T8103) Macs (J274, J293, J313, J456, J457)

Areas: area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at f0674cbd19cb (B2 merge train, 12-01 merge bar). Approval at this head: RyanTheTide. Row: the hardware row at f0674cb that the readiness check found (PR body or comment). CI: train L17 = main 539585d + #3836 #3839 #3825: Apple build + changed .c objects (incl. drivers/edac) + DTBs pass; hosted host-tests reds = main's pre-existing fails Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit b1dffde into main Dec 1, 2026
7 of 8 checks passed
@RyanTheTide
RyanTheTide deleted the feat/t8103-avd-dma-coherent branch December 1, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants