Skip to content

drm/apple: Drive HDR output on desktop 26.x external displays - #553

Merged
RyanTheTide merged 4 commits into
integration/aurorafrom
j616s/hdr-output
Oct 28, 2026
Merged

RyanTheTide merged 4 commits into
integration/aurorafrom
j616s/hdr-output

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

External displays on the M4 Pro (J616s) had no HDR option. The T6041 external processors build their EDID from firmware data as a base block only, and the connectors had no Colorspace or HDR_OUTPUT_METADATA property, so GNOME and KWin never offered HDR.

The firmware already reports what HDR needs: the sink's PQ, static metadata and BT.2020 support and its luminance range in DisplayAttributes, and per timing the PQ color elements the link can carry. This PR uses that.

What changes

  • DisplayAttributes: parse SupportsPQEOTF, SupportsHDRStaticMetadataType1, SupportsBT2020RGB and Luminance (optional; a malformed key reads as absent).
  • EDID: when the sink takes PQ, add a CTA-861 block with a colorimetry data block (BT.2020 RGB) and an HDR static metadata data block (SDR + ST 2084, type 1, luminance codes per CTA-861.3).
  • Timings: keep each timing's best PQ BT.2020 element that is neither unsafe nor DSC-only. Full-range RGB comes first, then YCbCr 4:4:4, and 10-bit is preferred.
  • Connectors: external DP and HDMI connectors get Colorspace (Default, BT2020_RGB) and HDR_OUTPUT_METADATA; changing either forces a mode set.
  • Atomic check: refuse EOTFs other than SDR/PQ, PQ on a timing without a PQ element, and PQ on processors other than desktop 26.x.
  • Mode set and swap: a PQ commit selects the PQ element and tags RGB surfaces BT.2020 + HDR transfer, so the PQ code values pass through.

Internal panels, the other firmware generations and SDR output are unchanged. The firmware generates the HDR infoframe/SDP itself. Mastering metadata from the compositor is not forwarded yet, because no IOMFB call for it is known.

Tested on the J616s (desktop 26.6 firmware), Acer QG270 S3, GNOME 51:

  • GNOME offers bt2100 for the Acer; the internal panel still offers only default.
  • HDMI 1080p60: element 105 (PQ BT.2020 RGB 10-bit). Monitor OSD shows HDR, picture correct.
  • HDMI 1080p120: element 102 (PQ BT.2020 YCbCr 4:4:4 12-bit). HDR, picture correct.
  • DisplayPort 1080p180: element 111 (PQ BT.2020 RGB 10-bit). HDR, picture correct.
  • HDMI 144/180 Hz with HDR is refused (EINVAL), since the firmware marks every PQ element unsafe on that link. GNOME applies monitor configs without a test commit, so its flips then fail until another mode is picked.
  • edid-decode on the new EDID: CTA block with BT2020RGB and an HDR SMDB of 417.7 / 391.4 / 0.079 cd/m².
  • apple-dcp host selftests: 80/80 pass. New coverage: the CTA block bytes, the parsed HDR keys, PQ element choice (RGB over YCbCr 4:4:4, 10-bit over 12-bit, unsafe skipped, 4:2:2 ignored) and no PQ on the external SDR path.
  • appledrm builds without warnings (CONFIG_WERROR), and checkpatch is clean.

Design notes: external HDR on apple-dcp, 2026-10-28 (shared notes, HDR-DESIGN-20261028.md).

