[Intel-gfx] [PATCH v2 5/9] drm/i915/dp: Compute configuration for using PCON's color/format conversion

Ankit Nautiyal ankit.k.nautiyal at intel.com
Thu Sep 1 06:00:57 UTC 2022


Fill the crtc_state members to store the configuration required by PCONs
for color/format conversion for a YCBCR420 mode and the computed output
format.

This will be later used during protocol_converter_config to program the
PCON to use appropriate color/format conversion.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index b6f62444b589..4c1a0d9f750c 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -1970,6 +1970,30 @@ static bool intel_dp_has_audio(struct intel_encoder *encoder,
 		return intel_conn_state->force_audio == HDMI_AUDIO_ON;
 }
 
+static void
+intel_dp_compute_dfp_ycbcr420(struct intel_encoder *encoder,
+			      struct intel_crtc_state *crtc_state)
+{
+	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+	if (!drm_dp_is_branch(intel_dp->dpcd))
+		return;
+
+	/* Mode is YCBCR420, output_format is also YCBCR420: Passthrough */
+	if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420)
+		return;
+
+	/* Mode is YCBCR420, output_format is YCBCR444: Downsample */
+	if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444) {
+		crtc_state->dp_dfp_config.ycbcr_444_to_420 = true;
+		return;
+	}
+
+	/* Mode is YCBCR420, output_format is RGB: Convert to YCBCR444 and Downsample */
+	crtc_state->dp_dfp_config.rgb_to_ycbcr = true;
+	crtc_state->dp_dfp_config.ycbcr_444_to_420 = true;
+}
+
 static int
 intel_dp_compute_output_format(struct intel_encoder *encoder,
 			       struct intel_crtc_state *crtc_state,
@@ -1987,6 +2011,8 @@ intel_dp_compute_output_format(struct intel_encoder *encoder,
 	ycbcr_420_only = drm_mode_is_420_only(info, adjusted_mode);
 
 	crtc_state->output_format = intel_dp_output_format(connector, ycbcr_420_only);
+	if (ycbcr_420_only)
+		intel_dp_compute_dfp_ycbcr420(encoder, crtc_state);
 
 	if (ycbcr_420_only && !intel_dp_is_ycbcr420(intel_dp, crtc_state)) {
 		drm_dbg_kms(&i915->drm,
@@ -2003,6 +2029,7 @@ intel_dp_compute_output_format(struct intel_encoder *encoder,
 			return ret;
 
 		crtc_state->output_format = intel_dp_output_format(connector, true);
+		intel_dp_compute_dfp_ycbcr420(encoder, crtc_state);
 		ret = intel_dp_compute_link_config(encoder, crtc_state, conn_state,
 						   respect_downstream_limits);
 	}
-- 
2.25.1



More information about the Intel-gfx mailing list