amdgpu display fixes for 5.3
cover amdgpu display fixes for 5.3
Some display fixes for vega20 for stable. Fixes stability issues with certain combinations of monitors. Cherry-picked from master.
Alex Deucher (1):
drm/amdgpu/display: fix 64 bit divide
Charlene Liu (1):
drm/amd/display: dce11.x /dce12 update formula input
Zhan Liu (1):
drm/amd/display: Add missing HBM support and raise Vega20's uclk.
.../dc/clk_mgr/dce110/dce110_clk_mgr.c | 27 ++++++++++++++++--- .../drm/amd/display/dc/dce/dce_mem_input.c | 4 +-- .../amd/display/dc/dce112/dce112_resource.c | 16 ++++++----- .../amd/display/dc/dce120/dce120_resource.c | 11 +++++--- drivers/gpu/drm/amd/display/dc/inc/resource.h | 2 ++ 5 files changed, 45 insertions(+), 15 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/3 drm/amd/display: dce11.x /dce12 update formula input
From: Charlene Liu <[email protected]>
[Description]
1. OUTSTANDING_REQUEST_LIMIT update from 0xFF to 0x1F (HW doc update)
2. using memory type to convert UMC's MCLK to Yclk.
--- .../display/dc/clk_mgr/dce110/dce110_clk_mgr.c | 7 +++++-- .../gpu/drm/amd/display/dc/dce/dce_mem_input.c | 4 ++-- .../drm/amd/display/dc/dce112/dce112_resource.c | 16 ++++++++++------ .../drm/amd/display/dc/dce120/dce120_resource.c | 11 ++++++++--- drivers/gpu/drm/amd/display/dc/inc/resource.h | 2 ++ 5 files changed, 27 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c +5 -2
@@ -98,11 +98,14 @@ uint32_t dce110_get_min_vblank_time_us(const struct dc_state *context)struct dc_stream_state *stream = context->streams[j];uint32_t vertical_blank_in_pixels =0 ;uint32_t vertical_blank_time =0 ; +uint32_t vertical_total_min = stream->timing.v_total; +struct dc_crtc_timing_adjust adjust = stream->adjust; +if (adjust.v_total_max != adjust.v_total_min) + vertical_total_min = adjust.v_total_min; vertical_blank_in_pixels = stream->timing.h_total * - (stream->timing.v_total + (vertical_total_min - stream->timing.v_addressable); - vertical_blank_time = vertical_blank_in_pixels *10000 / stream->timing.pix_clk_100hz;
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +2 -2
@@ -148,7 +148,7 @@ static void dce_mi_program_pte_vm( pte->min_pte_before_flip_horiz_scan;REG_UPDATE (GRPH_PIPE_OUTSTANDING_REQUEST_LIMIT , -GRPH_PIPE_OUTSTANDING_REQUEST_LIMIT ,0xff ); +GRPH_PIPE_OUTSTANDING_REQUEST_LIMIT ,0x7f ); REG_UPDATE_3(DVMM_PTE_CONTROL, DVMM_PAGE_WIDTH, page_width,
@@ -157,7 +157,7 @@ static void dce_mi_program_pte_vm(REG_UPDATE_2 (DVMM_PTE_ARB_CONTROL ,DVMM_PTE_REQ_PER_CHUNK , pte->pte_req_per_chunk, -DVMM_MAX_PTE_REQ_OUTSTANDING ,0xff ); +DVMM_MAX_PTE_REQ_OUTSTANDING ,0x7f ); } static void program_urgency_watermark(
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +10 -6
@@ -987,6 +987,10 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc)struct dm_pp_clock_levels_with_latency mem_clks = {0 };struct dm_pp_wm_sets_with_clock_ranges clk_ranges = {0 };struct dm_pp_clock_levels clks = {0 }; +int memory_type_multiplier =MEMORY_TYPE_MULTIPLIER_CZ ; + +if (dc->bw_vbios && dc->bw_vbios->memory_type == bw_def_hbm) + memory_type_multiplier =MEMORY_TYPE_HBM ;/*do system clock TODO PPLIB: after PPLIB implement, * then remove old way
@@ -1026,12 +1030,12 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc) &clks); dc->bw_vbios->low_yclk =bw_frc_to_fixed ( - clks.clocks_in_khz[0 ] *MEMORY_TYPE_MULTIPLIER_CZ ,1000 ); + clks.clocks_in_khz[0 ] * memory_type_multiplier,1000 ); dc->bw_vbios->mid_yclk =bw_frc_to_fixed ( - clks.clocks_in_khz[clks.num_levels>>1 ] *MEMORY_TYPE_MULTIPLIER_CZ , + clks.clocks_in_khz[clks.num_levels>>1 ] * memory_type_multiplier,1000 ); dc->bw_vbios->high_yclk =bw_frc_to_fixed ( - clks.clocks_in_khz[clks.num_levels-1 ] *MEMORY_TYPE_MULTIPLIER_CZ , + clks.clocks_in_khz[clks.num_levels-1 ] * memory_type_multiplier,1000 );return ;
@@ -1067,12 +1071,12 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc)* YCLK = UMACLK*m_memoryTypeMultiplier */ dc->bw_vbios->low_yclk =bw_frc_to_fixed ( - mem_clks.data[0 ].clocks_in_khz *MEMORY_TYPE_MULTIPLIER_CZ ,1000 ); + mem_clks.data[0 ].clocks_in_khz * memory_type_multiplier,1000 ); dc->bw_vbios->mid_yclk =bw_frc_to_fixed ( - mem_clks.data[mem_clks.num_levels>>1 ].clocks_in_khz *MEMORY_TYPE_MULTIPLIER_CZ , + mem_clks.data[mem_clks.num_levels>>1 ].clocks_in_khz * memory_type_multiplier,1000 ); dc->bw_vbios->high_yclk =bw_frc_to_fixed ( - mem_clks.data[mem_clks.num_levels-1 ].clocks_in_khz *MEMORY_TYPE_MULTIPLIER_CZ , + mem_clks.data[mem_clks.num_levels-1 ].clocks_in_khz * memory_type_multiplier,1000 );/* Now notify PPLib/SMU about which Watermarks sets they should select
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +8 -3
@@ -847,6 +847,8 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc)int i;unsigned int clk;unsigned int latency; +/*original logic in dal3*/ +int memory_type_multiplier =MEMORY_TYPE_MULTIPLIER_CZ ;/*do system clock*/ if (!dm_pp_get_clock_levels_by_type_with_latency(
@@ -905,13 +907,16 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc)* ALSO always convert UMA clock (from PPLIB) to YCLK (HW formula): * YCLK = UMACLK*m_memoryTypeMultiplier */ +if (dc->bw_vbios->memory_type == bw_def_hbm) + memory_type_multiplier =MEMORY_TYPE_HBM ; + dc->bw_vbios->low_yclk =bw_frc_to_fixed ( - mem_clks.data[0 ].clocks_in_khz *MEMORY_TYPE_MULTIPLIER_CZ ,1000 ); + mem_clks.data[0 ].clocks_in_khz * memory_type_multiplier,1000 ); dc->bw_vbios->mid_yclk =bw_frc_to_fixed ( - mem_clks.data[mem_clks.num_levels>>1 ].clocks_in_khz *MEMORY_TYPE_MULTIPLIER_CZ , + mem_clks.data[mem_clks.num_levels>>1 ].clocks_in_khz * memory_type_multiplier,1000 ); dc->bw_vbios->high_yclk =bw_frc_to_fixed ( - mem_clks.data[mem_clks.num_levels-1 ].clocks_in_khz *MEMORY_TYPE_MULTIPLIER_CZ , + mem_clks.data[mem_clks.num_levels-1 ].clocks_in_khz * memory_type_multiplier,1000 );/* Now notify PPLib/SMU about which Watermarks sets they should select
drivers/gpu/drm/amd/display/dc/inc/resource.h +2 -0
@@ -31,6 +31,8 @@#include "dm_pp_smu.h" #define MEMORY_TYPE_MULTIPLIER_CZ 4 +#define MEMORY_TYPE_HBM 2 +enum dce_version resource_parse_asic_id (struct hw_asic_id asic_id);
Signature · 1 line
2.20.1
PATCH 2/3 drm/amd/display: Add missing HBM support and raise Vega20's uclk.
In reply to Alex DeucherFrom: Zhan Liu <[email protected]>
[Why]
When more than 2 displays are connected to the graphics card, only the minimum memory clock is needed. However, when more displays are connected, the minimum memory clock is not sufficient enough to support the overwhelming bandwidth. System will hang under this circumstance.
Also, the old code didn't address HBM cards, which has 2 pseudo channels. We need to add the HBM part here.
[How]
When graphics card connects to 2 or more displays, switch to high memory clock. Also, choose memory multiplier based on whether its regular DRAM or HBM.
--- .../display/dc/clk_mgr/dce110/dce110_clk_mgr.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c +16 -2
@@ -174,6 +174,10 @@ void dce11_pplib_apply_display_requirements( struct dc_state *context) {struct dm_pp_display_configuration *pp_display_cfg = &context->pp_display_cfg; +int memory_type_multiplier =MEMORY_TYPE_MULTIPLIER_CZ ; + +if (dc->bw_vbios && dc->bw_vbios->memory_type == bw_def_hbm) + memory_type_multiplier =MEMORY_TYPE_HBM ; pp_display_cfg->all_displays_in_sync = context->bw_ctx.bw.dce.all_displays_in_sync;
@@ -186,8 +190,18 @@ void dce11_pplib_apply_display_requirements( pp_display_cfg->cpu_pstate_separation_time = context->bw_ctx.bw.dce.blackout_recovery_time_us; - pp_display_cfg->min_memory_clock_khz = context->bw_ctx.bw.dce.yclk_khz - /MEMORY_TYPE_MULTIPLIER_CZ ; +/* +* TODO: determine whether the bandwidth has reached memory's limitation +* , then change minimum memory clock based on real-time bandwidth +* limitation. +*/ +if (ASICREV_IS_VEGA20_P (dc->ctx->asic_id.hw_internal_rev) && (context->stream_count >=2 )) { + pp_display_cfg->min_memory_clock_khz =max (pp_display_cfg->min_memory_clock_khz, + (uint32_t ) (dc->bw_vbios->high_yclk.value / memory_type_multiplier /10000 )); + }else { + pp_display_cfg->min_memory_clock_khz = context->bw_ctx.bw.dce.yclk_khz + / memory_type_multiplier; + } pp_display_cfg->min_engine_clock_khz = determine_sclk_from_bounding_box( dc,
Signature · 1 line
2.20.1
PATCH 3/3 drm/amdgpu/display: fix 64 bit divide
In reply to Alex DeucherUse proper helper for 32 bit.
--- .../gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c +3 -1
@@ -197,7 +197,9 @@ void dce11_pplib_apply_display_requirements(*/ if (ASICREV_IS_VEGA20_P (dc->ctx->asic_id.hw_internal_rev) && (context->stream_count >=2 )) { pp_display_cfg->min_memory_clock_khz =max (pp_display_cfg->min_memory_clock_khz, - (uint32_t ) (dc->bw_vbios->high_yclk.value / memory_type_multiplier /10000 )); + (uint32_t )div64_s64 ( +div64_s64 (dc->bw_vbios->high_yclk.value, + memory_type_multiplier),10000 )); }else { pp_display_cfg->min_memory_clock_khz = context->bw_ctx.bw.dce.yclk_khz / memory_type_multiplier;
Signature · 1 line
2.20.1
Quoted 13 lines · Alex Deucher
Some display fixes for vega20 for stable. Fixes stability issues with certain combinations of monitors. Cherry-picked from master.
Alex Deucher (1):
drm/amdgpu/display: fix 64 bit divideCharlene Liu (1):
drm/amd/display: dce11.x /dce12 update formula inputZhan Liu (1):
drm/amd/display: Add missing HBM support and raise Vega20's uclk.
Quoted 6 lines
.../dc/clk_mgr/dce110/dce110_clk_mgr.c | 27 ++++++++++++++++--- .../drm/amd/display/dc/dce/dce_mem_input.c | 4 +-- .../amd/display/dc/dce112/dce112_resource.c | 16 ++++++----- .../amd/display/dc/dce120/dce120_resource.c | 11 +++++--- drivers/gpu/drm/amd/display/dc/inc/resource.h | 2 ++ 5 files changed, 45 insertions(+), 15 deletions(-)
All now queued up, thanks.
greg k-h