drm/amd/display: Request usb4 bw for mst streams
[WHY] When usb4 bandwidth allocation mode is enabled, driver need to request bandwidth from connection manager. For mst link, the requested bandwidth should be big enough for all remote streams. [HOW] - If mst link, the requested bandwidth should be the sum of all mst streams bandwidth added with dp MTPH overhead. - Allocate/deallcate usb4 bandwidth when setting dpms on/off. - When doing display mode validation, driver also need to consider total bandwidth of all mst streams for mst link. Reviewed-by: Cruise Hung <cruise.hung@amd.com> Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com> Signed-off-by: Peichen Huang <peichen.huang@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
a465536ebf
commit
5f3bce1326
@@ -346,23 +346,61 @@ enum dc_status link_validate_mode_timing(
|
||||
return DC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function calculates the bandwidth required for the stream timing
|
||||
* and aggregates the stream bandwidth for the respective dpia link
|
||||
*
|
||||
* @stream: pointer to the dc_stream_state struct instance
|
||||
* @num_streams: number of streams to be validated
|
||||
*
|
||||
* return: true if validation is succeeded
|
||||
*/
|
||||
bool link_validate_dpia_bandwidth(const struct dc_stream_state *stream, const unsigned int num_streams)
|
||||
{
|
||||
bool ret = true;
|
||||
int bw_needed[MAX_DPIA_NUM];
|
||||
struct dc_link *link[MAX_DPIA_NUM];
|
||||
|
||||
if (!num_streams || num_streams > MAX_DPIA_NUM)
|
||||
return ret;
|
||||
int bw_needed[MAX_DPIA_NUM] = {0};
|
||||
struct dc_link *dpia_link[MAX_DPIA_NUM] = {0};
|
||||
int num_dpias = 0;
|
||||
|
||||
for (uint8_t i = 0; i < num_streams; ++i) {
|
||||
if (stream[i].signal == SIGNAL_TYPE_DISPLAY_PORT) {
|
||||
/* new dpia sst stream, check whether it exceeds max dpia */
|
||||
if (num_dpias >= MAX_DPIA_NUM)
|
||||
return false;
|
||||
|
||||
link[i] = stream[i].link;
|
||||
bw_needed[i] = dc_bandwidth_in_kbps_from_timing(&stream[i].timing,
|
||||
dc_link_get_highest_encoding_format(link[i]));
|
||||
dpia_link[num_dpias] = stream[i].link;
|
||||
bw_needed[num_dpias] = dc_bandwidth_in_kbps_from_timing(&stream[i].timing,
|
||||
dc_link_get_highest_encoding_format(dpia_link[num_dpias]));
|
||||
num_dpias++;
|
||||
} else if (stream[i].signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
|
||||
uint8_t j = 0;
|
||||
/* check whether its a known dpia link */
|
||||
for (; j < num_dpias; ++j) {
|
||||
if (dpia_link[j] == stream[i].link)
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == num_dpias) {
|
||||
/* new dpia mst stream, check whether it exceeds max dpia */
|
||||
if (num_dpias >= MAX_DPIA_NUM)
|
||||
return false;
|
||||
else {
|
||||
dpia_link[j] = stream[i].link;
|
||||
num_dpias++;
|
||||
}
|
||||
}
|
||||
|
||||
bw_needed[j] += dc_bandwidth_in_kbps_from_timing(&stream[i].timing,
|
||||
dc_link_get_highest_encoding_format(dpia_link[j]));
|
||||
}
|
||||
}
|
||||
|
||||
ret = dpia_validate_usb4_bw(link, bw_needed, num_streams);
|
||||
/* Include dp overheads */
|
||||
for (uint8_t i = 0; i < num_dpias; ++i) {
|
||||
int dp_overhead = 0;
|
||||
|
||||
return ret;
|
||||
dp_overhead = link_dp_dpia_get_dp_overhead_in_dp_tunneling(dpia_link[i]);
|
||||
bw_needed[i] += dp_overhead;
|
||||
}
|
||||
|
||||
return dpia_validate_usb4_bw(dpia_link, bw_needed, num_dpias);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user