Skip to content

drm: apple: tag RGB surfaces on external displays as sRGB (default off) - #412

Open
briantoll wants to merge 1 commit into
omacom:integration/aurorafrom
briantoll:dcp-external-srgb
Open

briantoll wants to merge 1 commit into
omacom:integration/aurorafrom
briantoll:dcp-external-srgb

Conversation

@briantoll

Copy link
Copy Markdown

drm: apple: tag RGB surfaces on external displays as sRGB

Target: omacom/linux-aurora, branch integration/aurora. One commit (branch dcp-external-srgb). Split out of #157; the link colorimetry change stays there and the XRGB2101010 fix is #411. This patch is independent of both, but is only useful once the link carries a default-RGB colorimetry (#157), since a BT.2020 link stretches the converted pixels again.

Problem

plane.c tags every RGB framebuffer DCP_COLORSPACE_NATIVE, and iomfb_template.c only rewrites that for eDP. The desktop renders sRGB, and Apple's external panels (Studio Display, Studio Display XDR, Pro Display XDR) are Display P3, so sRGB values land on P3 primaries with no conversion and every saturated colour comes out far more vivid than on macOS. The internal panel never shows this because DCP applies its own factory pipeline there.

DCP can do the conversion itself when a surface is tagged DCP_COLORSPACE_BG_SRGB, which is what macOS asks of it (AsahiLinux#547).

Fix

New module parameter appledrm.external_srgb, default off, writable at runtime through /sys/module/appledrm/parameters/external_srgb. When on, RGB surfaces for non-eDP connectors are tagged DCP_COLORSPACE_BG_SRGB so DCP converts to the panel gamut in hardware. YUV planes keep their own tag.

Why the default is off: compositors now map sRGB into the panel gamut themselves. Omarchy 4.5 sets cm = "edid" on every Apple Silicon monitor rule (omacom/omarchy#17640, merged 2026-11-05), and Hyprland users set cm or an ICC profile by hand. With DCP converting as well, the picture is converted twice. Measured on a Studio Display XDR next to the internal panel, that reads as flattened reds. Y is for a compositor that does no colour management of its own, and for A/B testing, since it can be flipped live. The global is left uninitialised per kernel style; the MODULE_PARM_DESC states the default.

Tested

MacBook Pro 14" M1 Max (j314c), DCP firmware 13.5, Studio Display XDR at 5120x2880@60 over a Thunderbolt DP tunnel, Hyprland 0.56.2 for the side-by-side tests, 0.57.1 in daily use since, with the default-RGB link from #157 in place. Reference was the internal panel beside it, same swatch page on both.

  • external_srgb=Y with Hyprland on plain cm = "srgb": clearly closer to the internal panel than the untouched driver, reds still a little more saturated with a hue shift.
  • external_srgb=Y plus a compositor-side profile: reds go flat (double conversion), which is why the default is N.
  • external_srgb=N plus a compositor-side ICC profile: a match. This is the configuration in daily use since 2026-10-19 (local kernel releases 12 through 16), which also exercises the parameter's default path.
  • The parameter can be flipped at runtime to A/B the two behaviours against the internal panel.
  • No change on the internal panel (eDP keeps its existing rewrite).

drivers/gpu/drm/apple/ builds on integration/aurora 8eddf5a with the Omarchy config (W=1, clang); checkpatch --strict reports only the Co-Authored-By trailer spelling and the pre-existing DRM_MODE_CONNECTOR_eDP CamelCase check.

🤖 Generated with Claude Code

plane.c tags every RGB framebuffer DCP_COLORSPACE_NATIVE. The desktop
renders sRGB, and Apple's external panels (Studio Display, Studio Display
XDR, Pro Display XDR) are Display P3, so sRGB values land on P3 primaries
unconverted and every saturated colour, reds most visibly, comes out far
more vivid than on macOS. The internal panel does not show this because
DCP applies its own factory pipeline there.

Tag the surface DCP_COLORSPACE_BG_SRGB for non-eDP connectors so DCP
converts sRGB to the panel gamut in hardware, which is what macOS asks
of it. YUV planes keep their own tag.

Behind appledrm.external_srgb, default off and writable at runtime.
Compositors now map sRGB into the panel gamut themselves: Omarchy 4.5
sets cm = "edid" on every Apple Silicon monitor rule (omacom/omarchy
PR #17640), and Hyprland users set cm or an ICC profile by hand. With
DCP converting as well the picture is converted twice, which measured as
flattened reds on a Studio Display XDR next to the internal panel. Y is
for a compositor that does no colour management of its own.

Seen on an M1 Max MacBook Pro (J314c) driving a Studio Display XDR at
5120x2880@60 over USB-C DisplayPort, DCP firmware 13.5.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Brian Toll <[email protected]>
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.

1 participant