drm/amdgpu/display: handle multiple numbers of fclks in dcn_calcs.c (v2)
Subsystems (3)
PATCH 1/3 drm/amdgpu/display: handle multiple numbers of fclks in dcn_calcs.c (v2)
We might get different numbers of clocks from powerplay depending on what the OEM has populated.
v2: add assert for at least one level
--- .../gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +23 -11
@@ -1435,6 +1435,7 @@ void dcn_bw_update_from_pplib(struct dc *dc)struct dc_context *ctx = dc->ctx;struct dm_pp_clock_levels_with_voltage fclks = {0 }, dcfclks = {0 };bool res; +unsigned vmin0p65_idx, vmid0p72_idx, vnom0p8_idx, vmax0p9_idx;/* TODO: This is not the proper way to obtain fabric_and_dram_bandwidth, should be min(fclk, memclk) */ res = dm_pp_get_clock_levels_by_type_with_voltage(
@@ -1446,17 +1447,28 @@ void dcn_bw_update_from_pplib(struct dc *dc) res =verify_clock_values (&fclks);if (res) { -ASSERT (fclks.num_levels >=3 ); - dc->dcn_soc->fabric_and_dram_bandwidth_vmin0p65 =32 * (fclks.data[0 ].clocks_in_khz /1000.0 ) /1000.0 ; - dc->dcn_soc->fabric_and_dram_bandwidth_vmid0p72 = dc->dcn_soc->number_of_channels * - (fclks.data[fclks.num_levels - (fclks.num_levels >2 ?3 :2 )].clocks_in_khz /1000.0 ) - * ddr4_dram_factor_single_Channel /1000.0 ; - dc->dcn_soc->fabric_and_dram_bandwidth_vnom0p8 = dc->dcn_soc->number_of_channels * - (fclks.data[fclks.num_levels -2 ].clocks_in_khz /1000.0 ) - * ddr4_dram_factor_single_Channel /1000.0 ; - dc->dcn_soc->fabric_and_dram_bandwidth_vmax0p9 = dc->dcn_soc->number_of_channels * - (fclks.data[fclks.num_levels -1 ].clocks_in_khz /1000.0 ) - * ddr4_dram_factor_single_Channel /1000.0 ; +ASSERT (fclks.num_levels); + + vmin0p65_idx =0 ; + vmid0p72_idx = fclks.num_levels - + (fclks.num_levels >2 ?3 : (fclks.num_levels >1 ?2 :1 )); + vnom0p8_idx = fclks.num_levels - (fclks.num_levels >1 ?2 :1 ); + vmax0p9_idx = fclks.num_levels -1 ; + + dc->dcn_soc->fabric_and_dram_bandwidth_vmin0p65 = +32 * (fclks.data[vmin0p65_idx].clocks_in_khz /1000.0 ) /1000.0 ; + dc->dcn_soc->fabric_and_dram_bandwidth_vmid0p72 = + dc->dcn_soc->number_of_channels * + (fclks.data[vmid0p72_idx].clocks_in_khz /1000.0 ) + * ddr4_dram_factor_single_Channel /1000.0 ; + dc->dcn_soc->fabric_and_dram_bandwidth_vnom0p8 = + dc->dcn_soc->number_of_channels * + (fclks.data[vnom0p8_idx].clocks_in_khz /1000.0 ) + * ddr4_dram_factor_single_Channel /1000.0 ; + dc->dcn_soc->fabric_and_dram_bandwidth_vmax0p9 = + dc->dcn_soc->number_of_channels * + (fclks.data[vmax0p9_idx].clocks_in_khz /1000.0 ) + * ddr4_dram_factor_single_Channel /1000.0 ; }else BREAK_TO_DEBUGGER ();
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_latency
Only send non-0 clocks to DC for validation. This mirrors what the windows driver does.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +9 -6
@@ -1026,12 +1026,15 @@ static int smu10_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr, clocks->num_levels =0 ;for (i =0 ; i < pclk_vol_table->count; i++) { - clocks->data[i].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; - clocks->data[i].latency_in_us = latency_required ? -smu10_get_mem_latency (hwmgr, - pclk_vol_table->entries[i].clk) : -0 ; - clocks->num_levels++; +if (pclk_vol_table->entries[i].clk) { + clocks->data[clocks->num_levels].clocks_in_khz = + pclk_vol_table->entries[i].clk *10 ; + clocks->data[clocks->num_levels].latency_in_us = latency_required ? +smu10_get_mem_latency (hwmgr, + pclk_vol_table->entries[i].clk) : +0 ; + clocks->num_levels++; + } }return 0 ;
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage
In reply to Alex DeucherCull out 0 clocks to avoid a warning in DC.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +5 -3
@@ -1080,9 +1080,11 @@ static int smu10_get_clock_by_type_with_voltage(struct pp_hwmgr *hwmgr, clocks->num_levels =0 ;for (i =0 ; i < pclk_vol_table->count; i++) { - clocks->data[i].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; - clocks->data[i].voltage_in_mv = pclk_vol_table->entries[i].vol; - clocks->num_levels++; +if (pclk_vol_table->entries[i].clk) { + clocks->data[clocks->num_levels].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; + clocks->data[clocks->num_levels].voltage_in_mv = pclk_vol_table->entries[i].vol; + clocks->num_levels++; + } }return 0 ;
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/3] drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage
Ping?
Quoted 29 lines · Alex Deucher
Cull out 0 clocks to avoid a warning in DC.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +5
-4@@ -1080,9 +1080,11 @@ static int smu10_get_clock_by_type_with_voltage(struct pp_hwmgr *hwmgr, clocks->num_levels =0 ;for (i =0 ; i < pclk_vol_table->count; i++) { - clocks->data[i].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; - clocks->data[i].voltage_in_mv = pclk_vol_table->entries[i].vol; - clocks->num_levels++; +if (pclk_vol_table->entries[i].clk) { + clocks->data[clocks->num_levels].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; + clocks->data[clocks->num_levels].voltage_in_mv = pclk_vol_table->entries[i].vol; + clocks->num_levels++; + } }return 0 ; --
Quoted 2 lines
2.24.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/3] drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage
In reply to Alex Deucher-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, January 30, 2020 2:02 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage
Cull out 0 clocks to avoid a warning in DC.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +5 -3
@@ -1080,9 +1080,11 @@ static int smu10_get_clock_by_type_with_voltage(struct pp_hwmgr *hwmgr, clocks->num_levels =0 ;for (i =0 ; i < pclk_vol_table->count; i++) { - clocks->data[i].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; - clocks->data[i].voltage_in_mv = pclk_vol_table->entries[i].vol; - clocks->num_levels++; +if (pclk_vol_table->entries[i].clk) { + clocks->data[clocks->num_levels].clocks_in_khz = pclk_vol_table->entries[i].clk *10 ; + clocks->data[clocks->num_levels].voltage_in_mv = pclk_vol_table->entries[i].vol; + clocks->num_levels++; + } }return 0 ;
Signature · 10 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7Cdb4d6e0d0d9940cf353b08d7a4e54d7f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637159177099605051&sdata=B33UJMbMy0tRJkG%2BM7ajYKktcka%2BDz1ehc8tbpOCh0s%3D&reserved=0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx