Skip to contentSkip to conversation

drm/i915/dp: Attach HDR_OUTPUT_METADATA on eDP when TCON supports HDR

PATCH Superseded Yitian Shao 2 participants 2 messages Nov 20

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 and the Intel AUX HDR backlight interface is the one in use, 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. LSPCON is excluded from that early return, as it still needs the infoframe populated for lspcon_write_infoframe().

---
v2:
- Do not skip the infoframe on LSPCON, which still needs it for lspcon_write_infoframe(). Reported by Sashiko.
- Add intel_dp_aux_is_hdr_backlight() and use it to attach the property only when the Intel AUX HDR backlight interface is in use, instead of reading the untagged union unconditionally. Reported by Sashiko.

v1 was tested on a CometLake-U (Gen9.5) laptop with a 3840x2160 10bpc eDP panel that advertises BT2020 + ST2084 in its EDID: the connector gains HDR_OUTPUT_METADATA, GNOME 50 offers the HDR switch, and the panel enters PQ/BT2020 mode. The Intel TCON HDR backlight interface was already in use before the change. v2 keeps that path unchanged on this hardware (the new helper returns true there) and was compile-tested; I have not re-run the runtime test for v2.

Sashiko also raised a fastset concern: with the early return, crtc_state->infoframes.enable no longer changes when HDR metadata is toggled, so the commit might be downgraded to a fastset and skip intel_dp_aux_hdr_enable_backlight(). I don't think that can happen, because intel_digital_connector_atomic_check() sets mode_changed = true whenever drm_connector_atomic_hdr_metadata_equal() fails, which forces a full modeset and therefore intel_dp_encoder_enable() -> intel_backlight_enable() -> funcs->enable(). Happy to be corrected if there is a path I am missing.

One remaining question: 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. Should that check be relaxed too?

 drivers/gpu/drm/i915/display/intel_dp.c           | 15 ++++++++++++++-
 .../gpu/drm/i915/display/intel_dp_aux_backlight.c |  5 +++++
 .../gpu/drm/i915/display/intel_dp_aux_backlight.h |  3 +++
 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp.c +14 -1
index afd4169..f816dd5 100644
@@ -70,6 +70,7 @@
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_dp_aux.h"
+#include "intel_dp_aux_backlight.h"
 #include "intel_dp_hdcp.h"
 #include "intel_dp_link_training.h"
 #include "intel_dp_mst.h"
@@ -3086,8 +3087,17 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp,
 {
 	struct intel_display *display = to_intel_display(intel_dp);
 	int ret;
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
 	struct hdmi_drm_infoframe *drm_infoframe = &crtc_state->infoframes.drm.drm;
 
+	/*
+	 * LSPCON does not use a gamut metadata DIP, but still needs the
+	 * infoframe populated for lspcon_write_infoframe().
+	 */
+	if (!intel_dp_has_gamut_metadata_dip(encoder) &&
+	    !intel_bios_encoder_is_lspcon(encoder->devdata))
+		return;
+
 	if (!conn_state->hdr_output_metadata)
 		return;
 
@@ -6715,7 +6725,10 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *_connec
 		intel_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) &&
+	     intel_dp_aux_is_hdr_backlight(connector) &&
+	     connector->panel.backlight.edp.intel_cap.supports_2084_decode))
 		drm_connector_attach_hdr_output_metadata_property(&connector->base);
 
 	if (HAS_VRR(display))
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +5 -0
index 266e042..069895f 100644
@@ -672,6 +672,11 @@ static const struct intel_panel_bl_funcs intel_dp_hdr_bl_funcs = {
 	.get = intel_dp_aux_hdr_get_backlight,
 };
 
+bool intel_dp_aux_is_hdr_backlight(const struct intel_connector *connector)
+{
+	return connector->panel.backlight.funcs == &intel_dp_hdr_bl_funcs;
+}
+
 static const struct intel_panel_bl_funcs intel_dp_vesa_bl_funcs = {
 	.setup = intel_dp_aux_vesa_setup_backlight,
 	.enable = intel_dp_aux_vesa_enable_backlight,
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.h +3 -0
index ed60c28..1fa1b93 100644
@@ -6,8 +6,11 @@
 #ifndef __INTEL_DP_AUX_BACKLIGHT_H__
 #define __INTEL_DP_AUX_BACKLIGHT_H__
 
+#include <linux/types.h>
+
 struct intel_connector;
 
 int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector);
+bool intel_dp_aux_is_hdr_backlight(const struct intel_connector *connector);
 
 #endif /* __INTEL_DP_AUX_BACKLIGHT_H__ */
Signature · 1 line
2.53.0
#1 lore raw

✗ LGCI.VerificationFailed: failure for drm/i915/dp: Attach HDR_OUTPUT_METADATA on eDP when TCON supports HDR (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915/dp: Attach HDR_OUTPUT_METADATA on eDP when TCON supports HDR (rev2)
URL : https://patchwork.freedesktop.org/series/179176/
State : failure

== Summary ==

Series author address '[email protected]' is not on the allowlist, which prevents CI from being automatically triggered. If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork. Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/193534/ (on built-in)