Repository navigation
drm/apple: Drive HDR output on desktop 26.x external displays - #553
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ColorspaceorHDR_OUTPUT_METADATAproperty, 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
Colorspace(Default, BT2020_RGB) andHDR_OUTPUT_METADATA; changing either forces a mode set.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:
bt2100for the Acer; the internal panel still offers onlydefault.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-decodeon the new EDID: CTA block with BT2020RGB and an HDR SMDB of 417.7 / 391.4 / 0.079 cd/m².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:
bt2100and applies it at 1080p180: element 111 (PQ BT.2020 RGB 10-bit, full range); OSD shows HDR; desktop normal.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_brightnessin 16.16 nits; the swap binary64 fields at +0x37e/+0x3e6 flagged bybl_flags[2]/[4]).is_main_display. A peak above the SDR maximum enables EDR, and the panel EDID gets the same CTA HDR block as external sinks.ColorspaceandHDR_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:
edid-decodeshows the HDR block at 1600 cd/m², and GNOME offersbt2100for the internal display.Not covered
VRR_ENABLED=1givesadaptive_sync minRR = 0x180000andVRR=YES), but GNOME 51 leavesVRR_ENABLEDat 0 on the desktop and for fullscreen vkcube. That is a separate investigation.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