drm/amd/display: Separate fec debug flag and monitor patch
authorLewis Huang <Lewis.Huang@amd.com>
Mon, 7 Dec 2020 09:14:14 +0000 (17:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 14 Jan 2021 04:42:59 +0000 (23:42 -0500)
[Why]
Driver apply the monitor patch into global debug flag.  When apply
monitor patch, fec feature will always disable.

[How]
Separate fec debug flag and monitor patch

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Lewis Huang <Lewis.Huang@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/dc_link.h

index f4a2088..59ef1ea 100644 (file)
@@ -1065,9 +1065,6 @@ static bool dc_link_detect_helper(struct dc_link *link,
                        break;
                }
 
-               if (link->local_sink->edid_caps.panel_patch.disable_fec)
-                       link->ctx->dc->debug.disable_fec = true;
-
                // Check if edid is the same
                if ((prev_sink) &&
                    (edid_status == EDID_THE_SAME || edid_status == EDID_OK))
@@ -3635,7 +3632,7 @@ uint32_t dc_link_bandwidth_kbps(
        link_bw_kbps *= 8;   /* 8 bits per byte*/
        link_bw_kbps *= link_setting->lane_count;
 
-       if (dc_link_is_fec_supported(link) && !link->dc->debug.disable_fec) {
+       if (dc_link_should_enable_fec(link)) {
                /* Account for FEC overhead.
                 * We have to do it based on caps,
                 * and not based on FEC being set ready,
@@ -3687,3 +3684,18 @@ bool dc_link_is_fec_supported(const struct dc_link *link)
                        !IS_FPGA_MAXIMUS_DC(link->ctx->dce_environment));
 }
 
+bool dc_link_should_enable_fec(const struct dc_link *link)
+{
+       bool is_fec_disable = false;
+       bool ret = false;
+
+       if (link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT_MST &&
+                       link->local_sink &&
+                       link->local_sink->edid_caps.panel_patch.disable_fec)
+               is_fec_disable = true;
+
+       if (dc_link_is_fec_supported(link) && !link->dc->debug.disable_fec && !is_fec_disable)
+               ret = true;
+
+       return ret;
+}
index 1bd1a09..3cd84dc 100644 (file)
@@ -4345,7 +4345,7 @@ void dp_set_fec_ready(struct dc_link *link, bool ready)
        struct link_encoder *link_enc = link->link_enc;
        uint8_t fec_config = 0;
 
-       if (!dc_link_is_fec_supported(link) || link->dc->debug.disable_fec)
+       if (!dc_link_should_enable_fec(link))
                return;
 
        if (link_enc->funcs->fec_set_ready &&
@@ -4380,7 +4380,7 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)
 {
        struct link_encoder *link_enc = link->link_enc;
 
-       if (!dc_link_is_fec_supported(link) || link->dc->debug.disable_fec)
+       if (!dc_link_should_enable_fec(link))
                return;
 
        if (link_enc->funcs->fec_set_enable &&
index 6d9a60c..d8d659b 100644 (file)
@@ -369,5 +369,6 @@ uint32_t dc_bandwidth_in_kbps_from_timing(
        const struct dc_crtc_timing *timing);
 
 bool dc_link_is_fec_supported(const struct dc_link *link);
+bool dc_link_should_enable_fec(const struct dc_link *link);
 
 #endif /* DC_LINK_H_ */