Commit af65840f authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915/dp: Fix DFP rgb->ycbcr conversion matrix



Our YCbCr output is always supposed to be limited range BT.709.
That's what we send with native HDMI. The conn_state->colorspace
stuff is entirely independent of that and is not supposed to alter
the generated output in any way. If we want a way to do that then
we need a new proprty for it.

Make it so that the RGB->YCbCr conversion when performed by the
DPF will match the BT.709 we would transmit with native HDMI.

Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220322120015.28074-12-ville.syrjala@linux.intel.com


Reviewed-by: default avatarUma Shankar <uma.shankar@intel.com>
parent 56185b90
Loading
Loading
Loading
Loading
+3 −35
Original line number Diff line number Diff line
@@ -2625,38 +2625,8 @@ void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp,
			    "Failed to %s protocol converter YCbCr 4:2:0 conversion mode\n",
			    str_enable_disable(intel_dp->dfp.ycbcr_444_to_420));

	tmp = 0;
	if (intel_dp->dfp.rgb_to_ycbcr) {
		bool bt2020, bt709;

		/*
		 * FIXME: Currently if userspace selects BT2020 or BT709, but PCON supports only
		 * RGB->YCbCr for BT601 colorspace, we go ahead with BT601, as default.
		 *
		 */
		tmp = DP_CONVERSION_BT601_RGB_YCBCR_ENABLE;

		bt2020 = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
								   intel_dp->downstream_ports,
								   DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
		bt709 = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
								  intel_dp->downstream_ports,
								  DP_DS_HDMI_BT709_RGB_YCBCR_CONV);
		switch (crtc_state->infoframes.vsc.colorimetry) {
		case DP_COLORIMETRY_BT2020_RGB:
		case DP_COLORIMETRY_BT2020_YCC:
			if (bt2020)
				tmp = DP_CONVERSION_BT2020_RGB_YCBCR_ENABLE;
			break;
		case DP_COLORIMETRY_BT709_YCC:
		case DP_COLORIMETRY_XVYCC_709:
			if (bt709)
				tmp = DP_CONVERSION_BT709_RGB_YCBCR_ENABLE;
			break;
		default:
			break;
		}
	}
	tmp = intel_dp->dfp.rgb_to_ycbcr ?
		DP_CONVERSION_BT709_RGB_YCBCR_ENABLE : 0;

	if (drm_dp_pcon_convert_rgb_to_ycbcr(&intel_dp->aux, tmp) < 0)
		drm_dbg_kms(&i915->drm,
@@ -4510,9 +4480,7 @@ intel_dp_update_420(struct intel_dp *intel_dp)
							intel_dp->downstream_ports);
	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
								 intel_dp->downstream_ports,
								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV);

	if (DISPLAY_VER(i915) >= 11) {
		/* Let PCON convert from RGB->YCbCr if possible */