Skip to content

Map sRGB into each display's gamut on Apple Silicon - #17640

Merged
dhh merged 3 commits into
quattrofrom
apple-silicon-xdr-color
Nov 5, 2026
Merged

dhh merged 3 commits into
quattrofrom
apple-silicon-xdr-color

Conversation

@dhh

@dhh dhh commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

On an Apple Silicon Mac, the Pro Display XDR showed every color oversaturated. The same display looks right connected to a PC.

The Mac's display controller (DCP) sends the display its native gamut, because macOS does the color matching itself. Asahi's appledrm exposes no Colorspace property for the display, so Hyprland can't tag the signal as sRGB. sRGB content therefore reaches a P3 panel unconverted. A PC's GPU driver signals sRGB, and the XDR maps it itself.

This change has Hyprland do the mapping on Apple Silicon: cm = "edid" converts sRGB into the gamut each display's EDID reports. That fixes any wide-gamut display and changes nothing on an sRGB one. The built-in panel has no EDID, so Hyprland falls back to sRGB for it, exactly as before.

default/hypr/wide-gamut.lua wraps hl.monitor and gives every rule without a cm of its own cm = "edid". That covers rules from the config and the port-named rules the monitor panel and bin/ commands send through hyprctl eval, since a rule without cm puts the display back on sRGB. Nothing changes off Apple Silicon, where converting would happen twice and wash the colors out.

This is a workaround for the Asahi display driver, and it should come out once the driver handles color.

Testing

  • On an M2 Pro with an XDR, colors match how the display looks on a PC.
  • After a reload the XDR runs on edid and the built-in panel stays on srgb. A panel-style port rule keeps the XDR on edid, and an explicit cm overrides it.
  • test/shell.d/hyprland-monitor-settings-test.sh covers the rule handling on and off Apple Silicon, and fails without the module.

🤖 Generated with Claude Code

dhh and others added 2 commits November 4, 2026 20:45
On Apple Silicon the display controller sends the XDR its native P3 and
Asahi's driver can't tag the signal as sRGB, so everything showed
oversaturated. Give every monitor rule for the XDR cm = "edid" there,
including the panel's port-named rules. A PC signals sRGB and the display
maps it itself, so nothing changes off Apple Silicon.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The display controller never tags any external display as sRGB, so any
wide-gamut one shows oversaturated, and an sRGB display or the built-in
panel (which has no EDID) is unchanged by it. Dropping the XDR matching
leaves a few lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dhh dhh changed the title Map sRGB into the Pro Display XDR's gamut on Apple Silicon Map sRGB into each display's gamut on Apple Silicon Nov 5, 2026
@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the earlier color-choice overwrite is fixed.

Summary

The PR maps sRGB colors into each display's reported gamut on Apple Silicon.

  • Apple Silicon monitor rules use each display’s color range by default.

The previous finding is addressed. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "Keep a cm chosen in monitors.lua when th..." · Reviewed by Greptile

Comment thread default/hypr/wide-gamut.lua Resolved
The panel's saved settings load after hypr/monitors.lua as port-named
rules without cm, so the wrapper overrode an explicit choice with edid.
Carry a chosen cm to later rules for that port, the monitor's description,
or every monitor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dhh
dhh merged commit 6194f46 into quattro Nov 5, 2026
2 of 3 checks passed
@jotenakis2

Copy link
Copy Markdown

Should n t be Apple Silicon builtin (MacBook Pro) Display P3 color instead of sRGB ?

mark-groves added a commit to mark-groves/omarchy that referenced this pull request Nov 7, 2026
@briantoll

Copy link
Copy Markdown

Data point from an M1 Max (j314c, DCP firmware 13.5) driving a Studio Display XDR at 5120x2880@60 over Thunderbolt, Omarchy with Hyprland 0.57.1, side by side with the built-in panel on a swatch page.

The compositor-side mapping is only half of it on this machine. Stock integration/aurora lets the DCP firmware pick the SDR RGB link by score, and for the XDR's 5K60 timing that is colour mode 68: 10-bit RGB, colorimetry 9 (BT.2020 RGB). The display then stretches the whole link to BT.2020, so sRGB mapped into the EDID's P3 primaries arrives on a BT.2020 link and overshoots. In my side-by-side on a stock kernel, cm = "dp3" came out more saturated than srgb, not less. Once the link is on colorimetry 16 (default RGB, the same thing the internal panel negotiates), mapping into P3 gets close: cm = "dp3" with sdr_eotf = "gamma22" left reds a touch vivid next to the built-in panel and everything else a match. I have not re-run edid specifically on that link yet, but it targets the same primaries. That link selection is omacom/linux-aurora#157 (parser.c, prefers an sRGB/default-RGB SDR mode over BT.2020 by tier, firmware score within a tier).

Could you post this line from the M2 Pro with the Pro Display XDR?

sudo dmesg | grep 'set_digital_out_mode() color mode'

If it says colorimetry:16 there, that explains why edid looks right on your setup and why it won't on an M1 until the kernel side lands. If it says colorimetry:9, it would be worth a second look at the result, because then the display is doing a BT.2020 stretch on top of the EDID mapping.

Two interactions worth knowing about:

The decoded ColorElements table for the XDR (which modes the firmware offers per timing, and their scores) and the full trial log are in https://github.com/briantoll/omarchy-thunderbolt-display/blob/main/notes/display-color.md. Happy to test any revision of this on the M1 Max.

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.

3 participants