drm/i915/dp: Attach HDR_OUTPUT_METADATA on eDP when TCON supports HDR
Subsystems (3)
PATCH 1/1 drm/i915/dp: Attach HDR_OUTPUT_METADATA on eDP when TCON supports HDR
intel_dp_has_gamut_metadata_dip() returns false for port A on pre-ICL platforms. intel_dp_add_properties() uses that helper to decide whether to attach the HDR_OUTPUT_METADATA connector property, so eDP panels on those platforms never expose it even when the panel advertises HDR in its EDID.
On such panels the HDR metadata is not sent as a gamut metadata SDP, but programmed through the Intel AUX HDR interface instead. The TCON is already probed during intel_edp_backlight_setup(), which runs before intel_dp_add_properties(), so the capability is known at that point.
Attach the property when the panel's TCON advertises PQ (ST2084) decode support, so that userspace can enable HDR on these panels.
Since no SDP is transmitted in that case, also bail out early from intel_dp_compute_hdr_metadata_infoframe_sdp() when the encoder cannot send gamut metadata. Otherwise the computed infoframe state would be inconsistent with what is actually programmed, and the state checker would complain.
---
Reviewer notes, not part of the commit message:
Tested on a CometLake-U (Gen9.5) laptop with a 3840x2160 10bpc eDP panel that advertises BT2020 + ST2084 in its EDID. With this change the connector gains the HDR_OUTPUT_METADATA property, GNOME 50 exposes the HDR switch, and the panel enters PQ/BT2020 mode (the DP Colorspace property switches to BT2020_RGB). The Intel TCON HDR backlight interface was already in use before this change, so the hardware path existed and only the property was missing.
Two things I am not sure about:
1. intel_dp_aux_write_content_luminance() also returns early when !intel_dp_has_gamut_metadata_dip(), which is exactly the PORT_A case where the AUX path is used. max_cll/max_fall therefore never reach the TCON. In my testing Mutter sends all-zero mastering metadata anyway, so I could not tell whether this shows up in practice. Should this check be relaxed too, or is it intentional?
2. panel->backlight.edp.intel_cap shares a union with the VESA backlight info, so supports_2084_decode would read unrelated bits if the VESA interface had been selected instead of the Intel one. Would you prefer an explicit "Intel HDR backlight is in use" check here?
drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp.c +6 -1
@@ -3088,6 +3088,9 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,int ret;struct hdmi_drm_infoframe *drm_infoframe = &crtc_state->infoframes.drm.drm; +if (!intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +return ; +if (!conn_state->hdr_output_metadata)return ;
@@ -6715,7 +6718,9 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connecintel_attach_dp_colorspace_property (&connector->base); } -if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base) || + (intel_dp_is_edp (intel_dp) && + connector->panel.backlight.edp.intel_cap.supports_2084_decode))drm_connector_attach_hdr_output_metadata_property (&connector->base);if (HAS_VRR (display))
Signature · 1 line
2.53.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/i915/dp: broken LSPCON HDR in intel_dp_compute_hdr_metadata_infoframe_sdp() - [Medium]…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] drm/i915/dp: broken LSPCON HDR in intel_dp_compute_hdr_metadata_infoframe_sdp()
- [Medium] drm/i915/dp: unchecked union read of intel_cap in intel_dp_add_properties()
- [Medium] drm/i915/dp: fastset skips TCON HDR update when SDP computation is bypassed
--
commit ee42402ceca82543288507d878602e90d81ac27f
Author: Yitian Shao <[email protected]>
drm/i915/dp: Attach HDR_OUTPUT_METADATA on eDP when TCON supports HDR
This commit attaches the HDR_OUTPUT_METADATA property on eDP connectors whose TCON supports PQ (ST2084) decoding via the Intel AUX HDR interface, and skips computing the HDR metadata infoframe SDP when the encoder does not support gamut metadata DIP.
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp, · line 3246
Quoted 13 lines
drivers/gpu/drm/i915/display/intel_dp.c +3
-0@@ -3239,6 +3239,9 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,int ret;struct hdmi_drm_infoframe *drm_infoframe = &crtc_state->infoframes.drm.drm; +if (!intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +return ; +if (!conn_state->hdr_output_metadata)return ;
[Severity: High]
Does this break HDR metadata transmission on LSPCON outputs?
intel_dp_has_gamut_metadata_dip() unconditionally returns false when intel_bios_encoder_is_lspcon(encoder->devdata) is true, because LSPCON connectors defer attaching HDR_OUTPUT_METADATA until intel_dp_connector_register() probes intel_lspcon_detect_hdr_capability(). LSPCON encoders still rely on intel_dp_compute_hdr_metadata_infoframe_sdp() to populate crtc_state->infoframes.drm.drm and enable HDMI_PACKET_TYPE_GAMUT_METADATA in crtc_state->infoframes.enable for lspcon_write_infoframe(). With this check, HDR metadata is never computed or sent on LSPCON ports, and the state checker will report an infoframe mismatch if VIDEO_DIP_ENABLE_GMP_HSW was already active.
[Severity: Medium]
When intel_dp_compute_hdr_metadata_infoframe_sdp() returns early on pre-ICL port A eDP panels, can a fastset skip programming the TCON HDR parameters?
When userspace toggles HDR_OUTPUT_METADATA, intel_digital_connector_atomic_check() sets crtc_state->mode_changed = true, and on platforms with gamut metadata DIP the resulting change in crtc_state->infoframes.enable causes intel_pipe_config_compare() to reject fastset and run a full modeset. Returning early here leaves crtc_state->infoframes.enable unchanged, so commits without another pipe config change are downgraded to a fastset (update_pipe). On the fastset path, intel_ddi_update_pipe_dp() calls intel_backlight_update(), which only calls __intel_backlight_enable() -> intel_dp_aux_hdr_enable_backlight() when !panel->backlight.enabled:
drivers/gpu/drm/i915/display/intel_backlight.c:intel_backlight_update() {
...
mutex_lock(&display->backlight.lock);
if (!panel->backlight.enabled)
__intel_backlight_enable(crtc_state, conn_state);
mutex_unlock(&display->backlight.lock);
...
}Because panel->backlight.enabled is already true on an active panel, INTEL_EDP_HDR_GETSET_CTRL_PARAMS is never updated in the TCON.
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connec · line 7029
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.c +3
-1@@ -7018,7 +7021,9 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connecintel_attach_dp_colorspace_property (&connector->base); } -if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base) || + (intel_dp_is_edp (intel_dp) && + connector->panel.backlight.edp.intel_cap.supports_2084_decode))drm_connector_attach_hdr_output_metadata_property (&connector->base);if (HAS_VRR (display))
[Severity: Medium]
Can reading connector->panel.backlight.edp.intel_cap.supports_2084_decode here access the wrong union member when the VESA eDP AUX backlight interface is selected?
In struct intel_panel, panel.backlight.edp is an untagged union between vesa and intel_cap:
drivers/gpu/drm/i915/display/intel_display_types.h:struct intel_panel {
...
union {
struct {
struct drm_edp_backlight_info info;
bool luminance_control_support;
} vesa;
struct {
bool sdr_uses_aux;
bool supports_2084_decode;
...
}supports_2084_decode sits at byte offset 1, overlapping vesa.info.pwm_freq_pre_divider in struct drm_edp_backlight_info. If intel_edp_backlight_setup() selected the VESA AUX backlight path instead of the Intel HDR AUX path, drm_edp_backlight_init() populates vesa.info and a non-zero pwm_freq_pre_divider will falsely attach HDR_OUTPUT_METADATA (and trigger an out-of-range bool load under UBSan if the divider is >= 2).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 37 lines · On Fri, Nov 20, 2026 at 06:15:06AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] drm/i915/dp: broken LSPCON HDR inintel_dp_compute_hdr_metadata_infoframe_sdp()
- [Medium] drm/i915/dp: unchecked union read ofintel_capinintel_dp_add_properties()
- [Medium] drm/i915/dp: fastset skips TCON HDR update when SDP computation is bypassed
--commit
ee42402ceca82543288507d878602e90d81ac27f
Author: Yitian Shao <[email protected]>drm/i915/dp: Attach
HDR_OUTPUT_METADATAon eDP when TCON supports HDRThis commit attaches the
HDR_OUTPUT_METADATAproperty on eDP connectors whose TCON supports PQ (ST2084) decoding via the Intel AUX HDR interface, and skips computing the HDR metadata infoframe SDP when the encoder does not support gamut metadata DIP.drivers/gpu/drm/i915/display/intel_dp.c intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp, · line 3246
Quoted 13 lines
drivers/gpu/drm/i915/display/intel_dp.c +3
-0@@ -3239,6 +3239,9 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,int ret;struct hdmi_drm_infoframe *drm_infoframe = &crtc_state->infoframes.drm.drm; +if (!intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +return ; +if (!conn_state->hdr_output_metadata)return ;[Severity: High]
Does this break HDR metadata transmission on LSPCON outputs?
Quoted 10 lines
intel_dp_has_gamut_metadata_dip()unconditionally returns false whenintel_bios_encoder_is_lspcon(encoder->devdata)is true, because LSPCON connectors defer attachingHDR_OUTPUT_METADATAuntilintel_dp_connector_register()probesintel_lspcon_detect_hdr_capability(). LSPCON encoders still rely onintel_dp_compute_hdr_metadata_infoframe_sdp()to populatecrtc_state->infoframes.drm.drmand enableHDMI_PACKET_TYPE_GAMUT_METADATAincrtc_state->infoframes.enableforlspcon_write_infoframe(). With this check, HDR metadata is never computed or sent on LSPCON ports, and the state checker will report an infoframe mismatch ifVIDEO_DIP_ENABLE_GMP_HSWwas already active.
Looks legit. I think the correct solution would be to drop the LSPCON check from has_gamut_metadata_dip() since it's clearly nonsense. But then intel_dp_add_properties() will need to do the LSPCON check itself so that it doesn't attache the HDR metadata to the LSPCON there.
And I think for good measure we also want to add a has_gamut_metadata_dip() check into intel_lspcon_detect_hdr_capability(), just in case someone has ever hooked up an on board LSPCON to a port that doesn't support that DIP. This should be a separate patch though since it's a separate pre-existing issue.
Quoted 5 lines
[Severity: Medium]
Whenintel_dp_compute_hdr_metadata_infoframe_sdp()returns early on pre-ICL port A eDP panels, can a fastset skip programming the TCON HDR parameters?
Quoted 10 lines
When userspace toggles
HDR_OUTPUT_METADATA,intel_digital_connector_atomic_check()setscrtc_state->mode_changed= true, and on platforms with gamut metadata DIP the resulting change incrtc_state->infoframes.enablecausesintel_pipe_config_compare()to reject fastset and run a full modeset. Returning early here leavescrtc_state->infoframes.enableunchanged, so commits without another pipe config change are downgraded to a fastset (update_pipe). On the fastset path,intel_ddi_update_pipe_dp()callsintel_backlight_update(), which only calls__intel_backlight_enable()->intel_dp_aux_hdr_enable_backlight()when !panel->backlight.enabled:
This looks correct as well. And I think it highlights that our HDR metadata fastset support is already broken. Well, it kinda works for changing the metadata (except when the backlight interface is involved as is the case here), but not for switching between HDR and SDR modes.
I say "kinda works" above because in general the whole .update_pipe() thing is a half baked hack. There is no real consideration for any differences in double buffering behaviour of DIPs (or a complete lack of double buffering as is the case for many DIPs). .update_pipe() is also called outside the vblank evasion critical section, so even the double buffered DIPs (or anything else we do there) will probably not sync up with the rest of the atomic commit on the CRTC.
So how to fix this specific AUX backlight problem... Maybe we need a crtc_state->backlight_changed or something? This might in fact also be relevant for the recently proposed LUMINANCE connector property (which I've not had any time to actually consider).
Quoted 56 lines
drivers/gpu/drm/i915/display/intel_backlight.c:intel_backlight_update() { ... mutex_lock(&display->backlight.lock); if (!panel->backlight.enabled) __intel_backlight_enable(crtc_state, conn_state); mutex_unlock(&display->backlight.lock); ... }Because
panel->backlight.enabledis already true on an active panel,INTEL_EDP_HDR_GETSET_CTRL_PARAMSis never updated in the TCON.drivers/gpu/drm/i915/display/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connec · line 7029
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.c +3
-1@@ -7018,7 +7021,9 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connecintel_attach_dp_colorspace_property (&connector->base); } -if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base) || + (intel_dp_is_edp (intel_dp) && + connector->panel.backlight.edp.intel_cap.supports_2084_decode))drm_connector_attach_hdr_output_metadata_property (&connector->base);if (HAS_VRR (display))[Severity: Medium]
Can readingconnector->panel.backlight.edp.intel_cap.supports_2084_decodehere access the wrong union member when the VESA eDP AUX backlight interface is selected?In struct
intel_panel, panel.backlight.edp is an untagged union between vesa andintel_cap:drivers/gpu/drm/i915/display/intel_display_types.h:struct intel_panel { ... union { struct { struct drm_edp_backlight_info info; bool luminance_control_support; } vesa; struct { bool sdr_uses_aux; bool supports_2084_decode; ... }
supports_2084_decodesits at byte offset 1, overlapping vesa.info.pwm_freq_pre_divider in structdrm_edp_backlight_info. Ifintel_edp_backlight_setup()selected the VESA AUX backlight path instead of the Intel HDR AUX path,drm_edp_backlight_init()populates vesa.info and a non-zeropwm_freq_pre_dividerwill falsely attachHDR_OUTPUT_METADATA(and trigger an out-of-range bool load under UBSan if the divider is >= 2).Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Signature · 2 lines
Ville Syrjälä Intel
Quoted 32 lines · Yitian Shao
intel_dp_has_gamut_metadata_dip()returns false for port A on pre-ICL platforms.intel_dp_add_properties()uses that helper to decide whether to attach theHDR_OUTPUT_METADATAconnector property, so eDP panels on those platforms never expose it even when the panel advertises HDR in its EDID.On such panels the HDR metadata is not sent as a gamut metadata SDP, but programmed through the Intel AUX HDR interface instead. The TCON is already probed during
intel_edp_backlight_setup(), which runs beforeintel_dp_add_properties(), so the capability is known at that point.Attach the property when the panel's TCON advertises PQ (ST2084) decode support, so that userspace can enable HDR on these panels.
Since no SDP is transmitted in that case, also bail out early from
intel_dp_compute_hdr_metadata_infoframe_sdp()when the encoder cannot send gamut metadata. Otherwise the computed infoframe state would be inconsistent with what is actually programmed, and the state checker would complain.Signed-off-by Yitian Shao <[email protected]>---
Reviewer notes, not part of the commit message:Tested on a CometLake-U (Gen9.5) laptop with a 3840x2160 10bpc eDP panel that advertises BT2020 + ST2084 in its EDID. With this change the connector gains the
HDR_OUTPUT_METADATAproperty, GNOME 50 exposes the HDR switch, and the panel enters PQ/BT2020 mode (the DP Colorspace property switches toBT2020_RGB). The Intel TCON HDR backlight interface was already in use before this change, so the hardware path existed and only the property was missing.
Quoted 8 lines
Two things I am not sure about:
1.
intel_dp_aux_write_content_luminance()also returns early when !intel_dp_has_gamut_metadata_dip(), which is exactly thePORT_Acase where the AUX path is used. max_cll/max_fall therefore never reach the TCON. In my testing Mutter sends all-zero mastering metadata anyway, so I could not tell whether this shows up in practice. Should this check be relaxed too, or is it intentional?
My reading of the "spec" is that we should do the content luminance write. On the platforms where the SDP is used, I believe the SDP should actually take precedence over the DPCD based information.
Quoted 5 lines
2.
panel->backlight.edp.intel_capshares a union with the VESA backlight info, sosupports_2084_decodewould read unrelated bits if the VESA interface had been selected instead of the Intel one. Would you prefer an explicit "Intel HDR backlight is in use" check here?
Yeah, we probably want that. Maybe a small helper function that does all the checks we need, so as to not clog up the if-statement too much.
Quoted 31 lines
drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/display/intel_dp.c +6
-1@@ -3088,6 +3088,9 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,int ret;struct hdmi_drm_infoframe *drm_infoframe = &crtc_state->infoframes.drm.drm; +if (!intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +return ; +if (!conn_state->hdr_output_metadata)return ;@@ -6715,7 +6718,9 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connecintel_attach_dp_colorspace_property (&connector->base); } -if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base)) +if (intel_dp_has_gamut_metadata_dip (&dp_to_dig_port (intel_dp)->base) || + (intel_dp_is_edp (intel_dp) && + connector->panel.backlight.edp.intel_cap.supports_2084_decode))drm_connector_attach_hdr_output_metadata_property (&connector->base);if (HAS_VRR (display))Signature · 1 line
2.53.0
Signature · 2 lines
Ville Syrjälä Intel