Skip to content

Commit 12cdfb6

Browse files
Fangzhi Zuoalexdeucher
authored andcommitted
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: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1bde558 commit 12cdfb6

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8015,7 +8015,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder,
80158015
if (IS_ERR(mst_state))
80168016
return PTR_ERR(mst_state);
80178017

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

80208020
if (!state->duplicated) {
80218021
int max_bpc = conn_state->max_requested_bpc;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,13 +854,20 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
854854
drm_connector_attach_dp_subconnector_property(&aconnector->base);
855855
}
856856

857-
int dm_mst_get_pbn_divider(struct dc_link *link)
857+
uint32_t dm_mst_get_pbn_divider(struct dc_link *link)
858858
{
859+
uint32_t pbn_div_x100;
860+
uint64_t dividend, divisor;
861+
859862
if (!link)
860863
return 0;
861864

862-
return dc_link_bandwidth_kbps(link,
863-
dc_link_get_link_cap(link)) / (8 * 1000 * 54);
865+
dividend = (uint64_t)dc_link_bandwidth_kbps(link, dc_link_get_link_cap(link)) * 100;
866+
divisor = 8 * 1000 * 54;
867+
868+
pbn_div_x100 = div64_u64(dividend, divisor);
869+
870+
return dfixed_const(pbn_div_x100) / 100;
864871
}
865872

866873
struct dsc_mst_fairness_params {

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum mst_msg_ready_type {
6060
struct amdgpu_display_manager;
6161
struct amdgpu_dm_connector;
6262

63-
int dm_mst_get_pbn_divider(struct dc_link *link);
63+
uint32_t dm_mst_get_pbn_divider(struct dc_link *link);
6464

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

0 commit comments

Comments
 (0)