Repository navigation
Conversation
|
Found a selection regression while preparing a J613/.20 backport of this PR. This is an offline source test against head In the new One synthetic decoded-record sequence, all non-virtual SDR RGB:
The invalid third record leaves A small fix is to copy the current RGB slot, reset the temporary score for a higher tier, validate into the temporary, and commit both the slot and Reproducer extracts the actual fill/rank/selection code and final slot-priority block from pinned source blobs. With ASan/UBSan: the PR fails seven of nine checks, the fixed version passes nine of nine; the .20 reference passes its existing-behaviour checks. Valid preference and disabled-preference checks pass with the fix. This does not exercise serialized record decoding, the H17P-specific branch or firmware output. The fixed .20 parser object also compiles for ARM64; a broader reference build hit the unchanged temperature guard, so no complete module-build/native claim follows. Nothing installed or loaded. Selected results and scope. Tests, patch and report prepared with Codex on Toni's J613. Serialized-record follow-upThe wrong final colour selection also reproduces through the actual The fixed parser passes all 15 serialized checks, including valid and disabled preference, internal-panel score behaviour, one H17P rank case, same-tier scores, invalid-colour rejection, bad header and truncation. The reference for this comparison is the exact PR parent GitHub GCC and Clang jobs both pass the nine fixed slot-selection checks and 15 fixed serialized checks, reproduce the expected upstream failures, and independently apply the published patch and compare its complete output with the tested fixed source. All four downloaded JSON result artifacts were checked, with no compiler or sanitizer diagnostics. Serialized reproducer, selected results and artifact hashes. This is still a host harness, not a full kernel/KUnit, firmware, scanout or native colour/HDR qualification. No installation or runtime colour change made. |
For an SDR RGB link the parser keeps whichever colour mode the firmware scores highest. On a Studio Display XDR at 5120x2880@60 that is colour mode 68: 10-bit RGB, colorimetry 9 (BT.2020 RGB). The desktop renders sRGB, so its pixels travel on a BT.2020 link and the display stretches them to its full gamut. The H17P path already refuses wide-gamut modes by score alone (external_sdr_rank); this gives the other externals a similar preference. appledrm.external_colorimetry (default 10, sRGB) names the colorimetry to prefer. Exact match wins, then sRGB/BT.709, then default RGB, then anything else, with the firmware score deciding within a tier. -1 keeps the old behaviour. The parser reads it when a display's modes are parsed, so a change needs a replug or reboot. Validate a higher-tier candidate into a copy of the slot and commit the copy and its rank only once fill_color_mode() has accepted it. An earlier version reset the slot's score before validating, so a malformed higher-tier record (depth 7, a missing depth or range) erased a valid lower-tier mode and advanced the rank past it; the final fallback then picked a wide-gamut mode over the valid BT.709 one. Reported-by: Toni Bergholm <[email protected]> Link: omacom#157 (comment) Suggested-by: Toni Bergholm <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Brian Toll <[email protected]>
9d3aeb2 to
a7ae084
Compare
|
Thanks, that is a real bug and your reproducer nails it. A higher-tier record reset the slot's score before Pushed a new version of the series, rebased onto the current
|
For an SDR RGB link the parser keeps whichever colour mode the firmware scores highest. On a Studio Display XDR at 5120x2880@60 that is colour mode 68: 10-bit RGB, colorimetry 9 (BT.2020 RGB). The desktop renders sRGB, so its pixels travel on a BT.2020 link and the display stretches them to its full gamut. The H17P path already refuses wide-gamut modes by score alone (external_sdr_rank); this gives the other externals a similar preference. appledrm.external_colorimetry (default 10, sRGB) names the colorimetry to prefer. Exact match wins, then sRGB/BT.709, then default RGB, then anything else, with the firmware score deciding within a tier. -1 keeps the old behaviour. The parser reads it when a display's modes are parsed, so a change needs a replug or reboot. Validate a higher-tier candidate into a copy of the slot and commit the copy and its rank only once fill_color_mode() has accepted it. An earlier version reset the slot's score before validating, so a malformed higher-tier record (depth 7, a missing depth or range) erased a valid lower-tier mode and advanced the rank past it; the final fallback then picked a wide-gamut mode over the valid BT.709 one. Reported-by: Toni Bergholm <[email protected]> Link: omacom#157 (comment) Suggested-by: Toni Bergholm <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Brian Toll <[email protected]>
a7ae084 to
14996b5
Compare
drm: apple: let external displays prefer an sRGB link colorimetry
Target: omacom/linux-aurora, branch
integration/aurora. One commit, rebased on 8eddf5a.This PR is now just the link colorimetry change. The other two patches that used to ride along are their own PRs: the XRGB2101010 10-bit scanout fix is #411 and the sRGB surface tag is #412. Each can be reviewed and merged on its own.
Problem
For the SDR RGB link to an external display,
parser.ckeeps whichever colour mode the firmware scores highest. On a Studio Display XDR at 5120x2880@60 that is colour mode 68: 10-bit RGB, colorimetry 9 (BT.2020 RGB). The desktop renders sRGB, so its pixels travel on a BT.2020 link and the display stretches them to its full gamut. Every saturated colour comes out far more vivid than on macOS, reds most visibly. The internal panel runs colorimetry 16 (default RGB). The H17P path already refuses wide-gamut modes by score alone (external_sdr_rank); the other externals get nothing.Decoded
ColorElementsfor the XDR's 5K60 timing (non-virtual RGB modes; the sRGB 8-bit entries 1 and 2 are virtual and skipped):No sRGB, BT.709 or P3 entry exists for this timing, so the best available is "default RGB", the same colorimetry the internal panel uses.
This matters for compositors too. Omarchy 4.5 now sets
cm = "edid"on every Apple Silicon monitor rule (omacom/omarchy#17640) so Hyprland maps sRGB into the display's EDID gamut. That mapping assumes the link carries the display's native colorimetry. On a BT.2020 link the display stretches the already-mapped pixels a second time, and no compositor setting can undo that.Fix
New module parameter
appledrm.external_colorimetry(default 10, sRGB). Among SDR RGB modes for an external display an exact match wins, then sRGB/BT.709, then default RGB, then anything else, with the firmware score deciding inside a tier.-1keeps the old behaviour. Read at mode-parse time, so a change needs a replug or reboot. Internal panels and the H17P external path are untouched.v2 (after Toni Bergholm's review, comment): a higher-tier candidate is now validated into a copy of the slot and committed, with its rank, only once
fill_color_mode()accepts it. The earlier version reset the slot's score before validating, so a malformed higher-tier record (depth 7, a missing depth or range) erased a valid lower-tier mode and advanced the rank past it; the fallback then picked a wide-gamut mode over the valid BT.709 one. Reported-by and Suggested-by are in the commit. A host test of the selection logic (not part of the tree) covers the three-record case and the malformed-record variants on either side of a valid record: the old code lost the slot in all of them, the new code keeps the valid mode, and the all-valid preference, same-tier score and no-valid cases are unchanged.Tested
MacBook Pro 14" M1 Max (j314c), DCP firmware 13.5, Studio Display XDR at 5120x2880@60 over a Thunderbolt DP tunnel, Omarchy with Hyprland 0.56.2 for the side-by-side tests, 0.57.1 in daily use since. In daily use since 2026-10-19 (local kernel releases 12 through 16), including hotplug cycles.
dmesg | grep 'set_digital_out_mode() color mode'goes fromdepth:10 format:0 colorimetry:9tocolorimetry:16for the XDR. The internal panel still picks mode 1. A replug on 2026-10-23 logged the same mode 69 selection through the normal hotplug path.cm = "dp3"withsdr_eotf = "gamma22"lands close to the internal panel, and a per-monitor ICC profile gets to a match. On the BT.2020 link the same settings overshoot.drivers/gpu/drm/apple/builds onintegration/aurora8eddf5a with the Omarchy config (W=1, clang); checkpatch --strict reports only theCo-Authored-Bytrailer spelling.🤖 Generated with Claude Code