Commit a04d27cd authored by Ankit Nautiyal's avatar Ankit Nautiyal Committed by Ville Syrjälä
Browse files

drm/i915/display: Add new member to configure PCON color conversion



The decision to use DFP output format conversion capabilities should be
during compute_config phase.

This patch adds new member to crtc_state to represent the final
output_format to the sink. In case of a DFP this can be different than
the output_format, as per the format conversion done via the PCON.

This will help to store only the format conversion capabilities of the
DP device in intel_dp->dfp, and use crtc_state to compute and store the
configuration for color/format conversion for a given mode.

v2: modified the new member to crtc_state to represent the final
output_format that eaches the sink, after possible conversion by
PCON kind of devices. (Ville)

v3: Addressed comments from Ville:
-Added comments to clarify difference between sink_format and
output_format.
-Corrected the order of setting sink_format and output_format.
-Added readout for sink_format in get_pipe_config hooks.

v4: Set sink_format for intel_sdvo too. (Ville)

v5: Rebased.

v6: Fixed condition to go for YCbCr420 format for dp and hdmi. (Ville)

v7: Fix the condition to set sink_format for HDMI.
Set hdmi output_format simply as sink_format. (Ville)

Signed-off-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v3)
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230427125605.487769-2-ankit.k.nautiyal@intel.com
parent 51f70082
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1591,6 +1591,7 @@ static int gen11_dsi_compute_config(struct intel_encoder *encoder,
		&pipe_config->hw.adjusted_mode;
	int ret;

	pipe_config->sink_format = INTEL_OUTPUT_FORMAT_RGB;
	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;

	ret = intel_panel_compute_config(intel_connector, adjusted_mode);
+1 −0
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ static int intel_crt_compute_config(struct intel_encoder *encoder,
	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
		return -EINVAL;

	pipe_config->sink_format = INTEL_OUTPUT_FORMAT_RGB;
	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;

	return 0;
+3 −2
Original line number Diff line number Diff line
@@ -217,10 +217,11 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config,

	snprintf_output_types(buf, sizeof(buf), pipe_config->output_types);
	drm_dbg_kms(&i915->drm,
		    "active: %s, output_types: %s (0x%x), output format: %s\n",
		    "active: %s, output_types: %s (0x%x), output format: %s, sink format: %s\n",
		    str_yes_no(pipe_config->hw.active),
		    buf, pipe_config->output_types,
		    intel_output_format_name(pipe_config->output_format));
		    intel_output_format_name(pipe_config->output_format),
		    intel_output_format_name(pipe_config->sink_format));

	drm_dbg_kms(&i915->drm,
		    "cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
+5 −0
Original line number Diff line number Diff line
@@ -2889,6 +2889,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
		return false;

	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
	pipe_config->sink_format = pipe_config->output_format;
	pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe;
	pipe_config->shared_dpll = NULL;

@@ -3314,6 +3315,8 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc,
		break;
	}

	pipe_config->sink_format = pipe_config->output_format;

	pipe_config->gamma_mode = REG_FIELD_GET(TRANSCONF_GAMMA_MODE_MASK_ILK, tmp);

	pipe_config->framestart_delay = REG_FIELD_GET(TRANSCONF_FRAME_START_DELAY_MASK, tmp) + 1;
@@ -3712,6 +3715,8 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
			bdw_get_pipe_misc_output_format(crtc);
	}

	pipe_config->sink_format = pipe_config->output_format;

	pipe_config->gamma_mode = intel_de_read(dev_priv,
						GAMMA_MODE(crtc->pipe));

+10 −1
Original line number Diff line number Diff line
@@ -1313,9 +1313,18 @@ struct intel_crtc_state {
	/* HDMI High TMDS char rate ratio */
	bool hdmi_high_tmds_clock_ratio;

	/* Output format RGB/YCBCR etc */
	/*
	 * Output format RGB/YCBCR etc., that is coming out
	 * at the end of the pipe.
	 */
	enum intel_output_format output_format;

	/*
	 * Sink output format RGB/YCBCR etc., that is going
	 * into the sink.
	 */
	enum intel_output_format sink_format;

	/* enable pipe gamma? */
	bool gamma_enable;

Loading