]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/dp: Add helper to get min sdp guardband
authorAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Fri, 17 Oct 2025 12:35:01 +0000 (18:05 +0530)
committerAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Sat, 18 Oct 2025 02:11:20 +0000 (07:41 +0530)
Add a helper to compute vblank time needed for transmitting specific
DisplayPort SDPs like PPS, GAMUT_METADATA, and VSC_EXT. Latency is
based on line count per packet type.

This will be used to ensure adequate guardband when features like DSC/HDR
are enabled.

v2: Correct the lines required for PPS SDP. (Jouni)

Bspec: 70151
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/20251017123504.2247954-3-ankit.k.nautiyal@intel.com
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_dp.h

index 215ad690ab07711dac8d85205c5add914b8e46e7..9441ef6852005d607c0504b21e07246a1a976b53 100644 (file)
@@ -7002,3 +7002,39 @@ int intel_dp_compute_config_late(struct intel_encoder *encoder,
 
        return 0;
 }
+
+static
+int intel_dp_get_lines_for_sdp(u32 type)
+{
+       switch (type) {
+       case DP_SDP_VSC_EXT_VESA:
+       case DP_SDP_VSC_EXT_CEA:
+               return 10;
+       case HDMI_PACKET_TYPE_GAMUT_METADATA:
+               return 8;
+       case DP_SDP_PPS:
+               return 7;
+       default:
+               break;
+       }
+
+       return 0;
+}
+
+int intel_dp_sdp_min_guardband(const struct intel_crtc_state *crtc_state,
+                              bool assume_all_enabled)
+{
+       int sdp_guardband = 0;
+
+       if (assume_all_enabled ||
+           crtc_state->infoframes.enable &
+           intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA))
+               sdp_guardband = max(sdp_guardband,
+                                   intel_dp_get_lines_for_sdp(HDMI_PACKET_TYPE_GAMUT_METADATA));
+
+       if (assume_all_enabled ||
+           crtc_state->dsc.compression_enable)
+               sdp_guardband = max(sdp_guardband, intel_dp_get_lines_for_sdp(DP_SDP_PPS));
+
+       return sdp_guardband;
+}
index 0537be20fe7b96428634f692dd0b1ab00da5e90c..200a8b267f647491f6df53f9f9d9a38b47f472e5 100644 (file)
@@ -223,5 +223,7 @@ bool intel_dp_in_hdr_mode(const struct drm_connector_state *conn_state);
 int intel_dp_compute_config_late(struct intel_encoder *encoder,
                                 struct intel_crtc_state *crtc_state,
                                 struct drm_connector_state *conn_state);
+int intel_dp_sdp_min_guardband(const struct intel_crtc_state *crtc_state,
+                              bool assume_all_enabled);
 
 #endif /* __INTEL_DP_H__ */