Skip to content

drm/apple: describe an internal panel without a known gamut as Display P3 - #2798

Draft
RyanTheTide wants to merge 1 commit into
mainfrom
isw/panel-p3-default-v2
Draft

RyanTheTide wants to merge 1 commit into
mainfrom
isw/panel-p3-default-v2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown

Replaces #2320 (same changes, commit trailers fixed).

Fixes #2060

This is the first commit of #2087, by @chrisohearn and under their authorship, on its own and on the current integration/aurora. It fixes the zero-primaries EDID without the second commit's EDR peak cap, so the fix can land while the cap is discussed in #2087.

Problem

The EDID synthesised for an internal panel takes its primaries from the firmware or, without a complete set, from the colour target named by the ADT's /product artwork-display-gamut. dcp_adt_gamut() knows P3 and sRGB; any other string leaves no target, and the EDID carries zero red, green and blue primaries with only the D65 white. The K114s (M5 Pro OLED, firmware 27.2) says Rec2020. Compositors that build a conversion matrix from the EDID primaries (Hyprland's colour management, edid preset) get a singular matrix and render black frames.

Change

dcp_panel_color_target(): the space the ADT names, or else Display P3, the space every untagged RGB surface on an internal panel is already tagged with (iomfb_template.c). The EDID and the surface tag then agree. Rec2020 is deliberately not mapped to BT.2020 primaries, since the pixels are shown as P3. A dev_info names the fallback. The choice depends only on the ADT string, so it applies to every internal panel on every SoC.

Testing

  • Author, on a K114s (firmware 27.2), see drm/apple: Display P3 for an internal panel without a known gamut; cap the panel peak firmware 27 EDR may use #2087: log panel ADT: no known colour gamut, EDID primaries default to Display P3; edid-decode red 0.6796/0.3203, green 0.2646/0.6904, blue 0.1503/0.0595, white 0.3125/0.3291; Hyprland 0.57.2 colour management with the edid, dp3 and srgb presets keeps the panel lit with normal colours (black frames before).
  • KUnit: parser_panel_adt_color_target covers a Rec2020 ADT (Display P3 primaries, D65, gamma 2.2) and a known gamut keeping its own space. Compile check on integration/aurora 0abc2f385e + this change: every touched file built for arm64 (gcc, kernel warning flags, -Werror) with no warnings. The full KUnit run is still to do.

…y P3

The EDID built for an internal panel takes its primaries from the
firmware or, without a complete set, from the colour target the ADT's
/product artwork-display-gamut names. A gamut string the driver does
not know leaves no target, and the EDID then carries zero red, green
and blue primaries with only the D65 white.

The K114s (MacBook Pro 14-inch OLED, M5 Pro, firmware 27.2) is such a
panel: its ADT says "Rec2020", with a valid version-1
primary-calibration-matrix. Compositors take the zero primaries at
face value. Hyprland's colour management builds its conversion matrix
from them, the matrix is singular, and every frame comes out black
while the firmware completes each swap.

Every untagged RGB surface on an internal panel is already tagged
P3-D65 (iomfb_template.c: "the panel's own primaries (P3-D65, as its
EDID reports)"). Describe a panel whose ADT names no known space in
that same space, so the EDID and the surface tag agree, and log it.
The Rec2020 string is not mapped to BT.2020 primaries: the firmware is
handed P3-tagged surfaces, so BT.2020 primaries in the EDID would make
compositors encode for a wider space than the one the pixels are
shown in. dcp_panel_edid() keeps its contract (no target, white only)
for its other callers and tests.

KUnit: parser_panel_adt_color_target covers a "Rec2020" ADT (no target
of its own, Display P3 primaries, D65 and gamma 2.2 in the EDID) and a
known gamut keeping its own space.

Not booted: built, and the Apple display KUnit suites pass in QEMU.

Closes: #2060
Signed-off-by: chrisohearn <137103567+chrisohearn@users.noreply.github.com>
[ryan: taken alone from #2087, onto the current integration/aurora; booted
 on a K114s by the author, see #2087]
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Author

Review at 128023e (non-author, draft). No blocker found; ready once the KUnit run and one unchanged-EDID row are in.

  • Merges cleanly onto integration/aurora 6748d83. One commit; author and committer sign-offs are both human, with the usual bracketed note for the split.
  • This is the first commit of the open drm/apple: Display P3 for an internal panel without a known gamut; cap the panel peak firmware 27 EDR may use #2087, which still carries it together with the EDR cap. Whichever merges second needs a rebase; nothing else open touches dcp_panel_read_adt().
  • dcp->panel.color_target has one consumer, the dcp_panel_edid() call in dcp.c, so the fallback changes the synthesised EDID's primaries and nothing else (no surface tagging, no CTM, no HDR decision). Firmware chromaticities still win when complete.
  • The decision is made from the ADT string alone: known name -> that space, anything else (or no ADT) -> Display P3. No board or SoC is named in the code; K114s appears only in comments as the example.
  • dcp_panel_edid() keeps its "no target, white only" contract for other callers, and the new KUnit case checks both the fallback and that a known gamut keeps its own space.

Small points, not blocking:

  • The fallback also applies when the ADT is not available at all (ret != 0, for example an older loader that does not pass it). Those boots go from a white-only EDID to P3 primaries and gain the info line on every probe. That is the intended direction, but it is a change on Macs other than the K114s and the message only talks about the unknown-string case.
  • Regression row: on one Mac whose ADT says P3 (any lab laptop), edid-decode of the internal panel before and after should be byte-identical and the new info line absent. Not listed in the description.
  • The panel's ADT has a valid primary calibration matrix; deriving the primaries from it would describe the panel rather than the space it is driven in. The message explains why P3 is preferred for now; a short comment at dcp_panel_color_target() pointing at that reasoning would keep the next reader from "fixing" it to BT.2020.
  • Still open, as listed: the full KUnit run.

Assisted-by: LLM (Claude:Opus 5.5)

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.

drm/apple: K114s (T6050, fw 27.2) internal panel EDID has zero primaries; compositor colour management renders black

2 participants