Skip to content

drm/apple: Drive desktop 26.x EDR panels at their peak - #652

Closed
AxxzyWasTaken wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:t6041-edr-backlight
Closed

AxxzyWasTaken wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:t6041-edr-backlight

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #553. With HDR on, a desktop 26.x panel never goes above SDR white: PQ content is squeezed below it instead of using the panel's headroom.

Cause

EDR swaps carry the EDR scale (SDR white over the peak) and the headroom, but the panel level stays at SDR white. Measured on a J616C (M4 Max, 26.6.2 firmware), the firmware shows a PQ surface at (PQ nits / 100) × the EDR scale × the panel level the swap asks for. With the level at SDR white, PQ 1600 lands at SDR white.

Change

  • EDR swaps also ask for the panel at its peak. The scale stays at SDR white over the peak, so PQ 100 shows at the user's level at any brightness, and highlights reach the peak.
  • A swap that carries a brightness change gets the peak in its place and takes its scale from the new level, so the change applies on a still HDR frame.
  • Ending EDR puts the panel back at the SDR level. A swap that turns the panel off keeps its zero.

Measurements

J616C. Backlight power is macsmc-hwmon's "Display Backlight Power". Patterns are full-screen KMS buffers (AR30) with HDR_OUTPUT_METADATA = PQ and Colorspace = BT2020_RGB, with no compositor running.

Before, SDR level 100 nits:

SDR white PQ 100 PQ 400 PQ 1000 PQ 1600
backlight 1.81 W 0.30 W 0.58 W 1.22 W 1.88 W

After:

SDR level SDR white PQ 100 PQ 400 PQ 1000
100 nits 1.81 W 1.81 W 7.77 W 20.2 W
200 nits 3.53 W 3.59 W 17.1 W 22.9 W
300 nits 5.33 W 5.33 W 22.6 W 23.1 W

The formula fits five scale/level pairs. For example, with the panel level fixed at 400 nits and SDR at 100, PQ 400 matches SDR white (1.84 W vs 1.81 W). Full-screen output tops out near 23 W, which looks like the firmware's own limit.

Hyprland 0.56 (cm = "hdr", 10-bit, sdr_max_luminance = 100): turning HDR on leaves the desktop's backlight power unchanged (2.36 W at 133 nits). An HDR test clip in mpv (gpu-next, colorspace hint) shows its PQ 1000 half far brighter than SDR white, at 18 W. Hyprland also needs a tonemap = 0 window rule. Without it, Hyprland tone-maps surfaces a second time because they declare PQ's default 10000-nit maximum. That rule is compositor configuration and isn't part of this PR.

Second commit: EDR only for BT.2020 PQ

Hyprland 0.56, switching from cm = "hdr" to a wide-gamut SDR mode (cm = "dp3"), sets Colorspace back to Default but leaves the PQ HDR_OUTPUT_METADATA blob (modetest: Colorspace 0, metadata EOTF 2). The panel EDR path decided on the metadata alone, so SDR frames went out tagged PQ BT.2020 at the panel's peak. At a 100-nit setting the backlight drew 22 W, the image had a green cast, and the brightness keys did nothing. EDR now also needs BT2020_RGB. A Colorspace change already forces a mode set (apple_connector_atomic_check()), so the decision is retaken. External PQ output is unchanged.

Testing

EDR swaps on a desktop 26.x panel carry the EDR scale (SDR white over
the peak) and the headroom, but leave the panel level at SDR white. The
firmware shows a PQ surface at (PQ nits / 100) x the EDR scale x the
panel level the swap asks for, so with that level the whole PQ range
ends up at or below SDR white. On a J616C at 100 nits, full-screen PQ
100, 400, 1000 and 1600 drew 0.30, 0.58, 1.22 and 1.88 W of backlight
power, against 1.81 W for SDR white.

Ask for the panel at its peak in EDR swaps as well, and keep the scale
at SDR white over the peak. PQ 100 then shows at the user's level at
any brightness, and highlights reach the peak:

  SDR level  SDR white  PQ 100  PQ 400   PQ 1000 (full screen)
  100 nits   1.81 W     1.81 W   7.77 W  20.2 W
  200 nits   3.53 W     3.59 W  17.1 W   22.9 W
  300 nits   5.33 W     5.33 W  22.6 W   23.1 W

A swap that carries a level of its own (a brightness change) gets the
peak in its place and the scale from its level, so a change on a still
HDR frame takes effect at once. Ending EDR puts the panel back at the
SDR level, and a swap that turns the panel off keeps its zero.

Signed-off-by: AxxzyWasTaken <[email protected]>
Hyprland 0.56, going from its HDR mode to a wide-gamut SDR mode
(cm = "dp3"), sets the connector's Colorspace back to Default but
leaves the PQ HDR_OUTPUT_METADATA blob in place. The panel EDR path
decides on the metadata alone, so it kept tagging the SDR frames as PQ
BT.2020 and driving the panel at its peak. On a J616C at 100 nits the
backlight drew 22 W, the image had a green cast, and brightness
changes did nothing.

Show PQ content as EDR only while BT2020_RGB is asked for as well. A
Colorspace change already forces a mode set, so the decision is taken
again whenever either property changes. External PQ output is
unchanged.

Signed-off-by: AxxzyWasTaken <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Both commits from this PR are included as authored in #777, which merged into aurora-wip. That PR adds the swap sequence macOS uses on top of them, verified on a J616s. The measurements are in its description.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Reviewed for the M4 merge train. This conflicts with integration/aurora in dcp-internal.h, iomfb.c and iomfb_template.c. The EDR swap code has moved since #553. Please rebase onto 19f71a1.

This also changes the desktop 26.x EDR path that the J616s (M4 Pro) panel uses, not only the J616C. So after the rebase we'll measure the same PQ ladder on the J616s backlight rail before merging. If you still have the measurement script, posting it would help us repeat your numbers.

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Closing: #777 does this the way macOS does.

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.

2 participants