Repository navigation
drm/apple: advertise HDR only on outputs that can carry PQ - #2951
RyanTheTide wants to merge 1 commit into
Conversation
An external connector got the Colorspace and HDR_OUTPUT_METADATA properties whatever its display processor could do with them. Where the processor cannot be given a PQ signal (dcp_hdr_output_supported() is false, e.g. the firmware 13.5 external DCP of the J413), the mode set drops the PQ request, keeps the SDR transfer function and sends no HDR metadata, but still honours a BT.2020 colorspace. GNOME offers HDR on such a monitor because the properties are there, renders a BT.2100 desktop, and the sink stays in SDR: the picture is washed out. Attach the two properties to an external output only when its display processor can carry PQ. The per-DCP connector asks its own processor; a Type-C port connector asks every pipeline that can drive the port, since the connector cannot know which one a commit lands on. Panels that show PQ content as EDR keep the properties as before, and outputs that can carry PQ are unchanged. Tested on a J413 with an MSI MPG 325CQRXF on USB-C (fleet83 plus this change in the initramfs): the external processor reports no PQ output, GNOME's supported color modes for the monitor go from [default, sdr-native, bt2100] to [default, sdr-native], and the monitor comes up in the default mode. The internal panel's modes are unchanged. Signed-off-by: Ryan Murray <[email protected]>
|
Superseded by the external HDR fix in progress. The J413 should send PQ and HDR static metadata to a capable display, matching macOS. Keep this PR in draft. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR technical review on Draft at db1bb9b0c41f8cf6005f8a3fdf321f452ee9c1e0 (COMMENT only — Draft PR).
Checklist Summary
- §1 No model gating: Pass — reuses the existing
dcp_hdr_output_supported()capability predicate so connector property advertisement matches what the mode-set path actually supports. - §2 Production-ready: Pass — default command line, no hacks or new parameters.
- §3 Safety: One logic bug found below (
panel_edrfallthrough inapple_connector_attach_hdr()). - §4 Clean-room & attribution: Pass — human author/committer (
Ryan Murray <[email protected]>) and humanSigned-off-by:only, zero AI trailers in commit; PR body includesAssisted-by:. - §5 Evidence & CI:
host-testsgreen; J413 negative-control row (external 13.5 DCP dropsbt2100, internal panel unchanged) is solid. Appropriately kept Draft pending the positive-control row on a PQ-capable external Mac (desktop 26.x or firmware 27 external DCP) + regression tuple. - §6 Naming: Pass.
Technical Findings (to address before undrafting)
panel_edrleaks onto externalUSB/DisplayPortconnectors inapple_connector_attach_hdr()(drivers/gpu/drm/apple/apple_drv.c:999-1010):case DRM_MODE_CONNECTOR_eDP: if (!panel_edr) return 0; fallthrough; case DRM_MODE_CONNECTOR_USB: case DRM_MODE_CONNECTOR_DisplayPort: if (!pq_output && !panel_edr) return 0; ret = drm_mode_create_dp_colorspace_property(connector, colorspaces); break;
apple_connector_create()passesdcp_fw_compat_panel_edr(dcp), which (drivers/gpu/drm/apple/dcp.c:4158) only checksdcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP || dcp->fw_compat == DCP_FIRMWARE_V_27_0without checkingdcp_has_panel(dcp). BecauseeDPfalls through andUSB/DisplayPortchecksif (!pq_output && !panel_edr), anyfw_compat26.6-desktop or 27.0 externalUSB/DisplayPortconnector whosedcp_pq_output_supported(dcp)isfalse(e.g.,iomfb_is_m4(dcp)or a future non-PQ 27.x external pipeline) would still havepanel_edr == trueand get HDR properties attached anyway.
Separating the guard cleanly (e.g.,if (connector->connector_type != DRM_MODE_CONNECTOR_eDP && !pq_output) return 0;, or keepingeDPandUSB/DisplayPortguards independent) closes that hole.- Null-guard nit in
dcp_pq_output_supported()(drivers/gpu/drm/apple/iomfb.c:3203-3206):
dcp_pq_output_supported()passesplatform_get_drvdata(pdev)straight todcp_hdr_output_supported()without checking forNULL. Addingstruct apple_dcp *dcp = platform_get_drvdata(pdev); return dcp && dcp_hdr_output_supported(dcp);makes the cross-file helper self-defending and simplifiesapple_typec_port_pq_output(). - Dual-stream ordered Type-C ports note (
drivers/gpu/drm/apple/apple_drv.c:1307-1326, 1385-1393):
apple_typec_port_pq_output()checks all candidate pipelines forport_idxrather than only the pipelines inmask(same asapple_typec_port_rgb8_only()). Fine as long as all external pipelines on a port sharefw_compat, worth keeping in mind if mixed-capability pipelines ever share a port. - Before undrafting (§5):
Add the positive-control row on a PQ-capable external Mac (desktop 26.x or firmware 27 external DCP) confirmingbt2100remains advertised, along with the regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors).
Verdict
COMMENT (Draft) — sound direction; fix the panel_edr fallthrough bug in apple_connector_attach_hdr() and add the positive-control external PQ row before marking Ready for Review.
Assisted-by: LLM (Gemini 4 Neon)
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent source review at db1bb9b0c41f. The HDR capability loop can include pipelines excluded from this connector's CRTC mask. In the non-fixed path, the mask is filtered by dcp_fabric_port_crtc_mask(), and a candidate can also have a zero crtc_mask[i]. An SDR-only excluded pipeline can still suppress HDR for an HDR-capable connector. Use the same eligible-pipeline set for the PQ decision and add a mixed-pipeline test. Then verify a positive HDR row against the J413 negative row.
Problem. On a J413 (M2 Air) with an HDR monitor on USB-C, GNOME offers HDR, and turning it on gives a washed-out picture with the monitor still in SDR. The external display processor (firmware 13.5) can't be given a PQ signal:
dcp_hdr_output_supported()is false, so the mode set drops the PQ request, keeps the SDR transfer function and sends no HDR metadata. It still honours the BT.2020 colorspace (DCP log:colorimetry:9 eotf:0). The connector carries Colorspace and HDR_OUTPUT_METADATA anyway, so GNOME treats the monitor as HDR-capable and renders a BT.2100 desktop.Change. Attach the two properties to an external output only when its display processor can carry PQ:
Panels that show PQ content as EDR keep the properties, and outputs that can carry PQ don't change.
Testing.
dracut -fand the stock initramfs was restored afterwards). MSI MPG 325CQRXF on USB-C. An instrumented build showed both processors report no PQ output.gdctl show -v: the monitor's supported color modes go from[default, sdr-native, bt2100]to[default, sdr-native], and it comes up indefault. The internal panel stays[default, sdr-native].Still to run. A Mac whose external output does carry PQ (desktop 26.x or a firmware 27 external processor), to confirm the monitor still lists
bt2100there. Sending PQ and the HDR metadata from the 13.5 external processor would be the real fix for this monitor; that is separate work.