Commit 12cdfb61 authored by Fangzhi Zuo's avatar Fangzhi Zuo Committed by Alex Deucher
Browse files

drm/amd/display: Fix pbn_div Calculation Error



[Why]
dm_mst_get_pbn_divider() returns value integer coming from
the cast from fixed point, but the casted integer will then be used
in dfixed_const to be multiplied by 4096. The cast from fixed point to integer
causes the calculation error becomes bigger when multiplied by 4096.

That makes the calculated pbn_div value becomes smaller than
it should be, which leads to the req_slot number becomes bigger.

Such error is getting reflected in 8k30 timing,
where the correct and incorrect calculated req_slot 62.9 Vs 63.1.
That makes the wrong calculation failed to light up 8k30
after a dock under HBR3 x 4.

[How]
Restore the accuracy by keeping the fraction part
calculated for the left shift operation.

Reviewed-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: default avatarFangzhi Zuo <Jerry.Zuo@amd.com>
Signed-off-by: default avatarWayne Lin <wayne.lin@amd.com>
Tested-by: default avatarDan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1bde5584
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8015,7 +8015,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder,
	if (IS_ERR(mst_state))
		return PTR_ERR(mst_state);

	mst_state->pbn_div.full = dfixed_const(dm_mst_get_pbn_divider(aconnector->mst_root->dc_link));
	mst_state->pbn_div.full = dm_mst_get_pbn_divider(aconnector->mst_root->dc_link);

	if (!state->duplicated) {
		int max_bpc = conn_state->max_requested_bpc;
+10 −3
Original line number Diff line number Diff line
@@ -854,13 +854,20 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
	drm_connector_attach_dp_subconnector_property(&aconnector->base);
}

int dm_mst_get_pbn_divider(struct dc_link *link)
uint32_t dm_mst_get_pbn_divider(struct dc_link *link)
{
	uint32_t pbn_div_x100;
	uint64_t dividend, divisor;

	if (!link)
		return 0;

	return dc_link_bandwidth_kbps(link,
			dc_link_get_link_cap(link)) / (8 * 1000 * 54);
	dividend = (uint64_t)dc_link_bandwidth_kbps(link, dc_link_get_link_cap(link)) * 100;
	divisor = 8 * 1000 * 54;

	pbn_div_x100 = div64_u64(dividend, divisor);

	return dfixed_const(pbn_div_x100) / 100;
}

struct dsc_mst_fairness_params {
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ enum mst_msg_ready_type {
struct amdgpu_display_manager;
struct amdgpu_dm_connector;

int dm_mst_get_pbn_divider(struct dc_link *link);
uint32_t dm_mst_get_pbn_divider(struct dc_link *link);

void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
				       struct amdgpu_dm_connector *aconnector,