Repository navigation
drm/apple: keep SDR content at the user's brightness when a panel shows PQ - #3367
RyanTheTide wants to merge 3 commits into
Conversation
…ws PQ With HDR on in GNOME, an EDR panel jumps to a blinding level: on a K114s at 835 nits, SDR content goes towards the 2000-nit peak. The firmware shows PQ 100 cd/m^2 at SDR white, the level a swap's brightness sets, and the driver hands it the user's brightness as SDR white. Compositors put SDR content at the PQ reference white of ITU-R BT.2408, 203 cd/m^2: Mutter in BT.2100 mode stops writing the sysfs backlight and scales that reference white instead, and KWin does the same by default. SDR content then shows at 2.03 times the user's brightness, up to the peak. While PQ is shown, give the firmware SDR white x 100 / 203, so PQ 203 lands on the user's brightness and only brighter PQ levels use the headroom, as macOS shows SDR content in EDR. Report 203 in PQ_REFERENCE_LUMINANCE, which said 100. The headroom target follows the lower SDR white, so the peak is still reachable. Nothing changes outside PQ, and the step applies to every panel with EDR headroom. Signed-off-by: Ryan Murray <[email protected]>
Signed-off-by: Ryan Murray <[email protected]> # Conflicts: # drivers/gpu/drm/apple/apple_drv.c
|
Merge-train status at
The K114s boot and KUnit (373/374) are noted. |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
J616s regression row (M4 Pro, desktop 26.x firmware, known-gamut mini-LED panel). Test kernel 7.3.0-j6disp = main + linux#3367 (
Files: traces/display/20261127-k114s-dcp/j616s-fleet89-before.txt and j616s-j6disp-after.txt (lab store). |
# Conflicts: # drivers/gpu/drm/apple/apple_drv.c
|
Merge-train review: MERGE once CI is green at Checked
|
|
Hardware row at
|
|
Back to draft: hold the merge. On the K114s with this commit, HDR in GNOME is still far too bright, as the owner reports. The K114s's ambient light sensor picks up the panel's own light, so I measured with it (auto-brightness off, same 300-nit backlight): SDR reads 0.30, HDR reads 2.5, about 8×. The PQ-203 offset is real but small. On firmware 27 the dominant effect is that the panel runs at SDR white × headroom and the desktop is not scaled back. A lab kernel now pins which EDR field the firmware ignores; this PR gets the real fix, or is reshaped, before it comes out of draft. |
|
Measurement update (ALS proxy, details on the lab store): with a lab-only knob on the K114s, any PQ/EDR presentation on firmware 27 is far brighter than SDR at 1000 nits, even with headroom forced to 1 and this remap on. On the J616s (desktop 26.x), SDR content in HDR already sits at the user's level without any remap, so this ×100/203 would halve it there. So this PR is wrong as it stands for the 26.x path and insufficient for 27. It stays draft until the firmware-27 PQ mapping is understood (question to @DjDeveloperr about the macOS 27 trace); expect it to be reshaped or closed. |
|
Merge-train note: my MERGE verdict from 21:4x is superseded by the author's HOLD above (back to draft at 22:10, HDR still too bright on the K114s). I'll re-review when it's back out of draft, with the compositor-free row. |
|
Closing: superseded. On Aurora's Mutter (which reads PQ_REFERENCE_LUMINANCE) this was neutral, and on firmware 27 the flash-bang has a different cause (no PQ decode on the surface path; measured in #3423, which merged as the stop-gap). Real HDR on firmware 27 is being done by the FW27-HDR lane. |
Status (draft, held): not the K114s flash-bang fix
packages/mutter0002, "Take the PQ reference white from PQ_REFERENCE_LUMINANCE") already puts SDR white at the connector'sPQ_REFERENCE_LUMINANCEand keeps the sysfs backlight in BT.2100. With that Mutter, this change is neutral: the J616s row shows SDR-in-HDR unchanged. It only matters for compositors without that patch (upstream Mutter's ref-white path, KWin). The Mutter paragraph below describes upstream Mutter.What
Turning HDR on in GNOME makes an EDR panel jump to a blinding level ("flash-bang"). On a K114s set to 835 nits, SDR content goes towards the panel's 2000-nit peak.
The firmware shows PQ 100 cd/m² at SDR white, which is the level a swap's brightness sets, and the driver hands it the user's brightness as SDR white. Compositors put SDR content at the PQ reference white of ITU-R BT.2408, 203 cd/m². Mutter 50/51 in BT.2100 mode stops writing the sysfs backlight and scales that reference white instead (
meta-output-kms.cforces its "ref-white" backlight in HDR); KWin's default is the same. SDR content therefore shows at 2.03 times the user's brightness, up to the peak.While PQ is shown, the firmware now gets SDR white × 100 / 203. PQ 203 lands on the user's brightness, and only brighter PQ levels use the headroom, which is how macOS shows SDR content in EDR.
PQ_REFERENCE_LUMINANCEnow reports 203 instead of 100. The headroom target follows the lower SDR white, so the peak is still reachable. Nothing changes outside PQ, and the change applies to every panel with EDR headroom (no SoC or board check).Tested
Tested: KUnit 374 tests (373 pass, 1 skip) incl. new edr_pq_sdr_test; K114s boots 7.3.0 with this commit (k114sdisp test kernel = main + this + #2798 + the zero refresh range change on branch fix/dcp-panel-vrr-range), panel bound, EDR headroom 16. The owner's HDR on/off check on that boot is posted as a comment.
drivers/gpu/drm/apple/tests/display.kunitconfig+CONFIG_DRM_APPLE_KUNIT_TEST=y, arm64 QEMU): 374 tests, 373 passed, 1 skipped. The newedr_pq_sdr_testchecks the mapping, its rounding over 10-1600 nits and the larger headroom target.actual_brightness442) and SDR content was encoded at PQ 203, i.e. 2× the user's level. The owner reports the flash-bang at his usual brightness.Risk: two-way · every EDR panel (K114s, J616s/J614s, J714s, ...): SDR level in HDR mode only
Not yet
apple-drm-kunitjob usesdisplay.kunitconfigwithoutCONFIG_DRM_APPLE_KUNIT_TEST, so the EDR tests indcp_backlight_test.cdon't run there. That is a separate CI follow-up.