From: Ville Syrjälä <[email protected]>

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 <[email protected]>
Cc: Uma Shankar <[email protected]>
Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 38 ++-----------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index dfd3ab385b0f..29b12456c461 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2456,38 +2456,8 @@ void intel_dp_configure_protocol_converter(struct 
intel_dp *intel_dp,
                            "Failed to %s protocol converter YCbCr 4:2:0 
conversion mode\n",
                            enabledisable(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,
@@ -4290,9 +4260,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 */
-- 
2.32.0

Reply via email to