Use the link caps helper to select the maximum MST link configuration
for non-DSC computation, instead of using the separate max rate and lane
count limits, which may not form a valid configuration after individual
configs are disabled by fallback.

This is a step towards unifying configuration selection and iteration
across connector types and between compute and fallback paths.

In some cases all configurations should be considered, as noted in the
code comment; for now keep the existing behavior of selecting the
maximum bandwidth configuration as determined by the MST connector's BW
config iteration order.

Signed-off-by: Imre Deak <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c 
b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index e113c9e60e67d..47b8563f85e4d 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -445,8 +445,20 @@ static int mst_stream_compute_link_config(struct intel_dp 
*intel_dp,
                                          struct drm_connector_state 
*conn_state,
                                          const struct link_config_limits 
*limits)
 {
-       crtc_state->lane_count = limits->max_lane_count;
-       crtc_state->port_clock = limits->max_rate;
+       struct intel_connector *connector = 
to_intel_connector(conn_state->connector);
+       struct intel_dp_link_config max_link_config;
+
+       /*
+        * FIXME: Use a proper iteration over the link configurations, instead
+        * of using only the max BW config. For instance UHBR rate configs may
+        * have additional limitations over non-UHBR ones, due to the DSC DPT
+        * bpp maximum limit.
+        */
+       if (!intel_dp_get_connector_max_link_config(connector, limits, 
&max_link_config))
+               return -EINVAL;
+
+       crtc_state->port_clock = max_link_config.rate;
+       crtc_state->lane_count = max_link_config.lane_count;
 
        /*
         * FIXME: allocate the BW according to link_bpp, which in the case of
-- 
2.49.1

Reply via email to