Repository navigation
media: apple: scaler: M3 family engines, keep CAPTURE at the OUTPUT size - #2804
Draft
RyanTheTide wants to merge 6 commits into
Draft
RyanTheTide wants to merge 6 commits into
RyanTheTide wants to merge 6 commits into
Conversation
…ery laptop The AOP accelerometer and gyroscope children were described only in t6000-j316s.dts and t8112-j413.dts, the two machines whose Apple device trees were at hand. The other 14" and 16" M1 Pro/Max MacBook Pros (J314s, J314c, J316c) and the other M2 laptops (J415, J493) share the same AOP and are left without them. Nothing in the description is board specific. The AOP core creates a service device only when the firmware announces the "accel" or "gyro" service, and gives it the AOP child of the same name. The driver then starts the sensor only with the calibration the bootloader copies into that child from the Apple device tree, and returns -ENODEV with one info line otherwise. On a machine without the sensor the child stays unused. Move the children to t600x-j314-j316.dtsi, next to the AOP enable of every M1 Pro/Max laptop, and to the AOP node in t8112.dtsi, next to the las and als services that are already there. The T8112 Mac mini (J473) keeps its AOP disabled, so the children are inert there. The J316s and J413 DTBs are byte-identical before and after. Fixes: 165f4bd ("arm64: dts: apple: describe reference Mac motion and peripheral endpoints") Signed-off-by: Ryan Murray <[email protected]>
The Mac Pro's die 0 HDMI port has its audio controller (dpaudio1) enabled, and that controller takes its DMA from the die 0 SIO. The loader sets up and enables each SIO it finds through an alias, and t6022-jxxxd.dtsi only aliases the die 1 SIO (sio1), so the die 0 SIO stays disabled and the die 0 HDMI port has no audio. Add the sio alias for the die 0 SIO. The Mac Studio (J475d) is not changed: all its display outputs, and their audio, run from die 1. This is the SIO hunk of linux#1115, split from that PR's Neural Engine changes so it can be reviewed on its own. Signed-off-by: Ryan Murray <[email protected]>
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 since 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]>
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]>
Contributor
Author
|
Review at b693335 (non-author, draft). Blocked on #2793 (its three commits are underneath; top commit reviewed only). No blocker in the delta itself, but it should not leave draft before one M3 machine has booted it.
Small points, not blocking:
Assisted-by: LLM (Claude:Opus 5.5) |
An odd RGB OUTPUT size and a 4:2:0 CAPTURE request round the CAPTURE dimensions up. The format ioctls succeed, but the job builder rejects the resulting unequal-size pair. Keep the active OUTPUT dimensions for CAPTURE and use the existing RGB fallback if the requested format cannot represent them. Preserve compatible format requests and existing OUTPUT negotiation. Signed-off-by: Ryan Murray <[email protected]>
…PUT size Folds #2971 into this PR unchanged. Signed-off-by: Ryan Murray <[email protected]>
This branch has not been deployed
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.
What: media: apple: scaler: M3 family engines, keep CAPTURE at the OUTPUT size. This PR now carries these drafts as one feature (merge commits, the commits themselves unchanged):
Tested: each part as tested on its own PR (folded bodies below; no hardware row on this head yet). Combined with current main (ba29027) together with the other folds of 11-25: full arm64 build (Image, modules, dtbs; fleet89 config, clang 22, rustc 1.97.1) clean.
Risk: two-way · M3, M3 Pro/Max/Ultra (scaler)
Not yet: a scaler row on an M3 Mac (J615) on this head.
#2804 original description
Replaces #2429 (same change, commit trailers fixed). It sits on #2793 (which replaced #2252) and merges after it.
Stacked on #2793 (M2 Pro/Max/Ultra engines): this branch contains #2793's three commits (head 6f0d2c1) plus one M3 commit. Review only the top commit; merge after #2793.
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
apple,t6031-scalerandapple,t6032-scalerreuse 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.apple,scaler.yamlalready 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 inmodules_prepareon a Rust bindings error from the shared config, so it is being rebuilt with Rust off). The result will be posted as a comment.statusof 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 int6030-gpu.dtsi:102, which this PR does not touch, so the T6030 nodes were checked in the source only.dt-doc-validateand yamllint pass. The J615, J514c, J575d and J516m DTBs passdt-validateagainst the updated schema, and a J615 DTB edited to give the scaler four ranges is rejected as expected.Still to run
t6030-gpu.dtsifloat literals are fixed.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)
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
statuschanges in the DT.Compared with the engines the driver already supports:
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 = trueinapple_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-rangeuntil a DART probe on M3 confirms the input address width.#2971 original description
Problem
An odd RGB OUTPUT size can be paired with a 4:2:0 CAPTURE format that rounds one or both dimensions up. The format ioctls succeed, but the same-size hardware job builder rejects the pair.
Change
Keep the active OUTPUT dimensions. Use the existing RGB fallback when the requested CAPTURE format cannot represent those dimensions. TRY_FMT, CAPTURE S_FMT and CAPTURE revalidation after OUTPUT S_FMT use the same helper.
Testing
Stock J413 fleet85 reproduced four format failures on the 13.5 stub. All three compatible controls passed, with zero new kernel errors, SELinux AVCs or failed units. J413 stock row
Format and build results
The native and emulated ARM64 host harnesses execute the scaler format callbacks and the V4L2 multiplanar fill helper. They use simulated format metadata and queue state. The candidate's CAPTURE-first sequence returns 641 × 481 ARGB32, and the four compatible state controls agree. Strict checkpatch reported zero errors, warnings or checks.
Still to run
Run the signed-candidate ioctls and stream a CAPTURE-first frame on the default command line. Run the stock and candidate controls on J473 and other available Macs with the scaler. Check kernel errors, AVCs and failed units.