Also in this PR

  • drm/apple: Drive HDR output on the external H17P display: the Neo's (A18 Pro) external processor uses the same IOMFB template mode set, so it gets the same PQ path. Its SDR element choice is unchanged, and the PQ surface tag takes precedence over the H17P sRGB source tag.
    Tested on the Neo (fleet4 base, which carries this commit) with the Acer QG270 S3 over DP, Ryan watching:
    • GNOME offers bt2100 and applies it at 1080p180: element 111 (PQ BT.2020 RGB 10-bit, full range); OSD shows HDR; desktop normal.
    • PQ split 100 vs 400 nits: right much brighter. Colour bars natural. In the patch row, 400/1000/4000 look the same: the Acer peaks at about 418 cd/m².
    • The Neo's internal panel is unchanged (offers only default), with no flip failures and no warnings.
  • drm/apple: Offer HDR on desktop 26.x Type-C pipeline connectors: a desktop 26.x processor driving a Type-C route has a USB-type connector of its own. It now gets the DisplayPort Colorspace property and HDR_OUTPUT_METADATA too.

Internal panel: HDR as EDR (drm/apple: Show HDR content as EDR on desktop 26.x panels)

The J616s panel has no PQ link mode; its processor describes it with one SDR element. The panel shows HDR the way macOS does, as EDR. SDR white stays at the panel level the user set. Each swap carries the display EDR scale (SDR white over peak) and the headroom used (peak over SDR white), and the processor maps PQ BT.2020 surfaces into that headroom. This is built clean-room from a facts-only interface report (method A128 max_panel_brightness in 16.16 nits; the swap binary64 fields at +0x37e/+0x3e6 flagged by bl_flags[2]/[4]).

  • At start-up the driver asks for the peak (A128) before is_main_display. A peak above the SDR maximum enables EDR, and the panel EDID gets the same CTA HDR block as external sinks.
  • Desktop 26.x eDP connectors get Colorspace and HDR_OUTPUT_METADATA, and PQ is accepted on the panel. The SDR link mode is kept.

