DC Patches May 20, 2024
cover DC Patches May 20, 2024
This DC patchset brings improvements in multiple areas. In summary, we have:
* DML2 fixes
* FAMS2 Improvements
* Fix YUV video color corruption, oled eDP not lighting up DCN401
* add UCLK p-state support message for DCN401
* Extends PSRSU residency mode
* Introducing deferred replay coasting vtotal update
* Fix DSC slice and delay calculations
Alex Hung (1):
drm/amd/display: Increase MAX_LINKS by 2
Alvin Lee (4):
drm/amd/display: Only program P-State force if pipe config changed drm/amd/display: Move fpo_in_use to stream_status drm/amd/display: Use current_state when checking old_pipe subvp type drm/amd/display: Program DIG FE source select for DVI before PHY en
Aric Cyr (1):
SWDEV-1 - dc: 3.2.287
Chiawen Huang (1):
drm/amd/display: add set ips disable
Chris Park (1):
drm/amd/display: Support new VA page table block size
Chun-LiangChang (1):
drm/amd/display: Add params of set_abm_event for VB Scaling
ChunTao Tso (1):
drm/amd/display: Introduce deferred Replay coasting vtotal update
Daniel Sa (1):
drm/amd/display: Fetch Mall caps from DC
Dillon Varone (5):
drm/amd/display: Wait for hardmins to complete on dcn401 drm/amd/display: Add UCLK p-state support message to dcn401 drm/amd/display: Force max clocks unconditionally when p-state is
unsupported
drm/amd/display: Add recovery timeout to FAMS2 drm/amd/display: Various DML2 fixes for FAMS2
Fangzhi Zuo (1):
drm/amd/display: Prevent IPX From Link Detect and Set Mode
Jack Chang (1):
drm/amd/display: Extend PSRSU residency mode
Joan Lee (1):
drm/amd/display: Add retires when read DPCD
Joshua Aberback (2):
drm/amd/display: Fix swapped dimension calculations drm/amd/display: workaround for oled eDP not lighting up on DCN401
Lewis Huang (1):
drm/amd/display: Add monitor patch skip disable crtc during psr and
ips1
Nicholas Kazlauskas (2):
drm/amd/display: Add outbox notification support for HPD redetect drm/amd/display: Guard reading 3DLUT registers for dcn32/dcn35
Nicholas Susanto (1):
drm/amd/display: Fix DML2 logic to set clk state to min
Relja Vojvodic (1):
drm/amd/display: Updated optc401_set_drr to use dcn401 functions
Samson Tam (1):
drm/amd/display: fix YUV video color corruption in DCN401
Sung Joon Kim (1):
drm/amd/display: Fix DSC slice and delay calculations
Wayne Lin (1):
drm/amd/display: Change the order of setting DP_IS_USB_C flag
Wenjing Liu (1):
drm/amd/display: turn on symclk for dio virtual stream in dpms
sequence
Yihan Zhu (1):
drm/amd/display: bypass ODM before CRTC off
yi-lchen (1):
drm/amd/display: Keep VBios pixel rate div setting until next mode set
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++ .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- .../amd/display/dc/clk_mgr/dcn401/dalsmc.h | 3 +- .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 165 +++++++++++------- .../dc/clk_mgr/dcn401/dcn401_clk_mgr.h | 3 +- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c | 127 +++++++++++++- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.h | 6 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 10 ++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 12 +- drivers/gpu/drm/amd/display/dc/dc.h | 6 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 16 +- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_types.h | 2 + .../amd/display/dc/dccg/dcn314/dcn314_dccg.c | 12 +- .../amd/display/dc/dccg/dcn32/dcn32_dccg.c | 12 +- .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 13 +- .../amd/display/dc/dccg/dcn401/dcn401_dccg.c | 5 +- .../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c | 18 ++ .../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h | 2 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 5 +- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 3 +- .../dc/dcn32/dcn32_dio_stream_encoder.c | 40 +---- .../display/dc/dcn35/dcn35_dio_link_encoder.c | 10 +- .../dc/dcn35/dcn35_dio_stream_encoder.c | 39 +---- .../dc/dcn401/dcn401_dio_stream_encoder.c | 3 +- .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c | 6 +- .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 15 +- .../amd/display/dc/dml2/display_mode_core.c | 45 +++-- .../dc/dml2/display_mode_core_structs.h | 1 + .../dc/dml2/dml21/dml21_translation_helper.c | 2 +- .../amd/display/dc/dml2/dml21/dml21_utils.c | 7 +- .../amd/display/dc/dml2/dml21/dml21_utils.h | 4 +- .../amd/display/dc/dml2/dml21/dml21_wrapper.c | 6 +- .../dml2/dml21/src/dml2_core/dml2_core_dcn4.c | 1 - .../src/dml2_core/dml2_core_dcn4_calcs.c | 29 --- .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 2 +- .../display/dc/dml2/dml2_translation_helper.c | 1 + .../drm/amd/display/dc/dml2/dml2_wrapper.c | 18 +- .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c | 29 +-- .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c | 16 +- .../display/dc/hubbub/dcn20/dcn20_hubbub.c | 27 ++- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 24 ++- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 23 +-- .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 21 +++ .../amd/display/dc/hwss/dcn314/dcn314_hwseq.h | 2 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 63 ++++++- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 2 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 3 + .../gpu/drm/amd/display/dc/inc/core_types.h | 6 + drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 5 + .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 9 +- .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 2 +- .../amd/display/dc/inc/hw/stream_encoder.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/link.h | 2 +- .../amd/display/dc/link/hwss/link_hwss_dio.c | 7 +- .../gpu/drm/amd/display/dc/link/link_dpms.c | 33 ++-- .../dc/link/protocols/link_dp_capability.c | 3 + .../dc/link/protocols/link_dp_irq_handler.c | 26 ++- .../link/protocols/link_edp_panel_control.c | 7 +- .../link/protocols/link_edp_panel_control.h | 2 +- .../amd/display/dc/optc/dcn10/dcn10_optc.c | 4 +- .../amd/display/dc/optc/dcn31/dcn31_optc.c | 11 ++ .../amd/display/dc/optc/dcn401/dcn401_optc.c | 2 +- .../dc/resource/dcn30/dcn30_resource.c | 8 +- .../dc/resource/dcn32/dcn32_resource.c | 4 + .../dc/resource/dcn401/dcn401_resource.c | 1 + drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 95 +++++++++- .../drm/amd/display/dmub/src/dmub_srv_stat.c | 6 + .../amd/display/modules/power/power_helpers.c | 14 ++ .../amd/display/modules/power/power_helpers.h | 5 + 75 files changed, 810 insertions(+), 323 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/32 drm/amd/display: Keep VBios pixel rate div setting until next mode set
From: yi-lchen <[email protected]>
[why]
Vbios & Driver have difference pixel rate div policy.
When enabling fast boot & performing blank & unblank w/o timing setting, pixel clock & pixel rate dividor are not match.
It would cause too high pixel reate and eDP would be black screen.
[How]
We would keep pixel rate div setting by Vbios until next timing setting.
--- .../gpu/drm/amd/display/dc/core/dc_resource.c | 6 +++ .../amd/display/dc/dccg/dcn314/dcn314_dccg.c | 12 +++--- .../amd/display/dc/dccg/dcn32/dcn32_dccg.c | 12 +++--- .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 13 +++--- .../amd/display/dc/dccg/dcn401/dcn401_dccg.c | 5 ++- .../dc/dcn32/dcn32_dio_stream_encoder.c | 40 ++----------------- .../dc/dcn35/dcn35_dio_stream_encoder.c | 36 +---------------- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 24 +++++++++-- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 23 +++++------ .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 21 ++++++++++ .../amd/display/dc/hwss/dcn314/dcn314_hwseq.h | 2 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 33 ++++++++++++--- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 2 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 3 ++ .../gpu/drm/amd/display/dc/inc/core_types.h | 6 +++ drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 5 +++ 20 files changed, 136 insertions(+), 111 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 -0
@@ -3969,6 +3969,12 @@ enum dc_status dc_validate_with_context(struct dc *dc, res =dc_validate_global_state (dc, context, fast_validate); +/* calculate pixel rate divider after deciding pxiel clock & odm combine */ +if ((dc->hwss.calculate_pix_rate_divider) && (res ==DC_OK )) { +for (i =0 ; i < add_streams_count; i++) + dc->hwss.calculate_pix_rate_divider (dc, context, add_streams[i]); + } + fail:if (res !=DC_OK ) DC_LOG_WARNING("%s:resource validation failed, dc_status:%d\n",
drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c +7 -5
@@ -58,8 +58,8 @@ static void dccg314_trigger_dio_fifo_resync(static void dccg314_get_pixel_rate_div (struct dccg *dccg,uint32_t otg_inst, -enum pixel_rate_div *k1, -enum pixel_rate_div *k2) +uint32_t *k1, +uint32_t *k2) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);uint32_t val_k1 =PIXEL_RATE_DIV_NA , val_k2 =PIXEL_RATE_DIV_NA ;
@@ -93,8 +93,8 @@ static void dccg314_get_pixel_rate_div(return ; } - *k1 = (enum pixel_rate_div )val_k1; - *k2 = (enum pixel_rate_div )val_k2; + *k1 = val_k1; + *k2 = val_k2; } static void dccg314_set_pixel_rate_div(
@@ -104,7 +104,8 @@ static void dccg314_set_pixel_rate_div( enum pixel_rate_div k2) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); -enum pixel_rate_div cur_k1 =PIXEL_RATE_DIV_NA , cur_k2 =PIXEL_RATE_DIV_NA ; +uint32_t cur_k1 =PIXEL_RATE_DIV_NA ; +uint32_t cur_k2 =PIXEL_RATE_DIV_NA ;// Don't program 0xF into the register field. Not valid since // K1 / K2 field is only 1 / 2 bits wide
@@ -373,6 +374,7 @@ static const struct dccg_funcs dccg314_funcs = { .disable_dsc = dccg31_disable_dscclk, .enable_dsc = dccg31_enable_dscclk, .set_pixel_rate_div = dccg314_set_pixel_rate_div, + .get_pixel_rate_div = dccg314_get_pixel_rate_div, .trigger_dio_fifo_resync = dccg314_trigger_dio_fifo_resync, .set_valid_pixel_rate = dccg314_set_valid_pixel_rate, .set_dtbclk_p_src = dccg314_set_dtbclk_p_src
drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c +7 -5
@@ -58,8 +58,8 @@ static void dccg32_trigger_dio_fifo_resync(static void dccg32_get_pixel_rate_div (struct dccg *dccg,uint32_t otg_inst, -enum pixel_rate_div *k1, -enum pixel_rate_div *k2) +uint32_t *k1, +uint32_t *k2) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);uint32_t val_k1 =PIXEL_RATE_DIV_NA , val_k2 =PIXEL_RATE_DIV_NA ;
@@ -93,8 +93,8 @@ static void dccg32_get_pixel_rate_div(return ; } - *k1 = (enum pixel_rate_div )val_k1; - *k2 = (enum pixel_rate_div )val_k2; + *k1 = val_k1; + *k2 = val_k2; } static void dccg32_set_pixel_rate_div(
@@ -104,7 +104,8 @@ static void dccg32_set_pixel_rate_div( enum pixel_rate_div k2) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); -enum pixel_rate_div cur_k1 =PIXEL_RATE_DIV_NA , cur_k2 =PIXEL_RATE_DIV_NA ; +uint32_t cur_k1 =PIXEL_RATE_DIV_NA ; +uint32_t cur_k2 =PIXEL_RATE_DIV_NA ;// Don't program 0xF into the register field. Not valid since // K1 / K2 field is only 1 / 2 bits wide
@@ -343,6 +344,7 @@ static const struct dccg_funcs dccg32_funcs = { .otg_add_pixel = dccg32_otg_add_pixel, .otg_drop_pixel = dccg32_otg_drop_pixel, .set_pixel_rate_div = dccg32_set_pixel_rate_div, + .get_pixel_rate_div = dccg32_get_pixel_rate_div, .trigger_dio_fifo_resync = dccg32_trigger_dio_fifo_resync, .set_dtbclk_p_src = dccg32_set_dtbclk_p_src, };
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +8 -5
@@ -146,8 +146,8 @@ static void dccg35_set_dppclk_root_clock_gating(struct dccg *dccg,static void dccg35_get_pixel_rate_div (struct dccg *dccg,uint32_t otg_inst, -enum pixel_rate_div *k1, -enum pixel_rate_div *k2) +uint32_t *k1, +uint32_t *k2) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);uint32_t val_k1 =PIXEL_RATE_DIV_NA , val_k2 =PIXEL_RATE_DIV_NA ;
@@ -181,8 +181,8 @@ static void dccg35_get_pixel_rate_div(return ; } - *k1 = (enum pixel_rate_div )val_k1; - *k2 = (enum pixel_rate_div )val_k2; + *k1 = val_k1; + *k2 = val_k2; } static void dccg35_set_pixel_rate_div(
@@ -192,7 +192,9 @@ static void dccg35_set_pixel_rate_div( enum pixel_rate_div k2) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); -enum pixel_rate_div cur_k1 =PIXEL_RATE_DIV_NA , cur_k2 =PIXEL_RATE_DIV_NA ; +uint32_t cur_k1 =PIXEL_RATE_DIV_NA ; +uint32_t cur_k2 =PIXEL_RATE_DIV_NA ; +// Don't program 0xF into the register field. Not valid since // K1 / K2 field is only 1 / 2 bits wide
@@ -1018,6 +1020,7 @@ static const struct dccg_funcs dccg35_funcs = { .disable_dsc = dccg35_disable_dscclk, .enable_dsc = dccg35_enable_dscclk, .set_pixel_rate_div = dccg35_set_pixel_rate_div, + .get_pixel_rate_div = dccg35_get_pixel_rate_div, .trigger_dio_fifo_resync = dccg35_trigger_dio_fifo_resync, .set_valid_pixel_rate = dccg35_set_valid_pixel_rate, .enable_symclk_se = dccg35_enable_symclk_se,
drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c +3 -2
@@ -119,7 +119,7 @@ static void dccg401_wait_for_dentist_change_done(static void dccg401_get_pixel_rate_div (struct dccg *dccg,uint32_t otg_inst, -enum pixel_rate_div *tmds_div, +uint32_t *tmds_div,uint32_t *dp_dto_int) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);
@@ -161,7 +161,7 @@ static void dccg401_set_pixel_rate_div( enum pixel_rate_div unused) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); -enum pixel_rate_div cur_tmds_div =PIXEL_RATE_DIV_NA ; +uint32_t cur_tmds_div =PIXEL_RATE_DIV_NA ;uint32_t dp_dto_int;uint32_t reg_val;
@@ -962,6 +962,7 @@ static const struct dccg_funcs dccg401_funcs = { .otg_add_pixel = dccg401_otg_add_pixel, .otg_drop_pixel = dccg401_otg_drop_pixel, .set_pixel_rate_div = dccg401_set_pixel_rate_div, + .get_pixel_rate_div = dccg401_get_pixel_rate_div, .set_dp_dto = dccg401_set_dp_dto, .enable_symclk_se = dccg401_enable_symclk_se, .disable_symclk_se = dccg401_disable_symclk_se,
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.c +3 -37
@@ -52,11 +52,11 @@static void enc32_dp_set_odm_combine (struct stream_encoder *enc, -bool odm_combine) +bool two_pixel_per_cyle) {struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); -REG_UPDATE (DP_PIXEL_FORMAT ,DP_PIXEL_PER_CYCLE_PROCESSING_MODE , odm_combine ?1 :0 ); +REG_UPDATE (DP_PIXEL_FORMAT ,DP_PIXEL_PER_CYCLE_PROCESSING_MODE , two_pixel_per_cyle ?1 :0 ); }/* setup stream encoder in dvi mode */
@@ -241,46 +241,12 @@ static bool is_two_pixels_per_containter(const struct dc_crtc_timing *timing)return two_pix; } -static bool is_h_timing_divisible_by_2 (const struct dc_crtc_timing *timing) -{ -/* math borrowed from function of same name in inc/resource -* checks if h_timing is divisible by 2 -*/ - -bool divisible = false; -uint16_t h_blank_start =0 ; -uint16_t h_blank_end =0 ; - -if (timing) { - h_blank_start = timing->h_total - timing->h_front_porch; - h_blank_end = h_blank_start - timing->h_addressable; - -/* HTOTAL, Hblank start/end, and Hsync start/end all must be -* divisible by 2 in order for the horizontal timing params -* to be considered divisible by 2. Hsync start is always 0. -*/ - divisible = (timing->h_total %2 ==0 ) && - (h_blank_start %2 ==0 ) && - (h_blank_end %2 ==0 ) && - (timing->h_sync_width %2 ==0 ); - } -return divisible; -} - -static bool is_dp_dig_pixel_rate_div_policy (struct dc *dc,const struct dc_crtc_timing *timing) -{ -/* should be functionally the same as dcn32_is_dp_dig_pixel_rate_div_policy for DP encoders*/ -return is_h_timing_divisible_by_2 (timing) && - dc->debug.enable_dp_dig_pixel_rate_div_policy; -} -void enc32_stream_encoder_dp_unblank (struct dc_link *link,struct stream_encoder *enc,const struct encoder_unblank_param *param) {struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); -struct dc *dc = enc->ctx->dc;if (param->link_settings.link_rate !=LINK_RATE_UNKNOWN ) {uint32_t n_vid =0x8000 ;
@@ -291,7 +257,7 @@ void enc32_stream_encoder_dp_unblank(/* YCbCr 4:2:0 : Computed VID_M will be 2X the input rate */ if (is_two_pixels_per_containter (¶m->timing) || param->opp_cnt >1 - ||is_dp_dig_pixel_rate_div_policy (dc, ¶m->timing)) { + || param->pix_per_cycle >1 ) {/*this logic should be the same in get_pixel_clock_parameters() */ n_multiply =1 ; pix_per_cycle =1 ;
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.c +1 -35
@@ -273,46 +273,12 @@ static bool is_two_pixels_per_containter(const struct dc_crtc_timing *timing)return two_pix; } -static bool is_h_timing_divisible_by_2 (const struct dc_crtc_timing *timing) -{ -/* math borrowed from function of same name in inc/resource -* checks if h_timing is divisible by 2 -*/ - -bool divisible = false; -uint16_t h_blank_start =0 ; -uint16_t h_blank_end =0 ; - -if (timing) { - h_blank_start = timing->h_total - timing->h_front_porch; - h_blank_end = h_blank_start - timing->h_addressable; - -/* HTOTAL, Hblank start/end, and Hsync start/end all must be -* divisible by 2 in order for the horizontal timing params -* to be considered divisible by 2. Hsync start is always 0. -*/ - divisible = (timing->h_total %2 ==0 ) && - (h_blank_start %2 ==0 ) && - (h_blank_end %2 ==0 ) && - (timing->h_sync_width %2 ==0 ); - } -return divisible; -} - -static bool is_dp_dig_pixel_rate_div_policy (struct dc *dc,const struct dc_crtc_timing *timing) -{ -/* should be functionally the same as dcn32_is_dp_dig_pixel_rate_div_policy for DP encoders*/ -return is_h_timing_divisible_by_2 (timing) && - dc->debug.enable_dp_dig_pixel_rate_div_policy; -} -static void enc35_stream_encoder_dp_unblank (struct dc_link *link,struct stream_encoder *enc,const struct encoder_unblank_param *param) {struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); -struct dc *dc = enc->ctx->dc;if (param->link_settings.link_rate !=LINK_RATE_UNKNOWN ) {uint32_t n_vid =0x8000 ;
@@ -323,7 +289,7 @@ static void enc35_stream_encoder_dp_unblank(/* YCbCr 4:2:0 : Computed VID_M will be 2X the input rate */ if (is_two_pixels_per_containter (¶m->timing) || param->opp_cnt >1 - ||is_dp_dig_pixel_rate_div_policy (dc, ¶m->timing)) { + || param->pix_per_cycle >1 ) {/*this logic should be the same in get_pixel_clock_parameters() */ n_multiply =1 ; pix_per_cycle =1 ;
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +21 -3
@@ -1779,6 +1779,7 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)struct dc_stream_state *edp_streams[MAX_NUM_EDP ];struct dc_link *edp_link_with_sink =NULL ;struct dc_link *edp_link =NULL ; +struct pipe_ctx *pipe_ctx =NULL ;struct dce_hwseq *hws = dc->hwseq;int edp_with_sink_num;int edp_num;
@@ -1815,9 +1816,26 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) can_apply_edp_fast_boot =dc_validate_boot_timing (dc, edp_stream->sink, &edp_stream->timing); edp_stream->apply_edp_fast_boot_optimization = can_apply_edp_fast_boot; -if (can_apply_edp_fast_boot) -DC_LOG_EVENT_LINK_TRAINING ("eDP fast boot disabled to optimize link rate\n" ); - +if (can_apply_edp_fast_boot) { +DC_LOG_EVENT_LINK_TRAINING ("eDP fast boot Enable\n" ); + +// Vbios & Driver support different pixel rate div policy. + pipe_ctx =resource_get_otg_master_for_stream (&context->res_ctx, edp_stream); +if (pipe_ctx && + hws->funcs.is_dp_dig_pixel_rate_div_policy && + hws->funcs.is_dp_dig_pixel_rate_div_policy (pipe_ctx)) { +// Get Vbios div factor from register + dc->res_pool->dccg->funcs->get_pixel_rate_div ( + dc->res_pool->dccg, + pipe_ctx->stream_res.tg->inst, + &pipe_ctx->pixel_rate_divider.div_factor1, + &pipe_ctx->pixel_rate_divider.div_factor2); + +// VBios doesn't support pixel rate div, so force it. +// If VBios supports it, we check it from reigster or other flags. + pipe_ctx->stream_res.pix_clk_params.dio_se_pix_per_cycle =1 ; + } + }break ; } }
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +9 -14
@@ -829,20 +829,17 @@ enum dc_status dcn20_enable_stream_timing(bool is_two_pixels_per_container = pipe_ctx->stream_res.tg->funcs->is_two_pixels_per_container (&stream->timing);bool rate_control_2x_pclk = (interlace || is_two_pixels_per_container); -unsigned int k1_div =PIXEL_RATE_DIV_NA ; -unsigned int k2_div =PIXEL_RATE_DIV_NA ;int odm_slice_width;int last_odm_slice_width;struct pipe_ctx *opp_heads[MAX_PIPES ]; -if (hws->funcs.calculate_dccg_k1_k2_values && dc->res_pool->dccg->funcs->set_pixel_rate_div) { - hws->funcs.calculate_dccg_k1_k2_values (pipe_ctx, &k1_div, &k2_div); - +if (dc->res_pool->dccg->funcs->set_pixel_rate_div) dc->res_pool->dccg->funcs->set_pixel_rate_div ( dc->res_pool->dccg, pipe_ctx->stream_res.tg->inst, - k1_div, k2_div); - } + pipe_ctx->pixel_rate_divider.div_factor1, + pipe_ctx->pixel_rate_divider.div_factor2); +/* by upper caller loop, pipe0 is parent pipe and be called first. * back end is set up by for pipe0. Other children pipe share back end * with pipe 0. No program is needed.
@@ -2685,6 +2682,7 @@ void dcn20_unblank_stream(struct pipe_ctx *pipe_ctx, pipe_ctx->stream_res.tg->funcs->is_two_pixels_per_container (&stream->timing); params.opp_cnt =1 ; +for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { params.opp_cnt++; }
@@ -2940,9 +2938,7 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx)struct dccg *dccg = dc->res_pool->dccg;enum phyd32clk_clock_source phyd32clk;int dp_hpo_inst; -struct dce_hwseq *hws = dc->hwseq; -unsigned int k1_div =PIXEL_RATE_DIV_NA ; -unsigned int k2_div =PIXEL_RATE_DIV_NA ; +struct link_encoder *link_enc =link_enc_cfg_get_link_enc (pipe_ctx->stream->link);struct stream_encoder *stream_enc = pipe_ctx->stream_res.stream_enc;
@@ -2963,14 +2959,13 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) dccg->funcs->enable_symclk_se (dccg, stream_enc->stream_enc_inst, link_enc->transmitter -TRANSMITTER_UNIPHY_A ); } -if (hws->funcs.calculate_dccg_k1_k2_values && dc->res_pool->dccg->funcs->set_pixel_rate_div) { - hws->funcs.calculate_dccg_k1_k2_values (pipe_ctx, &k1_div, &k2_div); +if (dc->res_pool->dccg->funcs->set_pixel_rate_div) dc->res_pool->dccg->funcs->set_pixel_rate_div ( dc->res_pool->dccg, pipe_ctx->stream_res.tg->inst, - k1_div, k2_div); - } + pipe_ctx->pixel_rate_divider.div_factor1, + pipe_ctx->pixel_rate_divider.div_factor2); link_hwss->setup_stream_encoder (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +21 -0
@@ -334,6 +334,27 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsigreturn odm_combine_factor; } +void dcn314_calculate_pix_rate_divider ( +struct dc *dc, +struct dc_state *context, +const struct dc_stream_state *stream) +{ +struct dce_hwseq *hws = dc->hwseq; +struct pipe_ctx *pipe_ctx =NULL ; +unsigned int k1_div =PIXEL_RATE_DIV_NA ; +unsigned int k2_div =PIXEL_RATE_DIV_NA ; + + pipe_ctx =resource_get_otg_master_for_stream (&context->res_ctx, stream); + +if (pipe_ctx) { +if (hws->funcs.calculate_dccg_k1_k2_values) + hws->funcs.calculate_dccg_k1_k2_values (pipe_ctx, &k1_div, &k2_div); + + pipe_ctx->pixel_rate_divider.div_factor1 = k1_div; + pipe_ctx->pixel_rate_divider.div_factor2 = k2_div; + } +} +void dcn314_resync_fifo_dccg_dio (struct dce_hwseq *hws,struct dc *dc,struct dc_state *context) {unsigned int i;
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.h +2 -0
@@ -39,6 +39,8 @@ void dcn314_enable_power_gating_plane(struct dce_hwseq *hws, bool enable);unsigned int dcn314_calculate_dccg_k1_k2_values (struct pipe_ctx *pipe_ctx,unsigned int *k1_div,unsigned int *k2_div); +void dcn314_calculate_pix_rate_divider (struct dc *dc,struct dc_state *context,const struct dc_stream_state *stream); +void dcn314_resync_fifo_dccg_dio (struct dce_hwseq *hws,struct dc *dc,struct dc_state *context);void dcn314_dpp_root_clock_control (struct dce_hwseq *hws,unsigned int dpp_inst,bool clock_on);
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +1 -0
@@ -114,6 +114,7 @@ static const struct hw_sequencer_funcs dcn314_funcs = { .optimize_pwr_state = dcn21_optimize_pwr_state, .exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state, .update_visual_confirm_color = dcn10_update_visual_confirm_color, + .calculate_pix_rate_divider = dcn314_calculate_pix_rate_divider, };static const struct hwseq_private_funcs dcn314_private_funcs = {
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +28 -5
@@ -1164,6 +1164,28 @@ unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsignreturn odm_combine_factor; } +void dcn32_calculate_pix_rate_divider ( +struct dc *dc, +struct dc_state *context, +const struct dc_stream_state *stream) +{ +struct dce_hwseq *hws = dc->hwseq; +struct pipe_ctx *pipe_ctx =NULL ; +unsigned int k1_div =PIXEL_RATE_DIV_NA ; +unsigned int k2_div =PIXEL_RATE_DIV_NA ; + + pipe_ctx =resource_get_otg_master_for_stream (&context->res_ctx, stream); + +if (pipe_ctx) { + +if (hws->funcs.calculate_dccg_k1_k2_values) + hws->funcs.calculate_dccg_k1_k2_values (pipe_ctx, &k1_div, &k2_div); + + pipe_ctx->pixel_rate_divider.div_factor1 = k1_div; + pipe_ctx->pixel_rate_divider.div_factor2 = k2_div; + } +} +void dcn32_resync_fifo_dccg_dio (struct dce_hwseq *hws,struct dc *dc,struct dc_state *context) {unsigned int i;
@@ -1202,9 +1224,10 @@ void dcn32_unblank_stream(struct pipe_ctx *pipe_ctx,struct dc_link *link = stream->link;struct dce_hwseq *hws = link->dc->hwseq;struct pipe_ctx *odm_pipe; -uint32_t pix_per_cycle =1 ; params.opp_cnt =1 ; + params.pix_per_cycle = pipe_ctx->stream_res.pix_clk_params.dio_se_pix_per_cycle; +for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) params.opp_cnt++;
@@ -1219,13 +1242,13 @@ void dcn32_unblank_stream(struct pipe_ctx *pipe_ctx, pipe_ctx->stream_res.hpo_dp_stream_enc, pipe_ctx->stream_res.tg->inst); }else if (dc_is_dp_signal (pipe_ctx->stream->signal)) { -if (pipe_ctx->stream_res.tg->funcs->is_two_pixels_per_container (&stream->timing) || params.opp_cnt >1 - ||dcn32_is_dp_dig_pixel_rate_div_policy (pipe_ctx)) { +if (pipe_ctx->stream_res.tg->funcs->is_two_pixels_per_container (&stream->timing) || + params.opp_cnt >1 ) { params.timing.pix_clk_100hz /=2 ; - pix_per_cycle =2 ; + params.pix_per_cycle =2 ; } pipe_ctx->stream_res.stream_enc->funcs->dp_set_odm_combine ( - pipe_ctx->stream_res.stream_enc, pix_per_cycle >1 ); + pipe_ctx->stream_res.stream_enc, params.pix_per_cycle >1 ); pipe_ctx->stream_res.stream_enc->funcs->dp_unblank (link, pipe_ctx->stream_res.stream_enc, ¶ms); }
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h +2 -0
@@ -91,6 +91,8 @@ void dcn32_unblank_stream(struct pipe_ctx *pipe_ctx,bool dcn32_is_dp_dig_pixel_rate_div_policy (struct pipe_ctx *pipe_ctx); +void dcn32_calculate_pix_rate_divider (struct dc *dc,struct dc_state *context,const struct dc_stream_state *stream); +void dcn32_disable_link_output (struct dc_link *link,const struct link_resource *link_res,enum signal_type signal);
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +1 -0
@@ -119,6 +119,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = { .apply_update_flags_for_phantom = dcn32_apply_update_flags_for_phantom, .blank_phantom = dcn32_blank_phantom, .is_pipe_topology_transition_seamless = dcn32_is_pipe_topology_transition_seamless, + .calculate_pix_rate_divider = dcn32_calculate_pix_rate_divider, };static const struct hwseq_private_funcs dcn32_private_funcs = {
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -0
@@ -123,6 +123,7 @@ static const struct hw_sequencer_funcs dcn35_funcs = { .hw_block_power_down = dcn35_hw_block_power_down, .root_clock_control = dcn35_root_clock_control, .set_long_vtotal = dcn35_set_long_vblank, + .calculate_pix_rate_divider = dcn32_calculate_pix_rate_divider, };static const struct hwseq_private_funcs dcn35_private_funcs = {
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +1 -0
@@ -122,6 +122,7 @@ static const struct hw_sequencer_funcs dcn351_funcs = { .hw_block_power_down = dcn351_hw_block_power_down, .root_clock_control = dcn35_root_clock_control, .set_long_vtotal = dcn35_set_long_vblank, + .calculate_pix_rate_divider = dcn32_calculate_pix_rate_divider, };static const struct hwseq_private_funcs dcn351_private_funcs = {
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +3 -0
@@ -339,6 +339,9 @@ struct hw_sequencer_funcs { struct dc_state *context);void (*exit_optimized_pwr_state)(const struct dc *dc,struct dc_state *context); +void (*calculate_pix_rate_divider)(struct dc *dc, +struct dc_state *context, +const struct dc_stream_state *stream);/* Audio Related */ void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx);
drivers/gpu/drm/amd/display/dc/inc/core_types.h +6 -0
@@ -399,6 +399,11 @@ union pipe_update_flags {uint32_t raw; }; +struct pixel_rate_divider { +uint32_t div_factor1; +uint32_t div_factor2; +}; +enum p_state_switch_method {P_STATE_UNKNOWN =0 ,P_STATE_V_BLANK =1 ,
@@ -464,6 +469,7 @@ struct pipe_ctx {bool has_vactive_margin;/* subvp_index: only valid if the pipe is a SUBVP_MAIN*/ uint8_t subvp_index; +struct pixel_rate_divider pixel_rate_divider; };/* Data used for dynamic link encoder assignment.
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +5 -0
@@ -176,6 +176,11 @@ struct dccg_funcs {enum pixel_rate_div k1, enum pixel_rate_div k2); +void (*get_pixel_rate_div)(struct dccg *dccg, +uint32_t otg_inst, +uint32_t *div_factor1, +uint32_t *div_factor2); + void (*set_valid_pixel_rate)( struct dccg *dccg, int ref_dtbclk_khz,
Signature · 1 line
2.34.1
PATCH 2/32 drm/amd/display: turn on symclk for dio virtual stream in dpms sequence
In reply to Zaeem MohamedFrom: Wenjing Liu <[email protected]>
[why]
In order to support glitchless display clock ramping for virtual stream, we must
turn on symclk for stream encoder. The code will power on phy and enable symclk
for dio encoder during virtual stream dpms sequence.
--- .../gpu/drm/amd/display/dc/core/dc_resource.c | 6 ++-- .../dc/dcn35/dcn35_dio_stream_encoder.c | 3 +- .../dc/dcn401/dcn401_dio_stream_encoder.c | 3 +- .../amd/display/dc/inc/hw/stream_encoder.h | 2 +- .../amd/display/dc/link/hwss/link_hwss_dio.c | 7 ++++- .../gpu/drm/amd/display/dc/link/link_dpms.c | 31 ++++++++++--------- .../dc/link/protocols/link_dp_capability.c | 3 ++ 7 files changed, 34 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -2
@@ -3648,8 +3648,10 @@ enum dc_status resource_map_pool_resources(/* Allocate DP HPO Stream Encoder based on signal, hw capabilities * and link settings */ -if (dc_is_dp_signal (stream->signal)) { -if (!dc->link_srv->dp_decide_link_settings (stream, &pipe_ctx->link_config.dp_link_settings)) +if (dc_is_dp_signal (stream->signal) || +dc_is_virtual_signal (stream->signal)) { +if (!dc->link_srv->dp_decide_link_settings (stream, + &pipe_ctx->link_config.dp_link_settings))return DC_FAIL_DP_LINK_BANDWIDTH ;if (dc->link_srv->dp_get_encoding_format ( &pipe_ctx->link_config.dp_link_settings) == DP_128b_132b_ENCODING) {
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.c +2 -1
@@ -254,6 +254,7 @@ static void enc35_stream_encoder_enable(break ;case SIGNAL_TYPE_EDP :case SIGNAL_TYPE_DISPLAY_PORT : +case SIGNAL_TYPE_VIRTUAL :/* DP SST */ REG_UPDATE (DIG_FE_CLK_CNTL ,DIG_FE_MODE ,0 );break ;
@@ -459,7 +460,7 @@ static const struct stream_encoder_funcs dcn35_str_enc_funcs = { .dp_set_dsc_pps_info_packet = enc3_dp_set_dsc_pps_info_packet, .set_dynamic_metadata = enc2_set_dynamic_metadata, .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute, - .dig_stream_enable = enc35_stream_encoder_enable, + .enable_stream = enc35_stream_encoder_enable, .set_input_mode = enc314_set_dig_input_mode, .enable_fifo = enc35_enable_fifo,
drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.c +2 -1
@@ -416,6 +416,7 @@ static void enc401_stream_encoder_enable(break ;case SIGNAL_TYPE_EDP :case SIGNAL_TYPE_DISPLAY_PORT : +case SIGNAL_TYPE_VIRTUAL :/* DP SST */ REG_UPDATE (DIG_FE_CLK_CNTL ,DIG_FE_MODE ,0 );break ;
@@ -760,7 +761,7 @@ static const struct stream_encoder_funcs dcn401_str_enc_funcs = { .dp_set_dsc_pps_info_packet = enc3_dp_set_dsc_pps_info_packet, .set_dynamic_metadata = enc401_set_dynamic_metadata, .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute, - .dig_stream_enable = enc401_stream_encoder_enable, + .enable_stream = enc401_stream_encoder_enable, .set_input_mode = enc401_set_dig_input_mode, .enable_fifo = enc32_enable_fifo,
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +1 -1
@@ -223,7 +223,7 @@ struct stream_encoder_funcs {struct stream_encoder *enc, int tg_inst); -void (*dig_stream_enable)( +void (*enable_stream)(struct stream_encoder *enc,enum signal_type signal,bool enable);
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_dio.c +6 -1
@@ -46,6 +46,9 @@ void setup_dio_stream_encoder(struct pipe_ctx *pipe_ctx)if (dc_is_dp_signal (pipe_ctx->stream->signal)) pipe_ctx->stream->ctx->dc->link_srv->dp_trace_source_sequence (pipe_ctx->stream->link,DPCD_SOURCE_SEQ_AFTER_CONNECT_DIG_FE_BE ); +if (stream_enc->funcs->enable_stream) + stream_enc->funcs->enable_stream (stream_enc, + pipe_ctx->stream->signal, true);if (stream_enc->funcs->map_stream_to_link) stream_enc->funcs->map_stream_to_link (stream_enc, stream_enc->stream_enc_inst, link_enc->transmitter -TRANSMITTER_UNIPHY_A );
@@ -65,7 +68,9 @@ void reset_dio_stream_encoder(struct pipe_ctx *pipe_ctx) stream_enc->funcs->disable_fifo (stream_enc);if (stream_enc->funcs->set_input_mode) stream_enc->funcs->set_input_mode (stream_enc,0 ); - +if (stream_enc->funcs->enable_stream) + stream_enc->funcs->enable_stream (stream_enc, + pipe_ctx->stream->signal, false); link_enc->funcs->connect_dig_be_to_fe( link_enc, pipe_ctx->stream_res.stream_enc->id,
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +16 -15
@@ -1907,7 +1907,9 @@ static void disable_link(struct dc_link *link, {if (dc_is_dp_signal (signal)) {disable_link_dp (link, link_res, signal); - }else if (signal !=SIGNAL_TYPE_VIRTUAL ) { + }else if (signal ==SIGNAL_TYPE_VIRTUAL ) { + link->dc->hwss.disable_link_output (link, link_res,SIGNAL_TYPE_DISPLAY_PORT ); + }else { link->dc->hwss.disable_link_output (link, link_res, signal); }
@@ -2154,6 +2156,18 @@ static enum dc_status enable_link_dp_mst(return enable_link_dp (state, pipe_ctx); } +static enum dc_status enable_link_virtual (struct pipe_ctx *pipe_ctx) +{ +struct dc_link *link = pipe_ctx->stream->link; + + link->dc->hwss.enable_dp_link_output (link, + &pipe_ctx->link_res, +SIGNAL_TYPE_DISPLAY_PORT , + pipe_ctx->clock_source->id, + &pipe_ctx->link_config.dp_link_settings); +return DC_OK ; +} +static enum dc_status enable_link (struct dc_state *state,struct pipe_ctx *pipe_ctx)
@@ -2193,7 +2207,7 @@ static enum dc_status enable_link( status =DC_OK ;break ;case SIGNAL_TYPE_VIRTUAL : - status =DC_OK ; + status =enable_link_virtual (pipe_ctx);break ;default :break ;
@@ -2437,17 +2451,10 @@ void link_set_dpms_on(if (!dc_is_virtual_signal (pipe_ctx->stream->signal) && !dp_is_128b_132b_signal (pipe_ctx)) { -struct stream_encoder *stream_enc = pipe_ctx->stream_res.stream_enc; -if (link_enc) link_enc->funcs->setup ( link_enc, pipe_ctx->stream->signal); - -if (stream_enc && stream_enc->funcs->dig_stream_enable) - stream_enc->funcs->dig_stream_enable ( - stream_enc, - pipe_ctx->stream->signal,1 ); } pipe_ctx->stream->link->link_state_valid = true;
@@ -2547,18 +2554,12 @@ void link_set_dpms_on(*/ if (!(dc_is_virtual_signal (pipe_ctx->stream->signal) ||dp_is_128b_132b_signal (pipe_ctx))) { -struct stream_encoder *stream_enc = pipe_ctx->stream_res.stream_enc;if (link_enc) link_enc->funcs->setup ( link_enc, pipe_ctx->stream->signal); -if (stream_enc && stream_enc->funcs->dig_stream_enable) - stream_enc->funcs->dig_stream_enable ( - stream_enc, - pipe_ctx->stream->signal,1 ); - } dc->hwss.enable_stream (pipe_ctx);
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +3 -0
@@ -955,6 +955,9 @@ bool link_decide_link_settings(struct dc_stream_state *stream, }else {edp_decide_link_settings (link, link_setting, req_bw); } + }else if (stream->signal ==SIGNAL_TYPE_VIRTUAL ) { + link_setting->lane_count =LANE_COUNT_FOUR ; + link_setting->link_rate =LINK_RATE_HIGH3 ; }else {decide_dp_link_settings (link, link_setting, req_bw); }
Signature · 1 line
2.34.1
PATCH 3/32 drm/amd/display: Wait for hardmins to complete on dcn401
In reply to Zaeem MohamedFrom: Dillon Varone <[email protected]>
[WHY&HOW]
When updating clocks via SMU, DAL needs to wait for requests to be fulfilled before proceeding.
--- .../amd/display/dc/clk_mgr/dcn401/dalsmc.h | 3 +- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c | 113 +++++++++++++++++- 2 files changed, 112 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dalsmc.h +2 -1
@@ -42,7 +42,8 @@#define DALSMC_MSG_IndicateDrrStatus 0x17 // PMFW 15811#define DALSMC_MSG_ActiveUclkFclk 0x18#define DALSMC_MSG_IdleUclkFclk 0x19 -#define DALSMC_Message_Count 0x1A +#define DALSMC_MSG_SetUclkPstateAllow 0x1A +#define DALSMC_Message_Count 0x1B typedef enum { FCLK_SWITCH_DISALLOW,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c +110 -3
143 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 4/32 drm/amd/display: Fix swapped dimension calculations
In reply to Zaeem MohamedFrom: Joshua Aberback <[email protected]>
[Why]
The values calculated in optc1_get_otg_active_size are assigned to the wrong output parameters, vertical blank is being used for horizontal size and vice versa. This results in DPG test pattern looking wrong during hardware init, as the DPG dimensions get assigned from this output, and potentially other issues.
--- drivers/gpu/drm/amd/display/dc/optc/dcn10/dcn10_optc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/optc/dcn10/dcn10_optc.c +2 -2
@@ -1423,8 +1423,8 @@ bool optc1_get_otg_active_size(struct timing_generator *optc,OTG_H_BLANK_START , &h_blank_start, OTG_H_BLANK_END, &h_blank_end); - *otg_active_width = v_blank_start - v_blank_end; - *otg_active_height = h_blank_start - h_blank_end; + *otg_active_width = h_blank_start - h_blank_end; + *otg_active_height = v_blank_start - v_blank_end;return true; }
Signature · 1 line
2.34.1
PATCH 5/32 drm/amd/display: Add params of set_abm_event for VB Scaling
In reply to Zaeem MohamedFrom: Chun-LiangChang <[email protected]>
[Why]
Add parameters for set_abm_event to enable varibright scaling. VariBright Scaling is a feature to refer to system states like
1. Power mode
2. Battery Life percent
3. FullScreen video
4. Backlight slider
to adjust variBright strength to get low power or user experience.
[How]
Add parameters of set_abm_event for VB Scaling
--- .../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c | 18 ++++++ .../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h | 2 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 55 +++++++++++++++++++ 3 files changed, 75 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c +18 -0
@@ -297,3 +297,21 @@ bool dmub_abm_set_backlight_level(struct abm *abm,return true; } +bool dmub_abm_set_event (struct abm *abm,unsigned int scaling_enable,unsigned int scaling_strength_map, +unsigned int panel_inst) +{ +union dmub_rb_cmd cmd; +struct dc_context *dc = abm->ctx; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.abm_set_event.header.type =DMUB_CMD__ABM ; + cmd.abm_set_event.header.sub_type =DMUB_CMD__ABM_SET_EVENT ; + cmd.abm_set_event.abm_set_event_data.vb_scaling_enable = scaling_enable; + cmd.abm_set_event.abm_set_event_data.vb_scaling_strength_mapping = scaling_strength_map; + cmd.abm_set_event.abm_set_event_data.panel_mask = (1 <<panel_inst); + cmd.abm_set_event.header.payload_bytes =sizeof (struct dmub_cmd_abm_set_event_data ); + +dc_wake_and_execute_dmub_cmd (dc, &cmd,DM_DMUB_WAIT_TYPE_WAIT ); + +return true; +}
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h +2 -0
@@ -49,4 +49,6 @@ bool dmub_abm_set_backlight_level(struct abm *abm,unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int panel_inst); +bool dmub_abm_set_event (struct abm *abm,unsigned int scaling_enable,unsigned int scaling_strength_map, +unsigned int panel_inst);#endif
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +55 -0
73 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 6/32 drm/amd/display: workaround for oled eDP not lighting up on DCN401
In reply to Zaeem MohamedFrom: Joshua Aberback <[email protected]>
[Why]
Currently there's an issue on DCN401 that prevents oled eDP panels from being lit up that is still under investigation. To unblock dev work while investigating, we can work around the issue by skipping toggling the enablement of the backlight.
[How]
- new debug bit that will skip touching backlight enable DPCD for oled
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c | 3 +++ .../gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c | 1 + 3 files changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -1042,6 +1042,7 @@ struct dc_debug_options {unsigned int force_easf;unsigned int force_sharpness;unsigned int force_lls; +bool edp_oled_no_backlight_enable; };
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +3 -0
@@ -248,6 +248,9 @@ bool edp_backlight_enable_aux(struct dc_link *link, bool enable) link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))return false; +if (link->dc->debug.edp_oled_no_backlight_enable && link->dpcd_sink_ext_caps.bits.oled) +return true; +if (core_link_write_dpcd (link,DP_SOURCE_BACKLIGHT_ENABLE , &backlight_enable,1 ) !=DC_OK )return false;
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +1 -0
@@ -732,6 +732,7 @@ static const struct dc_debug_options debug_defaults_drv = { }, .force_cositing = CHROMA_COSITING_TOPLEFT + 1, .disable_idle_power_optimizations = true, + .edp_oled_no_backlight_enable = true, }; static struct dce_aux *dcn401_aux_engine_create(
Signature · 1 line
2.34.1
PATCH 7/32 drm/amd/display: Support new VA page table block size
In reply to Zaeem MohamedFrom: Chris Park <[email protected]>
[Why]
Page table definition increased up to 2MB.
[How]
Define new use case of page table for VA.
--- .../display/dc/hubbub/dcn20/dcn20_hubbub.c | 27 ++++++++++++++++--- .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 9 ++++++- 2 files changed, 32 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c +24 -3
@@ -339,15 +339,36 @@ static enum dcn_hubbub_page_table_block_size page_table_block_size_to_hw(unsignecase 4096 : block_size =DCN_PAGE_TABLE_BLOCK_SIZE_4KB ;break ; -case 65536 : - block_size =DCN_PAGE_TABLE_BLOCK_SIZE_64KB ; +case 8192 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_8KB ; +break ; +case 16384 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_16KB ;break ;case 32768 : block_size =DCN_PAGE_TABLE_BLOCK_SIZE_32KB ;break ; +case 65536 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_64KB ; +break ; +case 131072 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_128KB ; +break ; +case 262144 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_256KB ; +break ; +case 524288 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_512KB ; +break ; +case 1048576 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_1024KB ; +break ; +case 2097152 : + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_2048KB ; +break ;default :ASSERT (false); - block_size = page_table_block_size; + block_size =DCN_PAGE_TABLE_BLOCK_SIZE_4KB ;break ; }
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +8 -1
@@ -74,8 +74,15 @@ enum dcn_hubbub_page_table_depth {enum dcn_hubbub_page_table_block_size {DCN_PAGE_TABLE_BLOCK_SIZE_4KB =0 , +DCN_PAGE_TABLE_BLOCK_SIZE_8KB =1 , +DCN_PAGE_TABLE_BLOCK_SIZE_16KB =2 , +DCN_PAGE_TABLE_BLOCK_SIZE_32KB =3 ,DCN_PAGE_TABLE_BLOCK_SIZE_64KB =4 , -DCN_PAGE_TABLE_BLOCK_SIZE_32KB =3 +DCN_PAGE_TABLE_BLOCK_SIZE_128KB =5 , +DCN_PAGE_TABLE_BLOCK_SIZE_256KB =6 , +DCN_PAGE_TABLE_BLOCK_SIZE_512KB =7 , +DCN_PAGE_TABLE_BLOCK_SIZE_1024KB =8 , +DCN_PAGE_TABLE_BLOCK_SIZE_2048KB =9 };struct dcn_hubbub_phys_addr_config {
Signature · 1 line
2.34.1
PATCH 8/32 drm/amd/display: Fix DML2 logic to set clk state to min
In reply to Zaeem MohamedFrom: Nicholas Susanto <[email protected]>
[Why]
When an eDP with high clock states is going into s0i3, stream_count is
0. This causes DML to not update the clks to the lowest state and blocking us to enter s0i3 since eDP is out of vmin.
[How]
When stream_count is 0, set all the clocks to the lowest state.
--- .../gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +17 -1
@@ -573,8 +573,24 @@ static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_sbool need_recalculation = false;uint32_t cstate_enter_plus_exit_z8_ns; -if (!context || context->stream_count ==0 ) +if (!context) +return true; + +else if (context->stream_count ==0 ) { +unsigned int lowest_state_idx =0 ; + + out_clks.p_state_supported = true; + out_clks.dispclk_khz = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].dispclk_mhz *1000 ; + out_clks.dcfclk_khz = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].dcfclk_mhz *1000 ; + out_clks.fclk_khz = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].fabricclk_mhz *1000 ; + out_clks.uclk_mts = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].dram_speed_mts; + out_clks.phyclk_khz = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].phyclk_mhz *1000 ; + out_clks.socclk_khz = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].socclk_mhz *1000 ; + out_clks.ref_dtbclk_khz = (unsigned int )dml2->v20.dml_core_ctx.states.state_array[lowest_state_idx].dtbclk_mhz *1000 ; + context->bw_ctx.bw.dcn.clk.dtbclk_en = false; +dml2_copy_clocks_to_dc_state (&out_clks, context);return true; + }/* Zero out before each call before proceeding */ memset (&dml2->v20.scratch,0 ,sizeof (struct dml2_wrapper_scratch ));
Signature · 1 line
2.34.1
PATCH 9/32 drm/amd/display: Add retires when read DPCD
In reply to Zaeem MohamedFrom: Joan Lee <[email protected]>
[why & how]
Sometimes read DPCD return fail while result not retrieved yet. Add retries mechanism in Replay handle hpd irq to get real result.
--- .../dc/link/protocols/link_dp_irq_handler.c | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +20 -6
@@ -189,16 +189,30 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link)union dpcd_replay_configuration replay_configuration = {0 };/*AMD Replay version reuse DP_PSR_ERROR_STATUS for REPLAY_ERROR status.*/ union psr_error_status replay_error_status = {0 }; +bool ret = false; +int retries =0 ;if (!link->replay_settings.replay_feature_enabled)return ; -dm_helpers_dp_read_dpcd ( - link->ctx, - link, -DP_SINK_PR_REPLAY_STATUS , - &replay_configuration.raw, -sizeof (replay_configuration.raw)); +while (retries <10 ) { + ret =dm_helpers_dp_read_dpcd ( + link->ctx, + link, +DP_SINK_PR_REPLAY_STATUS , + &replay_configuration.raw, +sizeof (replay_configuration.raw)); + +if (ret) +break ; + + retries++; + } + +if (!ret) +DC_LOG_WARNING ("[%s][%d] DPCD read addr.0x%x failed with %d retries\n" , + __func__, __LINE__, +DP_SINK_PR_REPLAY_STATUS , retries); dm_helpers_dp_read_dpcd( link->ctx,
Signature · 1 line
2.34.1
PATCH 10/32 drm/amd/display: Only program P-State force if pipe config changed
In reply to Zaeem MohamedFrom: Alvin Lee <[email protected]>
[Description]
Today for MED update type we do not call update clocks. However, for FPO the assumption is that update clocks should be called to disable P-State switch before any HW programming since FPO in FW and driver are not synchronized. This causes an issue where on a MED update, an FPO P-State switch could be taking place, then driver forces P-State disallow in the below code and prevents FPO from completing the sequence. In this case we add a check to avoid re-programming (and thus re-setting) the P-State force register by only reprogramming if the pipe was not previously Subvp or FPO. The assumption is that the P-State force register should be programmed correctly the first time SubVP / FPO was enabled, so there's no need to update / reset it if the pipe config has never exited SubVP / FPO.
--- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +17 -1
@@ -615,10 +615,26 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)*/ for (i =0 ; i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; +struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];struct hubp *hubp = pipe->plane_res.hubp; +/* Today for MED update type we do not call update clocks. However, for FPO +* the assumption is that update clocks should be called to disable P-State +* switch before any HW programming since FPO in FW and driver are not +* synchronized. This causes an issue where on a MED update, an FPO P-State +* switch could be taking place, then driver forces P-State disallow in the below +* code and prevents FPO from completing the sequence. In this case we add a check +* to avoid re-programming (and thus re-setting) the P-State force register by +* only reprogramming if the pipe was not previously Subvp or FPO. The assumption +* is that the P-State force register should be programmed correctly the first +* time SubVP / FPO was enabled, so there's no need to update / reset it if the +* pipe config has never exited SubVP / FPO. +*/ if (pipe->stream && (dc_state_get_pipe_subvp_type (context, pipe) ==SUBVP_MAIN || - pipe->stream->fpo_in_use)) { + pipe->stream->fpo_in_use) && + (!old_pipe->stream || + (dc_state_get_pipe_subvp_type (context, old_pipe) !=SUBVP_MAIN && + !old_pipe->stream->fpo_in_use))) {if (hubp && hubp->funcs->hubp_update_force_pstate_disallow) hubp->funcs->hubp_update_force_pstate_disallow (hubp, true);if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)
Signature · 1 line
2.34.1
PATCH 11/32 drm/amd/display: Move fpo_in_use to stream_status
In reply to Zaeem MohamedFrom: Alvin Lee <[email protected]>
[Description]
Refactor code and move fpo_in_use into stream_status to avoid unexpected changes to previous dc_state (i.e., current_state). Since stream pointers are shared between current and new dc_states, updating parameters of one stream will update the other as well which causes unexpected behaviors (i.e., checking that fpo_in_use isn't set in previous state and set in the new state is invalid). To avoid incorrect updates to current_state, move the fpo_in_use flag into dc_stream_status since stream_status is owned by dc and are not shared between different dc_states.
--- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 12 +++++++++-- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c | 6 +++++- .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 15 +++++++++++--- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 20 ++++++++++++++----- .../dc/resource/dcn30/dcn30_resource.c | 8 +++++++- 6 files changed, 50 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +10 -2
@@ -427,6 +427,7 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, struint ramp_up_num_steps =1 ;// TODO: Ramp is currently disabled. Reenable it. uint8_t visual_confirm_enabled;int pipe_idx =0 ; +struct dc_stream_status *stream_status =NULL ;if (dc ==NULL )return false;
@@ -443,6 +444,7 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, strufor (i =0 , pipe_idx =0 ; i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; + stream_status =NULL ;if (!pipe->stream)continue ;
@@ -450,7 +452,8 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru* that does not use FAMS, we are in an FPO + VActive scenario. * Assign vactive stretch margin in this case. */ -if (!pipe->stream->fpo_in_use) { + stream_status =dc_state_get_stream_status (context, pipe->stream); +if (stream_status && !stream_status->fpo_in_use) { cmd.fw_assisted_mclk_switch.config_data.vactive_stretch_margin_us = dc->debug.fpo_vactive_margin_us;break ; }
@@ -461,7 +464,12 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, strufor (i =0 , k =0 ; context && i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; -if (resource_is_pipe_type (pipe,OTG_MASTER ) && pipe->stream->fpo_in_use) { + stream_status =NULL ; +if (!resource_is_pipe_type (pipe,OTG_MASTER )) +continue ; + + stream_status =dc_state_get_stream_status (context, pipe->stream); +if (stream_status && stream_status->fpo_in_use) {struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];uint8_t min_refresh_in_hz = (pipe->stream->timing.min_refresh_in_uhz +999999 ) /1000000 ;
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -1
@@ -59,6 +59,7 @@ struct dc_stream_status {struct dc_plane_state *plane_states[MAX_SURFACE_NUM ];bool is_abm_supported;struct mall_stream_config mall_stream_config; +bool fpo_in_use; };enum hubp_dmdata_mode {
@@ -296,7 +297,6 @@ struct dc_stream_state {bool has_non_synchronizable_pclk;bool vblank_synchronized; -bool fpo_in_use;bool is_phantom;struct luminance_data lumin_data;
drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c +5 -1
@@ -387,13 +387,17 @@ void dcn30_fpu_calculate_wm_and_dlg(double dcfclk = context->bw_ctx.dml.vba.DCFCLKState[vlevel][maxMpcComb];bool pstate_en = context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][maxMpcComb] != dm_dram_clock_change_unsupported;unsigned int dummy_latency_index =0 ; +struct dc_stream_status *stream_status =NULL ;dc_assert_fp_enabled (); context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = false;for (i =0 ; i < context->stream_count; i++) { + stream_status =NULL ;if (context->streams[i]) - context->streams[i]->fpo_in_use = false; + stream_status =dc_state_get_stream_status (context, context->streams[i]); +if (stream_status) + stream_status->fpo_in_use = false; }if (!pstate_en) {
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +12 -3
@@ -2309,6 +2309,7 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,bool need_fclk_lat_as_dummy = false;bool is_subvp_p_drr = false;struct dc_stream_state *fpo_candidate_stream =NULL ; +struct dc_stream_status *stream_status =NULL ;dc_assert_fp_enabled ();
@@ -2343,8 +2344,11 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context, context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = false;for (i =0 ; i < context->stream_count; i++) { + stream_status =NULL ;if (context->streams[i]) - context->streams[i]->fpo_in_use = false; + stream_status =dc_state_get_stream_status (context, context->streams[i]); +if (stream_status) + stream_status->fpo_in_use = false; } if (!pstate_en || (!dc->debug.disable_fpo_optimizations &&
@@ -2352,7 +2356,9 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,/* only when the mclk switch can not be natural, is the fw based vblank stretch attempted */ fpo_candidate_stream =dcn32_can_support_mclk_switch_using_fw_based_vblank_stretch (dc, context);if (fpo_candidate_stream) { - fpo_candidate_stream->fpo_in_use = true; + stream_status =dc_state_get_stream_status (context, fpo_candidate_stream); +if (stream_status) + stream_status->fpo_in_use = true; context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = true; }
@@ -2389,8 +2395,11 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,*/ context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = false;for (i =0 ; i < context->stream_count; i++) { + stream_status =NULL ;if (context->streams[i]) - context->streams[i]->fpo_in_use = false; + stream_status =dc_state_get_stream_status (context, context->streams[i]); +if (stream_status) + stream_status->fpo_in_use = false; } context->bw_ctx.dml.soc.fclk_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A ].dml_input.fclk_change_latency_us;dcn32_internal_validate_bw (dc, context, pipes, &pipe_cnt, &vlevel, false);
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +15 -5
@@ -601,9 +601,13 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)for (i =0 ; i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];struct hubp *hubp = pipe->plane_res.hubp; +struct dc_stream_status *stream_status =NULL ; + +if (pipe->stream) + stream_status =dc_state_get_stream_status (context, pipe->stream);if (!pipe->stream || !(dc_state_get_pipe_subvp_type (context, pipe) ==SUBVP_MAIN || - pipe->stream->fpo_in_use)) { + (stream_status && stream_status->fpo_in_use))) {if (hubp && hubp->funcs->hubp_update_force_pstate_disallow) hubp->funcs->hubp_update_force_pstate_disallow (hubp, false);if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)
@@ -617,6 +621,8 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];struct hubp *hubp = pipe->plane_res.hubp; +struct dc_stream_status *stream_status =NULL ; +struct dc_stream_status *old_stream_status =NULL ;/* Today for MED update type we do not call update clocks. However, for FPO * the assumption is that update clocks should be called to disable P-State
@@ -630,11 +636,15 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)* time SubVP / FPO was enabled, so there's no need to update / reset it if the * pipe config has never exited SubVP / FPO. */ +if (pipe->stream) + stream_status =dc_state_get_stream_status (context, pipe->stream); +if (old_pipe->stream) + old_stream_status =dc_state_get_stream_status (dc->current_state, old_pipe->stream); +if (pipe->stream && (dc_state_get_pipe_subvp_type (context, pipe) ==SUBVP_MAIN || - pipe->stream->fpo_in_use) && - (!old_pipe->stream || - (dc_state_get_pipe_subvp_type (context, old_pipe) !=SUBVP_MAIN && - !old_pipe->stream->fpo_in_use))) { + (stream_status && stream_status->fpo_in_use)) && + (!old_pipe->stream || (dc_state_get_pipe_subvp_type (context, old_pipe) !=SUBVP_MAIN && + (old_stream_status && !old_stream_status->fpo_in_use)))) {if (hubp && hubp->funcs->hubp_update_force_pstate_disallow) hubp->funcs->hubp_update_force_pstate_disallow (hubp, true);if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)
drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c +7 -1
@@ -1966,6 +1966,7 @@ bool dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(struct dc *dc, {int refresh_rate =0 ;const int minimum_refreshrate_supported =120 ; +struct dc_stream_status *stream_status =NULL ;if (context ==NULL || context->streams[0 ] ==NULL )return false;
@@ -1999,7 +2000,12 @@ bool dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(struct dc *dc,if (context->streams[0 ]->vrr_active_variable && (dc->debug.disable_fams_gaming ==INGAME_FAMS_DISABLE ))return false; - context->streams[0 ]->fpo_in_use = true; + stream_status =dc_state_get_stream_status (context, context->streams[0 ]); + +if (!stream_status) +return false; + + stream_status->fpo_in_use = true;return true; }
Signature · 1 line
2.34.1
PATCH 12/32 drm/amd/display: Use current_state when checking old_pipe subvp type
In reply to Zaeem MohamedFrom: Alvin Lee <[email protected]>
[Description]
When checking the subvp type of the previous state we must pass in current_state to the interface instead of context otherwise we will get the wrong result.
--- drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +1 -1
@@ -643,7 +643,7 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)if (pipe->stream && (dc_state_get_pipe_subvp_type (context, pipe) ==SUBVP_MAIN || (stream_status && stream_status->fpo_in_use)) && - (!old_pipe->stream || (dc_state_get_pipe_subvp_type (context, old_pipe) !=SUBVP_MAIN && + (!old_pipe->stream || (dc_state_get_pipe_subvp_type (dc->current_state, old_pipe) !=SUBVP_MAIN && (old_stream_status && !old_stream_status->fpo_in_use)))) {if (hubp && hubp->funcs->hubp_update_force_pstate_disallow) hubp->funcs->hubp_update_force_pstate_disallow (hubp, true);
Signature · 1 line
2.34.1
PATCH 13/32 drm/amd/display: Add UCLK p-state support message to dcn401
In reply to Zaeem MohamedFrom: Dillon Varone <[email protected]>
[WHY&HOW]
Improves on the SMU interface to explicitly declare P-State support.
--- .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 133 ++++++++++++------ .../dc/clk_mgr/dcn401/dcn401_clk_mgr.h | 3 +- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c | 14 +- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.h | 6 +- .../dc/resource/dcn32/dcn32_resource.c | 4 + 5 files changed, 106 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +87 -46
@@ -467,10 +467,10 @@ static void dcn401_update_clocks_legacy(struct clk_mgr *clk_mgr_base,if (should_update_pstate_support (safe_to_lower, fclk_p_state_change_support, clk_mgr_base->clks.fclk_p_state_change_support)) { clk_mgr_base->clks.fclk_p_state_change_support = fclk_p_state_change_support; -/* To enable FCLK P-state switching, send FCLK_PSTATE_SUPPORTED message to PMFW */ +/* To enable FCLK P-state switching, send PSTATE_SUPPORTED message to PMFW */ if (clk_mgr_base->clks.fclk_p_state_change_support) {/* Handle the code for sending a message to PMFW that FCLK P-state change is supported */ -dcn401_smu_send_fclk_pstate_message (clk_mgr,FCLK_PSTATE_SUPPORTED ); +dcn401_smu_send_fclk_pstate_message (clk_mgr, true); } }
@@ -506,7 +506,7 @@ static void dcn401_update_clocks_legacy(struct clk_mgr *clk_mgr_base, p_state_change_support = new_clocks->p_state_change_support || (total_plane_count ==0 ); -if (should_update_pstate_support (safe_to_lower, p_state_change_support, clk_mgr_base->clks.p_state_change_support)) { +if (should_update_pstate_support (safe_to_lower, p_state_change_support, clk_mgr_base->clks.prev_p_state_change_support)) { clk_mgr_base->clks.p_state_change_support = p_state_change_support; clk_mgr_base->clks.fw_based_mclk_switching = p_state_change_support && new_clocks->fw_based_mclk_switching;
@@ -525,7 +525,7 @@ static void dcn401_update_clocks_legacy(struct clk_mgr *clk_mgr_base, update_fclk && dcn401_is_ppclk_dpm_enabled(clk_mgr, PPCLK_FCLK)) {/* Handle code for sending a message to PMFW that FCLK P-state change is not supported */ -dcn401_smu_send_fclk_pstate_message (clk_mgr,FCLK_PSTATE_NOTSUPPORTED ); +dcn401_smu_send_fclk_pstate_message (clk_mgr, false); }/* Always update saved value, even if new value not set due to P-State switching unsupported */
@@ -678,7 +678,12 @@ static void dcn401_execute_block_sequence(struct clk_mgr *clk_mgr_base, unsignedcase CLK_MGR401_UPDATE_FCLK_PSTATE_SUPPORT :dcn401_smu_send_fclk_pstate_message ( clk_mgr_internal, - params->update_fclk_pstate_support_params.support); + params->update_pstate_support_params.support); +break ; +case CLK_MGR401_UPDATE_UCLK_PSTATE_SUPPORT : +dcn401_smu_send_uclk_pstate_message ( + clk_mgr_internal, + params->update_pstate_support_params.support);break ;case CLK_MGR401_UPDATE_CAB_FOR_UCLK : dcn401_smu_send_cab_for_uclk_message(
@@ -773,16 +778,16 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence(/* CLK_MGR401_UPDATE_FCLK_PSTATE_SUPPORT */ clk_mgr_base->clks.fclk_prev_p_state_change_support = clk_mgr_base->clks.fclk_p_state_change_support; fclk_p_state_change_support = new_clocks->fclk_p_state_change_support || (total_plane_count ==0 ); -if (should_update_pstate_support (safe_to_lower, fclk_p_state_change_support, clk_mgr_base->clks.fclk_p_state_change_support)) { +if (should_update_pstate_support (safe_to_lower, fclk_p_state_change_support, clk_mgr_base->clks.fclk_prev_p_state_change_support)) { clk_mgr_base->clks.fclk_p_state_change_support = fclk_p_state_change_support; update_active_fclk = true; update_idle_fclk = true; -/* To enable FCLK P-state switching, send FCLK_PSTATE_SUPPORTED message to PMFW */ +/* To enable FCLK P-state switching, send PSTATE_SUPPORTED message to PMFW */ if (clk_mgr_base->clks.fclk_p_state_change_support) {/* Handle the code for sending a message to PMFW that FCLK P-state change is supported */ if (dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_FCLK )) { - block_sequence[num_steps].params.update_fclk_pstate_support_params.support =FCLK_PSTATE_SUPPORTED ; + block_sequence[num_steps].params.update_pstate_support_params.support = true; block_sequence[num_steps].func =CLK_MGR401_UPDATE_FCLK_PSTATE_SUPPORT ; num_steps++; }
@@ -825,12 +830,26 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence(/* We don't actually care about socclk, don't notify SMU of hard min */ clk_mgr_base->clks.socclk_khz = new_clocks->socclk_khz; +/* UCLK */ +if (new_clocks->fw_based_mclk_switching != clk_mgr_base->clks.fw_based_mclk_switching && + new_clocks->fw_based_mclk_switching) { +/* enable FAMS features */ + clk_mgr_base->clks.fw_based_mclk_switching = new_clocks->fw_based_mclk_switching; + + block_sequence[num_steps].params.update_wait_for_dmub_ack_params.enable = clk_mgr_base->clks.fw_based_mclk_switching; + block_sequence[num_steps].func =CLK_MGR401_UPDATE_WAIT_FOR_DMUB_ACK ; + num_steps++; + + block_sequence[num_steps].params.indicate_drr_status_params.mod_drr_for_pstate = clk_mgr_base->clks.fw_based_mclk_switching; + block_sequence[num_steps].func =CLK_MGR401_INDICATE_DRR_STATUS ; + num_steps++; + } +/* CLK_MGR401_UPDATE_CAB_FOR_UCLK */ - clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support; clk_mgr_base->clks.prev_num_ways = clk_mgr_base->clks.num_ways; -if (clk_mgr_base->clks.num_ways != new_clocks->num_ways && clk_mgr_base->clks.num_ways < new_clocks->num_ways) { +/* increase num ways for subvp */ clk_mgr_base->clks.num_ways = new_clocks->num_ways;if (dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_UCLK )) { block_sequence[num_steps].params.update_cab_for_uclk_params.num_ways = clk_mgr_base->clks.num_ways;
@@ -839,15 +858,22 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence( } } -/* UCLK */ + clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support; uclk_p_state_change_support = new_clocks->p_state_change_support || (total_plane_count ==0 ); -if (should_update_pstate_support (safe_to_lower, uclk_p_state_change_support, clk_mgr_base->clks.p_state_change_support)) { +if (should_update_pstate_support (safe_to_lower, uclk_p_state_change_support, clk_mgr_base->clks.prev_p_state_change_support)) { clk_mgr_base->clks.p_state_change_support = uclk_p_state_change_support; update_active_uclk = true; update_idle_uclk = true; -/* to disable P-State switching, set UCLK min = max */ -if (!clk_mgr_base->clks.p_state_change_support) { +if (clk_mgr_base->clks.p_state_change_support) { +/* enable UCLK switching */ +if (dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_UCLK )) { + block_sequence[num_steps].params.update_pstate_support_params.support = true; + block_sequence[num_steps].func =CLK_MGR401_UPDATE_UCLK_PSTATE_SUPPORT ; + num_steps++; + } + }else { +/* when disabling P-State switching, set UCLK min = max */ if (dc->clk_mgr->dc_mode_softmax_enabled) {/* will never have the functional UCLK min above the softmax * since we calculate mode support based on softmax being the max UCLK
@@ -870,6 +896,7 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence( active_uclk_mhz =khz_to_mhz_ceil (clk_mgr_base->clks.dramclk_khz); } } +if (should_set_clock (safe_to_lower, new_clocks->idle_dramclk_khz, clk_mgr_base->clks.idle_dramclk_khz)) { clk_mgr_base->clks.idle_dramclk_khz = new_clocks->idle_dramclk_khz;
@@ -879,17 +906,6 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence( } } -/* set UCLK to requested value */ -if ((update_active_uclk || update_idle_uclk) && -dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_UCLK ) && - !is_idle_dpm_enabled) { - block_sequence[num_steps].params.update_hardmin_params.ppclk =PPCLK_UCLK ; - block_sequence[num_steps].params.update_hardmin_params.freq_mhz = active_uclk_mhz; - block_sequence[num_steps].params.update_hardmin_params.response =NULL ; - block_sequence[num_steps].func =CLK_MGR401_UPDATE_HARDMIN_PPCLK ; - num_steps++; - } -/* FCLK */ /* Always update saved value, even if new value not set due to P-State switching unsupported */ if (should_set_clock (safe_to_lower, new_clocks->fclk_khz, clk_mgr_base->clks.fclk_khz)) {
@@ -927,41 +943,66 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence( num_steps++; } -/* CLK_MGR401_UPDATE_WAIT_FOR_DMUB_ACK, CLK_MGR401_INDICATE_DRR_STATUS*/ -if (clk_mgr_base->clks.fw_based_mclk_switching != new_clocks->fw_based_mclk_switching) { - clk_mgr_base->clks.fw_based_mclk_switching = new_clocks->fw_based_mclk_switching; - - block_sequence[num_steps].params.update_wait_for_dmub_ack_params.enable = clk_mgr_base->clks.fw_based_mclk_switching; - block_sequence[num_steps].func =CLK_MGR401_UPDATE_WAIT_FOR_DMUB_ACK ; - num_steps++; +/* set UCLK to requested value if P-State switching is supported, or to re-enable P-State switching */ +if (update_active_uclk || update_idle_uclk) { +if (!is_idle_dpm_enabled) { + block_sequence[num_steps].params.update_hardmin_params.ppclk =PPCLK_UCLK ; + block_sequence[num_steps].params.update_hardmin_params.freq_mhz = active_uclk_mhz; + block_sequence[num_steps].params.update_hardmin_params.response =NULL ; + block_sequence[num_steps].func =CLK_MGR401_UPDATE_HARDMIN_PPCLK ; + num_steps++; + } - block_sequence[num_steps].params.indicate_drr_status_params.mod_drr_for_pstate = clk_mgr_base->clks.fw_based_mclk_switching; - block_sequence[num_steps].func =CLK_MGR401_INDICATE_DRR_STATUS ; - num_steps++; +/* disable UCLK P-State support if needed */ +if (!uclk_p_state_change_support && +should_update_pstate_support (safe_to_lower, uclk_p_state_change_support, clk_mgr_base->clks.prev_p_state_change_support) && +dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_UCLK )) { + block_sequence[num_steps].params.update_pstate_support_params.support = false; + block_sequence[num_steps].func =CLK_MGR401_UPDATE_UCLK_PSTATE_SUPPORT ; + num_steps++; + } }/* set FCLK to requested value if P-State switching is supported, or to re-enable P-State switching */ -if ((update_active_fclk || update_idle_fclk)) { +if (update_active_fclk || update_idle_fclk) { +/* No need to send active FCLK hardmin, automatically set based on DCFCLK */ +// if (!is_idle_dpm_enabled) { +// block_sequence[*num_steps].update_hardmin_params.clk_mgr = clk_mgr; +// block_sequence[*num_steps].update_hardmin_params.ppclk = PPCLK_FCLK; +// block_sequence[*num_steps].update_hardmin_params.freq_mhz = active_fclk_mhz; +// block_sequence[*num_steps].update_hardmin_params.response = NULL; +// block_sequence[*num_steps].func = CLK_MGR401_UPDATE_HARDMIN_PPCLK; +// (*num_steps)++; +// } +/* disable FCLK P-State support if needed */ -if (clk_mgr_base->clks.fclk_p_state_change_support != clk_mgr_base->clks.fclk_prev_p_state_change_support && +if (!fclk_p_state_change_support && +should_update_pstate_support (safe_to_lower, fclk_p_state_change_support, clk_mgr_base->clks.fclk_prev_p_state_change_support) &&dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_FCLK )) { - block_sequence[num_steps].params.update_fclk_pstate_support_params.support =FCLK_PSTATE_NOTSUPPORTED ; + block_sequence[num_steps].params.update_pstate_support_params.support = false; block_sequence[num_steps].func =CLK_MGR401_UPDATE_FCLK_PSTATE_SUPPORT ; num_steps++; } + } -/* No need to send active FCLK hardmin, automatically set based on DCFCLK */ -// block_sequence[*num_steps].update_hardmin_params.clk_mgr = clk_mgr; -// block_sequence[*num_steps].update_hardmin_params.ppclk = PPCLK_FCLK; -// block_sequence[*num_steps].update_hardmin_params.freq_mhz = active_fclk_mhz; -// block_sequence[*num_steps].update_hardmin_params.response = NULL; -// block_sequence[*num_steps].func = CLK_MGR401_UPDATE_HARDMIN_PPCLK; -// (*num_steps)++; +if (new_clocks->fw_based_mclk_switching != clk_mgr_base->clks.fw_based_mclk_switching && + safe_to_lower && !new_clocks->fw_based_mclk_switching) { +/* disable FAMS features */ + clk_mgr_base->clks.fw_based_mclk_switching = new_clocks->fw_based_mclk_switching; + + block_sequence[num_steps].params.update_wait_for_dmub_ack_params.enable = clk_mgr_base->clks.fw_based_mclk_switching; + block_sequence[num_steps].func =CLK_MGR401_UPDATE_WAIT_FOR_DMUB_ACK ; + num_steps++; + + block_sequence[num_steps].params.indicate_drr_status_params.mod_drr_for_pstate = clk_mgr_base->clks.fw_based_mclk_switching; + block_sequence[num_steps].func =CLK_MGR401_INDICATE_DRR_STATUS ; + num_steps++; }/* CLK_MGR401_UPDATE_CAB_FOR_UCLK */ if (clk_mgr_base->clks.num_ways != new_clocks->num_ways && - clk_mgr_base->clks.num_ways > new_clocks->num_ways) { + safe_to_lower && clk_mgr_base->clks.num_ways > new_clocks->num_ways) { +/* decrease num ways for subvp */ clk_mgr_base->clks.num_ways = new_clocks->num_ways;if (dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_UCLK )) { block_sequence[num_steps].params.update_cab_for_uclk_params.num_ways = clk_mgr_base->clks.num_ways;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.h +2 -1
@@ -38,7 +38,7 @@ union dcn401_clk_mgr_block_sequence_params {struct {/* inputs */ bool support; - } update_fclk_pstate_support_params; + } update_pstate_support_params;struct {/* inputs */ unsigned int num_ways;
@@ -82,6 +82,7 @@ enum dcn401_clk_mgr_block_sequence_func {CLK_MGR401_UPDATE_IDLE_HARDMINS ,CLK_MGR401_UPDATE_DEEP_SLEEP_DCFCLK ,CLK_MGR401_UPDATE_FCLK_PSTATE_SUPPORT , +CLK_MGR401_UPDATE_UCLK_PSTATE_SUPPORT ,CLK_MGR401_UPDATE_CAB_FOR_UCLK ,CLK_MGR401_UPDATE_WAIT_FOR_DMUB_ACK , CLK_MGR401_INDICATE_DRR_STATUS,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c +11 -3
@@ -131,12 +131,20 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mgreturn false; } -void dcn401_smu_send_fclk_pstate_message (struct clk_mgr_internal *clk_mgr,bool enable) +void dcn401_smu_send_fclk_pstate_message (struct clk_mgr_internal *clk_mgr,bool support) { -smu_print ("FCLK P-state support value is : %d\n" , enable); +smu_print ("FCLK P-state support value is : %d\n" , support);dcn401_smu_send_msg_with_param (clk_mgr, - DALSMC_MSG_SetFclkSwitchAllow, enable ?FCLK_PSTATE_SUPPORTED :FCLK_PSTATE_NOTSUPPORTED ,NULL ); + DALSMC_MSG_SetFclkSwitchAllow, support,NULL ); +} + +void dcn401_smu_send_uclk_pstate_message (struct clk_mgr_internal *clk_mgr,bool support) +{ +smu_print ("UCLK P-state support value is : %d\n" , support); + +dcn401_smu_send_msg_with_param (clk_mgr, + DALSMC_MSG_SetUclkPstateAllow, support,NULL ); }void dcn401_smu_send_cab_for_uclk_message (struct clk_mgr_internal *clk_mgr,unsigned int num_ways)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.h +2 -4
@@ -9,10 +9,8 @@#include "core_types.h" #include "dcn32/dcn32_clk_mgr_smu_msg.h" -#define FCLK_PSTATE_NOTSUPPORTED 0x00 -#define FCLK_PSTATE_SUPPORTED 0x01 - -void dcn401_smu_send_fclk_pstate_message (struct clk_mgr_internal *clk_mgr,bool enable); +void dcn401_smu_send_fclk_pstate_message (struct clk_mgr_internal *clk_mgr,bool support); +void dcn401_smu_send_uclk_pstate_message (struct clk_mgr_internal *clk_mgr,bool support);void dcn401_smu_send_cab_for_uclk_message (struct clk_mgr_internal *clk_mgr,unsigned int num_ways);void dcn401_smu_transfer_wm_table_dram_2_smu (struct clk_mgr_internal *clk_mgr);void dcn401_smu_set_pme_workaround (struct clk_mgr_internal *clk_mgr);
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +4 -0
@@ -1978,6 +1978,10 @@ unsigned int dcn32_calculate_mall_ways_from_bytes(const struct dc *dc, unsigned {uint32_t cache_lines_used, lines_per_way, total_cache_lines, num_ways; +if (total_size_in_mall_bytes ==0 ) { +return 0 ; + } +/* add 2 lines for worst case alignment */ cache_lines_used = total_size_in_mall_bytes / dc->caps.cache_line_size +2 ;
Signature · 1 line
2.34.1
PATCH 14/32 drm/amd/display: Updated optc401_set_drr to use dcn401 functions
In reply to Zaeem MohamedFrom: Relja Vojvodic <[email protected]>
why:optc_401_set_drr was using an old optc3 function to update vtotal min and max, causing crashes when disabling FAMS2
how:
Updated dcn401 to point to opt401 function for vtotal updates. This version of the function has FAMS2 logic that allows for FAMS2 to be disabled.
--- drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c +1 -1
@@ -430,7 +430,7 @@ static struct timing_generator_funcs dcn401_tg_funcs = { .enable_optc_clock = optc1_enable_optc_clock, .set_drr = optc401_set_drr, .get_last_used_drr_vtotal = optc2_get_last_used_drr_vtotal, - .set_vtotal_min_max = optc3_set_vtotal_min_max, + .set_vtotal_min_max = optc401_set_vtotal_min_max, .set_static_screen_control = optc1_set_static_screen_control, .program_stereo = optc1_program_stereo, .is_stereo_left_eye = optc1_is_stereo_left_eye,
Signature · 1 line
2.34.1
PATCH 15/32 drm/amd/display: fix YUV video color corruption in DCN401
In reply to Zaeem MohamedFrom: Samson Tam <[email protected]>
[Why]
Missing check causes sequence error which results in chroma
filter coefficients not being updated in certain modes when we display YUV video in fullscreen. This results in color corruption in video
[How]
Add back chroma_coef_mode check in dscl_set_scl_filter
so that filter coefficients are calculated and updated when we have YUV surface
--- .../amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c +10 -6
@@ -297,17 +297,21 @@ static void dpp401_dscl_set_scl_filter(if ((dpp->base.ctx->dc->config.use_spl) && (!dpp->base.ctx->dc->debug.disable_spl)) { filter_h = scl_data->dscl_prog_data.filter_h; filter_v = scl_data->dscl_prog_data.filter_v; - filter_h_c = scl_data->dscl_prog_data.filter_h_c; - filter_v_c = scl_data->dscl_prog_data.filter_v_c; +if (chroma_coef_mode) { + filter_h_c = scl_data->dscl_prog_data.filter_h_c; + filter_v_c = scl_data->dscl_prog_data.filter_v_c; + } }else { filter_h =dpp401_dscl_get_filter_coeffs_64p ( scl_data->taps.h_taps, scl_data->ratios.horz); filter_v =dpp401_dscl_get_filter_coeffs_64p ( scl_data->taps.v_taps, scl_data->ratios.vert); - filter_h_c =dpp401_dscl_get_filter_coeffs_64p ( - scl_data->taps.h_taps_c, scl_data->ratios.horz_c); - filter_v_c =dpp401_dscl_get_filter_coeffs_64p ( - scl_data->taps.v_taps_c, scl_data->ratios.vert_c); +if (chroma_coef_mode) { + filter_h_c =dpp401_dscl_get_filter_coeffs_64p ( + scl_data->taps.h_taps_c, scl_data->ratios.horz_c); + filter_v_c =dpp401_dscl_get_filter_coeffs_64p ( + scl_data->taps.v_taps_c, scl_data->ratios.vert_c); + } } h_2tap_hardcode_coef_en = scl_data->taps.h_taps <3
Signature · 1 line
2.34.1
PATCH 16/32 drm/amd/display: Fetch Mall caps from DC
In reply to Zaeem MohamedFrom: Daniel Sa <[email protected]>
[Why]
When performing P-State switching with Subvp on 8k (downscaled to 4k). corruption can be seen on the screen. MALL data was not being fetched from DC, and the system things there is more MALL space then what is actually available.
[How]
Read MALL size from dc caps.
--- .../drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c +1 -1
@@ -306,7 +306,7 @@ void dml21_apply_soc_bb_overrides(struct dml2_initialize_instance_in_out *dml_inif (in_dc->ctx->dc_bios->vram_info.num_chans) { dml_clk_table->dram_config.channel_count = in_dc->ctx->dc_bios->vram_info.num_chans; -//dml_soc_bb->mall_allocated_for_dcn_mbytes = TODO; + dml_soc_bb->mall_allocated_for_dcn_mbytes = in_dc->caps.mall_size_total /1048576 ; }if (in_dc->ctx->dc_bios->vram_info.dram_channel_width_bytes) {
Signature · 1 line
2.34.1
PATCH 17/32 drm/amd/display: Prevent IPX From Link Detect and Set Mode
In reply to Zaeem MohamedFrom: Fangzhi Zuo <[email protected]>
IPX involvment proven to affect LT, causing link loss. Need to prevent IPX enabled in LT process in which link detect and set mode are main procedures that have LT taken place.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -0
@@ -3097,6 +3097,7 @@ static int dm_resume(void *handle) commit_params.streams = dc_state->streams; commit_params.stream_count = dc_state->stream_count; +dc_exit_ips_for_hw_access (dm->dc);WARN_ON (!dc_commit_streams (dm->dc, &commit_params));dm_gpureset_commit_state (dm->cached_dc_state, dm);
@@ -3169,6 +3170,7 @@ static int dm_resume(void *handle)emulated_link_detect (aconnector->dc_link); }else {mutex_lock (&dm->dc_lock); +dc_exit_ips_for_hw_access (dm->dc);dc_link_detect (aconnector->dc_link,DETECT_REASON_HPD );mutex_unlock (&dm->dc_lock); }
@@ -3505,6 +3507,7 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)enum dc_connection_type new_connection_type = dc_connection_none;struct amdgpu_device *adev =drm_to_adev (dev);struct dm_connector_state *dm_con_state =to_dm_connector_state (connector->state); +struct dc *dc = aconnector->dc_link->ctx->dc;bool ret = false;if (adev->dm.disable_hpd_irq)
@@ -3539,6 +3542,7 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)drm_kms_helper_connector_hotplug_event (connector); }else {mutex_lock (&adev->dm.dc_lock); +dc_exit_ips_for_hw_access (dc); ret =dc_link_detect (aconnector->dc_link,DETECT_REASON_HPD );mutex_unlock (&adev->dm.dc_lock);if (ret) {
@@ -3598,6 +3602,7 @@ static void handle_hpd_rx_irq(void *param)bool has_left_work = false;int idx = dc_link->link_index;struct hpd_rx_irq_offload_work_queue *offload_wq = &adev->dm.hpd_rx_offload_wq[idx]; +struct dc *dc = aconnector->dc_link->ctx->dc;memset (&hpd_irq_data,0 ,sizeof (hpd_irq_data));
@@ -3687,6 +3692,7 @@ static void handle_hpd_rx_irq(void *param)bool ret = false;mutex_lock (&adev->dm.dc_lock); +dc_exit_ips_for_hw_access (dc); ret =dc_link_detect (dc_link,DETECT_REASON_HPDRX );mutex_unlock (&adev->dm.dc_lock);
@@ -4888,6 +4894,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)bool ret = false;mutex_lock (&dm->dc_lock); +dc_exit_ips_for_hw_access (dm->dc); ret =dc_link_detect (link,DETECT_REASON_BOOT );mutex_unlock (&dm->dc_lock);
@@ -9298,6 +9305,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,memset (&position,0 ,sizeof (position));mutex_lock (&dm->dc_lock); +dc_exit_ips_for_hw_access (dm->dc);dc_stream_program_cursor_position (dm_old_crtc_state->stream, &position);mutex_unlock (&dm->dc_lock); }
@@ -9367,6 +9375,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,dm_enable_per_frame_crtc_master_sync (dc_state);mutex_lock (&dm->dc_lock); +dc_exit_ips_for_hw_access (dm->dc);WARN_ON (!dc_commit_streams (dm->dc, ¶ms));/* Allow idle optimization when vblank count is 0 for display off */
@@ -9732,6 +9741,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)mutex_lock (&dm->dc_lock); +dc_exit_ips_for_hw_access (dm->dc); dc_update_planes_and_stream(dm->dc, dummy_updates, status->plane_count,
Signature · 1 line
2.34.1
PATCH 18/32 drm/amd/display: Add outbox notification support for HPD redetect
In reply to Zaeem MohamedFrom: Nicholas Kazlauskas <[email protected]>
[Why]
HPD sense changes can occur during low power states and need to be notified from firmware to driver. Upon notification the hotplug redetection routines should execute.
[How]
Add Support in DMUB srv and DMUB srv stat for receiving these notifications. DM can hook them up and process the HPD redetection once received.
--- drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 ++ .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 24 +++++++++++++++++++ .../drm/amd/display/dmub/src/dmub_srv_stat.c | 6 +++++ 3 files changed, 32 insertions(+)
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +2 -0
@@ -137,6 +137,7 @@ enum dmub_notification_type {DMUB_NOTIFICATION_HPD_IRQ ,DMUB_NOTIFICATION_SET_CONFIG_REPLY ,DMUB_NOTIFICATION_DPIA_NOTIFICATION , +DMUB_NOTIFICATION_HPD_SENSE_NOTIFY , DMUB_NOTIFICATION_MAX };
@@ -560,6 +561,7 @@ struct dmub_notification {* DPIA notification command. */ struct dmub_rb_cmd_dpia_notification dpia_notification; +struct dmub_rb_cmd_hpd_sense_notify_data hpd_sense_notify; }; };
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +24 -0
@@ -1285,6 +1285,10 @@ enum dmub_out_cmd_type {* Command type used for USB4 DPIA notification */ DMUB_OUT_CMD__DPIA_NOTIFICATION =5 , +/** +* Command type used for HPD redetect notification +*/ + DMUB_OUT_CMD__HPD_SENSE_NOTIFY = 6, };/* DMUB_CMD__DPIA command sub-types. */
@@ -2468,6 +2472,22 @@ struct dmub_rb_cmd_query_hpd_state {struct dmub_cmd_hpd_state_query_data data; }; +/** +* struct dmub_rb_cmd_hpd_sense_notify - HPD sense notification data. +*/ +struct dmub_rb_cmd_hpd_sense_notify_data { +uint32_t old_hpd_sense_mask;/**< Old HPD sense mask */ +uint32_t new_hpd_sense_mask;/**< New HPD sense mask */ +}; + +/** +* struct dmub_rb_cmd_hpd_sense_notify - DMUB_OUT_CMD__HPD_SENSE_NOTIFY command. +*/ +struct dmub_rb_cmd_hpd_sense_notify { +struct dmub_cmd_header header;/**< header */ +struct dmub_rb_cmd_hpd_sense_notify_data data;/**< payload */ +}; +/* * Command IDs should be treated as stable ABI. * Do not reuse or modify IDs.
@@ -5204,6 +5224,10 @@ union dmub_rb_out_cmd {* DPIA notification command. */ struct dmub_rb_cmd_dpia_notification dpia_notification; +/** +* HPD sense notification command. +*/ +struct dmub_rb_cmd_hpd_sense_notify hpd_sense_notify; };#pragma pack(pop)
drivers/gpu/drm/amd/display/dmub/src/dmub_srv_stat.c +6 -0
@@ -113,6 +113,12 @@ enum dmub_status dmub_srv_stat_get_notification(struct dmub_srv *dmub, notify->result =DPIA_BW_ALLOC_CAPS_CHANGED ; }break ; +case DMUB_OUT_CMD__HPD_SENSE_NOTIFY : + notify->type =DMUB_NOTIFICATION_HPD_SENSE_NOTIFY ; +dmub_memcpy (¬ify->hpd_sense_notify, + &cmd.hpd_sense_notify.data, +sizeof (cmd.hpd_sense_notify.data)); +break ;default : notify->type =DMUB_NOTIFICATION_NO_DATA ;break ;
Signature · 1 line
2.34.1
PATCH 19/32 drm/amd/display: Extend PSRSU residency mode
In reply to Zaeem MohamedFrom: Jack Chang <[email protected]>
1. To support multiple PSRSU residency measurement mode
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 5 ++++- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 3 ++- drivers/gpu/drm/amd/display/dc/inc/link.h | 2 +- .../dc/link/protocols/link_edp_panel_control.c | 4 ++-- .../dc/link/protocols/link_edp_panel_control.h | 2 +- drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 12 ++++++++++++ 7 files changed, 23 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -1
@@ -3074,7 +3074,7 @@ static int psr_read_residency(void *data, u64 *val)struct dc_link *link = connector->dc_link;u32 residency =0 ; - link->dc->link_srv->edp_get_psr_residency (link, &residency); + link->dc->link_srv->edp_get_psr_residency (link, &residency,PSR_RESIDENCY_MODE_PHY ); *val = (u64 )residency;
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +4 -1
@@ -445,10 +445,13 @@ static void dmub_psr_force_static(struct dmub_psr *dmub, uint8_t panel_inst)/* * Get PSR residency from firmware. */ -static void dmub_psr_get_residency (struct dmub_psr *dmub,uint32_t *residency,uint8_t panel_inst) +static void dmub_psr_get_residency (struct dmub_psr *dmub,uint32_t *residency, +uint8_t panel_inst,enum psr_residency_mode mode) {uint16_t param = (uint16_t )(panel_inst <<8 ); + param |= mode; +/* Send gpint command and wait for ack */ dc_wake_and_execute_gpint (dmub->ctx,DMUB_GPINT__PSR_RESIDENCY , param, residency,DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY );
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h +2 -1
@@ -27,6 +27,7 @@#define _DMUB_PSR_H_#include "dc_types.h" +#include "dmub_cmd.h" struct dc_link ;struct dmub_psr_funcs ;
@@ -46,7 +47,7 @@ struct dmub_psr_funcs { uint8_t panel_inst);void (*psr_force_static)(struct dmub_psr *dmub,uint8_t panel_inst);void (*psr_get_residency)(struct dmub_psr *dmub,uint32_t *residency, -uint8_t panel_inst); +uint8_t panel_inst,enum psr_residency_mode mode);void (*psr_set_sink_vtotal_in_psr_active)(struct dmub_psr *dmub,uint16_t psr_vtotal_idle,uint16_t psr_vtotal_su);void (*psr_set_power_opt)(struct dmub_psr *dmub,unsigned int power_opt,uint8_t panel_inst);
drivers/gpu/drm/amd/display/dc/inc/link.h +1 -1
@@ -272,7 +272,7 @@ struct link_service {uint16_t psr_vtotal_idle, uint16_t psr_vtotal_su);void (*edp_get_psr_residency)( -const struct dc_link *link,uint32_t *residency); +const struct dc_link *link,uint32_t *residency,enum psr_residency_mode mode);bool (*edp_get_replay_state)(const struct dc_link *link,uint64_t *state);
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -2
@@ -853,7 +853,7 @@ bool edp_setup_psr(struct dc_link *link, } -void edp_get_psr_residency (const struct dc_link *link,uint32_t *residency) +void edp_get_psr_residency (const struct dc_link *link,uint32_t *residency,enum psr_residency_mode mode) {struct dc *dc = link->ctx->dc;struct dmub_psr *psr = dc->res_pool->psr;
@@ -864,7 +864,7 @@ void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency)// PSR residency measurements only supported on DMCUB if (psr !=NULL && link->psr_settings.psr_feature_enabled) - psr->funcs->psr_get_residency (psr, residency, panel_inst); + psr->funcs->psr_get_residency (psr, residency, panel_inst, mode);else *residency =0 ; }
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h +1 -1
@@ -51,7 +51,7 @@ bool edp_setup_psr(struct dc_link *link, struct psr_context *psr_context);bool edp_set_sink_vtotal_in_psr_active (const struct dc_link *link,uint16_t psr_vtotal_idle,uint16_t psr_vtotal_su); -void edp_get_psr_residency (const struct dc_link *link,uint32_t *residency); +void edp_get_psr_residency (const struct dc_link *link,uint32_t *residency,enum psr_residency_mode mode);bool edp_set_replay_allow_active (struct dc_link *dc_link,const bool *enable,bool wait,bool force_static,const unsigned int *power_opts); bool edp_setup_replay(struct dc_link *link,
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +12 -0
@@ -3249,6 +3249,18 @@ struct dmub_rb_cmd_psr_set_power_opt {struct dmub_cmd_psr_set_power_opt_data psr_set_power_opt_data; }; +/** +* Different PSR residency modes. +* Different modes change the definition of PSR residency. +*/ +enum psr_residency_mode { +PSR_RESIDENCY_MODE_PHY =0 , +PSR_RESIDENCY_MODE_ALPM , +PSR_RESIDENCY_MODE_ENABLEMENT_PERIOD , +/* Do not add below. */ +PSR_RESIDENCY_MODE_LAST_ELEMENT , +}; +/** * Definition of Replay Residency GPINT command. * Bit[0] - Residency mode for Revision 0
Signature · 1 line
2.34.1
PATCH 20/32 drm/amd/display: bypass ODM before CRTC off
In reply to Zaeem MohamedFrom: Yihan Zhu <[email protected]>
[WHY]
OPPs couldn't disconnect from the ODM that cause the double buffer pending not being latched due to missing VUPDATE.
[HOW]
Moving memory blanking before OTG turn off to make sure double buffer latched correctly.
--- .../gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c +11 -0
@@ -121,6 +121,17 @@ static bool optc31_enable_crtc(struct timing_generator *optc)static bool optc31_disable_crtc (struct timing_generator *optc) {struct optc *optc1 =DCN10TG_FROM_TG (optc); + +REG_UPDATE_5 (OPTC_DATA_SOURCE_SELECT , +OPTC_SEG0_SRC_SEL ,0xf , +OPTC_SEG1_SRC_SEL ,0xf , +OPTC_SEG2_SRC_SEL ,0xf , +OPTC_SEG3_SRC_SEL ,0xf , +OPTC_NUM_OF_INPUT_SEGMENT ,0 ); + +REG_UPDATE (OPTC_MEMORY_CONFIG , +OPTC_MEM_SEL ,0 ); +/* disable otg request until end of the first line * in the vertical blank region */
Signature · 1 line
2.34.1
PATCH 21/32 drm/amd/display: Change the order of setting DP_IS_USB_C flag
In reply to Zaeem MohamedFrom: Wayne Lin <[email protected]>
[Why]enc10->base.features.flags.bits.DP_IS_USB_C will be overwritten if we set it before initializing enc10->base.features
[How]
Determine DP_IS_USB_C after enc10->base.features is initialized. Besides, bp_cap_info.DP_IS_USB_C will never be set in get_connector_speed_cap_info(). Remove the redudant code.
--- .../drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c +3 -7
@@ -183,13 +183,13 @@ void dcn35_link_encoder_construct( enc10->base.hpd_source = init_data->hpd_source; enc10->base.connector = init_data->connector; -if (enc10->base.connector.id ==CONNECTOR_ID_USBC ) - enc10->base.features.flags.bits.DP_IS_USB_C =1 ; - enc10->base.preferred_engine =ENGINE_ID_UNKNOWN ; enc10->base.features = *enc_features; +if (enc10->base.connector.id ==CONNECTOR_ID_USBC ) + enc10->base.features.flags.bits.DP_IS_USB_C =1 ; + enc10->base.transmitter = init_data->transmitter;/* set the flag to indicate whether driver poll the I2C data pin
@@ -255,10 +255,6 @@ void dcn35_link_encoder_construct( enc10->base.features.flags.bits.IS_UHBR10_CAPABLE = bp_cap_info.DP_UHBR10_EN; enc10->base.features.flags.bits.IS_UHBR13_5_CAPABLE = bp_cap_info.DP_UHBR13_5_EN; enc10->base.features.flags.bits.IS_UHBR20_CAPABLE = bp_cap_info.DP_UHBR20_EN; -if (bp_cap_info.DP_IS_USB_C) { -/*BIOS not switch to use CONNECTOR_ID_USBC = 24 yet*/ - enc10->base.features.flags.bits.DP_IS_USB_C =1 ; - } }else { DC_LOG_WARNING("%s: Failed to get encoder_cap_info from VBIOS with error code %d!\n",
Signature · 1 line
2.34.1
PATCH 22/32 drm/amd/display: Force max clocks unconditionally when p-state is unsupported
In reply to Zaeem MohamedFrom: Dillon Varone <[email protected]>
[WHY&HOW]
UCLK and FCLK are updated together, so an FCLK update can also cause UCLK update to SMU. When this happens, the UCLK provided should be max if switching is unsupported.
--- .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +20 -16
@@ -791,14 +791,16 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence( block_sequence[num_steps].func =CLK_MGR401_UPDATE_FCLK_PSTATE_SUPPORT ; num_steps++; } - }else { -/* P-State is not supported so force max clocks */ - idle_fclk_mhz = - clk_mgr_base->bw_params->clk_table.entries[clk_mgr_base->bw_params->clk_table.num_entries_per_clk.num_fclk_levels -1 ].fclk_mhz; - active_fclk_mhz = idle_fclk_mhz; } } +if (!clk_mgr_base->clks.fclk_p_state_change_support &&dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_FCLK )) { +/* when P-State switching disabled, set UCLK min = max */ + idle_fclk_mhz = + clk_mgr_base->bw_params->clk_table.entries[clk_mgr_base->bw_params->clk_table.num_entries_per_clk.num_fclk_levels -1 ].fclk_mhz; + active_fclk_mhz = idle_fclk_mhz; + } +/* UPDATE DCFCLK */ if (dc->debug.force_min_dcfclk_mhz >0 ) new_clocks->dcfclk_khz = (new_clocks->dcfclk_khz > (dc->debug.force_min_dcfclk_mhz * 1000)) ?
@@ -872,19 +874,21 @@ static unsigned int dcn401_build_update_bandwidth_clocks_sequence( block_sequence[num_steps].func =CLK_MGR401_UPDATE_UCLK_PSTATE_SUPPORT ; num_steps++; } + } + } + +if (!clk_mgr_base->clks.p_state_change_support &&dcn401_is_ppclk_dpm_enabled (clk_mgr_internal,PPCLK_UCLK )) { +/* when P-State switching disabled, set UCLK min = max */ +if (dc->clk_mgr->dc_mode_softmax_enabled) { +/* will never have the functional UCLK min above the softmax +* since we calculate mode support based on softmax being the max UCLK +* frequency. +*/ + active_uclk_mhz = clk_mgr_base->bw_params->dc_mode_softmax_memclk; }else { -/* when disabling P-State switching, set UCLK min = max */ -if (dc->clk_mgr->dc_mode_softmax_enabled) { -/* will never have the functional UCLK min above the softmax -* since we calculate mode support based on softmax being the max UCLK -* frequency. -*/ - active_uclk_mhz = clk_mgr_base->bw_params->dc_mode_softmax_memclk; - }else { - active_uclk_mhz = clk_mgr_base->bw_params->max_memclk_mhz; - } - idle_uclk_mhz = active_uclk_mhz; + active_uclk_mhz = clk_mgr_base->bw_params->max_memclk_mhz; } + idle_uclk_mhz = active_uclk_mhz; }/* Always update saved value, even if new value not set due to P-State switching unsupported */
Signature · 1 line
2.34.1
PATCH 23/32 drm/amd/display: Add recovery timeout to FAMS2
In reply to Zaeem MohamedFrom: Dillon Varone <[email protected]>
[WHY&HOW]
Add 5ms timeout to trigger recovery and force allow P-State in DMUB.
--- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 1 + drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +1 -0
@@ -1653,6 +1653,7 @@ void dc_dmub_srv_fams2_update_config(struct dc *dc,/* send global configuration parameters */ global_cmd->config.global.max_allow_delay_us =100 *1000 ;//100ms global_cmd->config.global.lock_wait_time_us =5000 ;//5ms + global_cmd->config.global.recovery_timeout_us =5000 ;//5ms /* copy static feature configuration */ global_cmd->config.global.features.all = dc->debug.fams2_config.all;
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +1 -0
@@ -1833,6 +1833,7 @@ struct dmub_cmd_fams2_global_config {uint32_t lock_wait_time_us;// time to forecast acquisition of lock uint32_t num_streams;union dmub_fams2_global_feature_config features; +uint32_t recovery_timeout_us;uint8_t pad[3 ]; };
Signature · 1 line
2.34.1
PATCH 24/32 drm/amd/display: add set ips disable
In reply to Zaeem MohamedFrom: Chiawen Huang <[email protected]>
[How&Why]
Once IPS active, all the DCN resources are not be allowed to access.
It needs to a function for 3rd party to on/off IPS.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 10 ++++++++++ drivers/gpu/drm/amd/display/dc/dc.h | 2 ++ 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +10 -0
@@ -5332,6 +5332,16 @@ bool dc_set_replay_allow_active(struct dc *dc, bool active)return true; } +/* set IPS disable state */ +bool dc_set_ips_disable (struct dc *dc,unsigned int disable_ips) +{ +dc_exit_ips_for_hw_access (dc); + + dc->config.disable_ips = disable_ips; + +return true; +} +void dc_allow_idle_optimizations_internal (struct dc *dc,bool allow,char const *caller_name) {if (dc->debug.disable_idle_power_optimizations)
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
@@ -2467,6 +2467,8 @@ bool dc_set_psr_allow_active(struct dc *dc, bool enable);bool dc_set_replay_allow_active (struct dc *dc,bool active); +bool dc_set_ips_disable (struct dc *dc,unsigned int disable_ips); +void dc_z10_restore (const struct dc *dc);void dc_z10_save_init (struct dc *dc);
Signature · 1 line
2.34.1
PATCH 25/32 drm/amd/display: Add monitor patch skip disable crtc during psr and ips1
In reply to Zaeem MohamedFrom: Lewis Huang <[email protected]>
[Why]
For some panel, it cannot handle pseudo vblank set by otg resync when leave psr
[How]
The monitor patch will keep otg_on during enter IPS1. And then we don't need to do otg resync when wake up.
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 +++ drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -304,6 +304,7 @@ struct dc_bug_wa { uint8_t dcfclk : 1; uint8_t dcfclk_ds: 1; } clock_update_disable_mask; +bool skip_psr_ips_crtc_disable;//Customer Specific WAs uint32_t force_backlight_start_level; };
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +3 -0
@@ -1256,6 +1256,9 @@ static void dc_dmub_srv_notify_idle(const struct dc *dc, bool allow_idle) cmd.idle_opt_notify_idle.cntl_data.driver_idle = allow_idle; +if (dc->work_arounds.skip_psr_ips_crtc_disable) + cmd.idle_opt_notify_idle.cntl_data.skip_otg_disable = true; +if (allow_idle) {volatile struct dmub_shared_state_ips_driver *ips_driver = &dc_dmub_srv->dmub->shared_state[DMUB_SHARED_SHARE_FEATURE__IPS_DRIVER ].data.ips_driver;
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +2 -1
@@ -1882,7 +1882,8 @@ struct dmub_rb_cmd_idle_opt_dcn_restore {*/ struct dmub_dcn_notify_idle_cntl_data {uint8_t driver_idle; -uint8_t reserved[59 ]; +uint8_t skip_otg_disable; +uint8_t reserved[58 ]; };/**
Signature · 1 line
2.34.1
PATCH 26/32 drm/amd/display: Introduce deferred Replay coasting vtotal update
In reply to Zaeem MohamedFrom: ChunTao Tso <[email protected]>
Add functions to defer updating of coasting vtotal after source refresh rate update.
--- drivers/gpu/drm/amd/display/dc/dc_types.h | 2 ++ .../drm/amd/display/modules/power/power_helpers.c | 14 ++++++++++++++ .../drm/amd/display/modules/power/power_helpers.h | 5 +++++ 3 files changed, 21 insertions(+)
drivers/gpu/drm/amd/display/dc/dc_types.h +2 -0
@@ -1091,6 +1091,8 @@ struct replay_settings {uint32_t coasting_vtotal;/* Coasting vtotal table */ uint32_t coasting_vtotal_table[PR_COASTING_TYPE_NUM ]; +/* Defer Update Coasting vtotal table */ +uint32_t defer_update_coasting_vtotal_table[PR_COASTING_TYPE_NUM ];/* Maximum link off frame count */ uint32_t link_off_frame_count;/* Replay pseudo vtotal for abm + ips on full screen video which can improve ips residency */
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +14 -0
@@ -973,6 +973,20 @@ bool psr_su_set_dsc_slice_height(struct dc *dc, struct dc_link *link,return true; } +void set_replay_defer_update_coasting_vtotal (struct dc_link *link, +enum replay_coasting_vtotal_type type, +uint32_t vtotal) +{ + link->replay_settings.defer_update_coasting_vtotal_table[type] = vtotal; +} + +void update_replay_coasting_vtotal_from_defer (struct dc_link *link, +enum replay_coasting_vtotal_type type) +{ + link->replay_settings.coasting_vtotal_table[type] = + link->replay_settings.defer_update_coasting_vtotal_table[type]; +} +void set_replay_coasting_vtotal (struct dc_link *link,enum replay_coasting_vtotal_type type,uint32_t vtotal)
drivers/gpu/drm/amd/display/modules/power/power_helpers.h +5 -0
@@ -57,6 +57,11 @@ void init_replay_config(struct dc_link *link, struct replay_config *pr_config);void set_replay_coasting_vtotal (struct dc_link *link,enum replay_coasting_vtotal_type type,uint32_t vtotal); +void set_replay_defer_update_coasting_vtotal (struct dc_link *link, +enum replay_coasting_vtotal_type type, +uint32_t vtotal); +void update_replay_coasting_vtotal_from_defer (struct dc_link *link, +enum replay_coasting_vtotal_type type);void set_replay_ips_full_screen_video_src_vtotal (struct dc_link *link,uint16_t vtotal);void calculate_replay_link_off_frame_count (struct dc_link *link,uint16_t vtotal,uint16_t htotal);
Signature · 1 line
2.34.1
PATCH 27/32 drm/amd/display: Program DIG FE source select for DVI before PHY en
In reply to Zaeem MohamedFrom: Alvin Lee <[email protected]>
[Description]
In newer DCN's the programming of SYMCLK_FE_SRC_SEL depends on the value of DIG_FE_SOURCE_SELECT. If DIG_FE_SOURCE_SELECT is not already programmed at the time of PHY / DIG enable then the FW sequence will program an incorrect SYMCLK source. Ensure that we program DIG_FE_SOURCE_SELECT for all DIO scenarios (DVI in this particular case) before going through the PHY / DIG enable sequence.
--- drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +1 -1
@@ -1976,7 +1976,7 @@ static void enable_link_hdmi(struct pipe_ctx *pipe_ctx)/* We need to enable stream encoder for TMDS first to apply 1/4 TMDS * character clock in case that beyond 340MHz. */ -if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) +if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal) ||dc_is_dvi_signal (pipe_ctx->stream->signal)) link_hwss->setup_stream_encoder (pipe_ctx); dc->hwss.enable_tmds_link_output(
Signature · 1 line
2.34.1
PATCH 28/32 drm/amd/display: Various DML2 fixes for FAMS2
In reply to Zaeem MohamedFrom: Dillon Varone <[email protected]>
- Ensure SubVP stream settings match ODM policy
- Fix MALL size calculations when DCC is enabled
- Fail if any stream fails DRR policy check
--- .../amd/display/dc/dml2/dml21/dml21_utils.c | 7 +++-- .../amd/display/dc/dml2/dml21/dml21_utils.h | 4 +-- .../amd/display/dc/dml2/dml21/dml21_wrapper.c | 6 ++-- .../dml2/dml21/src/dml2_core/dml2_core_dcn4.c | 1 - .../src/dml2_core/dml2_core_dcn4_calcs.c | 29 ------------------- .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 2 +- 6 files changed, 11 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c +5 -2
@@ -85,8 +85,8 @@ void find_pipe_regs_idx(const struct dml2_context *dml_ctx,int dml21_find_dc_pipes_for_plane (const struct dc *in_dc,struct dc_state *context,struct dml2_context *dml_ctx, -struct pipe_ctx **dc_main_pipes, -struct pipe_ctx **dc_phantom_pipes, +struct pipe_ctx *dc_main_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__], +struct pipe_ctx *dc_phantom_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__],int dml_plane_idx) {unsigned int dml_stream_index;
@@ -100,6 +100,9 @@ int dml21_find_dc_pipes_for_plane(const struct dc *in_dc,struct dc_plane_state *dc_phantom_plane;int num_pipes =0 ; +memset (dc_main_pipes,0 ,sizeof (struct pipe_ctx *) * __DML2_WRAPPER_MAX_STREAMS_PLANES__); +memset (dc_phantom_pipes,0 ,sizeof (struct pipe_ctx *) * __DML2_WRAPPER_MAX_STREAMS_PLANES__); + dml_stream_index = dml_ctx->v21.mode_programming.programming->plane_programming[dml_plane_idx].plane_descriptor->stream_index; main_stream_id = dml_ctx->v21.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id[dml_stream_index];
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.h +2 -2
@@ -33,8 +33,8 @@ void find_pipe_regs_idx(const struct dml2_context *dml_ctx,int dml21_find_dc_pipes_for_plane (const struct dc *in_dc,struct dc_state *context,struct dml2_context *dml_ctx, -struct pipe_ctx **dc_main_pipes, -struct pipe_ctx **dc_phantom_pipes, +struct pipe_ctx *dc_main_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__], +struct pipe_ctx *dc_phantom_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__],int dml_plane_idx); void dml21_program_dc_pipe(struct dml2_context *dml_ctx, struct dc_state *context,
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c +3 -3
@@ -156,7 +156,7 @@ static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_stafor (dc_pipe_index =0 ; dc_pipe_index < num_pipes; dc_pipe_index++) {dml21_program_dc_pipe (in_ctx, context, dc_main_pipes[dc_pipe_index], pln_prog, stream_prog); -if (pln_prog->phantom_plane.valid) { +if (pln_prog->phantom_plane.valid && dc_phantom_pipes[dc_pipe_index]) {dml21_program_dc_pipe (in_ctx, context, dc_phantom_pipes[dc_pipe_index], pln_prog, stream_prog); } }
@@ -325,7 +325,7 @@ void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context }/* get config for each phantom pipe */ -if (pln_prog->phantom_plane.valid) { +if (pln_prog->phantom_plane.valid && dc_phantom_pipes[0 ]) { mcache_config = &l->build_mcache_programming_params.mcache_configurations[dml_phantom_prog_idx];memset (mcache_config,0 ,sizeof (struct dml2_plane_mcache_configuration_descriptor )); mcache_config->plane_descriptor = pln_prog->plane_descriptor;
@@ -368,7 +368,7 @@ void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context }/* get config for each phantom pipe */ -if (pln_prog->phantom_plane.valid) { +if (pln_prog->phantom_plane.valid && dc_phantom_pipes[0 ]) {for (dc_pipe_index =0 ; dc_pipe_index < num_pipes; dc_pipe_index++) {ASSERT (dc_phantom_pipes[dc_pipe_index]);if (l->build_mcache_programming_params.per_plane_pipe_mcache_regs[dml_phantom_prog_idx][dc_pipe_index]) {
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4.c +0 -1
@@ -235,7 +235,6 @@ static void create_phantom_stream_from_main_stream(struct dml2_stream_parameters phantom->timing.v_active = meta->v_active; phantom->timing.v_front_porch = meta->v_front_porch; phantom->timing.vblank_nom = phantom->timing.v_total - phantom->timing.v_active; - phantom->timing.dsc.enable = dml2_dsc_disable; phantom->timing.drr_config.enabled = false; }
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +0 -29
@@ -4501,24 +4501,6 @@ static void CalculateSurfaceSizeInMall(math_floor2 ((double )composition->viewport.plane1.y_start + composition->viewport.plane1.height + ReadBlockHeightC[k] -1 , ReadBlockHeightC[k]) - math_floor2(composition->viewport.plane1.y_start, ReadBlockHeightC[k])) * BytesPerPixelC[k]); } -if (surface->dcc.enable) { - SurfaceSizeInMALL[k] = (unsigned int )(SurfaceSizeInMALL[k] + -math_min2 (math_ceil2 (surface->plane0.width,8 * Read256BytesBlockWidthY[k]), -math_floor2 (composition->viewport.plane0.x_start + composition->viewport.plane0.width +8 * Read256BytesBlockWidthY[k] -1 ,8 * Read256BytesBlockWidthY[k]) - -math_floor2 (composition->viewport.plane0.x_start,8 * Read256BytesBlockWidthY[k])) * -math_min2 (math_ceil2 (surface->plane0.height,8 * Read256BytesBlockHeightY[k]), -math_floor2 (composition->viewport.plane0.y_start + composition->viewport.plane0.height +8 * Read256BytesBlockHeightY[k] -1 ,8 * Read256BytesBlockHeightY[k]) - -math_floor2 (composition->viewport.plane0.y_start,8 * Read256BytesBlockHeightY[k])) * BytesPerPixelY[k] /256 ) + (64 *1024 ); -if (Read256BytesBlockWidthC[k] >0 ) { - SurfaceSizeInMALL[k] = (unsigned int )(SurfaceSizeInMALL[k] + -math_min2 (math_ceil2 (surface->plane1.width,8 * Read256BytesBlockWidthC[k]), -math_floor2 (composition->viewport.plane1.y_start + composition->viewport.plane1.width +8 * Read256BytesBlockWidthC[k] -1 ,8 * Read256BytesBlockWidthC[k]) - -math_floor2 (composition->viewport.plane1.y_start,8 * Read256BytesBlockWidthC[k])) * -math_min2 (math_ceil2 (surface->plane1.height,8 * Read256BytesBlockHeightC[k]), -math_floor2 (composition->viewport.plane1.y_start + composition->viewport.plane1.height +8 * Read256BytesBlockHeightC[k] -1 ,8 * Read256BytesBlockHeightC[k]) - -math_floor2 (composition->viewport.plane1.y_start,8 * Read256BytesBlockHeightC[k])) * BytesPerPixelC[k] /256 ); - } - } }else { SurfaceSizeInMALL[k] = (unsigned int )(math_ceil2 (math_min2 (surface->plane0.width, composition->viewport.plane0.width + ReadBlockWidthY[k] -1 ), ReadBlockWidthY[k]) *math_ceil2 (math_min2 (surface->plane0.height, composition->viewport.plane0.height + ReadBlockHeightY[k] -1 ), ReadBlockHeightY[k]) * BytesPerPixelY[k]);
@@ -4527,17 +4509,6 @@ static void CalculateSurfaceSizeInMall(math_ceil2 (math_min2 (surface->plane1.width, composition->viewport.plane1.width + ReadBlockWidthC[k] -1 ), ReadBlockWidthC[k]) * math_ceil2(math_min2(surface->plane1.height, composition->viewport.plane1.height + ReadBlockHeightC[k] - 1), ReadBlockHeightC[k]) * BytesPerPixelC[k]); } -if (surface->dcc.enable) { - SurfaceSizeInMALL[k] = (unsigned int )(SurfaceSizeInMALL[k] + -math_ceil2 (math_min2 (surface->plane0.width, composition->viewport.plane0.width +8 * Read256BytesBlockWidthY[k] -1 ),8 * Read256BytesBlockWidthY[k]) * -math_ceil2 (math_min2 (surface->plane0.height, composition->viewport.plane0.height +8 * Read256BytesBlockHeightY[k] -1 ),8 * Read256BytesBlockHeightY[k]) * BytesPerPixelY[k] /256 ) + (64 *1024 ); - -if (Read256BytesBlockWidthC[k] >0 ) { - SurfaceSizeInMALL[k] = (unsigned int )(SurfaceSizeInMALL[k] + -math_ceil2 (math_min2 (surface->plane1.width, composition->viewport.plane1.width +8 * Read256BytesBlockWidthC[k] -1 ),8 * Read256BytesBlockWidthC[k]) * -math_ceil2 (math_min2 (surface->plane1.height, composition->viewport.plane1.height +8 * Read256BytesBlockHeightC[k] -1 ),8 * Read256BytesBlockHeightC[k]) * BytesPerPixelC[k] /256 ); - } - } } }
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +1 -1
@@ -1361,7 +1361,7 @@ static bool validate_pstate_support_strategy_cofunctionality(struct dml2_pmo_insbreak ; } - strategy_matches_drr_requirements = + strategy_matches_drr_requirements &=stream_matches_drr_policy (pmo, display_cfg, per_stream_pstate_strategy[stream_index], stream_index); if (per_stream_pstate_strategy[stream_index] == dml2_pmo_pstate_strategy_fw_svp ||
Signature · 1 line
2.34.1
PATCH 29/32 drm/amd/display: Guard reading 3DLUT registers for dcn32/dcn35
In reply to Zaeem MohamedFrom: Nicholas Kazlauskas <[email protected]>
[Why]
3DLUT is not part of the DPP on DCN32/DCN35 ASIC and these registers now exist in MCM state.
[How]
Add guards when reading DPP state based on whether the register has a valid offset.
--- .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c +15 -14
@@ -64,22 +64,23 @@ void dpp30_read_state(struct dpp *dpp_base, struct dcn_dpp_state *s) }// Shaper LUT (RAM), 3D LUT (mode, bit-depth, size) -REG_GET (CM_SHAPER_CONTROL , -CM_SHAPER_LUT_MODE , &s->shaper_lut_mode); -REG_GET (CM_3DLUT_MODE , -CM_3DLUT_MODE_CURRENT , &s->lut3d_mode); -REG_GET (CM_3DLUT_READ_WRITE_CONTROL , -CM_3DLUT_30BIT_EN , &s->lut3d_bit_depth); -REG_GET (CM_3DLUT_MODE , -CM_3DLUT_SIZE , &s->lut3d_size); +if (REG (CM_SHAPER_CONTROL )) +REG_GET (CM_SHAPER_CONTROL ,CM_SHAPER_LUT_MODE , &s->shaper_lut_mode); +if (REG (CM_3DLUT_MODE )) +REG_GET (CM_3DLUT_MODE ,CM_3DLUT_MODE_CURRENT , &s->lut3d_mode); +if (REG (CM_3DLUT_READ_WRITE_CONTROL )) +REG_GET (CM_3DLUT_READ_WRITE_CONTROL ,CM_3DLUT_30BIT_EN , &s->lut3d_bit_depth); +if (REG (CM_3DLUT_MODE )) +REG_GET (CM_3DLUT_MODE ,CM_3DLUT_SIZE , &s->lut3d_size);// Blend/Out Gamma (RAM) -REG_GET (CM_BLNDGAM_CONTROL , -CM_BLNDGAM_MODE_CURRENT , &s->rgam_lut_mode); -if (s->rgam_lut_mode){ -REG_GET (CM_BLNDGAM_CONTROL ,CM_BLNDGAM_SELECT_CURRENT , &rgam_lut_mode); -if (!rgam_lut_mode) - s->rgam_lut_mode =LUT_RAM_A ;// Otherwise, LUT_RAM_B +if (REG (CM_BLNDGAM_CONTROL )) { +REG_GET (CM_BLNDGAM_CONTROL ,CM_BLNDGAM_MODE_CURRENT , &s->rgam_lut_mode); +if (s->rgam_lut_mode){ +REG_GET (CM_BLNDGAM_CONTROL ,CM_BLNDGAM_SELECT_CURRENT , &rgam_lut_mode); +if (!rgam_lut_mode) + s->rgam_lut_mode =LUT_RAM_A ;// Otherwise, LUT_RAM_B + } } }
Signature · 1 line
2.34.1
PATCH 30/32 drm/amd/display: Increase MAX_LINKS by 2
In reply to Zaeem MohamedFrom: Alex Hung <[email protected]>
Two additional virtual links are created and thus increasing size for dc->links by two.
--- drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +1 -1
@@ -44,7 +44,7 @@*/ #define MAX_PIPES 6#define MAX_PHANTOM_PIPES (MAX_PIPES / 2) -#define MAX_LINKS (MAX_PIPES * 2) +#define MAX_LINKS (MAX_PIPES * 2 +2)#define MAX_DIG_LINK_ENCODERS 7#define MAX_DWB_PIPES 1#define MAX_HPO_DP2_ENCODERS 4
Signature · 1 line
2.34.1
PATCH 31/32 drm/amd/display: Fix DSC slice and delay calculations
In reply to Zaeem MohamedFrom: Sung Joon Kim <[email protected]>
[why]
There are other factors that determine the number of DSC slices. The slices should not be determined in DML but retrieve the value calculated from driver.
[how]
Update the logic to determine DSC slice. Make DSCDelay per display pipe.
--- .../amd/display/dc/dml2/display_mode_core.c | 45 +++++++++++-------- .../dc/dml2/display_mode_core_structs.h | 1 + .../display/dc/dml2/dml2_translation_helper.c | 1 + 3 files changed, 29 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +27 -18
@@ -115,6 +115,7 @@ static void CalculateODMMode(dml_float_t DISPCLKDPPCLKDSCCLKDownSpreading, dml_float_t DISPCLKRampingMargin, dml_float_t DISPCLKDPPCLKVCOSpeed, + dml_uint_t NumberOfDSCSlices,// Output dml_bool_t *TotalAvailablePipesSupport,
@@ -5516,6 +5517,7 @@ static void CalculateODMMode(dml_float_t DISPCLKDPPCLKDSCCLKDownSpreading, dml_float_t DISPCLKRampingMargin, dml_float_t DISPCLKDPPCLKVCOSpeed, + dml_uint_t NumberOfDSCSlices,// Output dml_bool_t *TotalAvailablePipesSupport,
@@ -5563,7 +5565,7 @@ static void CalculateODMMode( *NumberOfDPP =0 ;if (!(Output == dml_hdmi || Output == dml_dp || Output == dml_edp) && (ODMUse == dml_odm_use_policy_combine_4to1 || (ODMUse == dml_odm_use_policy_combine_as_needed && - (SurfaceRequiredDISPCLKWithODMCombineTwoToOne > StateDispclk || (DSCEnable && (HActive >2 * MaximumPixelsPerLinePerDSCUnit)))))) { + (SurfaceRequiredDISPCLKWithODMCombineTwoToOne > StateDispclk || (DSCEnable && (HActive >2 * MaximumPixelsPerLinePerDSCUnit)) || NumberOfDSCSlices >8 )))) {if (TotalNumberOfActiveDPP +4 <= MaxNumDPP) { *ODMMode = dml_odm_mode_combine_4to1; *RequiredDISPCLKPerSurface = SurfaceRequiredDISPCLKWithODMCombineFourToOne;
@@ -5573,7 +5575,7 @@ static void CalculateODMMode( } }else if (Output != dml_hdmi && (ODMUse == dml_odm_use_policy_combine_2to1 || (ODMUse == dml_odm_use_policy_combine_as_needed && ((SurfaceRequiredDISPCLKWithoutODMCombine > StateDispclk && SurfaceRequiredDISPCLKWithODMCombineTwoToOne <= StateDispclk) || - (DSCEnable && (HActive > MaximumPixelsPerLinePerDSCUnit)))))) { + (DSCEnable && (HActive > MaximumPixelsPerLinePerDSCUnit)) || (NumberOfDSCSlices <=8 && NumberOfDSCSlices >4 ))))) {if (TotalNumberOfActiveDPP +2 <= MaxNumDPP) { *ODMMode = dml_odm_mode_combine_2to1; *RequiredDISPCLKPerSurface = SurfaceRequiredDISPCLKWithODMCombineTwoToOne;
@@ -5880,11 +5882,11 @@ static dml_uint_t DSCDelayRequirement(if (DSCEnabled == true && OutputBpp !=0 ) {if (ODMMode == dml_odm_mode_combine_4to1) { - DSCDelayRequirement_val =4 * (dscceComputeDelay (DSCInputBitPerComponent, OutputBpp, (dml_uint_t)(dml_ceil ((dml_float_t ) HActive / (dml_float_t ) NumberOfDSCSlices,1.0 )), - (dml_uint_t) (NumberOfDSCSlices /4.0 ), OutputFormat, Output) +dscComputeDelay (OutputFormat, Output)); + DSCDelayRequirement_val =dscceComputeDelay (DSCInputBitPerComponent, OutputBpp, (dml_uint_t)(dml_ceil ((dml_float_t ) HActive / (dml_float_t ) NumberOfDSCSlices,1.0 )), + (dml_uint_t) (NumberOfDSCSlices /4.0 ), OutputFormat, Output) +dscComputeDelay (OutputFormat, Output); }else if (ODMMode == dml_odm_mode_combine_2to1) { - DSCDelayRequirement_val =2 * (dscceComputeDelay (DSCInputBitPerComponent, OutputBpp, (dml_uint_t)(dml_ceil ((dml_float_t ) HActive / (dml_float_t ) NumberOfDSCSlices,1.0 )), - (dml_uint_t) (NumberOfDSCSlices /2.0 ), OutputFormat, Output) +dscComputeDelay (OutputFormat, Output)); + DSCDelayRequirement_val =dscceComputeDelay (DSCInputBitPerComponent, OutputBpp, (dml_uint_t)(dml_ceil ((dml_float_t ) HActive / (dml_float_t ) NumberOfDSCSlices,1.0 )), + (dml_uint_t) (NumberOfDSCSlices /2.0 ), OutputFormat, Output) +dscComputeDelay (OutputFormat, Output); }else { DSCDelayRequirement_val =dscceComputeDelay (DSCInputBitPerComponent, OutputBpp, (dml_uint_t)((dml_float_t )dml_ceil (HActive / (dml_float_t ) NumberOfDSCSlices,1.0 )), NumberOfDSCSlices, OutputFormat, Output) +dscComputeDelay (OutputFormat, Output);
@@ -6938,20 +6940,25 @@ dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib)/*Number Of DSC Slices*/ for (k =0 ; k < mode_lib->ms.num_active_planes; ++k) { -if (mode_lib->ms.cache_display_cfg.plane.BlendingAndTiming[k] == k) { -if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >4800 ) { - mode_lib->ms.support.NumberOfDSCSlices[k] = (dml_uint_t)(dml_ceil (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] /600 ,4 )); - }else if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >2400 ) { - mode_lib->ms.support.NumberOfDSCSlices[k] =8 ; - }else if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >1200 ) { - mode_lib->ms.support.NumberOfDSCSlices[k] =4 ; - }else if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >340 ) { - mode_lib->ms.support.NumberOfDSCSlices[k] =2 ; - }else { - mode_lib->ms.support.NumberOfDSCSlices[k] =1 ; +if (mode_lib->ms.cache_display_cfg.plane.BlendingAndTiming[k] == k && + mode_lib->ms.cache_display_cfg.output.DSCEnable[k] != dml_dsc_disable) { + mode_lib->ms.support.NumberOfDSCSlices[k] = mode_lib->ms.cache_display_cfg.output.DSCSlices[k]; + +if (mode_lib->ms.support.NumberOfDSCSlices[k] ==0 ) { +if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >4800 ) { + mode_lib->ms.support.NumberOfDSCSlices[k] = (dml_uint_t)(dml_ceil (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] /600 ,4 )); + }else if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >2400 ) { + mode_lib->ms.support.NumberOfDSCSlices[k] =8 ; + }else if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >1200 ) { + mode_lib->ms.support.NumberOfDSCSlices[k] =4 ; + }else if (mode_lib->ms.cache_display_cfg.output.PixelClockBackEnd[k] >340 ) { + mode_lib->ms.support.NumberOfDSCSlices[k] =2 ; + }else { + mode_lib->ms.support.NumberOfDSCSlices[k] =1 ; + } } }else { - mode_lib->ms.support.NumberOfDSCSlices[k] =0 ; + mode_lib->ms.support.NumberOfDSCSlices[k] =1 ; } }
@@ -7050,6 +7057,7 @@ dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib) mode_lib->ms.soc.dcn_downspread_percent, mode_lib->ms.ip.dispclk_ramp_margin_percent, mode_lib->ms.soc.dispclk_dppclk_vco_speed_mhz, + mode_lib->ms.support.NumberOfDSCSlices[k],/* Output */ &s->TotalAvailablePipesSupportNoDSC,
@@ -7072,6 +7080,7 @@ dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib) mode_lib->ms.soc.dcn_downspread_percent, mode_lib->ms.ip.dispclk_ramp_margin_percent, mode_lib->ms.soc.dispclk_dppclk_vco_speed_mhz, + mode_lib->ms.support.NumberOfDSCSlices[k],/* Output */ &s->TotalAvailablePipesSupportDSC,
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core_structs.h +1 -0
@@ -575,6 +575,7 @@ struct dml_output_cfg_st {dml_uint_t AudioSampleRate[__DML_NUM_PLANES__];dml_uint_t AudioSampleLayout[__DML_NUM_PLANES__];dml_bool_t OutputDisabled[__DML_NUM_PLANES__]; +dml_uint_t DSCSlices[__DML_NUM_PLANES__]; };// dml_timing_cfg_st; /// @brief Writeback Setting
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +1 -0
@@ -739,6 +739,7 @@ static void populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st * out->DSCEnable[location] = (enum dml_dsc_enable )in->timing.flags.DSC; out->OutputLinkDPLanes[location] =4 ;// As per code in dcn20_resource.c out->DSCInputBitPerComponent[location] =12 ;// As per code in dcn20_resource.c + out->DSCSlices[location] = in->timing.dsc_cfg.num_slices_h;switch (in->signal) {case SIGNAL_TYPE_DISPLAY_PORT_MST :
Signature · 1 line
2.34.1
PATCH 32/32 SWDEV-1 - dc: 3.2.287
In reply to Zaeem MohamedFrom: Aric Cyr <[email protected]>
This version brings the following changes:
- Add sequential ONO sequencing for DCN35
- Add new GPINT command definitions
- reduce ODM slice count to initial new dc state only when needed
- Enable copying of bounding box data from VBIOS DMUB
- Guard reading 3DLUT registers for dcn32/dcn35
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -55,7 +55,7 @@ struct aux_payload;struct set_config_cmd_payload ;struct dmub_notification ; -#define DC_VER "3.2.286" +#define DC_VER "3.2.287"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 1 line
2.34.1
[Public]
Hi all,
This week this patchset was tested on the following systems:
• Lenovo ThinkBook T13s Gen4 with AMD Ryzen 5 6600U
• MSI Gaming X Trio RX 6800
• Gigabyte Gaming OC RX 7900 XTX
These systems were tested on the following display/connection types:
• eDP, (1080p 60hz [5650U]) (1920x1200 60hz [6600U]) (2560x1600 120hz[6600U])
• VGA and DVI (1680x1050 60hz [DP to VGA/DVI, USB-C to VGA/DVI])
• DP/HDMI/USB-C (1440p 170hz, 4k 60hz, 4k 144hz, 4k 240hz [Includes USB-C to DP/HDMI adapters])
• Thunderbolt (LG Ultrafine 5k)
• MST (Startech MST14DP123DP [DP to 3x DP] and 2x 4k 60Hz displays)
• DSC (with Cable Matters 101075 [DP to 3x DP] with 3x 4k60 displays, and HP Hook G2 with 1 4k60 display)
• USB 4 (Kensington SD5700T and 1x 4k 60Hz display)
• PCON (Club3D CAC-1085 and 1x 4k 144Hz display [at 4k 120HZ, as that is the max the adapter supports])
The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to):
• Changing display configurations and settings
• Benchmark testing
• Feature testing (Freesync, etc.)
Automated testing includes (but is not limited to):
• Script testing (scripts to automate some of the manual checks)
• IGT testing
The patchset consists of the amd-staging-drm-next branch (Head commit - 16e25cc8375f59ff2a16a762d102e398ecba3d0d -> drm/amdgpu: Add lock around VF RLCG interface) with new patches added on top of it.
Tested on Ubuntu 22.04.3, on Wayland and X11, using KDE Plasma and Gnome.
Thank you,
Dan Wheeler
Sr. Technologist | AMD
SW Display
------------------------------------------------------------------------------------------------------------------
1 Commerce Valley Dr E, Thornhill, ON L3T 7X6
amd.com
-----Original Message-----
From: Mohamed, Zaeem <[email protected]>
Sent: Friday, May 31, 2024 12:51 PM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Siqueira, Rodrigo <[email protected]>; Pillai, Aurabindo <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Gutierrez, Agustin <[email protected]>; Chung, ChiaHsuan (Tom) <[email protected]>; Zuo, Jerry <[email protected]>; Mohamed, Zaeem <[email protected]>; Wheeler, Daniel <[email protected]>
Subject: [PATCH 00/32] DC Patches May 20, 2024
This DC patchset brings improvements in multiple areas. In summary, we have:
* DML2 fixes
* FAMS2 Improvements
* Fix YUV video color corruption, oled eDP not lighting up DCN401
* add UCLK p-state support message for DCN401
* Extends PSRSU residency mode
* Introducing deferred replay coasting vtotal update
* Fix DSC slice and delay calculations
Alex Hung (1):
drm/amd/display: Increase MAX_LINKS by 2
Alvin Lee (4):
drm/amd/display: Only program P-State force if pipe config changed drm/amd/display: Move fpo_in_use to stream_status drm/amd/display: Use current_state when checking old_pipe subvp type drm/amd/display: Program DIG FE source select for DVI before PHY en
Aric Cyr (1):
SWDEV-1 - dc: 3.2.287
Chiawen Huang (1):
drm/amd/display: add set ips disable
Chris Park (1):
drm/amd/display: Support new VA page table block size
Chun-LiangChang (1):
drm/amd/display: Add params of set_abm_event for VB Scaling
ChunTao Tso (1):
drm/amd/display: Introduce deferred Replay coasting vtotal update
Daniel Sa (1):
drm/amd/display: Fetch Mall caps from DC
Dillon Varone (5):
drm/amd/display: Wait for hardmins to complete on dcn401 drm/amd/display: Add UCLK p-state support message to dcn401 drm/amd/display: Force max clocks unconditionally when p-state is
unsupported
drm/amd/display: Add recovery timeout to FAMS2 drm/amd/display: Various DML2 fixes for FAMS2
Fangzhi Zuo (1):
drm/amd/display: Prevent IPX From Link Detect and Set Mode
Jack Chang (1):
drm/amd/display: Extend PSRSU residency mode
Joan Lee (1):
drm/amd/display: Add retires when read DPCD
Joshua Aberback (2):
drm/amd/display: Fix swapped dimension calculations drm/amd/display: workaround for oled eDP not lighting up on DCN401
Lewis Huang (1):
drm/amd/display: Add monitor patch skip disable crtc during psr and
ips1
Nicholas Kazlauskas (2):
drm/amd/display: Add outbox notification support for HPD redetect drm/amd/display: Guard reading 3DLUT registers for dcn32/dcn35
Nicholas Susanto (1):
drm/amd/display: Fix DML2 logic to set clk state to min
Relja Vojvodic (1):
drm/amd/display: Updated optc401_set_drr to use dcn401 functions
Samson Tam (1):
drm/amd/display: fix YUV video color corruption in DCN401
Sung Joon Kim (1):
drm/amd/display: Fix DSC slice and delay calculations
Wayne Lin (1):
drm/amd/display: Change the order of setting DP_IS_USB_C flag
Wenjing Liu (1):
drm/amd/display: turn on symclk for dio virtual stream in dpms
sequence
Yihan Zhu (1):
drm/amd/display: bypass ODM before CRTC off
yi-lchen (1):
drm/amd/display: Keep VBios pixel rate div setting until next mode set
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++ .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- .../amd/display/dc/clk_mgr/dcn401/dalsmc.h | 3 +- .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 165 +++++++++++------- .../dc/clk_mgr/dcn401/dcn401_clk_mgr.h | 3 +- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c | 127 +++++++++++++- .../clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.h | 6 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 10 ++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 12 +- drivers/gpu/drm/amd/display/dc/dc.h | 6 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 16 +- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_types.h | 2 + .../amd/display/dc/dccg/dcn314/dcn314_dccg.c | 12 +- .../amd/display/dc/dccg/dcn32/dcn32_dccg.c | 12 +- .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 13 +- .../amd/display/dc/dccg/dcn401/dcn401_dccg.c | 5 +- .../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c | 18 ++ .../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h | 2 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 5 +- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 3 +- .../dc/dcn32/dcn32_dio_stream_encoder.c | 40 +---- .../display/dc/dcn35/dcn35_dio_link_encoder.c | 10 +- .../dc/dcn35/dcn35_dio_stream_encoder.c | 39 +---- .../dc/dcn401/dcn401_dio_stream_encoder.c | 3 +- .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c | 6 +- .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 15 +- .../amd/display/dc/dml2/display_mode_core.c | 45 +++-- .../dc/dml2/display_mode_core_structs.h | 1 + .../dc/dml2/dml21/dml21_translation_helper.c | 2 +- .../amd/display/dc/dml2/dml21/dml21_utils.c | 7 +- .../amd/display/dc/dml2/dml21/dml21_utils.h | 4 +- .../amd/display/dc/dml2/dml21/dml21_wrapper.c | 6 +- .../dml2/dml21/src/dml2_core/dml2_core_dcn4.c | 1 - .../src/dml2_core/dml2_core_dcn4_calcs.c | 29 --- .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 2 +- .../display/dc/dml2/dml2_translation_helper.c | 1 + .../drm/amd/display/dc/dml2/dml2_wrapper.c | 18 +- .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c | 29 +-- .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c | 16 +- .../display/dc/hubbub/dcn20/dcn20_hubbub.c | 27 ++- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 24 ++- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 23 +-- .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 21 +++ .../amd/display/dc/hwss/dcn314/dcn314_hwseq.h | 2 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 63 ++++++- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 2 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 3 + .../gpu/drm/amd/display/dc/inc/core_types.h | 6 + drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 5 + .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 9 +- .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 2 +- .../amd/display/dc/inc/hw/stream_encoder.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/link.h | 2 +- .../amd/display/dc/link/hwss/link_hwss_dio.c | 7 +- .../gpu/drm/amd/display/dc/link/link_dpms.c | 33 ++-- .../dc/link/protocols/link_dp_capability.c | 3 + .../dc/link/protocols/link_dp_irq_handler.c | 26 ++- .../link/protocols/link_edp_panel_control.c | 7 +- .../link/protocols/link_edp_panel_control.h | 2 +- .../amd/display/dc/optc/dcn10/dcn10_optc.c | 4 +- .../amd/display/dc/optc/dcn31/dcn31_optc.c | 11 ++ .../amd/display/dc/optc/dcn401/dcn401_optc.c | 2 +- .../dc/resource/dcn30/dcn30_resource.c | 8 +- .../dc/resource/dcn32/dcn32_resource.c | 4 + .../dc/resource/dcn401/dcn401_resource.c | 1 + drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 95 +++++++++- .../drm/amd/display/dmub/src/dmub_srv_stat.c | 6 + .../amd/display/modules/power/power_helpers.c | 14 ++ .../amd/display/modules/power/power_helpers.h | 5 + 75 files changed, 810 insertions(+), 323 deletions(-)
--
2.34.1