summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/dsc
diff options
context:
space:
mode:
authorNikola Cornij <nikola.cornij@amd.com>2019-03-19 19:47:32 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-06-22 09:34:08 -0500
commitc2bcd914a2a7917442daf20a7b33d690f5903bea (patch)
tree39a2dc287053ccc8315d44ed4b60adc55d73a732 /drivers/gpu/drm/amd/display/dc/dsc
parentc5d3a38b1a18a0bcdfd4cc54e4396cce2aabc968 (diff)
downloadlinux-c2bcd914a2a7917442daf20a7b33d690f5903bea.tar.gz
linux-c2bcd914a2a7917442daf20a7b33d690f5903bea.tar.bz2
linux-c2bcd914a2a7917442daf20a7b33d690f5903bea.zip
drm/amd/display: Calculate link bandwidth in a common function
[why] Currently link bandwidth is calculated in various places using the same multi-step formula. Doing this in one common place makes sure the same formula will indeed be applied to all link bandwidth calculations. It also makes it possible to apply link-setting-specific adjustments that affect effective link bandwidth. [how] Replace all implementations of link bandwidth calculation with a call to a function. Signed-off-by: Nikola Cornij <nikola.cornij@amd.com> Reviewed-by: Nikola Cornij <Nikola.Cornij@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dsc')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
index 4ffcc2844d19..9e9c77e472e1 100644
--- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
+++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
@@ -849,15 +849,11 @@ bool dc_check_and_fit_timing_into_bandwidth_with_dsc_legacy(
{
int requiredBandwidth_Kbps;
bool stream_fits_into_bandwidth = false;
- int link_rate_kbytes_per_sec = link->verified_link_cap.link_rate * LINK_RATE_REF_FREQ_IN_KHZ;
- int total_link_bandwdith_kbps = link->verified_link_cap.lane_count * link_rate_kbytes_per_sec * 8;
-
- if (link->preferred_link_setting.lane_count !=
- LANE_COUNT_UNKNOWN &&
- link->preferred_link_setting.link_rate !=
- LINK_RATE_UNKNOWN) {
- link_rate_kbytes_per_sec = link->preferred_link_setting.link_rate * LINK_RATE_REF_FREQ_IN_KHZ;
- total_link_bandwdith_kbps = link->preferred_link_setting.lane_count * link_rate_kbytes_per_sec * 8;
+ int total_link_bandwdith_kbps = dc_link_bandwidth_kbps(link, &link->verified_link_cap);
+
+ if (link->preferred_link_setting.lane_count != LANE_COUNT_UNKNOWN &&
+ link->preferred_link_setting.link_rate != LINK_RATE_UNKNOWN) {
+ total_link_bandwdith_kbps = dc_link_bandwidth_kbps(link, &link->preferred_link_setting);
}
timing->flags.DSC = 0;