Tested on the J616s (fleet4 base, internal panel, GNOME 51), with Ryan watching the screen:

  • A128 returned a 1600-nit peak (Apple's published panel peak). edid-decode shows the HDR block at 1600 cd/m², and GNOME offers bt2100 for the internal display.
  • PQ patch row (0.1 to 4000 nits): every step is distinct up to 1000 nits; 1000 and 4000 look the same, since the panel peaks at 1600.
  • PQ split screen 203 vs 1000 nits: 1000 is much brighter. 1000 vs 4000 nits: same or slightly brighter, since the panel peaks at 1600.
  • Desktop with HDR on looks normal. Toggling HDR every 2 s gives no visible change apart from the switch blink.
  • No flip failures and no new firmware errors.
  • apple-dcp host selftests: 80/80, including a new panel HDR EDID check. The binary64 ratio encoder matches IEEE round-to-nearest on 2,008 ratios.

Not covered

  • VRR on the internal panel: the driver path works (KMS VRR_ENABLED=1 gives adaptive_sync minRR = 0x180000 and VRR=YES), but GNOME 51 leaves VRR_ENABLED at 0 on the desktop and for fullscreen vkcube. That is a separate investigation.
  • Forwarding compositor mastering metadata to external sinks (the firmware has a path for it; not wired yet).

Before merging: the USB-C pipeline connector commit is still unchecked on hardware (it only adds properties to USB-type connectors).

🤖 Generated with Claude Code

External displays had no HDR mode on the M4 Pro: the firmware-derived
EDID of the T6041 external processors is a base block alone, and their
connectors carry neither a Colorspace nor an HDR_OUTPUT_METADATA
property, so GNOME and KWin never offer HDR.

The firmware reports what is needed. DisplayAttributes says whether
the sink takes a PQ signal and HDR static metadata, whether it takes
BT.2020 RGB, and its luminance range. Each timing lists PQ color
elements next to its SDR ones, with the elements its link cannot
carry.

Use it:

- Parse SupportsPQEOTF, SupportsHDRStaticMetadataType1,
  SupportsBT2020RGB and Luminance from DisplayAttributes. A malformed
  optional key reads as absent; the sink identity still stands.
- When the sink takes PQ, extend the firmware-derived EDID with a
  CTA-861 block: a colorimetry data block (BT.2020 RGB) and an HDR
  static metadata data block (SDR and SMPTE ST 2084, static metadata
  type 1, and the luminance range coded per CTA-861.3).
- Keep, for each timing, its best PQ BT.2020 element the link can
  carry: full range RGB first, 10 bits per component first, then
  YCbCr 4:4:4, which the processor converts the RGB surfaces to.
- Give external DisplayPort and HDMI connectors a Colorspace property
  (Default, BT2020_RGB) and HDR_OUTPUT_METADATA. A change of either
  is a mode set.
- Refuse an EOTF other than SDR or PQ, and PQ on a timing without a
  PQ element or on a processor other than the desktop 26.x one.
- On a PQ commit, set the timing's PQ element and tag RGB surfaces
  BT.2020 with the HDR transfer function, so the processor takes the
  PQ code values the compositor wrote as they are.

The internal panels, the other processors and SDR output are
unchanged. The firmware sends the HDR infoframe or SDP itself; the
mastering metadata a compositor supplies is not forwarded.

Tested on the J616s (M4 Pro, desktop 26.6 firmware) with an Acer
QG270 S3. GNOME 51 offers HDR (bt2100) for it, and the monitor enters
HDR mode: over HDMI at 1080p60 (PQ BT.2020 RGB, 10-bit) and 1080p120
(PQ BT.2020 YCbCr 4:4:4, 12-bit), over DisplayPort at 1080p180 (PQ
BT.2020 RGB, 10-bit). HDR at 144 or 180 Hz over HDMI is refused, as
the firmware has no PQ element that link can carry there. The internal
panel keeps its SDR mode only.

The apple-dcp host selftests cover the CTA block, the parsed HDR keys
and the PQ element choice.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The external display processor of the A18 Pro (T8140, H17P) sets its
modes through the same IOMFB template as the desktop 26.x firmware and
builds its EDID from the same DisplayAttributes, so the HDR path of the
desktop processors applies to it as well.

Collect the PQ element of each timing on its external SDR parse path
too, which keeps choosing its SDR element as before, and let its
connector take a PQ commit. On a PQ output its RGB surfaces are tagged
BT.2020 with the HDR transfer function before the sRGB source tag of
the H17P external SDR path applies, which then leaves them alone.

Not yet tested on hardware: the Neo was not available.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A desktop 26.x processor whose output is a Type-C route gets a
connector of its own, of the USB type, and drives DisplayPort over it.
Give it the DisplayPort Colorspace property and HDR_OUTPUT_METADATA as
the DisplayPort and HDMI connectors have, so a USB-C display on such a
route is offered HDR the same way.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The internal panel of the M4 Pro MacBook Pro reaches 1600 cd/m2 for
HDR content, but its processor describes it with a single SDR color
element, and no PQ link mode exists for it. macOS shows HDR there as
EDR instead: SDR white keeps the panel level the user chose, and every
swap carries the display EDR scale (SDR white over the peak) and the
headroom the frame uses (the peak over SDR white), so the processor
can raise the backlight and leave SDR content where it was. The
processor reports the panel's peak luminance through
max_panel_brightness (A128), in 16.16 cd/m2. It also takes PQ BT.2020
surfaces on this path and maps them into the headroom.

Do the same:

- Ask for the peak during start-up, before is_main_display. A peak
  above the panel's SDR maximum enables EDR.
- With it, give the panel EDID the CTA-861 block of the external
  displays: BT.2020 RGB, SDR and SMPTE ST 2084, static metadata type
  1, the peak as maximum and frame-average luminance.
- Give desktop 26.x eDP connectors the Colorspace and
  HDR_OUTPUT_METADATA properties, and accept PQ on the panel when its
  peak is known. The panel keeps its SDR mode.
- On a PQ commit, tag its RGB surfaces BT.2020 with the HDR transfer
  function and put the EDR scale and headroom, binary64 values at
  +0x37e and +0x3e6 of the swap flagged by bl_flags[2] and [4], into
  each swap, computed from the current panel level. The first swap
  after PQ ends sets both to 1.

Other panels and processors are unchanged.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[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