Commit 2ecae76a authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Hide the source vs. sink rate handling from intel_dp_compute_config()

intel_dp_compute_config() only really needs to know the rates supported
by both source and sink, so hide the raw source and sink arrays from it.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarSonika Jindal <sonika.jindal@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 1db10e28
...@@ -1195,7 +1195,7 @@ intel_dp_set_clock(struct intel_encoder *encoder, ...@@ -1195,7 +1195,7 @@ intel_dp_set_clock(struct intel_encoder *encoder,
} }
} }
static int intel_supported_rates(const int *source_rates, int source_len, static int intersect_rates(const int *source_rates, int source_len,
const int *sink_rates, int sink_len, const int *sink_rates, int sink_len,
int *supported_rates) int *supported_rates)
{ {
...@@ -1216,6 +1216,21 @@ static int intel_supported_rates(const int *source_rates, int source_len, ...@@ -1216,6 +1216,21 @@ static int intel_supported_rates(const int *source_rates, int source_len,
return k; return k;
} }
static int intel_supported_rates(struct intel_dp *intel_dp,
int *supported_rates)
{
struct drm_device *dev = intel_dp_to_dev(intel_dp);
const int *source_rates, *sink_rates;
int source_len, sink_len;
sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
source_len = intel_dp_source_rates(dev, &source_rates);
return intersect_rates(source_rates, source_len,
sink_rates, sink_len,
supported_rates);
}
static int rate_to_index(int find, const int *rates) static int rate_to_index(int find, const int *rates)
{ {
int i = 0; int i = 0;
...@@ -1246,17 +1261,10 @@ intel_dp_compute_config(struct intel_encoder *encoder, ...@@ -1246,17 +1261,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
int max_clock; int max_clock;
int bpp, mode_rate; int bpp, mode_rate;
int link_avail, link_clock; int link_avail, link_clock;
const int *sink_rates; int supported_rates[DP_MAX_SUPPORTED_RATES] = {};
int supported_rates[8] = {0}; int supported_len;
const int *source_rates;
int source_len, sink_len, supported_len;
sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
source_len = intel_dp_source_rates(dev, &source_rates);
supported_len = intel_supported_rates(source_rates, source_len, supported_len = intel_supported_rates(intel_dp, supported_rates);
sink_rates, sink_len, supported_rates);
/* No common link rates between source and sink */ /* No common link rates between source and sink */
WARN_ON(supported_len <= 0); WARN_ON(supported_len <= 0);
...@@ -1355,7 +1363,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, ...@@ -1355,7 +1363,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) { if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) {
intel_dp->rate_select = intel_dp->rate_select =
rate_to_index(supported_rates[clock], sink_rates); rate_to_index(supported_rates[clock],
intel_dp->supported_rates);
intel_dp->link_bw = 0; intel_dp->link_bw = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment