Repository navigation
drm/apple: report the internal panel colour gamut (Display P3 on M4 Pro/Max) in the EDID - #1021
Conversation
Internal panels are calibrated by the factory to a standard colour space, and the display coprocessor applies that calibration itself. On the M4 Pro and M4 Max MacBook Pros the firmware does not publish the panel's primaries, so the OS cannot learn the gamut from the hardware. Add an optional apple,color-gamut string to the panel node naming that target: "srgb" or "display-p3". Each name stands for a published colour space (primaries, D65 white, nominal gamma 2.2), so the device tree carries no hand-tuned coordinates and no per-unit calibration. A named enum is used instead of raw chromaticity cells because the panels are specified by the colour space they target, the schema can check the value, and a new panel only needs a known name. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The EDID built for a desktop 26.x internal panel carries only a nominal D65 white when the firmware does not publish chromaticities, which is always the case on the J616s. Compositors read the zero primaries as bogus colour characteristics and build no colour profile, so the P3 panel is treated as an unknown display. Read the optional apple,color-gamut property of the panel node and map it to the standard primaries, D65 white and nominal gamma 2.2 of sRGB or Display P3. When building the panel EDID, complete and valid firmware chromaticities still win; otherwise the device tree target is used; without either the EDID keeps the white-only description, so boards without the property are unchanged. An unknown or malformed value is ignored with a warning. Per-unit factory calibration is applied by the DCP and is never reported. The property is read for every internal panel, whichever firmware drives it, and kept with the panel dimensions, so the target applies wherever a panel EDID is synthesised. Cover the precedence, the fallback for absent, partial and rejected firmware colour, the unchanged output without a target and the rejected property values in KUnit and the host colorimetry test. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Apple's technical specifications for the MacBook Pro (14-inch, M4 Pro or M4 Max, 2024) and the MacBook Pro (16-inch, 2024) list "Wide color (P3)" for the built-in display: https://support.apple.com/en-us/121553 https://support.apple.com/en-us/121554 Set apple,color-gamut = "display-p3" on the J614s, J616s and J616c panel nodes so the synthesised EDID reports P3 primaries, a D65 white and gamma 2.2 instead of a white point alone. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
|
Hardware result on the J616s (MacBook Pro 16" M4 Pro). Setup: kernel 7.3.0-gapscol1 (this branch, fleet17 config) as a one-shot boot entry, plus a one-shot aura-try Stage 2 whose embedded DTB differs from the live one by a single line, Before (fleet17): eDP-1 EDID primaries all 0.0000, gamma undefined, gnome-shell logs "EDID ... contains bogus Color Characteristics", no colord profile for the panel. After (gapscol1 + trial Stage 2):
Then rebooted back to fleet17 and the untouched Stage 2, test kernel removed. Note for rollout: the property only takes effect once a Stage 2 built with the new DTB ships. |
Bring in #1016, which keeps the internal panel identity in struct dcp_panel_identity and builds the panel EDID for every internal panel. The colour target needs no change: it is kept with the panel dimensions and passed to dcp_panel_edid() from dcp_panel_edid_snapshot(). Resolve the host fixture conflict in apple-dcp/desktop.py by taking the dcp_panel_identity stub from integration/aurora and adding the panel color_target field and the NULL colour target argument to dcp_panel_edid(). Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Problem
On the J616s the DCP firmware publishes no chromaticities for the internal panel. The EDID that drm/apple builds for it therefore has zero RGB primaries and only a nominal D65 white. GNOME logs "EDID ... contains bogus Color Characteristics" and builds no colour profile, so a P3 wide-gamut panel is handled as an unknown display.
Change
apple,color-gamutstring on the DCPpanelnode, enum"srgb"or"display-p3". It names the standard colour space the panel is calibrated to by default. Each name maps to published primaries (IEC 61966-2-1, SMPTE EG 432-1), a D65 white and nominal gamma 2.2, so the device tree holds no hand-tuned coordinates. Per-unit factory calibration is applied inside the DCP and is not described or reported.apple,color-gamut = "display-p3"on the J614s, J616s and J616c panels. Apple's technical specifications list "Wide color (P3)" for both machines:Interaction with #1016 (merge this after it)
#1016 moves the panel identity into
struct dcp_panel_identityand builds the panel EDID for every internal panel, not only on desktop 26.x firmware. This PR keeps the colour target instruct dcp_panel(next to the dimensions), readsapple,color-gamutfor every panel node whichever firmware drives it, and passes it todcp_panel_edid()fromdcp_panel_edid_snapshot(). Once #1016 is in, the target therefore applies to every internal panel with no further change.Merge order: #1016 first, then this PR. #1016 is now merged.
integration/aurora(1207cd2) was merged into this branch as fc62523. The only conflict was in the host fixtureapple-dcp/desktop.py: I took thedcp_panel_identitystub from integration and addedcolor_targetto the fixture'spanelstruct andNULLas the colour target argument of onedcp_panel_edid()call. On the merged result: KUnit 256 run, 255 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK); host suite 86/86 ok.Until then only the desktop 26.x path (T6041) synthesises a panel EDID, so the property is set only on the M4 Pro/Max laptops. Other internal panels (for example the MacBook Neo, sRGB per https://www.apple.com/macbook-neo/specs/) can get it in a follow-up.
Resulting EDID colour on the J616s: red 0.680/0.320, green 0.265/0.690, blue 0.150/0.060, white 0.3127/0.3290, gamma 2.2 (EDID byte 120).
Testing
apple*suites): 253 run, 252 passed, 1 skipped (apple_g17_rx_util_min_test, which needs CONFIG_UCLAMP_TASK), including the newparser_panel_color_target(firmware primaries win; absent, partial or rejected firmware colour falls back to the DT target; no target keeps the white-only block and gamma 0xff) andparser_panel_of_color_target(no property,display-p3,srgb, unknown value and unterminated string).tools/testing/selftests/drivers/gpu/apple-dcp: 86/86 ok.panel-colorimetrynow checks that the DT targets equal the standard sRGB and P3 fixture coordinates, that the target gives the same EDID colour bytes as firmware-published P3/sRGB, that firmware wins, and that every absent or invalid firmware case falls back.make dt_binding_check DT_SCHEMA_FILES=display/apple,dcp.yaml: clean for this change. A hand-edited DTB with"adobe-rgb"or an integer value is rejected by dt-validate.make CHECK_DTBS=yfor t6040-j616s, t6040-j614s, t6041-j616c and t6040-j616s-tether: no new warnings (only the existing ANE schema warnings).W=1build of drivers/gpu/drm/apple: 0 warnings.checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on all 3 patches.Hardware results on the J616s are posted in the PR comments.
🤖 Generated with Claude Code