Skip to content

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

Merged
RyanTheTide merged 2 commits into
mainfrom
isw/panel-p3-default-v2
Nov 27, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
isw/panel-p3-default-v2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What

The EDID that the driver synthesises for an internal panel takes its primaries from the firmware or, if that set is incomplete, from the colour target named by the ADT's /product artwork-display-gamut. dcp_adt_gamut() knows only 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 get a singular matrix: Hyprland's edid preset renders black frames, and GNOME offers no "SDR native" (wide-gamut) colour mode.

dcp_panel_color_target() returns the space the ADT names, or else Display P3. Every untagged RGB surface on an internal panel is already tagged P3 (iomfb_template.c), so the EDID and the surface tag then agree. Rec2020 is deliberately not mapped to BT.2020 primaries, because 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.

Author: Chris O'Hearn (from #2087, under their authorship). Fixes #2060. Replaces #2320. Forward-merged with main (a5ee0c10, no force push).

Tested

Tested: K114s at a5ee0c1-equivalent (dcp_panel_read_adt() identical), firmware 27.2: "panel ADT: no known colour gamut, EDID primaries default to Display P3"; the panel EDID primaries become P3 (red 0.6797/0.3203; zero before). KUnit at a5ee0c1: 373 tests, 372 passed, 1 skipped. Details: #2798 (comment)

Risk: two-way · internal panels whose ADT names a gamut the driver doesn't know (K114s and other T6050 OLED boards); panels with P3/sRGB unchanged

Not yet

  • Other boards with an unknown ADT gamut: none rowed besides the K114s.

…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 <[email protected]>
[ryan: taken alone from #2087, onto the current integration/aurora; booted
 on a K114s by the author, see #2087]
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor 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)

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

# Conflicts:
#	drivers/gpu/drm/apple/dcp.c
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Forward-merged main (a5ee0c10, merge commit, no force push). There was one conflict in dcp_panel_read_adt(): this PR's colour-target lines were kept, and main's unconditional EDR ceiling was taken over the old desktop || V_27_0 condition.

Hardware row: K114s (T6050, M5 Pro OLED), firmware 27.2. Test kernel 7.3.0-k114sdisp = main e9fd1d92 + this change (same dcp_panel_read_adt() as at this head) + linux#3367. aura main + aura#535 Stage 2, one-shot, default command line plus console=ttyDC0:

  • apple-dcp 48ae00000.dcp: panel ADT: no known colour gamut, EDID primaries default to Display P3 (the K114s ADT says Rec2020).
  • The panel EDID (/sys/class/drm/card1-eDP-1/edid, 256 B, "Apple Panel") now carries P3 primaries, red x/y 0.6797/0.3203. Before, they were all zero.
  • On the previous boot without this change, Mutter offered colour modes [default, bt2100] only. SDR native needs EDID gamma, primaries and white point (meta-monitor.c).
  • KUnit at a5ee0c10 (display.kunitconfig + CONFIG_DRM_APPLE_KUNIT_TEST=y, arm64): 373 tests, 372 passed, 1 skipped.

The Mutter colour-mode list on this boot follows once the owner is logged in.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merge-train review at a5ee0c10: MERGE once CI is green and one unchanged-EDID row is in. No blockers.

Checked

  • dcp_panel_color_target() returns the ADT-named space when it's known (sRGB, P3). Otherwise it returns Display P3, the space every untagged internal surface is already tagged with in iomfb_template.c. That replaces the zero primaries that gave compositors a singular matrix (the K114s ADT says "Rec2020").
  • An ADT parse failure now also gets P3. Apple Silicon internal panels are P3, so it describes the space they're driven in.
  • KUnit covers the Rec2020 case (P3 primaries, gamma 120) and a known gamut keeping its own space. The forward merge kept main's EDR ceiling.

Before merge

  1. CI green.
  2. The unchanged-EDID row asked for at the earlier review: one Mac whose ADT names a known gamut (J616s or J413), with the synthesised EDID primaries byte-identical to main.

The K114s row covers the fixed case.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:none Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 27, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J616s regression row (M4 Pro, desktop 26.x firmware, known-gamut mini-LED panel). Test kernel 7.3.0-j6disp = main + linux#3367 (6522d8db) + linux#3369 (ff66aef1) + #2798 (a5ee0c10), merged as d8cf3fe8e04be5. The J616s's fleet89 config, trimmed to its loaded modules; its own Stage 2 and DTB; a GRUB one-shot, then a plain reboot back to fleet89. Before = fleet89 on the same machine, read the same way:

fleet89 with the three PRs
eDP-1 modes 6 (3456x2234 at 120/60/59.94/50/48/47.95) 6 (same)
EDID primaries R/G/B/W, gamma 0.6797,0.3203 / 0.2646,0.6904 / 0.1504,0.0596 / 0.3125,0.3291, 2.20 identical
EDID name Apple Panel Apple Panel
P3 fallback message none (the ADT names a known gamut) none
vrr_capable, vrr_range 1, 24-120 1, 24-120
Colorspace / Mutter colour modes 9 / [0, 2, 1] 9 / [0, 2, 1]
PQ_REFERENCE_LUMINANCE 100 203 (the intended change in #3367)
EDR headroom / peak 16 / 1600 nits 16 / 1600 nits
DCP/DRM error lines, failed units 0, 0 0, 0

Files: traces/display/20261127-k114s-dcp/j616s-fleet89-before.txt and j616s-j6disp-after.txt (lab store).

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 27, 2026
@github-actions

Copy link
Copy Markdown

Merge readiness at a5ee0c10: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at a5ee0c10
Conflicts ok none
PR text ok Risk: two-way · internal panels whose ADT names a gamut the driver doesn't know (K114s and other T6050 OLED boards); panels with P3/sRGB unchanged Not yet - Other boards with an unknown ADT gamut: none rowed besides the K114s.

Areas: area:display

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

@RyanTheTide
RyanTheTide merged commit 2d96d92 into main Nov 27, 2026
22 of 25 checks passed
@RyanTheTide
RyanTheTide deleted the isw/panel-p3-default-v2 branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) blast:none Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

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