MLK-20304-2 imx/drm/dcss: get the hdmi controller CS from private_flags
authorLaurentiu Palcu <laurentiu.palcu@nxp.com>
Fri, 9 Nov 2018 07:08:54 +0000 (09:08 +0200)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
DCSS HDR10 output pipe is always 10-bit. All we need to know to better
setup the LUTs and/or CSC matrices is the output colorspace.

This patch will fetch the CS from adjusted_mode's private_flags, as
indicated in the connector's mode_fixup phase.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
drivers/gpu/drm/imx/dcss/dcss-crtc.c

index d73be20..29f35d7 100644 (file)
@@ -179,14 +179,14 @@ static void dcss_crtc_atomic_flush(struct drm_crtc *crtc,
                dcss_ctxld_enable(dcss);
 }
 
+#define YUV_MODE               BIT(0)
+
 void dcss_crtc_setup_opipe(struct drm_crtc *crtc, struct drm_connector *conn,
                           u32 colorimetry, u32 eotf,
                           enum hdmi_quantization_range qr)
 {
        struct dcss_crtc *dcss_crtc = container_of(crtc, struct dcss_crtc,
                                                   base);
-       struct drm_display_info *di = &conn->display_info;
-       int vic;
 
        if ((colorimetry & BIT(HDMI_EXTENDED_COLORIMETRY_BT2020)) ||
            (colorimetry & BIT(HDMI_EXTENDED_COLORIMETRY_BT2020_CONST_LUM)))
@@ -206,15 +206,15 @@ void dcss_crtc_setup_opipe(struct drm_crtc *crtc, struct drm_connector *conn,
        else
                dcss_crtc->opipe_pr = PR_LIMITED;
 
-       vic = drm_match_cea_mode(&crtc->state->adjusted_mode);
-
-       /* FIXME: we should get the connector colorspace some other way */
-       if (vic == 97 &&
-           (di->color_formats & DRM_COLOR_FORMAT_YCRCB420) &&
-           (di->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_30))
+       /*
+        * private_flags is set in the connector driver in the mode_fixup()
+        * phase. Also, the DCSS HDR10 output pipe color depth is always
+        * 10-bit.
+        */
+       if (crtc->state->adjusted_mode.private_flags & YUV_MODE)
                dcss_crtc->opipe_pix_format = DRM_FORMAT_P010;
        else
-               dcss_crtc->opipe_pix_format = DRM_FORMAT_ARGB8888;
+               dcss_crtc->opipe_pix_format = DRM_FORMAT_ARGB2101010;
 
        DRM_DEBUG_KMS("OPIPE_CFG: gamut = %d, nl = %d, pr = %d, pix_fmt = %d\n",
                      dcss_crtc->opipe_g, dcss_crtc->opipe_nl,