Skip to content

media: apple: scaler: add the M3, M3 Pro, Max and Ultra engines (on #2252) - #2429

Closed
RyanTheTide wants to merge 2 commits into
integration/aurorafrom
m3-media/scaler
Closed

RyanTheTide wants to merge 2 commits into
integration/aurorafrom
m3-media/scaler

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Stacked on #2252 (M2 Pro/Max/Ultra engines): this branch contains its commit ff0deb5 plus one M3 commit. Review only the top commit; merge after #2252.

Problem

The scaler (MSR) driver matched no M3-generation engine, so the disabled scaler and scaler-DART nodes for T8122, T6030, T6031/T6034 and T6032 (added by Ryan Murray in 982f330 and 4c28191) had no driver and stayed off. The rule is that a block is on by default on every machine that has it, chosen by a hardware property, with no per-chip copies of the driver.

Change

  • Driver: two variant entries keyed on the MSR hardware version: 16 (T8122: three ranges) and 17 (T6030, T6031, T6032: four ranges, the extra one being the PMGR-facing range of the later engines). apple,t6031-scaler and apple,t6032-scaler reuse the T6030 data, so there is no per-chip code. Both run the common job that hardware-version 12/13/14 engines already run, without the MSR20 control block.
  • DT: enable the existing scaler and scaler-DART nodes in the SoC dtsi files: one engine on M3 and M3 Pro, two on M3 Max (T6031 and T6034), four on M3 Ultra (two per die). Every board of each SoC has these engines, so no board files change.
  • Binding: apple,scaler.yaml already lists the M3 compatibles. This adds tighter limits: exactly three ranges on T8122, four on T6030/T6031, and both DART streams on all three.

Testing

  • make W=1 drivers/media/platform/apple/scaler/ (arm64, LLVM): in progress at PR time (the first attempt failed in modules_prepare on a Rust bindings error from the shared config, so it is being rebuilt with Rust off). The result will be posted as a comment.
  • All M3 DTBs (T8122 x8, T6030 x2, T6031/T6034 x4, T6032 x1) built before and after: T8122 (7 DTBs) and T6031/T6034/T6032 (5 DTBs) build with 0 new dtc warnings, and the only change is the status of the scaler and scaler-DART nodes (2 lines on T8122, 4 on T6031/T6034, 8 on J575d). The two T6030 DTBs (j514s, j516s) fail in dtc both before and after this change, on the float literals in t6030-gpu.dtsi:102, which this PR does not touch, so the T6030 nodes were checked in the source only.
  • Binding: dt-doc-validate and yamllint pass. The J615, J514c, J575d and J516m DTBs pass dt-validate against the updated schema, and a J615 DTB edited to give the scaler four ranges is rejected as expected.
  • KUnit apple-scaler (arm64): not run yet. The tests cover the CSC, format and job tables, not the match table, and this PR does not change any of them.
  • The node values were checked against the ADT of each M3 board and against our own IODeviceTree capture of a J615 under macOS 27.2.

Still to run

  • Scaler module W=1 result and scaler KUnit (posted as a comment when done).
  • T6030 DTB build once the t6030-gpu.dtsi float literals are fixed.
  • No M3 hardware test yet: the M3 Air (J615) is still in macOS. On first boot, the J615 row needs one probe line (hardware-version 16 and the engine id) with no DART faults, v4l2-compliance -s, and NV12/P010 to BGRx plus BGRx to NV12 at 1080p compared with a software reference. If the first job times out, the first thing to test is the MSR20 control block (see below). M3 Pro/Max/Ultra rows will come from community owners.
Per-SoC hardware facts (ADT of each board)
SoC boards engines hw-version MSR range ranges IRQs DART
T8122 j433 j434 j504 j613 j615 scaler0 @31d000000 16 0x30000 3 751, 753 @31d200000 irq 752, SID 0 pixel / 1 PIODMA mapper
T6030 j514s j516s scaler0 @391000000 17 0x30000 4 (+@390000000 0x8000) 860, 862 @391200000 irq 861
T6031/T6034 j514c j516c j514m j516m scaler0 @407000000, scaler1 @3c7000000 17 0x30000 4 1291/1293, 1297/1299 @407200000 irq 1292, @3c7200000 irq 1298
T6032 j575d scaler0-1 on die 0, scaler2-3 on die 1 (same offsets, die-1 AIC) 17 0x30000 4 as T6031 per die as T6031 per die

Power domains: the DT nodes use the MSR (or MSRn) pwrstate and the MSR ASE core below it. The PMGR device list confirms both (T8122 0x428/0x498, T6030 0x508/0x560, T6031 MSR0 0x518/0x590, MSR1 0x508/0x538). The ADT MSR-V and MSRn-DART gates are aliases of those same pwrstates, so the DART node's MSR domain is correct. The SOC-VNOM/VMAX entries are performance votes, not power domains, and are not modelled. Only status changes in the DT.

Compared with the engines the driver already supports:

  • hardware-version 10-14: 0x28000 MSR range, 2-3 ranges, common job only
  • hardware-version 16/17: 0x30000, 3 (T8122) or 4 (T603x) ranges
  • hardware-version 20-22: 0x38000, 4 ranges, common job plus the MSR20 control block at 0x2e300
Open question: the MSR20 control block on hardware-version 16/17

The M3 MSR range (0x30000) is large enough to hold the 0x2e300-0x2e318 words that the MSR20 engines program. The hardware description shows the size of the range but not which blocks are inside it. This PR uses the job that hardware-version 12, 13 and 14 engines run without that block, because more generations have been tested with it. A wrong guess fails safely: the job times out (500 ms watchdog), the engine is reset, and the buffer is returned with an error. If the J615 times out, the next step is a one-line test build with .msr20 = true in apple_scaler_t8122.

The scaler DARTs keep the full DART input address space, as on T8112 and T8132. The ADT DVA window (base 1 TiB) is not added as apple,dma-range until a DART probe on M3 confirms the input address width.

Assisted-by: LLM (Claude:Opus 5.5)

RyanTheTide and others added 2 commits November 19, 2026 22:26
The scaler matched T8103, T6000, T8112 and the M4/A18 Pro engines, but
not T6020, T6021 or T6022. Their device trees describe the MSR engines
(one on M2 Pro, two on M2 Max, four on M2 Ultra) and keep them disabled
because nothing would bind.

The driver needs two things from a variant: the number of register
ranges and whether the engine has the MSR20 control block (M4 and
later). The T602x nodes have the T8112 register map: three ranges of
0x28000, 0x4000 and 0x4000 bytes at +0, +0x210000 and +0x204000, two
DART streams, and the "apple,scaler" fallback. The scaler binding
already puts apple,t6020/t6021/t6022-scaler in the same constraint
group as apple,t8112-scaler. They are M2-generation engines, before
MSR20. Use the T8112 data for them.

Enable the engines and their DARTs in the T6020, T6021 and T6022
peripheral trees, so every board with the SoC gets them. The DARTs name
the MSR domain of their own die (commit 4109497, "arm64: dts:
apple: t602x: give the scaler and external DCP DARTs their power
domains"), so the DART's first register read finds its block powered.
The engines additionally vote the T602x media fabric domain (ps_afr),
which the driver links through its power-domain list.

T8103, T6000/T6001/T6002 and T8112 device trees are unchanged.

Signed-off-by: Ryan Murray <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The scaler driver did not match the M3 generation, so the disabled
scaler and scaler-DART nodes Ryan Murray described for T8122, T6030,
T6031 (also used by T6034) and T6032 in 982f330 and 4c28191
had no driver and stayed off.

The M3 engines report hardware-version 16 (T8122) and 17 (T6030, T6031,
T6032) in the hardware description of every M3 board. Compared with the
engines the driver already knows:

  - MSR aperture 0x30000: larger than the 0x28000 of hardware-version
    10 to 14, smaller than the 0x38000 of the MSR20 engines (20 to 22).
  - Two interrupts (MSR, PIODMA) and a T8110 DART with the pixel stream
    at SID 0 and the PIODMA mapper at SID 1, as on every other engine.
  - T8122: three register ranges like T6000/T8112. T6030/T6031/T6032:
    the fourth, PMGR-facing range of the later engines.

Add one variant for each hardware version and run them on the common
job without the MSR20 control block, the job that hardware-version 12,
13 and 14 engines already run. Whether hardware-version 16/17 also has
the MSR20 block inside its larger aperture is not visible in the
hardware description; a job that does not complete is caught by the
500 ms watchdog.

Enable the scaler and its DART in the SoC dtsi files: one engine on
M3 and M3 Pro, two on M3 Max, four on M3 Ultra (two per die). Every
board of each SoC has these engines. The existing nodes were checked
against the hardware description of each board and our own
IODeviceTree capture of a J615: register ranges, interrupts, DART SIDs
and the MSR / MSR ASE core power domains all match, so only the status
changes.

In the binding, require exactly three ranges on T8122, four on
T6030/T6031, and both DART streams on all three.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Build and KUnit results for the M3 scaler commit (e70c9fa), arm64, LLVM, on the shared integration config with CONFIG_RUST turned off (its modules_prepare fails in rust/bindings.o for reasons unrelated to this PR):

  • make W=1 drivers/media/platform/apple/scaler/: rc 0, no warnings (apple-scaler-drv, -hw, -test and the module link).
  • apple-scaler KUnit (drivers/media/platform/apple/scaler/.kunitconfig): 17 of 17 passed.

Still to run: T6030 DTBs with the system dtc (blocked on the t6030-gpu.dtsi float literals, unrelated) and the J615 hardware row once that Mac boots Linux.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J615 row (MacBook Air 15" M3, T8122, macOS 27.2 firmware): the hardware-version 16 variant works with the common job. Cold one-shot boot with this PR's driver change (as a module on the 7.3 lab kernel) and the T8122 scaler and DART nodes enabled: MSR hardware-version 16, id 0x10d0041; the MSR check (1080p colour bars vs a software reference, 19 jobs each) passes all five conversions with max error <= 1: NV12M BT.709 limited -> ARGB (0, 1.37 ms per job), NV12 BT.601 -> ARGB, NV12M BT.709 full -> ARGB, ARGB -> NV12M (0.98 ms), P010 BT.2020 -> ARGB (1.42 ms). No DART faults, no driver errors, and the engine runtime-suspends after idle. So the open question about the MSR20 control block on hwv16 is answered for T8122: not needed.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

#2252 has been replaced by #2793, which carries the M2 Pro/Max/Ultra scaler commit with its trailer fixed. This branch still carries the old ff0deb5 (Co-Authored-By trailer), so it needs a replacement branch with only e70c9fa on top of #2793, then it merges after #2793; the J615 row is in.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2804: the same changes with the commit trailers fixed, on the current integration/aurora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant