Commit 636280ba authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Don't copy the DP source rates arrays

The source rates don't change, so we can just point the caller at the
const arrays.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarSonika Jindal <sonika.jindal@intel.com>
Reviewed-by: default avatarTodd Previte <tprevite@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent ea2d8a42
...@@ -1160,22 +1160,18 @@ intel_read_sink_rates(struct intel_dp *intel_dp, int *sink_rates) ...@@ -1160,22 +1160,18 @@ intel_read_sink_rates(struct intel_dp *intel_dp, int *sink_rates)
} }
static int static int
intel_read_source_rates(struct intel_dp *intel_dp, int *source_rates) intel_dp_source_rates(struct intel_dp *intel_dp, const int **source_rates)
{ {
struct drm_device *dev = intel_dp_to_dev(intel_dp); struct drm_device *dev = intel_dp_to_dev(intel_dp);
int i;
int max_default_rate;
if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) { if (INTEL_INFO(dev)->gen >= 9) {
for (i = 0; i < ARRAY_SIZE(gen9_rates); ++i) *source_rates = gen9_rates;
source_rates[i] = gen9_rates[i]; return ARRAY_SIZE(gen9_rates);
} else {
/* Index of the max_link_bw supported + 1 */
max_default_rate = (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
for (i = 0; i < max_default_rate; ++i)
source_rates[i] = default_rates[i];
} }
return i;
*source_rates = default_rates;
return (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
} }
static void static void
...@@ -1272,12 +1268,12 @@ intel_dp_compute_config(struct intel_encoder *encoder, ...@@ -1272,12 +1268,12 @@ intel_dp_compute_config(struct intel_encoder *encoder,
int link_avail, link_clock; int link_avail, link_clock;
int sink_rates[8]; int sink_rates[8];
int supported_rates[8] = {0}; int supported_rates[8] = {0};
int source_rates[8]; const int *source_rates;
int source_len, sink_len, supported_len; int source_len, sink_len, supported_len;
sink_len = intel_read_sink_rates(intel_dp, sink_rates); sink_len = intel_read_sink_rates(intel_dp, sink_rates);
source_len = intel_read_source_rates(intel_dp, source_rates); source_len = intel_dp_source_rates(intel_dp, &source_rates);
supported_len = intel_supported_rates(source_rates, source_len, supported_len = intel_supported_rates(source_rates, source_len,
sink_rates, sink_len, supported_rates); sink_rates, sink_len, supported_rates);
......
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