diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-03-12 11:10:33 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-20 06:48:07 -0400 |
commit | 2ecae76ad6c6da042dbbcce0084bd6b6c5700845 (patch) | |
tree | 8a0aca71296edae5062a3999ce1f31f729fc1fa0 | |
parent | 1db10e28b25687fea1d11a94196b0477145a24a8 (diff) |
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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 7553f08d87e1..45c35681eb48 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1195,9 +1195,9 @@ intel_dp_set_clock(struct intel_encoder *encoder, | |||
1195 | } | 1195 | } |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | static int intel_supported_rates(const int *source_rates, int source_len, | 1198 | static int intersect_rates(const int *source_rates, int source_len, |
1199 | const int *sink_rates, int sink_len, | 1199 | const int *sink_rates, int sink_len, |
1200 | int *supported_rates) | 1200 | int *supported_rates) |
1201 | { | 1201 | { |
1202 | int i = 0, j = 0, k = 0; | 1202 | int i = 0, j = 0, k = 0; |
1203 | 1203 | ||
@@ -1216,6 +1216,21 @@ static int intel_supported_rates(const int *source_rates, int source_len, | |||
1216 | return k; | 1216 | return k; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | static int intel_supported_rates(struct intel_dp *intel_dp, | ||
1220 | int *supported_rates) | ||
1221 | { | ||
1222 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
1223 | const int *source_rates, *sink_rates; | ||
1224 | int source_len, sink_len; | ||
1225 | |||
1226 | sink_len = intel_dp_sink_rates(intel_dp, &sink_rates); | ||
1227 | source_len = intel_dp_source_rates(dev, &source_rates); | ||
1228 | |||
1229 | return intersect_rates(source_rates, source_len, | ||
1230 | sink_rates, sink_len, | ||
1231 | supported_rates); | ||
1232 | } | ||
1233 | |||
1219 | static int rate_to_index(int find, const int *rates) | 1234 | static int rate_to_index(int find, const int *rates) |
1220 | { | 1235 | { |
1221 | int i = 0; | 1236 | int i = 0; |
@@ -1246,17 +1261,10 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
1246 | int max_clock; | 1261 | int max_clock; |
1247 | int bpp, mode_rate; | 1262 | int bpp, mode_rate; |
1248 | int link_avail, link_clock; | 1263 | int link_avail, link_clock; |
1249 | const int *sink_rates; | 1264 | int supported_rates[DP_MAX_SUPPORTED_RATES] = {}; |
1250 | int supported_rates[8] = {0}; | 1265 | int supported_len; |
1251 | const int *source_rates; | ||
1252 | int source_len, sink_len, supported_len; | ||
1253 | |||
1254 | sink_len = intel_dp_sink_rates(intel_dp, &sink_rates); | ||
1255 | |||
1256 | source_len = intel_dp_source_rates(dev, &source_rates); | ||
1257 | 1266 | ||
1258 | supported_len = intel_supported_rates(source_rates, source_len, | 1267 | supported_len = intel_supported_rates(intel_dp, supported_rates); |
1259 | sink_rates, sink_len, supported_rates); | ||
1260 | 1268 | ||
1261 | /* No common link rates between source and sink */ | 1269 | /* No common link rates between source and sink */ |
1262 | WARN_ON(supported_len <= 0); | 1270 | WARN_ON(supported_len <= 0); |
@@ -1355,7 +1363,8 @@ found: | |||
1355 | 1363 | ||
1356 | if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) { | 1364 | if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) { |
1357 | intel_dp->rate_select = | 1365 | intel_dp->rate_select = |
1358 | rate_to_index(supported_rates[clock], sink_rates); | 1366 | rate_to_index(supported_rates[clock], |
1367 | intel_dp->supported_rates); | ||
1359 | intel_dp->link_bw = 0; | 1368 | intel_dp->link_bw = 0; |
1360 | } | 1369 | } |
1361 | 1370 | ||