Repository navigation
drm/apple: Drive desktop 26.x EDR panels at their peak - #652
Closed
AxxzyWasTaken wants to merge 2 commits into
Closed
AxxzyWasTaken wants to merge 2 commits into
AxxzyWasTaken wants to merge 2 commits into
Conversation
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]>
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. |
Contributor
|
Reviewed for the M4 merge train. This conflicts with 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. |
Contributor
Author
|
Closing: #777 does this the way macOS does. |
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.
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
Measurements
J616C. Backlight power is macsmc-hwmon's "Display Backlight Power". Patterns are full-screen KMS buffers (AR30) with
HDR_OUTPUT_METADATA= PQ andColorspace= BT2020_RGB, with no compositor running.Before, SDR level 100 nits:
After:
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 atonemap = 0window 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"), setsColorspaceback to Default but leaves the PQHDR_OUTPUT_METADATAblob (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 needsBT2020_RGB. A Colorspace change already forces a mode set (apple_connector_atomic_check()), so the decision is retaken. External PQ output is unchanged.Testing
W=1(iomfb.o, iomfb_v26_6_desktop.o and the other template instantiations), and the apple-dcp host selftests pass 80/80 on both commits.DCP_FW_NAME()spacing false positive, which drm/apple: Drive HDR output on desktop 26.x external displays #553's commit also triggers.