Commit 855f42ba authored by Peichen Huang's avatar Peichen Huang Committed by Alex Deucher

drm/amd/display: Add usb4_bw_alloc_support flag

[Why]
dc should have a flag for DM to enable usb4_bw_alloc in dptx

[How]
- Add usb4_bw_alloc_support flag in dc_config
Reviewed-by: default avatarWayne Lin <wayne.lin@amd.com>
Reviewed-by: default avatarMeenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Acked-by: default avatarRoman Li <roman.li@amd.com>
Signed-off-by: default avatarPeichen Huang <peichen.huang@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9feaa4c0
...@@ -435,6 +435,7 @@ struct dc_config { ...@@ -435,6 +435,7 @@ struct dc_config {
bool enable_auto_dpm_test_logs; bool enable_auto_dpm_test_logs;
unsigned int disable_ips; unsigned int disable_ips;
unsigned int disable_ips_in_vpb; unsigned int disable_ips_in_vpb;
bool usb4_bw_alloc_support;
}; };
enum visual_confirm { enum visual_confirm {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "protocols/link_dp_dpia.h" #include "protocols/link_dp_dpia.h"
#include "protocols/link_dp_phy.h" #include "protocols/link_dp_phy.h"
#include "protocols/link_dp_training.h" #include "protocols/link_dp_training.h"
#include "protocols/link_dp_dpia_bw.h"
#include "accessories/link_dp_trace.h" #include "accessories/link_dp_trace.h"
#include "link_enc_cfg.h" #include "link_enc_cfg.h"
...@@ -991,6 +992,23 @@ static bool detect_link_and_local_sink(struct dc_link *link, ...@@ -991,6 +992,23 @@ static bool detect_link_and_local_sink(struct dc_link *link,
if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA && if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA &&
link->reported_link_cap.link_rate > LINK_RATE_HIGH3) link->reported_link_cap.link_rate > LINK_RATE_HIGH3)
link->reported_link_cap.link_rate = LINK_RATE_HIGH3; link->reported_link_cap.link_rate = LINK_RATE_HIGH3;
/*
* If this is DP over USB4 link then we need to:
* - Enable BW ALLOC support on DPtx if applicable
*/
if (dc->config.usb4_bw_alloc_support) {
if (link_dp_dpia_set_dptx_usb4_bw_alloc_support(link)) {
/* update with non reduced link cap if bw allocation mode is supported */
if (link->dpia_bw_alloc_config.nrd_max_link_rate &&
link->dpia_bw_alloc_config.nrd_max_lane_count) {
link->reported_link_cap.link_rate =
link->dpia_bw_alloc_config.nrd_max_link_rate;
link->reported_link_cap.lane_count =
link->dpia_bw_alloc_config.nrd_max_lane_count;
}
}
}
break; break;
} }
......
...@@ -2197,6 +2197,64 @@ static enum dc_status enable_link( ...@@ -2197,6 +2197,64 @@ static enum dc_status enable_link(
static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, int bw) static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, int bw)
{ {
struct dc_link *link = stream->sink->link;
int req_bw = bw;
DC_LOGGER_INIT(link->ctx->logger);
if (!link->dpia_bw_alloc_config.bw_alloc_enabled)
return false;
if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
int sink_index = 0;
int i = 0;
for (i = 0; i < link->sink_count; i++) {
if (link->remote_sinks[i] == NULL)
continue;
if (stream->sink->sink_id != link->remote_sinks[i]->sink_id)
req_bw += link->dpia_bw_alloc_config.remote_sink_req_bw[i];
else
sink_index = i;
}
link->dpia_bw_alloc_config.remote_sink_req_bw[sink_index] = bw;
}
/* get dp overhead for dp tunneling */
link->dpia_bw_alloc_config.dp_overhead = link_dp_dpia_get_dp_overhead_in_dp_tunneling(link);
req_bw += link->dpia_bw_alloc_config.dp_overhead;
if (link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, req_bw)) {
if (req_bw <= link->dpia_bw_alloc_config.allocated_bw) {
DC_LOG_DEBUG("%s, Success in allocate bw for link(%d), allocated_bw(%d), dp_overhead(%d)\n",
__func__, link->link_index, link->dpia_bw_alloc_config.allocated_bw,
link->dpia_bw_alloc_config.dp_overhead);
} else {
// Cannot get the required bandwidth.
DC_LOG_ERROR("%s, Failed to allocate bw for link(%d), allocated_bw(%d), dp_overhead(%d)\n",
__func__, link->link_index, link->dpia_bw_alloc_config.allocated_bw,
link->dpia_bw_alloc_config.dp_overhead);
return false;
}
} else {
DC_LOG_DEBUG("%s, usb4 request bw timeout\n", __func__);
return false;
}
if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
int i = 0;
for (i = 0; i < link->sink_count; i++) {
if (link->remote_sinks[i] == NULL)
continue;
DC_LOG_DEBUG("%s, remote_sink=%s, request_bw=%d\n", __func__,
(const char *)(&link->remote_sinks[i]->edid_caps.display_name[0]),
link->dpia_bw_alloc_config.remote_sink_req_bw[i]);
}
}
return true; return true;
} }
......
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