DC Patches Dec 11, 2018
cover DC Patches Dec 11, 2018
From: Leo Li <[email protected]>
Lots of patches this time around, my appologies :) I've been falling behind on preparing these, so doing some catch-up here.
Summary of change:
* Fix display corruption on some systems running Polaris
* Remove/demote some error messages to warnings
* Architectural refactors and cleanups on the DC stream object
Dale Zhao (1):
drm/amd/display: Wait edp HPD to high in detect_sink
David Francis (4):
drm/amd/display: Detach backlight from stream drm/amd/display: Warn instead of error on REG_WAIT timeout drm/amd/display: Add backlight pwm debugfs drm/amd/display: Remove unused parameter plane_states
Dmytro Laktyushkin (5):
drm/amd/display: fix surface update sequence drm/amd/display: Remove some extra braces drm/amd/display: update DCN dml calcs drm/amd/display: add dsclk to pipe bw struct drm/amd/display: move AYCrCb8888 format to video section
Eric Bernstein (3):
drm/amd/display: Expose hubp1_vready_workaround function drm/amd/display: Fix runtime errors for diagnostic tests drm/amd/display: Improve logging of validation failures during
atomic_check
Eric Yang (3):
drm/amd/display: update bw formula to v252 drm/amd/display: fix YCbCr420 blank color drm/amd/display: Don't skip link training for empty dongle
Fatemeh Darbehani (2):
drm/amd/display: Add pixel clock values to dtn logs drm/amd/display: Start using the new pp_smu interface
Harry Wentland (1):
drm/amd/display: Don't log error if we have no connectors
Hugo Hu (1):
drm/amd/display: Add debug option to force fclk request
Imad Syed (1):
drm/amd/display: Remove unused headers
Jun Lei (3):
drm/amd/display: Add a PP_SMU_VER_MAX enum drm/amd/display: remove sink reference in dc_stream_state drm/amd/display: add stream ID and otg instance in dc_stream_state
Ken Chalmers (2):
drm/amd/display: Use 100 Hz precision for pipe pixel clocks drm/amd/display: Expand set_pixel_clock debug log message
Krunoslav Kovac (1):
drm/amd/display: Fix issue with VLine interrupt not firing
Leo Li (6):
drm/amd/display: Remove stream_status->link drm/amd/display: Fix driver load crash in amdgpu_dm drm/amd/display: Add DCE_VERSION_12_1 enum for Vega 20 drm/amd/display: Add functionality to get XGMI SS info drm/amd/display: Use local variable instead of caching global drm/amd/display: Compensate for XGMI SS downspread on dprefclk
Lewis Huang (1):
drm/amd/display: add plane size change check condition
Paul Hsieh (1):
drm/amd/display: Add retry to read ddc_clock pin
Roman Li (1):
drm/amd/display: Raise dispclk value for Polaris
SivapiriyanKumarasamy (2):
drm/amd/display: Minor code cleanup drm/amd/display: Fix bug with not updating VSP infoframe
Steven Chiu (3):
drm/amd/display: 3.2.09
drm/amd/display: 3.2.10
drm/amd/display: 3.2.11
Wenjing Liu (3):
drm/amd/display: implement dc_init_callbacks to assign callback
pointers after dc_create
drm/amd/display: verify lane status before exiting verify link cap drm/amd/display: validate extended dongle caps
Yongqiang Sun (1):
drm/amd/display: Optimize passive update planes.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 45 ++-- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 49 +++- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 +- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 15 ++ .../gpu/drm/amd/display/dc/bios/command_table.c | 19 +- .../gpu/drm/amd/display/dc/bios/command_table2.c | 12 +- .../amd/display/dc/bios/command_table_helper2.c | 1 + drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 10 +- .../gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c | 43 +++- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 19 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 60 +++-- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 132 ++++++----- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 256 +++++++++++---------- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 16 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 32 +-- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 69 ++++-- drivers/gpu/drm/amd/display/dc/dc.h | 14 +- drivers/gpu/drm/amd/display/dc/dc_helper.c | 4 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 4 +- drivers/gpu/drm/amd/display/dc/dc_link.h | 4 +- drivers/gpu/drm/amd/display/dc/dc_stream.h | 35 ++- drivers/gpu/drm/amd/display/dc/dc_types.h | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 122 +++++++--- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.h | 35 ++- .../gpu/drm/amd/display/dc/dce/dce_clock_source.c | 196 ++++++++-------- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 12 + .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 8 +- .../drm/amd/display/dc/dce/dce_stream_encoder.c | 4 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 57 ++--- .../drm/amd/display/dc/dce110/dce110_resource.c | 12 +- .../drm/amd/display/dc/dce112/dce112_resource.c | 2 +- .../amd/display/dc/dce120/dce120_hw_sequencer.c | 15 ++ .../amd/display/dc/dce120/dce120_hw_sequencer.h | 1 + .../drm/amd/display/dc/dce120/dce120_resource.c | 81 ++++++- .../amd/display/dc/dce80/dce80_timing_generator.c | 8 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 107 +++------ .../gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c | 12 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 73 +++--- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h | 12 - drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 2 + .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 32 ++- .../display/dc/dcn10/dcn10_hw_sequencer_debug.c | 11 +- .../drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 20 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 48 ++-- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 10 +- .../amd/display/dc/dcn10/dcn10_stream_encoder.c | 2 +- drivers/gpu/drm/amd/display/dc/dm_pp_smu.h | 3 +- .../drm/amd/display/dc/dml/display_mode_enums.h | 26 +++ .../gpu/drm/amd/display/dc/dml/display_mode_lib.c | 28 +++ .../gpu/drm/amd/display/dc/dml/display_mode_lib.h | 2 + .../drm/amd/display/dc/dml/display_mode_structs.h | 107 +-------- .../amd/display/dc/dml/dml1_display_rq_dlg_calc.c | 4 +- drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c | 1 + drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c | 1 + drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c | 1 + drivers/gpu/drm/amd/display/dc/inc/clock_source.h | 8 +- drivers/gpu/drm/amd/display/dc/inc/core_status.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 7 +- drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 15 ++ drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 5 + drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 4 +- .../drm/amd/display/include/bios_parser_types.h | 5 +- drivers/gpu/drm/amd/display/include/dal_types.h | 1 + .../drm/amd/display/modules/color/color_gamma.c | 2 +- .../drm/amd/display/modules/freesync/freesync.c | 12 +- 66 files changed, 1132 insertions(+), 834 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1544569071-7114-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
PATCH 1/45 drm/amd/display: 3.2.09
From: Steven Chiu <[email protected]>
--- 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
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.08" +#define DC_VER "3.2.09"#define MAX_SURFACES 3#define MAX_STREAMS 6
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/45 drm/amd/display: Add a PP_SMU_VER_MAX enum
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dm_pp_smu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dm_pp_smu.h +2 -1
@@ -38,7 +38,8 @@ enum pp_smu_ver {* of interface sharing between families of ASIcs. */ PP_SMU_UNSUPPORTED , -PP_SMU_VER_RV +PP_SMU_VER_RV , +PP_SMU_VER_MAX }; struct pp_smu {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/45 drm/amd/display: Expose hubp1_vready_workaround function
In reply to a message not in the archiveFrom: Eric Bernstein <[email protected]>
Expose this function for future use.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +1 -1
@@ -115,7 +115,7 @@ static void hubp1_set_hubp_blank_en(struct hubp *hubp, bool blank)REG_UPDATE (DCHUBP_CNTL ,HUBP_BLANK_EN , blank_en); } -static void hubp1_vready_workaround (struct hubp *hubp, +void hubp1_vready_workaround (struct hubp *hubp,struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest) {uint32_t value =0 ;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +2 -0
@@ -745,5 +745,7 @@ void hubp1_clear_underflow(struct hubp *hubp);enum cursor_pitch hubp1_get_cursor_pitch (unsigned int pitch); +void hubp1_vready_workaround (struct hubp *hubp, +struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest);#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/45 drm/amd/display: Fix runtime errors for diagnostic tests
In reply to a message not in the archiveFrom: Eric Bernstein <[email protected]>
1) Rename and make public definition of input CSC matrix struct.
2) Make wm_read_state() function an interface of hubbub, and check if watermark registers exist before read/write to them.
3) Check if OTG_INTERLACE_CONTROL register exists before updating
4) Add dummy functions for set_input/output_transfer function to avoid errors due to differences in CM registers.
5) Added missing register field definition in header file
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c | 12 ++-- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 73 ++++++++++++---------- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h | 12 ---- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- .../display/dc/dcn10/dcn10_hw_sequencer_debug.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 21 ++++--- drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 15 +++++ drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 5 ++ 8 files changed, 78 insertions(+), 64 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c +4 -8
@@ -51,10 +51,6 @@#define NUM_ELEMENTS (a) (sizeof(a) / sizeof((a)[0])) -struct dcn10_input_csc_matrix { -enum dc_color_space color_space; -uint16_t regval[12 ]; -};enum dcn10_coef_filter_type_sel {SCL_COEF_LUMA_VERT_FILTER =0 ,
@@ -99,7 +95,7 @@ enum gamut_remap_select {GAMUT_REMAP_COMB_COEFF }; -static const struct dcn10_input_csc_matrix dcn10_input_csc_matrix[] = { +static const struct dpp_input_csc_matrix dpp_input_csc_matrix[] = { {COLOR_SPACE_SRGB , {0x2000 ,0 ,0 ,0 ,0 ,0x2000 ,0 ,0 ,0 ,0 ,0x2000 ,0 } }, {COLOR_SPACE_SRGB_LIMITED ,
@@ -454,7 +450,7 @@ void dpp1_program_input_csc( {struct dcn10_dpp *dpp =TO_DCN10_DPP (dpp_base);int i; -int arr_size =sizeof (dcn10_input_csc_matrix)/sizeof (struct dcn10_input_csc_matrix ); +int arr_size =sizeof (dpp_input_csc_matrix)/sizeof (struct dpp_input_csc_matrix );const uint16_t *regval =NULL ;uint32_t cur_select =0 ;enum dcn10_input_csc_select select;
@@ -467,8 +463,8 @@ void dpp1_program_input_csc(if (tbl_entry ==NULL ) {for (i =0 ; i < arr_size; i++) -if (dcn10_input_csc_matrix[i].color_space == color_space) { - regval = dcn10_input_csc_matrix[i].regval; +if (dpp_input_csc_matrix[i].color_space == color_space) { + regval = dpp_input_csc_matrix[i].regval;break ; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +41 -32
103 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h +0 -12
@@ -165,18 +165,6 @@ struct dcn_hubbub_mask {struct dc ; -struct dcn_hubbub_wm_set { -uint32_t wm_set; -uint32_t data_urgent; -uint32_t pte_meta_urgent; -uint32_t sr_enter; -uint32_t sr_exit; -uint32_t dram_clk_chanage; -}; - -struct dcn_hubbub_wm { -struct dcn_hubbub_wm_set sets[4 ]; -};struct hubbub {const struct hubbub_funcs *funcs;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -95,7 +95,7 @@ void dcn10_log_hubbub_state(struct dc *dc, struct dc_log_buffer_ctx *log_ctx)struct dcn_hubbub_wm wm = {0 };int i; -hubbub1_wm_read_state (dc->res_pool->hubbub, &wm); + dc->res_pool->hubbub->funcs->wm_read_state (dc->res_pool->hubbub, &wm);DTN_INFO ("HUBBUB WM: data_urgent pte_meta_urgent" " sr_enter sr_exit dram_clk_change\n" );
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c +1 -1
@@ -81,7 +81,7 @@ static unsigned int dcn10_get_hubbub_state(struct dc *dc, char *pBuf, unsigned iconst uint32_t ref_clk_mhz = dc_ctx->dc->res_pool->ref_clock_inKhz /1000 ;static const unsigned int frac =1000 ; -hubbub1_wm_read_state (dc->res_pool->hubbub, &wm); + dc->res_pool->hubbub->funcs->wm_read_state (dc->res_pool->hubbub, &wm); chars_printed =snprintf_count (pBuf, remaining_buffer,"wm_set_index,data_urgent,pte_meta_urgent,sr_enter,sr_exit,dram_clk_chanage\n" ); remaining_buffer -= chars_printed;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +11 -10
@@ -299,16 +299,17 @@ void optc1_program_timing( }/* Interlace */ -if (patched_crtc_timing.flags.INTERLACE ==1 ) { -REG_UPDATE (OTG_INTERLACE_CONTROL , -OTG_INTERLACE_ENABLE ,1 ); - v_init = v_init /2 ; -if ((optc->dlg_otg_param.vstartup_start/2 )*2 > asic_blank_end) - v_fp2 = v_fp2 /2 ; - }else -REG_UPDATE (OTG_INTERLACE_CONTROL , -OTG_INTERLACE_ENABLE ,0 ); - +if (REG (OTG_INTERLACE_CONTROL )) { +if (patched_crtc_timing.flags.INTERLACE ==1 ) { +REG_UPDATE (OTG_INTERLACE_CONTROL , +OTG_INTERLACE_ENABLE ,1 ); + v_init = v_init /2 ; +if ((optc->dlg_otg_param.vstartup_start/2 )*2 > asic_blank_end) + v_fp2 = v_fp2 /2 ; + }else +REG_UPDATE (OTG_INTERLACE_CONTROL , +OTG_INTERLACE_ENABLE ,0 ); + }/* VTG enable set to 0 first VInit */ REG_UPDATE(CONTROL,
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +15 -0
@@ -39,6 +39,18 @@ enum segment_order { segment_order__non_contiguous, }; +struct dcn_hubbub_wm_set { +uint32_t wm_set; +uint32_t data_urgent; +uint32_t pte_meta_urgent; +uint32_t sr_enter; +uint32_t sr_exit; +uint32_t dram_clk_chanage; +}; + +struct dcn_hubbub_wm { +struct dcn_hubbub_wm_set sets[4 ]; +};struct hubbub_funcs { void (*update_dchub)(
@@ -58,6 +70,9 @@ struct hubbub_funcs {bool (*dcc_support_pixel_format)(enum surface_pixel_format format,unsigned int *bytes_per_element); + +void (*wm_read_state)(struct hubbub *hubbub, +struct dcn_hubbub_wm *wm); };
drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h +5 -0
@@ -39,6 +39,11 @@ struct dpp { }; +struct dpp_input_csc_matrix { +enum dc_color_space color_space; +uint16_t regval[12 ]; +}; +struct dpp_grph_csc_adjustment {struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE ];enum graphics_gamut_adjust_type gamut_adjust_type;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/45 drm/amd/display: fix surface update sequence
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
An earlier change added update of interdependent dlg/ttu params for pipes not being updated in the current call. The code fails to check if the other pipes are actually active yet causing an assert.
This change adds a check for surface presence on the pipes before updating the interdepenednt params.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +4 -2
@@ -2348,7 +2348,8 @@ static void dcn10_apply_ctx_for_surface(struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];/* Skip inactive pipes and ones already updated */ -if (!pipe_ctx->stream || pipe_ctx->stream == stream) +if (!pipe_ctx->stream || pipe_ctx->stream == stream + || !pipe_ctx->plane_state)continue ; pipe_ctx->stream_res.tg->funcs->lock (pipe_ctx->stream_res.tg);
@@ -2362,7 +2363,8 @@ static void dcn10_apply_ctx_for_surface(for (i =0 ; i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; -if (!pipe_ctx->stream || pipe_ctx->stream == stream) +if (!pipe_ctx->stream || pipe_ctx->stream == stream + || !pipe_ctx->plane_state)continue ;dcn10_pipe_control_lock (dc, pipe_ctx, false);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/45 drm/amd/display: Add pixel clock values to dtn logs
In reply to a message not in the archiveFrom: Fatemeh Darbehani <[email protected]>
[Why]
To make sure future changes in DAL for SMU msgs will not change the current behaviour and to make sure clock registeres are programmed correctly based on SMU msgs that DAL sends.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c +6 -3
@@ -419,20 +419,22 @@ static unsigned int dcn10_get_otg_states(struct dc *dc, char *pBuf, unsigned intunsigned int remaining_buffer = bufSize; chars_printed =snprintf_count (pBuf, remaining_buffer,"instance,v_bs,v_be,v_ss,v_se,vpol,vmax,vmin,vmax_sel,vmin_sel," -"h_bs,h_be,h_ss,h_se,hpol,htot,vtot,underflow\n" ); +"h_bs,h_be,h_ss,h_se,hpol,htot,vtot,underflow,pixelclk[khz]\n" ); remaining_buffer -= chars_printed; pBuf += chars_printed;for (i =0 ; i < pool->timing_generator_count; i++) {struct timing_generator *tg = pool->timing_generators[i];struct dcn_otg_state s = {0 }; +int pix_clk =0 ;optc1_read_otg_state (DCN10TG_FROM_TG (tg), &s); + pix_clk = dc->current_state->res_ctx.pipe_ctx[i].stream_res.pix_clk_params.requested_pix_clk;//only print if OTG master is enabled if (s.otg_enabled &1 ) { chars_printed = snprintf_count(pBuf, remaining_buffer, "%x,%d,%d,%d,%d,%d,%d,%d,%d,%d," - "%d,%d,%d,%d,%d,%d,%d,%d" + "%d,%d,%d,%d,%d,%d,%d,%d,%d" "\n", tg->inst, s.v_blank_start,
@@ -451,7 +453,8 @@ static unsigned int dcn10_get_otg_states(struct dc *dc, char *pBuf, unsigned int s.h_sync_a_pol, s.h_total, s.v_total, - s.underflow_occurred_status); + s.underflow_occurred_status, + pix_clk); remaining_buffer -= chars_printed; pBuf += chars_printed;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/45 drm/amd/display: Remove some extra braces
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Remove braces around single-line conditionals
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -4
@@ -2243,13 +2243,11 @@ static void program_all_pipe_in_tree( } -if (pipe_ctx->plane_state !=NULL ) { +if (pipe_ctx->plane_state !=NULL )dcn10_program_pipe (dc, pipe_ctx, context); - } -if (pipe_ctx->bottom_pipe !=NULL && pipe_ctx->bottom_pipe != pipe_ctx) { +if (pipe_ctx->bottom_pipe !=NULL && pipe_ctx->bottom_pipe != pipe_ctx)program_all_pipe_in_tree (dc, pipe_ctx->bottom_pipe, context); - } } struct pipe_ctx *find_top_pipe_for_stream(
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/45 drm/amd/display: implement dc_init_callbacks to assign callback pointers after dc_create
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
[why]
Some components depend on dc to constuct
but need to assign callback functions to dc.
[how]
Instead of assigning dc callback functions in dc_create, decouple the callback init to a standlone function after dc_create. This is currently a no-op.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 +++++ drivers/gpu/drm/amd/display/dc/dc.h | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -0
@@ -844,6 +844,11 @@ struct dc *dc_create(const struct dc_init_data *init_params)return NULL ; } +void dc_init_callbacks (struct dc *dc, +const struct dc_callback_init *init_params) +{ +} +void dc_destroy (struct dc **dc) {destruct (*dc);
drivers/gpu/drm/amd/display/dc/dc.h +6 -1
@@ -339,8 +339,13 @@ struct dc_init_data {uint32_t log_mask; }; -struct dc *dc_create (const struct dc_init_data *init_params); +struct dc_callback_init { +uint8_t reserved; +}; +struct dc *dc_create (const struct dc_init_data *init_params); +void dc_init_callbacks (struct dc *dc, +const struct dc_callback_init *init_params);void dc_destroy (struct dc **dc);/*******************************************************************************
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/45 drm/amd/display: add plane size change check condition
In reply to a message not in the archiveFrom: Lewis Huang <[email protected]>
[Why]
Driver didn't check plane size and surface size is mismatch. It will cause pitch data incorrect.
[How]
Add condition to check is plane change and update surface
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++++++ drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +6 -0
@@ -1224,6 +1224,12 @@ static enum surface_update_type get_plane_info_update_type(const struct dc_surfa*/ update_flags->bits.bpp_change =1 ; +if (u->plane_info->plane_size.grph.surface_pitch != u->surface->plane_size.grph.surface_pitch + || u->plane_info->plane_size.video.luma_pitch != u->surface->plane_size.video.luma_pitch + || u->plane_info->plane_size.video.chroma_pitch != u->surface->plane_size.video.chroma_pitch) + update_flags->bits.plane_size_change =1 ; + +if (memcmp (&u->plane_info->tiling_info, &u->surface->tiling_info,sizeof (union dc_tiling_info )) !=0 ) { update_flags->bits.swizzle_change =1 ;
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -445,6 +445,7 @@ union surface_update_flags { uint32_t coeff_reduction_change:1; uint32_t output_tf_change:1; uint32_t pixel_format_change:1; + uint32_t plane_size_change:1;/* Full updates */ uint32_t new_plane:1;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -1
@@ -2125,7 +2125,8 @@ void update_dchubp_dpp( plane_state->update_flags.bits.swizzle_change || plane_state->update_flags.bits.dcc_change || plane_state->update_flags.bits.bpp_change || - plane_state->update_flags.bits.scaling_change) { + plane_state->update_flags.bits.scaling_change || + plane_state->update_flags.bits.plane_size_change) { hubp->funcs->hubp_program_surface_config( hubp, plane_state->format,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/45 drm/amd/display: Fix issue with VLine interrupt not firing
In reply to a message not in the archiveFrom: Krunoslav Kovac <[email protected]>
[Why]
We are not correctly handling the wrap around case. VLine interrupt is relative to position of VUpdate interrupt.
Both VUpdate interrupt and VLine interrupt could possibly be in front porch or back porch.
[How]
Fix wraparound case by checking for line number that is greater than the VTOTAL of the OTG timing. In this case, the interrupt should occur on the next frame.
Also fix some variable naming and remove some dead code.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 25 ++++++++--------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +9 -16
@@ -102,14 +102,6 @@ static uint32_t get_start_vline(struct timing_generator *optc, const struct dc_c patched_crtc_timing = *dc_crtc_timing;optc1_apply_front_porch_workaround (optc, &patched_crtc_timing); - vesa_sync_start = patched_crtc_timing.h_addressable + - patched_crtc_timing.h_border_right + - patched_crtc_timing.h_front_porch; - - asic_blank_end = patched_crtc_timing.h_total - - vesa_sync_start - - patched_crtc_timing.h_border_left; - vesa_sync_start = patched_crtc_timing.v_addressable + patched_crtc_timing.v_border_bottom + patched_crtc_timing.v_front_porch;
@@ -119,10 +111,8 @@ static uint32_t get_start_vline(struct timing_generator *optc, const struct dc_c patched_crtc_timing.v_border_top); vertical_line_start = asic_blank_end - optc->dlg_otg_param.vstartup_start +1 ; -if (vertical_line_start <0 ) { -ASSERT (0 ); +if (vertical_line_start <0 ) vertical_line_start =0 ; - }return vertical_line_start; }
@@ -143,7 +133,7 @@ void optc1_program_vline_interrupt(uint32_t vsync_line =get_start_vline (optc, dc_crtc_timing);uint32_t start_line =0 ; -uint32_t endLine =0 ; +uint32_t end_line =0 ;if (req_delta_lines !=0 ) req_delta_lines--;
@@ -153,14 +143,17 @@ void optc1_program_vline_interrupt(else start_line = vsync_line - req_delta_lines; - endLine = start_line +2 ; + end_line = start_line +2 ; + +if (start_line >= dc_crtc_timing->v_total) + start_line = start_line % dc_crtc_timing->v_total; -if (endLine >= dc_crtc_timing->v_total) - endLine =2 ; +if (end_line >= dc_crtc_timing->v_total) + end_line = end_line % dc_crtc_timing->v_total;REG_SET_2 (OTG_VERTICAL_INTERRUPT0_POSITION ,0 ,OTG_VERTICAL_INTERRUPT0_LINE_START , start_line, -OTG_VERTICAL_INTERRUPT0_LINE_END , endLine); +OTG_VERTICAL_INTERRUPT0_LINE_END , end_line); }/**
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/45 drm/amd/display: update bw formula to v252
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
[why]
There was a recent fix in the BW spreadsheet to allow timing with very large vblank. Need to be ported into driver.
--- .../gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c | 43 +++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c +34 -9
@@ -797,9 +797,40 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)else { v->maximum_vstartup = v->v_sync_plus_back_porch[k] -1.0 ; } - v->line_times_for_prefetch[k] = v->maximum_vstartup - v->urgent_latency / (v->htotal[k] / v->pixel_clock[k]) - (v->time_calc + v->time_setup) / (v->htotal[k] / v->pixel_clock[k]) - (v->dst_y_after_scaler + v->dst_x_after_scaler / v->htotal[k]); - v->line_times_for_prefetch[k] =dcn_bw_floor2 (4.0 * (v->line_times_for_prefetch[k] +0.125 ),1.0 ) /4 ; - v->prefetch_bw[k] = (v->meta_pte_bytes_per_frame[k] +2.0 * v->meta_row_bytes[k] +2.0 * v->dpte_bytes_per_row[k] + v->prefetch_lines_y[k] * v->swath_width_yper_state[i][j][k] *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) + v->prefetch_lines_c[k] * v->swath_width_yper_state[i][j][k] /2.0 *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 )) / (v->line_times_for_prefetch[k] * v->htotal[k] / v->pixel_clock[k]); + +do { + v->line_times_for_prefetch[k] = v->maximum_vstartup - v->urgent_latency / (v->htotal[k] / v->pixel_clock[k]) - (v->time_calc + v->time_setup) / (v->htotal[k] / v->pixel_clock[k]) - (v->dst_y_after_scaler + v->dst_x_after_scaler / v->htotal[k]); + v->line_times_for_prefetch[k] =dcn_bw_floor2 (4.0 * (v->line_times_for_prefetch[k] +0.125 ),1.0 ) /4 ; + v->prefetch_bw[k] = (v->meta_pte_bytes_per_frame[k] +2.0 * v->meta_row_bytes[k] +2.0 * v->dpte_bytes_per_row[k] + v->prefetch_lines_y[k] * v->swath_width_yper_state[i][j][k] *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) + v->prefetch_lines_c[k] * v->swath_width_yper_state[i][j][k] /2.0 *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 )) / (v->line_times_for_prefetch[k] * v->htotal[k] / v->pixel_clock[k]); + +if (v->pte_enable == dcn_bw_yes && v->dcc_enable[k] == dcn_bw_yes) { + v->time_for_meta_pte_without_immediate_flip =dcn_bw_max3 ( + v->meta_pte_bytes_frame[k] / v->prefetch_bandwidth[k], + v->extra_latency, + v->htotal[k] / v->pixel_clock[k] /4.0 ); + }else { + v->time_for_meta_pte_without_immediate_flip = v->htotal[k] / v->pixel_clock[k] /4.0 ; + } + +if (v->pte_enable == dcn_bw_yes || v->dcc_enable[k] == dcn_bw_yes) { + v->time_for_meta_and_dpte_row_without_immediate_flip =dcn_bw_max3 (( + v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) / v->prefetch_bandwidth[k], + v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_without_immediate_flip, + v->extra_latency); + }else { + v->time_for_meta_and_dpte_row_without_immediate_flip =dcn_bw_max2 ( + v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_without_immediate_flip, + v->extra_latency - v->time_for_meta_pte_with_immediate_flip); + } + + v->lines_for_meta_pte_without_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_pte_without_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; + v->lines_for_meta_and_dpte_row_without_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_and_dpte_row_without_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; + v->maximum_vstartup = v->maximum_vstartup -1 ; + +if (v->lines_for_meta_pte_without_immediate_flip[k] <8.0 && v->lines_for_meta_and_dpte_row_without_immediate_flip[k] <16.0 ) +break ; + + }while (1 ); } v->bw_available_for_immediate_flip = v->return_bw_per_state[i];for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {
@@ -814,24 +845,18 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->pte_enable == dcn_bw_yes && v->dcc_enable[k] == dcn_bw_yes) { v->time_for_meta_pte_with_immediate_flip =dcn_bw_max5 (v->meta_pte_bytes_per_frame[k] / v->prefetch_bw[k], v->meta_pte_bytes_per_frame[k] * v->total_immediate_flip_bytes[k] / (v->bw_available_for_immediate_flip * (v->meta_pte_bytes_per_frame[k] + v->meta_row_bytes[k] + v->dpte_bytes_per_row[k])), v->extra_latency, v->urgent_latency, v->htotal[k] / v->pixel_clock[k] /4.0 ); - v->time_for_meta_pte_without_immediate_flip =dcn_bw_max3 (v->meta_pte_bytes_per_frame[k] / v->prefetch_bw[k], v->extra_latency, v->htotal[k] / v->pixel_clock[k] /4.0 ); }else { v->time_for_meta_pte_with_immediate_flip = v->htotal[k] / v->pixel_clock[k] /4.0 ; - v->time_for_meta_pte_without_immediate_flip = v->htotal[k] / v->pixel_clock[k] /4.0 ; }if (v->pte_enable == dcn_bw_yes || v->dcc_enable[k] == dcn_bw_yes) { v->time_for_meta_and_dpte_row_with_immediate_flip =dcn_bw_max5 ((v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) / v->prefetch_bw[k], (v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) * v->total_immediate_flip_bytes[k] / (v->bw_available_for_immediate_flip * (v->meta_pte_bytes_per_frame[k] + v->meta_row_bytes[k] + v->dpte_bytes_per_row[k])), v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_with_immediate_flip, v->extra_latency,2.0 * v->urgent_latency); - v->time_for_meta_and_dpte_row_without_immediate_flip =dcn_bw_max3 ((v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) / v->prefetch_bw[k], v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_without_immediate_flip, v->extra_latency); }else { v->time_for_meta_and_dpte_row_with_immediate_flip =dcn_bw_max2 (v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_with_immediate_flip, v->extra_latency - v->time_for_meta_pte_with_immediate_flip); - v->time_for_meta_and_dpte_row_without_immediate_flip =dcn_bw_max2 (v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_without_immediate_flip, v->extra_latency - v->time_for_meta_pte_without_immediate_flip); } v->lines_for_meta_pte_with_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_pte_with_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; - v->lines_for_meta_pte_without_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_pte_without_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; v->lines_for_meta_and_dpte_row_with_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_and_dpte_row_with_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; - v->lines_for_meta_and_dpte_row_without_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_and_dpte_row_without_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; v->line_times_to_request_prefetch_pixel_data_with_immediate_flip = v->line_times_for_prefetch[k] - v->lines_for_meta_pte_with_immediate_flip[k] - v->lines_for_meta_and_dpte_row_with_immediate_flip[k]; v->line_times_to_request_prefetch_pixel_data_without_immediate_flip = v->line_times_for_prefetch[k] - v->lines_for_meta_pte_without_immediate_flip[k] - v->lines_for_meta_and_dpte_row_without_immediate_flip[k];if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip >0.0 ) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/45 drm/amd/display: Add debug option to force fclk request
In reply to a message not in the archiveFrom: Hugo Hu <[email protected]>
[Why]
So that we can adjust fclk for debugging purposes.
[How]
Add option to force adjust fclk request to pplib.
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -255,6 +255,7 @@ struct dc_debug_options {bool scl_reset_length10;bool hdmi20_disable;bool skip_detection_link_training; +unsigned int force_fclk_khz; };struct dc_debug_data {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c +4 -0
@@ -218,6 +218,7 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, bool safe_to_lower) {struct dc *dc = clk_mgr->ctx->dc; +struct dc_debug_options *debug = &dc->debug;struct dc_clocks *new_clocks = &context->bw.dcn.clk;struct pp_smu_display_requirement_rv *smu_req_cur = &dc->res_pool->pp_smu_req;
@@ -261,6 +262,9 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, }// F Clock +if (debug->force_fclk_khz !=0 ) + new_clocks->fclk_khz = debug->force_fclk_khz; +if (should_set_clock (safe_to_lower, new_clocks->fclk_khz, clk_mgr->clks.fclk_khz)) { clk_mgr->clks.fclk_khz = new_clocks->fclk_khz; smu_req.hard_min_fclk_mhz = new_clocks->fclk_khz /1000 ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/45 drm/amd/display: remove sink reference in dc_stream_state
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]dc_stream_state containing a pointer to sink is poor design. Sink describes the display, and the specifications or capabilities it has. That information is irrelevant for dc_stream_state, which describes hardware state, and is generally used for hardware programming. It could further be argued that dc_sink itself is just a convenience dc provides, and DC should be perfectly capable of programming hardware without any dc_sinks (for example, emulated sinks).
[how]
Phase 1:
Deprecate use of dc_sink pointer in dc_stream. Most references are trivial to remove, but some call sites are risky (such as is_timing_changed) with no obvious logical replacement. These will be removed in follow up change.
Add dc_link pointer to dc_stream. This is the typical reason DC really needed sink pointer, and most call sites are replaced with this.
DMs also need minor updates, as all 3 DMs leverage stream->sink for some functionality. this is replaced instead by a pointer to private data inside dc_stream_state, which is used by DMs as a quality of life improvment for some key functionality. it allows DMs to set pointers have to their own objects which associate OS objects to dc_stream_states (such as DisplayTarget and amdgpu_dm_connector). Without the private pointer, DMs would be forced to perform a lookup for callbacks.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++-- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 6 +-- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 11 ++--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 54 +++++++++++----------- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 6 +-- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 9 ++-- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 14 +++--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 30 ++++++------ drivers/gpu/drm/amd/display/dc/dc_link.h | 1 + drivers/gpu/drm/amd/display/dc/dc_stream.h | 13 +++++- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 10 ++-- .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 2 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 26 ++++------- .../drm/amd/display/dc/dce110/dce110_resource.c | 2 +- .../drm/amd/display/dc/dce112/dce112_resource.c | 2 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- .../drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 2 +- 19 files changed, 103 insertions(+), 101 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -4
@@ -2640,10 +2640,10 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream, timing_out->v_border_bottom =0 ;/* TODO: un-hardcode */ if (drm_mode_is_420_only (info, mode_in) - && stream->sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) + && stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A ) timing_out->pixel_encoding =PIXEL_ENCODING_YCBCR420 ;else if ((connector->display_info.color_formats &DRM_COLOR_FORMAT_YCRCB444 ) - && stream->sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) + && stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A ) timing_out->pixel_encoding =PIXEL_ENCODING_YCBCR444 ;else timing_out->pixel_encoding =PIXEL_ENCODING_RGB ;
@@ -2685,7 +2685,7 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream, stream->out_transfer_func->type =TF_TYPE_PREDEFINED ; stream->out_transfer_func->tf =TRANSFER_FUNCTION_SRGB ; -if (stream->sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) +if (stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A )adjust_colour_depth_from_display_info (timing_out, info); }
@@ -2879,6 +2879,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, goto finish; } + stream->dm_stream_context = aconnector; +list_for_each_entry (preferred_mode, &aconnector->base.modes, head) {/* Search for preferred mode */ if (preferred_mode->type &DRM_MODE_TYPE_PREFERRED ) {
@@ -2930,7 +2932,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, drm_connector, sink); -update_stream_signal (stream); +update_stream_signal (stream, sink);if (dm_state && dm_state->freesync_capable) stream->ignore_msa_timing_param = true;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +3 -3
@@ -192,7 +192,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(int bpp =0 ;int pbn =0 ; - aconnector = stream->sink->priv; + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;if (!aconnector || !aconnector->mst_port)return false;
@@ -284,7 +284,7 @@ bool dm_helpers_dp_mst_poll_for_allocation_change_trigger(struct drm_dp_mst_topology_mgr *mst_mgr;int ret; - aconnector = stream->sink->priv; + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;if (!aconnector || !aconnector->mst_port)return false;
@@ -312,7 +312,7 @@ bool dm_helpers_dp_mst_send_payload_allocation(struct drm_dp_mst_port *mst_port;int ret; - aconnector = stream->sink->priv; + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;if (!aconnector || !aconnector->mst_port)return false;
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +1 -1
@@ -961,7 +961,7 @@ bool dcn_validate_bandwidth( v->dcc_rate[input_idx] =1 ;/*TODO: Worst case? does this change?*/ v->output_format[input_idx] = pipe->stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ? dcn_bw_420 : dcn_bw_444; - v->output[input_idx] = pipe->stream->sink->sink_signal == + v->output[input_idx] = pipe->stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A ? dcn_bw_hdmi : dcn_bw_dp; v->output_deep_color[input_idx] = dcn_bw_encoder_8bpc;if (v->output[input_idx] == dcn_bw_hdmi) {
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -6
@@ -388,7 +388,7 @@ void dc_stream_set_dither_option(struct dc_stream_state *stream, enum dc_dither_option option) {struct bit_depth_reduction_params params; -struct dc_link *link = stream->sink->link; +struct dc_link *link = stream->link;struct pipe_ctx *pipes =NULL ;int i;
@@ -530,9 +530,8 @@ void dc_link_set_preferred_link_settings(struct dc *dc,for (i =0 ; i <MAX_PIPES ; i++) { pipe = &dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe->stream && pipe->stream->sink - && pipe->stream->sink->link) { -if (pipe->stream->sink->link == link) +if (pipe->stream && pipe->stream->link) { +if (pipe->stream->link == link)break ; } }
@@ -1049,7 +1048,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c/* Program all planes within new context*/ for (i =0 ; i < context->stream_count; i++) { -const struct dc_sink *sink = context->streams[i]->sink; +const struct dc_link *link = context->streams[i]->link;if (!context->streams[i]->mode_changed)continue ;
@@ -1074,7 +1073,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c } } - CONN_MSG_MODE(sink->link, "{%dx%d, %dx%d@%dKhz}", + CONN_MSG_MODE(link, "{%dx%d, %dx%d@%dKhz}", context->streams[i]->timing.h_addressable, context->streams[i]->timing.v_addressable, context->streams[i]->timing.h_total,
drivers/gpu/drm/amd/display/dc/core/dc_link.c +27 -27
197 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +3 -3
@@ -1511,7 +1511,7 @@ void decide_link_settings(struct dc_stream_state *stream, req_bw =bandwidth_in_kbps_from_timing (&stream->timing); - link = stream->sink->link; + link = stream->link;/* if preferred is specified through AMDDP, use it, if it's enough * to drive the mode
@@ -1533,7 +1533,7 @@ void decide_link_settings(struct dc_stream_state *stream, }/* EDP use the link cap setting */ -if (stream->sink->sink_signal ==SIGNAL_TYPE_EDP ) { +if (link->connector_signal ==SIGNAL_TYPE_EDP ) { *link_setting = link->verified_link_cap;return ; }
@@ -2613,7 +2613,7 @@ bool dc_link_dp_set_test_pattern(memset (&training_pattern,0 ,sizeof (training_pattern));for (i =0 ; i <MAX_PIPES ; i++) { -if (pipes[i].stream->sink->link == link) { +if (pipes[i].stream->link == link) { pipe_ctx = &pipes[i];break ; }
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +3 -6
@@ -70,8 +70,7 @@ void dp_enable_link_phy(*/ for (i =0 ; i <MAX_PIPES ; i++) {if (pipes[i].stream !=NULL && - pipes[i].stream->sink !=NULL && - pipes[i].stream->sink->link == link) { + pipes[i].stream->link == link) {if (pipes[i].clock_source !=NULL && pipes[i].clock_source->id !=CLOCK_SOURCE_ID_DP_DTO ) { pipes[i].clock_source = dp_cs;
@@ -278,10 +277,8 @@ void dp_retrain_link_dp_test(struct dc_link *link,for (i =0 ; i <MAX_PIPES ; i++) {if (pipes[i].stream !=NULL && !pipes[i].top_pipe && - pipes[i].stream->sink !=NULL && - pipes[i].stream->sink->link !=NULL && - pipes[i].stream_res.stream_enc !=NULL && - pipes[i].stream->sink->link == link) { + pipes[i].stream->link !=NULL && + pipes[i].stream_res.stream_enc !=NULL ) {udelay (100 ); pipes[i].stream_res.stream_enc->funcs->dp_blank(
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +7 -7
@@ -1555,7 +1555,7 @@ static struct stream_encoder *find_first_free_match_stream_enc_for_link( {int i;int j =-1 ; -struct dc_link *link = stream->sink->link; +struct dc_link *link = stream->link;for (i =0 ; i < pool->stream_enc_count; i++) { if (!res_ctx->is_stream_enc_acquired[i] &&
@@ -1744,7 +1744,7 @@ static struct dc_stream_state *find_pll_sharable_stream(if (resource_are_streams_timing_synchronizable ( stream_needs_pll, stream_has_pll) && !dc_is_dp_signal (stream_has_pll->signal) - && stream_has_pll->sink->link->connector_signal + && stream_has_pll->link->connector_signal !=SIGNAL_TYPE_VIRTUAL )return stream_has_pll;
@@ -1846,7 +1846,7 @@ enum dc_status resource_map_pool_resources( true);/* TODO: Add check if ASIC support and EDID audio */ -if (!stream->sink->converter_disable_audio && +if (!stream->converter_disable_audio &&dc_is_audio_capable_signal (pipe_ctx->stream->signal) && stream->audio_info.mode_count) { pipe_ctx->stream_res.audio = find_first_free_audio(
@@ -2108,7 +2108,7 @@ static void set_avi_info_frame( itc = true; itc_value =1 ; - support = stream->sink->edid_caps.content_support; + support = stream->content_support;if (itc) {if (!support.bits.valid_content_type) {
@@ -2147,8 +2147,8 @@ static void set_avi_info_frame(/* TODO : We should handle YCC quantization */ /* but we do not have matrix calculation */ -if (stream->sink->edid_caps.qs_bit ==1 && - stream->sink->edid_caps.qy_bit ==1 ) { +if (stream->qs_bit ==1 && + stream->qy_bit ==1 ) {if (color_space ==COLOR_SPACE_SRGB || color_space ==COLOR_SPACE_2020_RGB_FULLRANGE ) { hdmi_info.bits.Q0_Q1 =RGB_QUANTIZATION_FULL_RANGE ;
@@ -2592,7 +2592,7 @@ void resource_build_bit_depth_reduction_params(struct dc_stream_state *stream,enum dc_status dc_validate_stream (struct dc *dc,struct dc_stream_state *stream) {struct dc *core_dc = dc; -struct dc_link *link = stream->sink->link; +struct dc_link *link = stream->link;struct timing_generator *tg = core_dc->res_pool->timing_generators[0 ];enum dc_status res =DC_OK ;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +14 -16
@@ -35,20 +35,17 @@/******************************************************************************* * Private functions ******************************************************************************/ -void update_stream_signal (struct dc_stream_state *stream) +void update_stream_signal (struct dc_stream_state *stream,struct dc_sink *sink) { - -struct dc_sink *dc_sink = stream->sink; - -if (dc_sink->sink_signal ==SIGNAL_TYPE_NONE ) - stream->signal = stream->sink->link->connector_signal; +if (sink->sink_signal ==SIGNAL_TYPE_NONE ) + stream->signal = stream->link->connector_signal;else - stream->signal = dc_sink->sink_signal; + stream->signal = sink->sink_signal;if (dc_is_dvi_signal (stream->signal)) {if (stream->ctx->dc->caps.dual_link_dvi && stream->timing.pix_clk_khz >TMDS_MAX_PIXEL_CLOCK && - stream->sink->sink_signal !=SIGNAL_TYPE_DVI_SINGLE_LINK ) + sink->sink_signal !=SIGNAL_TYPE_DVI_SINGLE_LINK ) stream->signal =SIGNAL_TYPE_DVI_DUAL_LINK ;else stream->signal =SIGNAL_TYPE_DVI_SINGLE_LINK ;
@@ -61,10 +58,15 @@ static void construct(struct dc_stream_state *stream,uint32_t i =0 ; stream->sink = dc_sink_data; - stream->ctx = stream->sink->ctx; -dc_sink_retain (dc_sink_data); + stream->ctx = dc_sink_data->ctx; + stream->link = dc_sink_data->link; + stream->sink_patches = dc_sink_data->edid_caps.panel_patch; + stream->converter_disable_audio = dc_sink_data->converter_disable_audio; + stream->qs_bit = dc_sink_data->edid_caps.qs_bit; + stream->qy_bit = dc_sink_data->edid_caps.qy_bit; +/* Copy audio modes */ /* TODO - Remove this translation */ for (i =0 ; i < (dc_sink_data->edid_caps.audio_mode_count); i++)
@@ -100,7 +102,7 @@ static void construct(struct dc_stream_state *stream,/* EDID CAP translation for HDMI 2.0 */ stream->timing.flags.LTE_340MCSC_SCRAMBLE = dc_sink_data->edid_caps.lte_340mcsc_scramble; -update_stream_signal (stream); +update_stream_signal (stream, dc_sink_data); stream->out_transfer_func =dc_create_transfer_func (); stream->out_transfer_func->type =TF_TYPE_BYPASS ;
@@ -340,10 +342,6 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream) stream->timing.pixel_encoding, stream->timing.display_color_depth);DC_LOG_DC ( -"\tsink name: %s, serial: %d\n" , - stream->sink->edid_caps.display_name, - stream->sink->edid_caps.serial_number); -DC_LOG_DC ("\tlink: %d\n" , - stream->sink->link->link_index); + stream->link->link_index); }
drivers/gpu/drm/amd/display/dc/dc_link.h +1 -0
@@ -110,6 +110,7 @@ struct dc_link {union ddi_channel_mapping ddi_channel_mapping;struct connector_device_tag_info device_tag;struct dpcd_caps dpcd_caps; +uint32_t dongle_max_pix_clk;unsigned short chip_caps;unsigned int dpcd_sink_count;enum edp_revision edp_revision;
drivers/gpu/drm/amd/display/dc/dc_stream.h +12 -1
@@ -51,7 +51,13 @@ struct freesync_context { };struct dc_stream_state { +// sink is deprecated, new code should not reference +// this pointer struct dc_sink *sink; + +struct dc_link *link; +struct dc_panel_patch sink_patches; +union display_content_support content_support;struct dc_crtc_timing timing;struct dc_crtc_timing_adjust adjust;struct dc_info_packet vrr_infopacket;
@@ -80,6 +86,9 @@ struct dc_stream_state {enum view_3d_format view_format;bool ignore_msa_timing_param; +bool converter_disable_audio; +uint8_t qs_bit; +uint8_t qy_bit;unsigned long long periodic_fn_vsync_delta;
@@ -105,6 +114,8 @@ struct dc_stream_state {bool dpms_off;bool apply_edp_fast_boot_optimization; +void *dm_stream_context; +struct dc_cursor_attributes cursor_attributes;struct dc_cursor_position cursor_position;uint32_t sdr_white_level;// for boosting (SDR) cursor in HDR mode
@@ -256,7 +267,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(*/ struct dc_stream_state *dc_create_stream_for_sink (struct dc_sink *dc_sink); -void update_stream_signal (struct dc_stream_state *stream); +void update_stream_signal (struct dc_stream_state *stream,struct dc_sink *sink);void dc_stream_retain (struct dc_stream_state *dc_stream);void dc_stream_release (struct dc_stream_state *dc_stream);
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +5 -5
@@ -483,15 +483,15 @@ void dce110_fill_display_configs( cfg->src_height = stream->src.height; cfg->src_width = stream->src.width; cfg->ddi_channel_mapping = - stream->sink->link->ddi_channel_mapping.raw; + stream->link->ddi_channel_mapping.raw; cfg->transmitter = - stream->sink->link->link_enc->transmitter; + stream->link->link_enc->transmitter; cfg->link_settings.lane_count = - stream->sink->link->cur_link_settings.lane_count; + stream->link->cur_link_settings.lane_count; cfg->link_settings.link_rate = - stream->sink->link->cur_link_settings.link_rate; + stream->link->cur_link_settings.link_rate; cfg->link_settings.link_spread = - stream->sink->link->cur_link_settings.link_spread; + stream->link->cur_link_settings.link_spread; cfg->sym_clock = stream->phy_pix_clk;/* Round v_refresh*/ cfg->v_refresh = stream->timing.pix_clk_khz *1000 ;
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +1 -1
@@ -788,7 +788,7 @@ bool dce110_link_encoder_validate_output_with_stream(case SIGNAL_TYPE_DVI_DUAL_LINK : is_valid =dce110_link_encoder_validate_dvi_output ( enc110, - stream->sink->link->connector_signal, + stream->link->connector_signal, stream->signal, &stream->timing);break ;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +10 -16
@@ -617,12 +617,11 @@ dce110_set_output_transfer_func(struct pipe_ctx *pipe_ctx,static enum dc_status bios_parser_crtc_source_select (struct pipe_ctx *pipe_ctx) { -struct dc_bios *dcb; +struct dc_bios *dcb = pipe_ctx->stream->ctx->dc_bios;/* call VBIOS table to set CRTC source for the HW * encoder block * note: video bios clears all FMT setting here. */ struct bp_crtc_source_select crtc_source_select = {0 }; -const struct dc_sink *sink = pipe_ctx->stream->sink; crtc_source_select.engine_id = pipe_ctx->stream_res.stream_enc->id; crtc_source_select.controller_id = pipe_ctx->stream_res.tg->inst +1 ;
@@ -652,8 +651,6 @@ static enum dc_status bios_parser_crtc_source_select(break ; } - dcb = sink->ctx->dc_bios; -if (BP_RESULT_OK != dcb->funcs->crtc_source_select ( dcb, &crtc_source_select)) {
@@ -692,10 +689,10 @@ void dce110_update_info_frame(struct pipe_ctx *pipe_ctx)void dce110_enable_stream (struct pipe_ctx *pipe_ctx) {enum dc_lane_count lane_count = - pipe_ctx->stream->sink->link->cur_link_settings.lane_count; + pipe_ctx->stream->link->cur_link_settings.lane_count;struct dc_crtc_timing *timing = &pipe_ctx->stream->timing; -struct dc_link *link = pipe_ctx->stream->sink->link; +struct dc_link *link = pipe_ctx->stream->link;uint32_t active_total_with_borders;
@@ -1048,7 +1045,7 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option)void dce110_disable_stream (struct pipe_ctx *pipe_ctx,int option) {struct dc_stream_state *stream = pipe_ctx->stream; -struct dc_link *link = stream->sink->link; +struct dc_link *link = stream->link;struct dc *dc = pipe_ctx->stream->ctx->dc;if (dc_is_hdmi_signal (pipe_ctx->stream->signal))
@@ -1073,7 +1070,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx, {struct encoder_unblank_param params = { {0 } };struct dc_stream_state *stream = pipe_ctx->stream; -struct dc_link *link = stream->sink->link; +struct dc_link *link = stream->link;/* only 3 items below are used by unblank */ params.pixel_clk_khz =
@@ -1090,7 +1087,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,void dce110_blank_stream (struct pipe_ctx *pipe_ctx) {struct dc_stream_state *stream = pipe_ctx->stream; -struct dc_link *link = stream->sink->link; +struct dc_link *link = stream->link;if (link->local_sink && link->local_sink->sink_signal ==SIGNAL_TYPE_EDP ) { link->dc->hwss.edp_backlight_control (link, false);
@@ -1399,7 +1396,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe !=0 ; - pipe_ctx->stream->sink->link->psr_enabled = false; + pipe_ctx->stream->link->psr_enabled = false;return DC_OK ; }
@@ -1804,18 +1801,15 @@ static bool should_enable_fbc(struct dc *dc,if (i == dc->res_pool->pipe_count)return false; -if (!pipe_ctx->stream->sink) -return false; - -if (!pipe_ctx->stream->sink->link) +if (!pipe_ctx->stream->link)return false;/* Only supports eDP */ -if (pipe_ctx->stream->sink->link->connector_signal !=SIGNAL_TYPE_EDP ) +if (pipe_ctx->stream->link->connector_signal !=SIGNAL_TYPE_EDP )return false;/* PSR should not be enabled */ -if (pipe_ctx->stream->sink->link->psr_enabled) +if (pipe_ctx->stream->link->psr_enabled)return false;/* Nothing to compress */
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -1
@@ -780,7 +780,7 @@ static void get_pixel_clock_parameters(* in pll_adjust_pix_clk */ pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; - pixel_clk_params->encoder_object_id = stream->sink->link->link_enc->id; + pixel_clk_params->encoder_object_id = stream->link->link_enc->id; pixel_clk_params->signal_type = pipe_ctx->stream->signal; pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst +1 ;/* TODO: un-hardcode*/
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
@@ -763,7 +763,7 @@ static struct clock_source *find_matching_pll(const struct resource_pool *pool, const struct dc_stream_state *const stream) { - switch (stream->sink->link->link_enc->transmitter) { + switch (stream->link->link_enc->transmitter) { case TRANSMITTER_UNIPHY_A: return pool->clock_sources[DCE112_CLK_SRC_PLL0];case TRANSMITTER_UNIPHY_B :
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -2515,7 +2515,7 @@ static void dcn10_config_stereo_parameters( timing_3d_format == TIMING_3D_FORMAT_DP_HDMI_INBAND_FA || timing_3d_format == TIMING_3D_FORMAT_SIDEBAND_FA) {enum display_dongle_type dongle = \ - stream->sink->link->ddc->dongle_type; + stream->link->ddc->dongle_type;if (dongle ==DISPLAY_DONGLE_DP_VGA_CONVERTER || dongle ==DISPLAY_DONGLE_DP_DVI_CONVERTER || dongle ==DISPLAY_DONGLE_DP_HDMI_CONVERTER )
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +1 -1
@@ -738,7 +738,7 @@ bool dcn10_link_encoder_validate_output_with_stream(case SIGNAL_TYPE_DVI_DUAL_LINK : is_valid =dcn10_link_encoder_validate_dvi_output ( enc10, - stream->sink->link->connector_signal, + stream->link->connector_signal, stream->signal, &stream->timing);break ;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -1
@@ -975,7 +975,7 @@ static void get_pixel_clock_parameters( {const struct dc_stream_state *stream = pipe_ctx->stream; pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; - pixel_clk_params->encoder_object_id = stream->sink->link->link_enc->id; + pixel_clk_params->encoder_object_id = stream->link->link_enc->id; pixel_clk_params->signal_type = pipe_ctx->stream->signal; pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst +1 ;/* TODO: un-hardcode*/
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/45 drm/amd/display: Remove unused headers
In reply to a message not in the archiveFrom: Imad Syed <[email protected]>
They're not being used, so remove them.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +0 -4
@@ -43,10 +43,6 @@#include "dpcd_defs.h" #include "dmcu.h" -#include "dce/dce_11_0_d.h" -#include "dce/dce_11_0_enum.h" -#include "dce/dce_11_0_sh_mask.h" -#define DC_LOGGER_INIT (logger)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/45 drm/amd/display: Detach backlight from stream
In reply to a message not in the archiveFrom: David Francis <[email protected]>
[Why]
Backlight is conceptually a property of links, not streams. All backlight programming is done on links, but there is a stream property bl_pwm_level that is used to restore backlight on dpms on and s3 resume. This is unnecessary, as backlight is already restored by hardware with no driver intervention.
[How]
Remove bl_pwm_level, and the stream argument to set_backlight
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 12 +----------- drivers/gpu/drm/amd/display/dc/dc_link.h | 3 +-- drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 - 4 files changed, 3 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -1734,7 +1734,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) + caps.min_input_signal *0x101 ;if (dc_link_set_backlight_level (dm->backlight_link, - brightness,0 ,0 )) + brightness,0 ))return 0 ;else return 1 ;
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -11
@@ -2158,8 +2158,7 @@ int dc_link_get_backlight_level(const struct dc_link *link)bool dc_link_set_backlight_level (const struct dc_link *link,uint32_t backlight_pwm_u16_16, -uint32_t frame_ramp, -const struct dc_stream_state *stream) +uint32_t frame_ramp) {struct dc *core_dc = link->ctx->dc;struct abm *abm = core_dc->res_pool->abm;
@@ -2174,10 +2173,6 @@ bool dc_link_set_backlight_level(const struct dc_link *link, (abm->funcs->set_backlight_level_pwm == NULL))return false; -if (stream) - ((struct dc_stream_state *)stream)->bl_pwm_level = - backlight_pwm_u16_16; - use_smooth_brightness = dmcu->funcs->is_dmcu_initialized (dmcu); DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n",
@@ -2605,11 +2600,6 @@ void core_link_enable_stream(if (dc_is_dp_signal (pipe_ctx->stream->signal))enable_stream_features (pipe_ctx); - -dc_link_set_backlight_level (pipe_ctx->stream->link, - pipe_ctx->stream->bl_pwm_level, -0 , - pipe_ctx->stream); } }
drivers/gpu/drm/amd/display/dc/dc_link.h +1 -2
@@ -147,8 +147,7 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_*/ bool dc_link_set_backlight_level (const struct dc_link *dc_link,uint32_t backlight_pwm_u16_16, -uint32_t frame_ramp, -const struct dc_stream_state *stream); +uint32_t frame_ramp);int dc_link_get_backlight_level (const struct dc_link *dc_link);
drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -1
@@ -100,7 +100,6 @@ struct dc_stream_state {/* DMCU info */ unsigned int abm_level; -unsigned int bl_pwm_level;/* from core_stream struct */ struct dc_context *ctx;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/45 drm/amd/display: Raise dispclk value for Polaris
In reply to a message not in the archiveFrom: Roman Li <[email protected]>
[Why]
The visual corruption due to low display clock value observed on some systems
[How]
There was earlier patch for dspclk:
'drm/amd/display: Raise dispclk value for dce_update_clocks' Adding +15% workaround also to to dce112_update_clocks
--- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +7 -0
@@ -676,6 +676,11 @@ static void dce112_update_clocks(struct clk_mgr *clk_mgr, {struct dce_clk_mgr *clk_mgr_dce =TO_DCE_CLK_MGR (clk_mgr);struct dm_pp_power_level_change_request level_change_req; +int unpatched_disp_clk = context->bw.dce.dispclk_khz; + +/*TODO: W/A for dal3 linux, investigate why this works */ +if (!clk_mgr_dce->dfs_bypass_active) + context->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz *115 /100 ; level_change_req.power_level =dce_get_required_clocks_state (clk_mgr, context);/* get max clock state from PPLIB */
@@ -690,6 +695,8 @@ static void dce112_update_clocks(struct clk_mgr *clk_mgr, clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz; }dce11_pplib_apply_display_requirements (clk_mgr->ctx->dc, context); + + context->bw.dce.dispclk_khz = unpatched_disp_clk; } static void dce12_update_clocks(struct clk_mgr *clk_mgr,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/45 drm/amd/display: Warn instead of error on REG_WAIT timeout
In reply to a message not in the archiveFrom: David Francis <[email protected]>
[Why]
DC warns when a REG_WAIT takes a while and full-on errors with stack dump on REG_WAIT timeout. Most of the time it isn't a real issue.
[How]
Make DC cool its jets - taking a while is a debug message (because it is not something that normal users should need to be aware of), and timeouts are warnings (because it technically shouldn't happen, but it's not a big deal if it does)
--- drivers/gpu/drm/amd/display/dc/dc_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_helper.c +2 -2
@@ -234,14 +234,14 @@ uint32_t generic_reg_wait(const struct dc_context *ctx,if (field_value == condition_value) {if (i * delay_between_poll_us >1000 && !IS_FPGA_MAXIMUS_DC (ctx->dce_environment)) -dm_output_to_console ("REG_WAIT taking a while: %dms in %s line:%d\n" , +DC_LOG_DC ("REG_WAIT taking a while: %dms in %s line:%d\n" , delay_between_poll_us * i /1000 , func_name, line);return reg_val; } } -dm_error ("REG_WAIT timeout %dus * %d tries - %s line:%d\n" , +DC_LOG_WARNING ("REG_WAIT timeout %dus * %d tries - %s line:%d\n" , delay_between_poll_us, time_out_num_tries, func_name, line);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/45 drm/amd/display: update DCN dml calcs
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
DV have made updates to DCN dml which we need to pull in
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 7 -- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 2 +- .../drm/amd/display/dc/dml/display_mode_structs.h | 107 ++------------------- .../amd/display/dc/dml/dml1_display_rq_dlg_calc.c | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 4 +- 5 files changed, 11 insertions(+), 113 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -7
@@ -290,41 +290,34 @@ static void pipe_ctx_to_e2e_pipe_params (switch (pipe->plane_state->tiling_info.gfx9.swizzle) {/* for 4/8/16 high tiles */ case DC_SW_LINEAR : - input->src.is_display_sw =1 ; input->src.macro_tile_size = dm_4k_tile;break ;case DC_SW_4KB_S :case DC_SW_4KB_S_X : - input->src.is_display_sw =0 ; input->src.macro_tile_size = dm_4k_tile;break ;case DC_SW_64KB_S :case DC_SW_64KB_S_X :case DC_SW_64KB_S_T : - input->src.is_display_sw =0 ; input->src.macro_tile_size = dm_64k_tile;break ;case DC_SW_VAR_S :case DC_SW_VAR_S_X : - input->src.is_display_sw =0 ; input->src.macro_tile_size = dm_256k_tile;break ;/* For 64bpp 2 high tiles */ case DC_SW_4KB_D :case DC_SW_4KB_D_X : - input->src.is_display_sw =1 ; input->src.macro_tile_size = dm_4k_tile;break ;case DC_SW_64KB_D :case DC_SW_64KB_D_X :case DC_SW_64KB_D_T : - input->src.is_display_sw =1 ; input->src.macro_tile_size = dm_64k_tile;break ;case DC_SW_VAR_D :case DC_SW_VAR_D_X : - input->src.is_display_sw =1 ; input->src.macro_tile_size = dm_256k_tile;break ;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -1
@@ -70,7 +70,7 @@const struct _vcs_dpi_ip_params_st dcn1_0_ip = { .rob_buffer_size_kbytes =64 , .det_buffer_size_kbytes =164 , - .dpte_buffer_size_in_pte_reqs =42 , + .dpte_buffer_size_in_pte_reqs_luma =42 , .dpp_output_buffer_pixels =2560 , .opp_output_buffer_lines =1 , .pixel_chunk_size_kbytes =8 ,
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +6 -101
198 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +2 -2
@@ -459,7 +459,7 @@ static void dml1_rq_dlg_get_row_heights(/* dpte */ /* ------ */ log2_vmpg_bytes =dml_log2 (mode_lib->soc.vmm_page_size_bytes); - dpte_buf_in_pte_reqs = mode_lib->ip.dpte_buffer_size_in_pte_reqs; + dpte_buf_in_pte_reqs = mode_lib->ip.dpte_buffer_size_in_pte_reqs_luma; log2_vmpg_height =0 ; log2_vmpg_width =0 ;
@@ -776,7 +776,7 @@ static void get_surf_rq_param(/* dpte */ /* ------ */ log2_vmpg_bytes =dml_log2 (mode_lib->soc.vmm_page_size_bytes); - dpte_buf_in_pte_reqs = mode_lib->ip.dpte_buffer_size_in_pte_reqs; + dpte_buf_in_pte_reqs = mode_lib->ip.dpte_buffer_size_in_pte_reqs_luma; log2_vmpg_height =0 ; log2_vmpg_width =0 ;
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +2 -2
@@ -31,7 +31,7 @@#include "dml/display_mode_structs.h" struct dchub_init_data ; -struct cstate_pstate_watermarks_st1 { +struct cstate_pstate_watermarks_st {uint32_t cstate_exit_ns;uint32_t cstate_enter_plus_exit_ns;uint32_t pstate_change_ns;
@@ -40,7 +40,7 @@ struct cstate_pstate_watermarks_st1 {struct dcn_watermarks {uint32_t pte_meta_urgent_ns;uint32_t urgent_ns; -struct cstate_pstate_watermarks_st1 cstate_pstate; +struct cstate_pstate_watermarks_st cstate_pstate; };struct dcn_watermark_set {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/45 drm/amd/display: fix YCbCr420 blank color
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
[Why]
YCbCr420 packing format uses two chanels for luma, and 1 channel for both chroma component. Our previous implementation did not account for this and results in every other pixel having very high luma value, showing greyish color instead of black.
YCbCr444 = <Y1, Cb1, Cr1>; <Y2, Cb2, Cr2> .....
YCbCr420 = <Y1, Y2, Cb1>; <Y3, Y4, Cr1> .....
[How]
Program the second channel with the black color value for luma as well.
--- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 11 ++++++++++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +10 -1
@@ -1264,10 +1264,19 @@ static void program_scaler(const struct dc *dc, pipe_ctx->plane_res.scl_data.lb_params.depth, &pipe_ctx->stream->bit_depth_params); -if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) +if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) { +/* +* The way 420 is packed, 2 channels carry Y component, 1 channel +* alternate between Cb and Cr, so both channels need the pixel +* value for Y +*/ +if (pipe_ctx->stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) + color.color_r_cr = color.color_g_y; + pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color ( pipe_ctx->stream_res.tg, &color); + } pipe_ctx->plane_res.xfm->funcs->transform_set_scaler (pipe_ctx->plane_res.xfm, &pipe_ctx->plane_res.scl_data);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +9 -0
@@ -2160,6 +2160,15 @@ static void dcn10_blank_pixel_data( color_space = stream->output_color_space;color_space_to_black_color (dc, color_space, &black_color); +/* +* The way 420 is packed, 2 channels carry Y component, 1 channel +* alternate between Cb and Cr, so both channels need the pixel +* value for Y +*/ +if (stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) + black_color.color_r_cr = black_color.color_g_y; + +if (stream_res->tg->funcs->set_blank_color) stream_res->tg->funcs->set_blank_color( stream_res->tg,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/45 drm/amd/display: Wait edp HPD to high in detect_sink
In reply to a message not in the archiveFrom: Dale Zhao <[email protected]>
[Why]
In 99% user case, edp will be post by vbios.
In 1% / current case: Lenovo don't light up edp panel in vbios
post stage, vbios won't be lit up. Thus in dal when we init DCN
10 hw, we power up edp, then we start detect_sink, but internal
time is too short, when we detect it, HPD is still low, so we don't detect the edp, and edp shows black.
[How]
When we init hw, we wait edp HPD to high after power up edp.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +3 -0
@@ -211,6 +211,9 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type)return true; } +if (link->connector_signal ==SIGNAL_TYPE_EDP ) + link->dc->hwss.edp_wait_for_hpd_ready (link, true); +/* todo: may need to lock gpio access */ hpd_pin =get_hpd_gpio (link->ctx->dc_bios, link->link_id, link->ctx->gpio_service);if (hpd_pin ==NULL )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/45 drm/amd/display: Don't skip link training for empty dongle
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
[Why]
Skipping initial link training will result in no verified link cap for mode enumeration. Some versions of the BIOS seem to have PHY programming sequence issue as well if initial link training is skipped, resulting in a softlock in BIOS command table.
[How]
Identify the empty dongle hotplug case, and still do initial link training.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +16 -2
@@ -702,12 +702,26 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)if (memcmp (&link->dpcd_caps, &prev_dpcd_caps,sizeof (struct dpcd_caps ))) same_dpcd = false; } -/* Active dongle downstream unplug */ +/* Active dongle plug in without display or downstream unplug*/ if (link->type == dc_connection_active_dongle && link->dpcd_caps.sink_count. bits.SINK_COUNT ==0 ) { -if (prev_sink !=NULL ) +if (prev_sink !=NULL ) { +/* Downstream unplug */ dc_sink_release (prev_sink); + }else { +/* Empty dongle plug in */ +for (i =0 ; i <LINK_TRAINING_MAX_VERIFY_RETRY ; i++) { +int fail_count =0 ; + +dp_verify_link_cap (link, + &link->reported_link_cap, + &fail_count); + +if (fail_count ==0 ) +break ; + } + }return true; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 22/45 drm/amd/display: add stream ID and otg instance in dc_stream_state
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]
stream ID allows DMs to avoid memory address comparisons to compare stream equality.otg_instance allows DC to more rigorously define when otg_instance
can change. specifically, it is now defined to be only mutable when dc_stream_state changes. This is better than a "get status" function which prevents efficient caching of otherwise very stable information.
[how]
stream ID follows similar pattern to sink ID, which is already implemented
otg_instance is an output which occurs on all dc_stream modification functions
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 +++++ drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 3 +++ drivers/gpu/drm/amd/display/dc/dc_stream.h | 12 ++++++++++++ drivers/gpu/drm/amd/display/dc/dc_types.h | 1 + 4 files changed, 21 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -0
@@ -673,6 +673,7 @@ static bool construct(struct dc *dc, dc_ctx->dc = dc; dc_ctx->asic_id = init_params->asic_id; dc_ctx->dc_sink_id_count =0 ; + dc_ctx->dc_stream_id_count =0 ; dc->ctx = dc_ctx; dc->current_state =dc_create_state ();
@@ -1049,6 +1050,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c/* Program all planes within new context*/ for (i =0 ; i < context->stream_count; i++) {const struct dc_link *link = context->streams[i]->link; +struct dc_stream_status *status;if (!context->streams[i]->mode_changed)continue ;
@@ -1073,6 +1075,9 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c } } + status =dc_stream_get_status (context->streams[i]); + context->streams[i]->out.otg_offset = status->primary_otg_inst; + CONN_MSG_MODE(link, "{%dx%d, %dx%d@%dKhz}", context->streams[i]->timing.h_addressable, context->streams[i]->timing.v_addressable,
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +3 -0
@@ -107,6 +107,9 @@ static void construct(struct dc_stream_state *stream, stream->out_transfer_func =dc_create_transfer_func (); stream->out_transfer_func->type =TF_TYPE_BYPASS ; stream->out_transfer_func->ctx = stream->ctx; + + stream->stream_id = stream->ctx->dc_stream_id_count; + stream->ctx->dc_stream_id_count++; }static void destruct (struct dc_stream_state *stream)
drivers/gpu/drm/amd/display/dc/dc_stream.h +12 -0
@@ -127,6 +127,18 @@ struct dc_stream_state {/* Computed state bits */ bool mode_changed : 1; +/* Output from DC when stream state is committed or altered +* DC may only access these values during: +* dc_commit_state, dc_commit_state_no_check, dc_commit_streams +* values may not change outside of those calls +*/ +struct { +// For interrupt management, some hardware instance +// offsets need to be exposed to DM +uint8_t otg_offset; + } out; + +uint32_t stream_id; };struct dc_stream_update {
drivers/gpu/drm/amd/display/dc/dc_types.h +1 -0
@@ -99,6 +99,7 @@ struct dc_context {struct gpio_service *gpio_service;struct i2caux *i2caux;uint32_t dc_sink_id_count; +uint32_t dc_stream_id_count;uint64_t fbc_gpu_addr; };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 23/45 drm/amd/display: Add backlight pwm debugfs
In reply to a message not in the archiveFrom: David Francis <[email protected]>
[Why]
ABM enablement testing can be automated if a way of reading target and current hardware backlight is available
[How]
Expand debugfs interface with two new entries.
Hook directly into dc interface. Units are as
a fraction of 0x1000 = 100%
Use the built-in amdgpu function for creating
read-only debugfs files
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 49 +++++++++++++++++++++- drivers/gpu/drm/amd/display/dc/core/dc.c | 20 +++++++++ drivers/gpu/drm/amd/display/dc/dc.h | 3 ++ 3 files changed, 70 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +47 -2
@@ -783,6 +783,45 @@ static ssize_t dtn_log_write(return size; } +/* +* Backlight at this moment. Read only. +* As written to display, taking ABM and backlight lut into account. +* Ranges from 0x0 to 0x10000 (= 100% PWM) +*/ +static int current_backlight_read (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *)m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; +struct dc *dc = adev->dm.dc; +unsigned int backlight =dc_get_current_backlight_pwm (dc); + +seq_printf (m,"0x%x\n" , backlight); +return 0 ; +} + +/* +* Backlight value that is being approached. Read only. +* As written to display, taking ABM and backlight lut into account. +* Ranges from 0x0 to 0x10000 (= 100% PWM) +*/ +static int target_backlight_read (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *)m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; +struct dc *dc = adev->dm.dc; +unsigned int backlight =dc_get_target_backlight_pwm (dc); + +seq_printf (m,"0x%x\n" , backlight); +return 0 ; +} + +static const struct drm_info_list amdgpu_dm_debugfs_list[] = { + {"amdgpu_current_backlight_pwm" , ¤t_backlight_read}, + {"amdgpu_target_backlight_pwm" , &target_backlight_read}, +}; +int dtn_debugfs_init (struct amdgpu_device *adev) {static const struct file_operations dtn_log_fops = {
@@ -793,9 +832,15 @@ int dtn_debugfs_init(struct amdgpu_device *adev) };struct drm_minor *minor = adev->ddev->primary; -struct dentry *root = minor->debugfs_root; +struct dentry *ent, *root = minor->debugfs_root; +int ret; + + ret =amdgpu_debugfs_add_files (adev, amdgpu_dm_debugfs_list, +ARRAY_SIZE (amdgpu_dm_debugfs_list)); +if (ret) +return ret; - struct dentry *ent = debugfs_create_file( + ent = debugfs_create_file( "amdgpu_dm_dtn_log", 0644, root,
drivers/gpu/drm/amd/display/dc/core/dc.c +20 -0
@@ -1785,6 +1785,26 @@ void dc_resume(struct dc *dc)core_link_resume (dc->links[i]); } +unsigned int dc_get_current_backlight_pwm (struct dc *dc) +{ +struct abm *abm = dc->res_pool->abm; + +if (abm) +return abm->funcs->get_current_backlight (abm); + +return 0 ; +} + +unsigned int dc_get_target_backlight_pwm (struct dc *dc) +{ +struct abm *abm = dc->res_pool->abm; + +if (abm) +return abm->funcs->get_target_backlight (abm); + +return 0 ; +} +bool dc_is_dmcu_initialized (struct dc *dc) {struct dmcu *dmcu = dc->res_pool->dmcu;
drivers/gpu/drm/amd/display/dc/dc.h +3 -0
@@ -749,6 +749,9 @@ void dc_set_power_state(struct dc *dc, enum dc_acpi_cm_power_state power_state);void dc_resume (struct dc *dc); +unsigned int dc_get_current_backlight_pwm (struct dc *dc); +unsigned int dc_get_target_backlight_pwm (struct dc *dc); +bool dc_is_dmcu_initialized (struct dc *dc);#endif /* DC_INTERFACE_H_ */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 24/45 drm/amd/display: 3.2.10
In reply to a message not in the archiveFrom: Steven Chiu <[email protected]>
--- 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
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.09" +#define DC_VER "3.2.10"#define MAX_SURFACES 3#define MAX_STREAMS 6
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 25/45 drm/amd/display: Remove stream_status->link
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
It's not being used anywhere.
[How]
Remove it.
--- drivers/gpu/drm/amd/display/dc/dc_stream.h | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -5
@@ -38,11 +38,6 @@ struct dc_stream_status {int stream_enc_inst;int plane_count;struct dc_plane_state *plane_states[MAX_SURFACE_NUM ]; - -/* -* link this stream passes through -*/ -struct dc_link *link; };// TODO: References to this needs to be removed..
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 26/45 drm/amd/display: Add retry to read ddc_clock pin
In reply to a message not in the archiveFrom: Paul Hsieh <[email protected]>
[WHY]
On customer board, there is one pluse (1v , < 1ms) on DDC_CLK pin when plug / unplug DP cable. Driver will read it and config DP to HDMI/DVI dongle.
[HOW]
If there is a real dongle, DDC_CLK should be always pull high. Try to read again to recovery this special case. Retry times = 3. Need additional 3ms to detect DP passive dongle(3 failures)
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +17 -6
@@ -338,7 +338,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) {enum gpio_result gpio_result;uint32_t clock_pin =0 ; - +uint8_t retry =0 ;struct ddc *ddc; enum connector_id connector_id =
@@ -367,11 +367,22 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)return present; } -/* Read GPIO: DP sink is present if both clock and data pins are zero */ -/* [anaumov] in DAL2, there was no check for GPIO failure */ - - gpio_result =dal_gpio_get_value (ddc->pin_clock, &clock_pin); -ASSERT (gpio_result ==GPIO_RESULT_OK ); +/* +* Read GPIO: DP sink is present if both clock and data pins are zero +* +* [W/A] plug-unplug DP cable, sometimes customer board has +* one short pulse on clk_pin(1V, < 1ms). DP will be config to HDMI/DVI +* then monitor can't br light up. Add retry 3 times +* But in real passive dongle, it need additional 3ms to detect +*/ +do { + gpio_result =dal_gpio_get_value (ddc->pin_clock, &clock_pin); +ASSERT (gpio_result ==GPIO_RESULT_OK ); +if (clock_pin) +udelay (1000 ); +else +break ; + }while (retry++ <3 ); present = (gpio_result ==GPIO_RESULT_OK ) && !clock_pin;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 27/45 drm/amd/display: Fix driver load crash in amdgpu_dm
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
This fixes an regression introduced by:
drm/amd/display: add stream ID and otg instance in dc_stream_state
During driver initialization, a null pointer deref is raised. This is caused by searching for a stream status in the dc->current_state before the dc_state swap happens at the end of dc_commit_state_no_check(). Since the swap has not happened, the dc_state to be swapped in should be searched, and not dc->current_state.
[How]
Add a function that searches for the stream status within the given dc_state, instead of dc->current_state. Use that before the state swap happens in dc_commit_state_no_check().
Also remove duplicate occurrences of this function in amdgpu_dm.c.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 22 +++------------- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 32 +++++++++++++++++++---- drivers/gpu/drm/amd/display/dc/dc_stream.h | 3 +++ 4 files changed, 35 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -18
@@ -4381,20 +4381,6 @@ static void prepare_flip_isr(struct amdgpu_crtc *acrtc) acrtc->crtc_id); } -struct dc_stream_status *dc_state_get_stream_status ( -struct dc_state *state, -struct dc_stream_state *stream) -{ -uint8_t i; - -for (i =0 ; i < state->stream_count; i++) { -if (stream == state->streams[i]) -return &state->stream_status[i]; - } - -return NULL ; -} - static void update_freesync_state_on_stream( struct amdgpu_display_manager *dm, struct dm_crtc_state *new_crtc_state,
@@ -4965,8 +4951,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)dc_stream_get_status (dm_new_crtc_state->stream);if (!status) - status =dc_state_get_stream_status (dc_state, - dm_new_crtc_state->stream); + status =dc_stream_get_status_from_state (dc_state, + dm_new_crtc_state->stream);if (!status)DC_ERR ("got no status for stream %p on acrtc%p\n" , dm_new_crtc_state->stream, acrtc);
@@ -5728,8 +5714,8 @@ dm_determine_update_type_for_commit(struct dc *dc, goto cleanup; } - status =dc_state_get_stream_status (old_dm_state->context, - new_dm_crtc_state->stream); + status =dc_stream_get_status_from_state (old_dm_state->context, + new_dm_crtc_state->stream); update_type =dc_check_update_surfaces_for_stream (dc, updates, num_plane, &stream_update, status);
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
@@ -1075,7 +1075,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c } } - status =dc_stream_get_status (context->streams[i]); + status =dc_stream_get_status_from_state (context, context->streams[i]); context->streams[i]->out.otg_offset = status->primary_otg_inst; CONN_MSG_MODE(link, "{%dx%d, %dx%d@%dKhz}",
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +27 -5
@@ -160,21 +160,43 @@ struct dc_stream_state *dc_create_stream_for_sink(return stream; } -struct dc_stream_status *dc_stream_get_status ( +/** +* dc_stream_get_status_from_state - Get stream status from given dc state +* @state: DC state to find the stream status in +* @stream: The stream to get the stream status for +* +* The given stream is expected to exist in the given dc state. Otherwise, NULL +* will be returned. +*/ +struct dc_stream_status *dc_stream_get_status_from_state ( +struct dc_state *state,struct dc_stream_state *stream) {uint8_t i; -struct dc *dc = stream->ctx->dc; -for (i =0 ; i < dc->current_state->stream_count; i++) { -if (stream == dc->current_state->streams[i]) -return &dc->current_state->stream_status[i]; +for (i =0 ; i < state->stream_count; i++) { +if (stream == state->streams[i]) +return &state->stream_status[i]; }return NULL ; }/** +* dc_stream_get_status() - Get current stream status of the given stream state +* @stream: The stream to get the stream status for. +* +* The given stream is expected to exist in dc->current_state. Otherwise, NULL +* will be returned. +*/ +struct dc_stream_status *dc_stream_get_status ( +struct dc_stream_state *stream) +{ +struct dc *dc = stream->ctx->dc; +return dc_stream_get_status_from_state (dc->current_state, stream); +} + +/** * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor surface address */ bool dc_stream_set_cursor_attributes(
drivers/gpu/drm/amd/display/dc/dc_stream.h +3 -0
@@ -278,6 +278,9 @@ void update_stream_signal(struct dc_stream_state *stream, struct dc_sink *sink);void dc_stream_retain (struct dc_stream_state *dc_stream);void dc_stream_release (struct dc_stream_state *dc_stream); +struct dc_stream_status *dc_stream_get_status_from_state ( +struct dc_state *state, +struct dc_stream_state *stream);struct dc_stream_status *dc_stream_get_status (struct dc_stream_state *dc_stream);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 28/45 drm/amd/display: Minor code cleanup
In reply to a message not in the archiveFrom: SivapiriyanKumarasamy <[email protected]>
[WHY]
There is an extra null check for fs_params in thebuild_freesync_hdr function detected by Smatch.
[HOW]
1) Remove the extra null check since it is checked in the caller.
--- drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +1 -1
@@ -823,7 +823,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma,bool is_clipped = false;struct fixed31_32 sdr_white_level; -if (fs_params ==NULL || fs_params->max_content ==0 || +if (fs_params->max_content ==0 || fs_params->max_display ==0 )return false;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 29/45 drm/amd/display: Use 100 Hz precision for pipe pixel clocks
In reply to a message not in the archiveFrom: Ken Chalmers <[email protected]>
[Why]
Users would like more accurate pixel clocks, especially for fractional "TV" frame rates like 59.94 Hz.
[How]
Store and communicate pixel clocks with 100 Hz accuracy from dc_crtc_timing through to BIOS command table setpixelclock call.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- .../gpu/drm/amd/display/dc/bios/command_table.c | 19 +- .../gpu/drm/amd/display/dc/bios/command_table2.c | 6 +- drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 10 +- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 10 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 22 +-- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 10 +- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 12 +- .../gpu/drm/amd/display/dc/dce/dce_clock_source.c | 196 ++++++++++----------- .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 6 +- .../drm/amd/display/dc/dce/dce_stream_encoder.c | 4 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 20 +-- .../drm/amd/display/dc/dce110/dce110_resource.c | 10 +- .../amd/display/dc/dce80/dce80_timing_generator.c | 8 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- .../display/dc/dcn10/dcn10_hw_sequencer_debug.c | 2 +- .../drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 18 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 6 +- .../amd/display/dc/dcn10/dcn10_stream_encoder.c | 2 +- drivers/gpu/drm/amd/display/dc/inc/clock_source.h | 8 +- .../drm/amd/display/include/bios_parser_types.h | 4 +- .../drm/amd/display/modules/freesync/freesync.c | 12 +- 29 files changed, 206 insertions(+), 209 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -4
@@ -2554,7 +2554,7 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing)* according to HDMI spec, we use YCbCr709 and YCbCr601 * respectively */ -if (dc_crtc_timing->pix_clk_khz >27030 ) { +if (dc_crtc_timing->pix_clk_100hz >270300 ) {if (dc_crtc_timing->flags.Y_ONLY) color_space =COLOR_SPACE_YCBCR709_LIMITED ;
@@ -2597,7 +2597,7 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_if (timing_out->display_color_depth <=COLOR_DEPTH_888 )return ; do { - normalized_clk = timing_out->pix_clk_khz; + normalized_clk = timing_out->pix_clk_100hz / 10; /* YCbCr 4:2:0 requires additional adjustment of 1/2 */ if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420) normalized_clk /= 2;
@@ -2678,7 +2678,7 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream, mode_in->crtc_vsync_start - mode_in->crtc_vdisplay; timing_out->v_sync_width = mode_in->crtc_vsync_end - mode_in->crtc_vsync_start; - timing_out->pix_clk_khz = mode_in->crtc_clock; + timing_out->pix_clk_100hz = mode_in->crtc_clock *10 ; timing_out->aspect_ratio =get_aspect_ratio (mode_in); stream->output_color_space =get_output_color_space (timing_out);
@@ -2806,7 +2806,7 @@ static void set_master_stream(struct dc_stream_state *stream_set[],if (stream_set[j] && stream_set[j]->triggered_crtc_reset.enabled) {int refresh_rate =0 ; - refresh_rate = (stream_set[j]->timing.pix_clk_khz*1000 )/ + refresh_rate = (stream_set[j]->timing.pix_clk_100hz*100 )/ (stream_set[j]->timing.h_total*stream_set[j]->timing.v_total);if (refresh_rate > highest_rfr) { highest_rfr = refresh_rate;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
@@ -205,7 +205,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( mst_port = aconnector->port;if (enable) { - clock = stream->timing.pix_clk_khz; + clock = stream->timing.pix_clk_100hz /10 ;switch (stream->timing.display_color_depth) {
drivers/gpu/drm/amd/display/dc/bios/command_table.c +9 -10
@@ -964,9 +964,9 @@ static enum bp_result set_pixel_clock_v3( allocation.sPCLKInput.ucPostDiv = (uint8_t )bp_params->pixel_clock_post_divider; -/* We need to convert from KHz units into 10KHz units */ +/* We need to convert from 100Hz units into 10KHz units */ allocation.sPCLKInput.usPixelClock = -cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock /10 )); +cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock_100hz /100 )); params = (PIXEL_CLOCK_PARAMETERS_V3 *)&allocation.sPCLKInput; params->ucTransmitterId =
@@ -1042,9 +1042,9 @@ static enum bp_result set_pixel_clock_v5( (uint8_t )bp->cmd_helper->encoder_mode_bp_to_atom ( bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ +/* We need to convert from 100Hz units into 10KHz units */ clk.sPCLKInput.usPixelClock = -cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock /10 )); +cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock_100hz /100 ));if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) clk.sPCLKInput.ucMiscInfo |=
@@ -1118,9 +1118,9 @@ static enum bp_result set_pixel_clock_v6( (uint8_t ) bp->cmd_helper->encoder_mode_bp_to_atom ( bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ +/* We need to convert from 100 Hz units into 10KHz units */ clk.sPCLKInput.ulCrtcPclkFreq.ulPixelClock = -cpu_to_le32 (bp_params->target_pixel_clock /10 ); +cpu_to_le32 (bp_params->target_pixel_clock_100hz /100 );if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) { clk.sPCLKInput.ucMiscInfo |=
@@ -1182,8 +1182,7 @@ static enum bp_result set_pixel_clock_v7( clk.ucTransmitterID = bp->cmd_helper->encoder_id_to_atom (dal_graphics_object_id_get_encoder_id (bp_params->encoder_object_id)); clk.ucEncoderMode = (uint8_t ) bp->cmd_helper->encoder_mode_bp_to_atom (bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ - clk.ulPixelClock =cpu_to_le32 (bp_params->target_pixel_clock *10 ); + clk.ulPixelClock =cpu_to_le32 (bp_params->target_pixel_clock_100hz); clk.ucDeepColorRatio = (uint8_t ) bp->cmd_helper->transmitter_color_depth_to_atom (bp_params->color_depth);
@@ -2164,7 +2163,7 @@ static enum bp_result program_clock_v5(/* We need to convert from KHz units into 10KHz units */ params.sPCLKInput.ucPpll = (uint8_t ) atom_pll_id; params.sPCLKInput.usPixelClock = -cpu_to_le16 ((uint16_t ) (bp_params->target_pixel_clock /10 )); +cpu_to_le16 ((uint16_t ) (bp_params->target_pixel_clock_100hz /100 )); params.sPCLKInput.ucCRTC = (uint8_t )ATOM_CRTC_INVALID ;if (bp_params->flags.SET_EXTERNAL_REF_DIV_SRC)
@@ -2196,7 +2195,7 @@ static enum bp_result program_clock_v6(/* We need to convert from KHz units into 10KHz units */ params.sPCLKInput.ucPpll = (uint8_t )atom_pll_id; params.sPCLKInput.ulDispEngClkFreq = -cpu_to_le32 (bp_params->target_pixel_clock /10 ); +cpu_to_le32 (bp_params->target_pixel_clock_100hz /100 );if (bp_params->flags.SET_EXTERNAL_REF_DIV_SRC) params.sPCLKInput.ucMiscInfo |=PIXEL_CLOCK_MISC_REF_DIV_SRC ;
drivers/gpu/drm/amd/display/dc/bios/command_table2.c +2 -4
@@ -301,9 +301,7 @@ static enum bp_result set_pixel_clock_v7( cmd_helper->encoder_mode_bp_to_atom ( bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ - clk.pixclk_100hz =cpu_to_le32 (bp_params->target_pixel_clock * -10 ); + clk.pixclk_100hz =cpu_to_le32 (bp_params->target_pixel_clock_100hz); clk.deep_color_ratio = (uint8_t) bp->cmd_helper->
@@ -311,7 +309,7 @@ static enum bp_result set_pixel_clock_v7( bp_params->color_depth);DC_LOG_BIOS ("%s:program display clock = %d" \"colorDepth = %d\n" , __func__,\ - bp_params->target_pixel_clock, bp_params->color_depth); + bp_params->target_pixel_clock_100hz, bp_params->color_depth);if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) clk.miscinfo |=PIXEL_CLOCK_V7_MISC_FORCE_PROG_PPLL ;
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +5 -5
@@ -2792,7 +2792,7 @@ static void populate_initial_data( data->lpt_en[num_displays +4 ] = false; data->h_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.h_total); data->v_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.v_total); - data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pipe[i].stream->timing.pix_clk_khz,1000 ); + data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pipe[i].stream->timing.pix_clk_100hz,10000 ); data->src_width[num_displays +4 ] =bw_int_to_fixed (pipe[i].plane_res.scl_data.viewport.width); data->pitch_in_pixels[num_displays +4 ] = data->src_width[num_displays +4 ]; data->src_height[num_displays +4 ] =bw_int_to_fixed (pipe[i].plane_res.scl_data.viewport.height);
@@ -2881,7 +2881,7 @@ static void populate_initial_data(/* Pipes without underlay after */ for (i =0 ; i < pipe_count; i++) { -unsigned int pixel_clock_khz; +unsigned int pixel_clock_100hz;if (!pipe[i].stream || pipe[i].bottom_pipe)continue ;
@@ -2890,10 +2890,10 @@ static void populate_initial_data( data->lpt_en[num_displays +4 ] = false; data->h_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.h_total); data->v_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.v_total); - pixel_clock_khz = pipe[i].stream->timing.pix_clk_khz; + pixel_clock_100hz = pipe[i].stream->timing.pix_clk_100hz;if (pipe[i].stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) - pixel_clock_khz *=2 ; - data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pixel_clock_khz,1000 ); + pixel_clock_100hz *=2 ; + data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pixel_clock_100hz,10000 );if (pipe[i].plane_state) { data->src_width[num_displays +4 ] =bw_int_to_fixed (pipe[i].plane_res.scl_data.viewport.width); data->pitch_in_pixels[num_displays +4 ] = data->src_width[num_displays +4 ];
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +5 -5
@@ -416,7 +416,7 @@ static void pipe_ctx_to_e2e_pipe_params ( - pipe->stream->timing.v_addressable - pipe->stream->timing.v_border_bottom - pipe->stream->timing.v_border_top; - input->dest.pixel_rate_mhz = pipe->stream->timing.pix_clk_khz/1000.0 ; + input->dest.pixel_rate_mhz = pipe->stream->timing.pix_clk_100hz/10000.0 ; input->dest.vstartup_start = pipe->pipe_dlg_param.vstartup_start; input->dest.vupdate_offset = pipe->pipe_dlg_param.vupdate_offset; input->dest.vupdate_offset = pipe->pipe_dlg_param.vupdate_offset;
@@ -663,9 +663,9 @@ static void hack_disable_optional_pipe_split(struct dcn_bw_internal_vars *v) }static void hack_force_pipe_split (struct dcn_bw_internal_vars *v, -unsigned int pixel_rate_khz) +unsigned int pixel_rate_100hz) { -float pixel_rate_mhz = pixel_rate_khz /1000 ; +float pixel_rate_mhz = pixel_rate_100hz /10000 ;/* * force enabling pipe split by lower dpp clock for DPM0 to just
@@ -688,7 +688,7 @@ static void hack_bounding_box(struct dcn_bw_internal_vars *v,if (context->stream_count ==1 && dbg->force_single_disp_pipe_split) -hack_force_pipe_split (v, context->streams[0 ]->timing.pix_clk_khz); +hack_force_pipe_split (v, context->streams[0 ]->timing.pix_clk_100hz); } bool dcn_validate_bandwidth(
@@ -845,7 +845,7 @@ bool dcn_validate_bandwidth( v->v_sync_plus_back_porch[input_idx] = pipe->stream->timing.v_total - v->vactive[input_idx] - pipe->stream->timing.v_front_porch; - v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_khz/1000.0 ; + v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_100hz/10000.0 ;if (pipe->stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) v->pixel_clock[input_idx] *=2 ;if (!pipe->plane_state) {
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
@@ -1083,7 +1083,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c context->streams[i]->timing.v_addressable, context->streams[i]->timing.h_total, context->streams[i]->timing.v_total, - context->streams[i]->timing.pix_clk_khz); + context->streams[i]->timing.pix_clk_100hz / 10); }dc_enable_stereo (dc, context, dc_streams, context->stream_count);
drivers/gpu/drm/amd/display/dc/core/dc_link.c +11 -11
@@ -1934,7 +1934,7 @@ static void enable_link_hdmi(struct pipe_ctx *pipe_ctx) && (stream->timing.v_addressable ==480 );if (stream->phy_pix_clk ==0 ) - stream->phy_pix_clk = stream->timing.pix_clk_khz; + stream->phy_pix_clk = stream->timing.pix_clk_100hz /10 ;if (stream->phy_pix_clk >340000 ) is_over_340mhz = true;
@@ -1988,7 +1988,7 @@ static void enable_link_lvds(struct pipe_ctx *pipe_ctx)struct dc_link *link = stream->link;if (stream->phy_pix_clk ==0 ) - stream->phy_pix_clk = stream->timing.pix_clk_khz; + stream->phy_pix_clk = stream->timing.pix_clk_100hz /10 ;memset (&stream->link->cur_link_settings,0 ,sizeof (struct dc_link_settings ));
@@ -2063,7 +2063,7 @@ static bool dp_active_dongle_validate_timing(const struct dc_crtc_timing *timing, const struct dpcd_caps *dpcd_caps) { - unsigned int required_pix_clk = timing->pix_clk_khz; + unsigned int required_pix_clk_100hz = timing->pix_clk_100hz;const struct dc_dongle_caps *dongle_caps = &dpcd_caps->dongle_caps;switch (dpcd_caps->dongle_type) {
@@ -2103,9 +2103,9 @@ static bool dp_active_dongle_validate_timing(/* Check Color Depth and Pixel Clock */ if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) - required_pix_clk /=2 ; + required_pix_clk_100hz /=2 ;else if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR422 ) - required_pix_clk = required_pix_clk *2 /3 ; + required_pix_clk_100hz = required_pix_clk_100hz *2 /3 ;switch (timing->display_color_depth) {case COLOR_DEPTH_666 :
@@ -2115,12 +2115,12 @@ static bool dp_active_dongle_validate_timing(case COLOR_DEPTH_101010 :if (dongle_caps->dp_hdmi_max_bpc <10 )return false; - required_pix_clk = required_pix_clk *10 /8 ; + required_pix_clk_100hz = required_pix_clk_100hz *10 /8 ;break ;case COLOR_DEPTH_121212 :if (dongle_caps->dp_hdmi_max_bpc <12 )return false; - required_pix_clk = required_pix_clk *12 /8 ; + required_pix_clk_100hz = required_pix_clk_100hz *12 /8 ;break ;case COLOR_DEPTH_141414 :
@@ -2130,7 +2130,7 @@ static bool dp_active_dongle_validate_timing(return false; } -if (required_pix_clk > dongle_caps->dp_hdmi_max_pixel_clk) +if (required_pix_clk_100hz > (dongle_caps->dp_hdmi_max_pixel_clk *10 ))return false;return true;
@@ -2141,7 +2141,7 @@ enum dc_status dc_link_validate_mode_timing(struct dc_link *link, const struct dc_crtc_timing *timing) { - uint32_t max_pix_clk = stream->link->dongle_max_pix_clk; + uint32_t max_pix_clk = stream->link->dongle_max_pix_clk * 10;struct dpcd_caps *dpcd_caps = &link->dpcd_caps;/* A hack to avoid failing any modes for EDID override feature on
@@ -2151,7 +2151,7 @@ enum dc_status dc_link_validate_mode_timing(return DC_OK ;/* Passive Dongle */ -if (0 != max_pix_clk && timing->pix_clk_khz > max_pix_clk) +if (0 != max_pix_clk && timing->pix_clk_100hz > max_pix_clk)return DC_EXCEED_DONGLE_CAP ;/* Active Dongle*/
@@ -2301,7 +2301,7 @@ static struct fixed31_32 get_pbn_from_timing(struct pipe_ctx *pipe_ctx)uint32_t denominator; bpc =get_color_depth (pipe_ctx->stream_res.pix_clk_params.color_depth); - kbps = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk * bpc *3 ; + kbps = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 * bpc *3 ;/* * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2 -2
@@ -1419,7 +1419,7 @@ static uint32_t bandwidth_in_kbps_from_timing(ASSERT (bits_per_channel !=0 ); - kbps = timing->pix_clk_khz; + kbps = timing->pix_clk_100hz /10 ; kbps *= bits_per_channel;if (timing->flags.Y_ONLY !=1 ) {
@@ -1461,7 +1461,7 @@ bool dp_validate_mode_timing(const struct dc_link_settings *link_setting;/*always DP fail safe mode*/ -if (timing->pix_clk_khz == (uint32_t )25175 && +if ((timing->pix_clk_100hz /10 ) == (uint32_t )25175 && timing->h_addressable == (uint32_t )640 && timing->v_addressable == (uint32_t )480 )return true;
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +2 -2
@@ -74,8 +74,8 @@ void dp_enable_link_phy(if (pipes[i].clock_source !=NULL && pipes[i].clock_source->id !=CLOCK_SOURCE_ID_DP_DTO ) { pipes[i].clock_source = dp_cs; - pipes[i].stream_res.pix_clk_params.requested_pix_clk = - pipes[i].stream->timing.pix_clk_khz; + pipes[i].stream_res.pix_clk_params.requested_pix_clk_100hz = + pipes[i].stream->timing.pix_clk_100hz; pipes[i].clock_source->funcs->program_pix_clk( pipes[i].clock_source, &pipes[i].stream_res.pix_clk_params,
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5 -5
@@ -351,8 +351,8 @@ bool resource_are_streams_timing_synchronizable( != stream2->timing.v_addressable)return false; -if (stream1->timing.pix_clk_khz - != stream2->timing.pix_clk_khz) +if (stream1->timing.pix_clk_100hz + != stream2->timing.pix_clk_100hz)return false;if (stream1->clamping.c_depth != stream2->clamping.c_depth)
@@ -1755,7 +1755,7 @@ static struct dc_stream_state *find_pll_sharable_stream(static int get_norm_pix_clk (const struct dc_crtc_timing *timing) { -uint32_t pix_clk = timing->pix_clk_khz; +uint32_t pix_clk = timing->pix_clk_100hz;uint32_t normalized_pix_clk = pix_clk;if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 )
@@ -1787,10 +1787,10 @@ static void calculate_phy_pix_clks(struct dc_stream_state *stream)/* update actual pixel clock on all streams */ if (dc_is_hdmi_signal (stream->signal)) stream->phy_pix_clk =get_norm_pix_clk ( - &stream->timing); + &stream->timing) /10 ;else stream->phy_pix_clk = - stream->timing.pix_clk_khz; + stream->timing.pix_clk_100hz /10 ;if (stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) stream->phy_pix_clk *=2 ;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2 -2
@@ -44,7 +44,7 @@ void update_stream_signal(struct dc_stream_state *stream, struct dc_sink *sink)if (dc_is_dvi_signal (stream->signal)) {if (stream->ctx->dc->caps.dual_link_dvi && - stream->timing.pix_clk_khz >TMDS_MAX_PIXEL_CLOCK && + (stream->timing.pix_clk_100hz /10 ) >TMDS_MAX_PIXEL_CLOCK && sink->sink_signal !=SIGNAL_TYPE_DVI_SINGLE_LINK ) stream->signal =SIGNAL_TYPE_DVI_DUAL_LINK ;else
@@ -361,7 +361,7 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream) stream->output_color_space); DC_LOG_DC( "\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n", - stream->timing.pix_clk_khz, + stream->timing.pix_clk_100hz / 10, stream->timing.h_total, stream->timing.v_total, stream->timing.pixel_encoding,
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 -1
@@ -730,7 +730,7 @@ struct dc_crtc_timing {uint32_t v_front_porch;uint32_t v_sync_width; -uint32_t pix_clk_khz; +uint32_t pix_clk_100hz;uint32_t vic;uint32_t hdmi_vic;
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +6 -6
@@ -194,8 +194,8 @@ static uint32_t get_max_pixel_clock_for_all_paths(struct dc_state *context)if (pipe_ctx->top_pipe)continue ; -if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk > max_pix_clk) - max_pix_clk = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; +if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 > max_pix_clk) + max_pix_clk = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 ;/* raise clock state for HBR3/2 if required. Confirmed with HW DCE/DPCS * logic for HBR3 still needs Nominal (0.8V) on VDDC rail
@@ -257,7 +257,7 @@ static int dce_set_clock( clk_mgr_dce->dentist_vco_freq_khz / 64);/* Prepare to program display clock*/ - pxl_clk_params.target_pixel_clock = requested_clk_khz; + pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz *10 ; pxl_clk_params.pll_id =CLOCK_SOURCE_ID_DFS ;if (clk_mgr_dce->dfs_bypass_active)
@@ -494,7 +494,7 @@ void dce110_fill_display_configs( stream->link->cur_link_settings.link_spread; cfg->sym_clock = stream->phy_pix_clk;/* Round v_refresh*/ - cfg->v_refresh = stream->timing.pix_clk_khz *1000 ; + cfg->v_refresh = stream->timing.pix_clk_100hz *100 ; cfg->v_refresh /= stream->timing.h_total; cfg->v_refresh = (cfg->v_refresh + stream->timing.v_total /2 ) / stream->timing.v_total;
@@ -518,7 +518,7 @@ static uint32_t dce110_get_min_vblank_time_us(const struct dc_state *context) - stream->timing.v_addressable); vertical_blank_time = vertical_blank_in_pixels - *1000 / stream->timing.pix_clk_khz; + *10000 / stream->timing.pix_clk_100hz;if (min_vertical_blank_time > vertical_blank_time) min_vertical_blank_time = vertical_blank_time;
@@ -612,7 +612,7 @@ static void dce11_pplib_apply_display_requirements( pp_display_cfg->crtc_index = pp_display_cfg->disp_configs[0 ].pipe_idx; - pp_display_cfg->line_time_in_us = timing->h_total *1000 / timing->pix_clk_khz; + pp_display_cfg->line_time_in_us = timing->h_total *10000 / timing->pix_clk_100hz; }if (memcmp (&dc->current_state->pp_display_cfg, pp_display_cfg,sizeof (*pp_display_cfg)) !=0 )
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +98 -98
390 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +3 -3
@@ -599,12 +599,12 @@ bool dce110_link_encoder_validate_dvi_output(if ((connector_signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || connector_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) && signal !=SIGNAL_TYPE_HDMI_TYPE_A && - crtc_timing->pix_clk_khz >TMDS_MAX_PIXEL_CLOCK ) + crtc_timing->pix_clk_100hz > (TMDS_MAX_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz <TMDS_MIN_PIXEL_CLOCK ) +if (crtc_timing->pix_clk_100hz < (TMDS_MIN_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz > max_pixel_clock) +if (crtc_timing->pix_clk_100hz > (max_pixel_clock *10 ))return false;/* DVI supports 6/8bpp single-link and 10/16bpp dual-link */
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +2 -2
@@ -662,7 +662,7 @@ static void dce110_stream_encoder_dvi_set_stream_attribute( cntl.signal = is_dual_link ?SIGNAL_TYPE_DVI_DUAL_LINK :SIGNAL_TYPE_DVI_SINGLE_LINK ; cntl.enable_dp_audio = false; - cntl.pixel_clock = crtc_timing->pix_clk_khz; + cntl.pixel_clock = crtc_timing->pix_clk_100hz /10 ; cntl.lanes_number = (is_dual_link) ?LANE_COUNT_EIGHT :LANE_COUNT_FOUR ; if (enc110->base.bp->funcs->encoder_control(
@@ -686,7 +686,7 @@ static void dce110_stream_encoder_lvds_set_stream_attribute( cntl.engine_id = enc110->base.id; cntl.signal =SIGNAL_TYPE_LVDS ; cntl.enable_dp_audio = false; - cntl.pixel_clock = crtc_timing->pix_clk_khz; + cntl.pixel_clock = crtc_timing->pix_clk_100hz /10 ; cntl.lanes_number =LANE_COUNT_FOUR ; if (enc110->base.bp->funcs->encoder_control(
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +10 -10
@@ -1074,7 +1074,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,/* only 3 items below are used by unblank */ params.pixel_clk_khz = - pipe_ctx->stream->timing.pix_clk_khz; + pipe_ctx->stream->timing.pix_clk_100hz /10 ; params.link_settings.link_rate = link_settings->link_rate;if (dc_is_dp_signal (pipe_ctx->stream->signal))
@@ -1160,27 +1160,27 @@ static void build_audio_output( stream->timing.flags.INTERLACE; audio_output->crtc_info.refresh_rate = - (stream->timing.pix_clk_khz*1000 )/ + (stream->timing.pix_clk_100hz*10000 )/ (stream->timing.h_total*stream->timing.v_total); audio_output->crtc_info.color_depth = stream->timing.display_color_depth; audio_output->crtc_info.requested_pixel_clock = - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; + pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 ; audio_output->crtc_info.calculated_pixel_clock = - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; + pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 ;/*for HDMI, audio ACR is with deep color ratio factor*/ if (dc_is_hdmi_signal (pipe_ctx->stream->signal) && audio_output->crtc_info.requested_pixel_clock == - stream->timing.pix_clk_khz) { + (stream->timing.pix_clk_100hz /10 )) {if (pipe_ctx->stream_res.pix_clk_params.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) { audio_output->crtc_info.requested_pixel_clock = audio_output->crtc_info.requested_pixel_clock/2 ; audio_output->crtc_info.calculated_pixel_clock = - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk/2 ; + pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz/20 ; } }
@@ -1621,8 +1621,8 @@ static uint32_t compute_pstate_blackout_duration( pstate_blackout_duration_ns =1000 * blackout_duration.value >>24 ; total_dest_line_time_ns =1000000UL * - stream->timing.h_total / - stream->timing.pix_clk_khz + + (stream->timing.h_total *10 ) / + stream->timing.pix_clk_100hz + pstate_blackout_duration_ns;return total_dest_line_time_ns;
@@ -2567,7 +2567,7 @@ static void dce110_apply_ctx_for_surface( pipe_ctx->plane_res.mi, pipe_ctx->stream->timing.h_total, pipe_ctx->stream->timing.v_total, - pipe_ctx->stream->timing.pix_clk_khz, + pipe_ctx->stream->timing.pix_clk_100hz /10 , context->stream_count);dce110_program_front_end_for_pipe (dc, pipe_ctx);
@@ -2622,7 +2622,7 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp;struct mem_input *mi = pipe_ctx->plane_res.mi;struct dc_cursor_mi_param param = { - .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_khz, + .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_100hz /10 , .ref_clk_khz = pipe_ctx->stream->ctx->dc->res_pool->ref_clock_inKhz, .viewport = pipe_ctx->plane_res.scl_data.viewport, .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +5 -5
@@ -779,7 +779,7 @@ static void get_pixel_clock_parameters(* the pixel clock normalization for hdmi up to here instead of doing it * in pll_adjust_pix_clk */ - pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; + pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz; pixel_clk_params->encoder_object_id = stream->link->link_enc->id; pixel_clk_params->signal_type = pipe_ctx->stream->signal; pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst +1 ;
@@ -797,10 +797,10 @@ static void get_pixel_clock_parameters( pixel_clk_params->color_depth =COLOR_DEPTH_888 ; }if (stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) { - pixel_clk_params->requested_pix_clk = pixel_clk_params->requested_pix_clk /2 ; + pixel_clk_params->requested_pix_clk_100hz = pixel_clk_params->requested_pix_clk_100hz /2 ; }if (stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) - pixel_clk_params->requested_pix_clk *=2 ; + pixel_clk_params->requested_pix_clk_100hz *=2 ; }
@@ -874,7 +874,7 @@ static bool dce110_validate_bandwidth( __func__, context->streams[0 ]->timing.h_addressable, context->streams[0 ]->timing.v_addressable, - context->streams[0]->timing.pix_clk_khz); + context->streams[0]->timing.pix_clk_100hz / 10);if (memcmp (&dc->current_state->bw.dce, &context->bw.dce,sizeof (context->bw.dce))) {
@@ -1055,7 +1055,7 @@ static struct pipe_ctx *dce110_acquire_underlay( pipe_ctx->plane_res.mi->funcs->allocate_mem_input (pipe_ctx->plane_res.mi, stream->timing.h_total, stream->timing.v_total, - stream->timing.pix_clk_khz, + stream->timing.pix_clk_100hz /10 , context->stream_count); color_space_to_black_color(dc,
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +4 -4
@@ -84,17 +84,17 @@ static const struct dce110_timing_generator_offsets reg_offsets[] = {#define DCP_REG (reg) (reg + tg110->offsets.dcp)#define DMIF_REG (reg) (reg + tg110->offsets.dmif) -static void program_pix_dur (struct timing_generator *tg,uint32_t pix_clk_khz) +static void program_pix_dur (struct timing_generator *tg,uint32_t pix_clk_100hz) {uint64_t pix_dur;uint32_t addr = mmDMIF_PG0_DPG_PIPE_ARBITRATION_CONTROL1 +DCE110TG_FROM_TG (tg)->offsets.dmif;uint32_t value =dm_read_reg (tg->ctx, addr); -if (pix_clk_khz ==0 ) +if (pix_clk_100hz ==0 )return ; - pix_dur =1000000000 / pix_clk_khz; + pix_dur =10000000000ull / pix_clk_100hz; set_reg_field_value( value,
@@ -110,7 +110,7 @@ static void program_timing(struct timing_generator *tg, bool use_vbios) {if (!use_vbios) -program_pix_dur (tg, timing->pix_clk_khz); +program_pix_dur (tg, timing->pix_clk_100hz);dce110_tg_program_timing (tg, timing, use_vbios); }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -2655,7 +2655,7 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)struct hubp *hubp = pipe_ctx->plane_res.hubp;struct dpp *dpp = pipe_ctx->plane_res.dpp;struct dc_cursor_mi_param param = { - .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_khz, + .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_100hz /10 , .ref_clk_khz = pipe_ctx->stream->ctx->dc->res_pool->ref_clock_inKhz, .viewport = pipe_ctx->plane_res.scl_data.viewport, .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c +1 -1
@@ -429,7 +429,7 @@ static unsigned int dcn10_get_otg_states(struct dc *dc, char *pBuf, unsigned intint pix_clk =0 ;optc1_read_otg_state (DCN10TG_FROM_TG (tg), &s); - pix_clk = dc->current_state->res_ctx.pipe_ctx[i].stream_res.pix_clk_params.requested_pix_clk; + pix_clk = dc->current_state->res_ctx.pipe_ctx[i].stream_res.pix_clk_params.requested_pix_clk_100hz /10 ;//only print if OTG master is enabled if (s.otg_enabled &1 ) {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +9 -9
@@ -543,12 +543,12 @@ bool dcn10_link_encoder_validate_dvi_output(if ((connector_signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || connector_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) && signal !=SIGNAL_TYPE_HDMI_TYPE_A && - crtc_timing->pix_clk_khz >TMDS_MAX_PIXEL_CLOCK ) + crtc_timing->pix_clk_100hz > (TMDS_MAX_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz <TMDS_MIN_PIXEL_CLOCK ) +if (crtc_timing->pix_clk_100hz < (TMDS_MIN_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz > max_pixel_clock) +if (crtc_timing->pix_clk_100hz > (max_pixel_clock *10 ))return false;/* DVI supports 6/8bpp single-link and 10/16bpp dual-link */
@@ -571,7 +571,7 @@ bool dcn10_link_encoder_validate_dvi_output(static bool dcn10_link_encoder_validate_hdmi_output (const struct dcn10_link_encoder *enc10,const struct dc_crtc_timing *crtc_timing, -int adjusted_pix_clk_khz) +int adjusted_pix_clk_100hz) {enum dc_color_depth max_deep_color = enc10->base.features.max_hdmi_deep_color;
@@ -581,11 +581,11 @@ static bool dcn10_link_encoder_validate_hdmi_output(if (crtc_timing->display_color_depth <COLOR_DEPTH_888 )return false; -if (adjusted_pix_clk_khz <TMDS_MIN_PIXEL_CLOCK ) +if (adjusted_pix_clk_100hz < (TMDS_MIN_PIXEL_CLOCK *10 ))return false; -if ((adjusted_pix_clk_khz ==0 ) || - (adjusted_pix_clk_khz > enc10->base.features.max_hdmi_pixel_clock)) +if ((adjusted_pix_clk_100hz ==0 ) || + (adjusted_pix_clk_100hz > (enc10->base.features.max_hdmi_pixel_clock *10 )))return false;/* DCE11 HW does not support 420 */
@@ -594,7 +594,7 @@ static bool dcn10_link_encoder_validate_hdmi_output(return false;if (!enc10->base.features.flags.bits.HDMI_6GB_EN && - adjusted_pix_clk_khz >=300000 ) + adjusted_pix_clk_100hz >=3000000 )return false;if (enc10->base.ctx->dc->debug.hdmi20_disable && crtc_timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 )
@@ -746,7 +746,7 @@ bool dcn10_link_encoder_validate_output_with_stream( is_valid =dcn10_link_encoder_validate_hdmi_output ( enc10, &stream->timing, - stream->phy_pix_clk); + stream->phy_pix_clk *10 );break ;case SIGNAL_TYPE_DISPLAY_PORT :case SIGNAL_TYPE_DISPLAY_PORT_MST :
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +1 -1
@@ -126,7 +126,7 @@ void optc1_program_vline_interrupt(struct optc *optc1 =DCN10TG_FROM_TG (optc);unsigned long long req_delta_tens_of_usec =div64_u64 ((vsync_delta +9999 ),10000 ); -unsigned long long pix_clk_hundreds_khz =div64_u64 ((dc_crtc_timing->pix_clk_khz +99 ),100 ); +unsigned long long pix_clk_hundreds_khz =div64_u64 ((dc_crtc_timing->pix_clk_100hz +999 ),1000 );uint32_t req_delta_lines = (uint32_t )div64_u64 ( (req_delta_tens_of_usec * pix_clk_hundreds_khz + dc_crtc_timing->h_total -1 ), dc_crtc_timing->h_total);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +3 -3
@@ -974,7 +974,7 @@ static void get_pixel_clock_parameters( struct pixel_clk_params *pixel_clk_params) {const struct dc_stream_state *stream = pipe_ctx->stream; - pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; + pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz; pixel_clk_params->encoder_object_id = stream->link->link_enc->id; pixel_clk_params->signal_type = pipe_ctx->stream->signal; pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst +1 ;
@@ -991,9 +991,9 @@ static void get_pixel_clock_parameters( pixel_clk_params->color_depth =COLOR_DEPTH_888 ;if (stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) - pixel_clk_params->requested_pix_clk /=2 ; + pixel_clk_params->requested_pix_clk_100hz /=2 ;if (stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) - pixel_clk_params->requested_pix_clk *=2 ; + pixel_clk_params->requested_pix_clk_100hz *=2 ; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +1 -1
@@ -594,7 +594,7 @@ void enc1_stream_encoder_dvi_set_stream_attribute( cntl.signal = is_dual_link ?SIGNAL_TYPE_DVI_DUAL_LINK :SIGNAL_TYPE_DVI_SINGLE_LINK ; cntl.enable_dp_audio = false; - cntl.pixel_clock = crtc_timing->pix_clk_khz; + cntl.pixel_clock = crtc_timing->pix_clk_100hz /10 ; cntl.lanes_number = (is_dual_link) ?LANE_COUNT_EIGHT :LANE_COUNT_FOUR ; if (enc1->base.bp->funcs->encoder_control(
drivers/gpu/drm/amd/display/dc/inc/clock_source.h +4 -4
@@ -78,7 +78,7 @@ struct csdp_ref_clk_ds_params { };struct pixel_clk_params { -uint32_t requested_pix_clk;/* in KHz */ +uint32_t requested_pix_clk_100hz;/*> Requested Pixel Clock * (based on Video Timing standard used for requested mode)*/ uint32_t requested_sym_clk;/* in KHz */
@@ -104,9 +104,9 @@ struct pixel_clk_params {* with actually calculated Clock and reference Crystal frequency */ struct pll_settings { -uint32_t actual_pix_clk; -uint32_t adjusted_pix_clk; -uint32_t calculated_pix_clk; +uint32_t actual_pix_clk_100hz; +uint32_t adjusted_pix_clk_100hz; +uint32_t calculated_pix_clk_100hz;uint32_t vco_freq;uint32_t reference_freq;uint32_t reference_divider;
drivers/gpu/drm/amd/display/include/bios_parser_types.h +2 -2
@@ -210,8 +210,8 @@ struct bp_pixel_clock_parameters {/* signal_type -> Encoder Mode - needed by VBIOS Exec table */ enum signal_type signal_type;/* Adjusted Pixel Clock (after VBIOS exec table) -* that becomes Target Pixel Clock (KHz) */ -uint32_t target_pixel_clock; +* that becomes Target Pixel Clock (100 Hz units) */ +uint32_t target_pixel_clock_100hz;/* Calculated Reference divider of Display PLL */ uint32_t reference_divider;/* Calculated Feedback divider of Display PLL */
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +6 -6
@@ -108,8 +108,8 @@ static unsigned int calc_duration_in_us_from_v_total( {unsigned int duration_in_us = (unsigned int )(div64_u64 (((unsigned long long )(v_total) - *1000 ) * stream->timing.h_total, - stream->timing.pix_clk_khz)); + *10000 ) * stream->timing.h_total, + stream->timing.pix_clk_100hz));return duration_in_us; }
@@ -126,7 +126,7 @@ static unsigned int calc_v_total_from_refresh( refresh_in_uhz))); v_total =div64_u64 (div64_u64 (((unsigned long long )( - frame_duration_in_ns) * stream->timing.pix_clk_khz), + frame_duration_in_ns) * (stream->timing.pix_clk_100hz /10 )), stream->timing.h_total),1000000 );/* v_total cannot be less than nominal */
@@ -152,7 +152,7 @@ static unsigned int calc_v_total_from_duration( duration_in_us = vrr->max_duration_in_us; v_total =div64_u64 (div64_u64 (((unsigned long long )( - duration_in_us) * stream->timing.pix_clk_khz), + duration_in_us) * (stream->timing.pix_clk_100hz /10 )), stream->timing.h_total),1000 );/* v_total cannot be less than nominal */
@@ -227,7 +227,7 @@ static void update_v_total_for_static_ramp( } v_total =div64_u64 (div64_u64 (((unsigned long long )( - current_duration_in_us) * stream->timing.pix_clk_khz), + current_duration_in_us) * (stream->timing.pix_clk_100hz /10 )), stream->timing.h_total),1000 ); in_out_vrr->adjust.v_total_min = v_total;
@@ -972,7 +972,7 @@ unsigned long long mod_freesync_calc_nominal_field_rate(unsigned long long nominal_field_rate_in_uhz =0 ;/* Calculate nominal field rate for stream */ - nominal_field_rate_in_uhz = stream->timing.pix_clk_khz; + nominal_field_rate_in_uhz = stream->timing.pix_clk_100hz /10 ; nominal_field_rate_in_uhz *=1000ULL *1000ULL *1000ULL ; nominal_field_rate_in_uhz =div_u64 (nominal_field_rate_in_uhz, stream->timing.h_total);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1544569071-7114-30-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 29/45] drm/amd/display: Use 100 Hz precision for pipe pixel clocks
Am 11.12.18 um 23:57 schrieb [email protected]:
Quoted 9 lines
From: Ken Chalmers <[email protected]>
[Why]
Users would like more accurate pixel clocks, especially for fractional "TV" frame rates like 59.94 Hz.[How]
Store and communicate pixel clocks with 100 Hz accuracy fromdc_crtc_timingthrough to BIOS command table setpixelclock call.
Why not directly use Hz?
I mean we don't have any pixel clocks above 4GHz, don't we? So a 32bit integer should be a perfect fit.
Christian.
Quoted 1,359 lines
Signed-off-by Ken Chalmers <[email protected]>Reviewed-by Charlene Liu <[email protected]>Acked-by Leo Li <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- .../gpu/drm/amd/display/dc/bios/command_table.c | 19 +- .../gpu/drm/amd/display/dc/bios/command_table2.c | 6 +- drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 10 +- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 10 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 22 +-- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 10 +- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 12 +- .../gpu/drm/amd/display/dc/dce/dce_clock_source.c | 196 ++++++++++----------- .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 6 +- .../drm/amd/display/dc/dce/dce_stream_encoder.c | 4 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 20 +-- .../drm/amd/display/dc/dce110/dce110_resource.c | 10 +- .../amd/display/dc/dce80/dce80_timing_generator.c | 8 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- .../display/dc/dcn10/dcn10_hw_sequencer_debug.c | 2 +- .../drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 18 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 6 +- .../amd/display/dc/dcn10/dcn10_stream_encoder.c | 2 +- drivers/gpu/drm/amd/display/dc/inc/clock_source.h | 8 +- .../drm/amd/display/include/bios_parser_types.h | 4 +- .../drm/amd/display/modules/freesync/freesync.c | 12 +- 29 files changed, 206 insertions(+), 209 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4
-4@@ -2554,7 +2554,7 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing)* according to HDMI spec, we use YCbCr709 and YCbCr601 * respectively */ -if (dc_crtc_timing->pix_clk_khz >27030 ) { +if (dc_crtc_timing->pix_clk_100hz >270300 ) {if (dc_crtc_timing->flags.Y_ONLY) color_space =COLOR_SPACE_YCBCR709_LIMITED ;@@ -2597,7 +2597,7 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_if (timing_out->display_color_depth <=COLOR_DEPTH_888 )return ; do { - normalized_clk = timing_out->pix_clk_khz; + normalized_clk = timing_out->pix_clk_100hz / 10; /* YCbCr 4:2:0 requires additional adjustment of 1/2 */ if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420) normalized_clk /= 2;@@ -2678,7 +2678,7 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream, mode_in->crtc_vsync_start - mode_in->crtc_vdisplay; timing_out->v_sync_width = mode_in->crtc_vsync_end - mode_in->crtc_vsync_start; - timing_out->pix_clk_khz = mode_in->crtc_clock; + timing_out->pix_clk_100hz = mode_in->crtc_clock *10 ; timing_out->aspect_ratio =get_aspect_ratio (mode_in); stream->output_color_space =get_output_color_space (timing_out);@@ -2806,7 +2806,7 @@ static void set_master_stream(struct dc_stream_state *stream_set[],if (stream_set[j] && stream_set[j]->triggered_crtc_reset.enabled) {int refresh_rate =0 ; - refresh_rate = (stream_set[j]->timing.pix_clk_khz*1000 )/ + refresh_rate = (stream_set[j]->timing.pix_clk_100hz*100 )/ (stream_set[j]->timing.h_total*stream_set[j]->timing.v_total);if (refresh_rate > highest_rfr) { highest_rfr = refresh_rate;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1
-1@@ -205,7 +205,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( mst_port = aconnector->port;if (enable) { - clock = stream->timing.pix_clk_khz; + clock = stream->timing.pix_clk_100hz /10 ;switch (stream->timing.display_color_depth) {drivers/gpu/drm/amd/display/dc/bios/command_table.c +9
-10@@ -964,9 +964,9 @@ static enum bp_result set_pixel_clock_v3( allocation.sPCLKInput.ucPostDiv = (uint8_t )bp_params->pixel_clock_post_divider; -/* We need to convert from KHz units into 10KHz units */ +/* We need to convert from 100Hz units into 10KHz units */ allocation.sPCLKInput.usPixelClock = -cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock /10 )); +cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock_100hz /100 )); params = (PIXEL_CLOCK_PARAMETERS_V3 *)&allocation.sPCLKInput; params->ucTransmitterId =@@ -1042,9 +1042,9 @@ static enum bp_result set_pixel_clock_v5( (uint8_t )bp->cmd_helper->encoder_mode_bp_to_atom ( bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ +/* We need to convert from 100Hz units into 10KHz units */ clk.sPCLKInput.usPixelClock = -cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock /10 )); +cpu_to_le16 ((uint16_t )(bp_params->target_pixel_clock_100hz /100 ));if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) clk.sPCLKInput.ucMiscInfo |=@@ -1118,9 +1118,9 @@ static enum bp_result set_pixel_clock_v6( (uint8_t ) bp->cmd_helper->encoder_mode_bp_to_atom ( bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ +/* We need to convert from 100 Hz units into 10KHz units */ clk.sPCLKInput.ulCrtcPclkFreq.ulPixelClock = -cpu_to_le32 (bp_params->target_pixel_clock /10 ); +cpu_to_le32 (bp_params->target_pixel_clock_100hz /100 );if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) { clk.sPCLKInput.ucMiscInfo |=@@ -1182,8 +1182,7 @@ static enum bp_result set_pixel_clock_v7( clk.ucTransmitterID = bp->cmd_helper->encoder_id_to_atom (dal_graphics_object_id_get_encoder_id (bp_params->encoder_object_id)); clk.ucEncoderMode = (uint8_t ) bp->cmd_helper->encoder_mode_bp_to_atom (bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ - clk.ulPixelClock =cpu_to_le32 (bp_params->target_pixel_clock *10 ); + clk.ulPixelClock =cpu_to_le32 (bp_params->target_pixel_clock_100hz); clk.ucDeepColorRatio = (uint8_t ) bp->cmd_helper->transmitter_color_depth_to_atom (bp_params->color_depth);@@ -2164,7 +2163,7 @@ static enum bp_result program_clock_v5(/* We need to convert from KHz units into 10KHz units */ params.sPCLKInput.ucPpll = (uint8_t ) atom_pll_id; params.sPCLKInput.usPixelClock = -cpu_to_le16 ((uint16_t ) (bp_params->target_pixel_clock /10 )); +cpu_to_le16 ((uint16_t ) (bp_params->target_pixel_clock_100hz /100 )); params.sPCLKInput.ucCRTC = (uint8_t )ATOM_CRTC_INVALID ;if (bp_params->flags.SET_EXTERNAL_REF_DIV_SRC)@@ -2196,7 +2195,7 @@ static enum bp_result program_clock_v6(/* We need to convert from KHz units into 10KHz units */ params.sPCLKInput.ucPpll = (uint8_t )atom_pll_id; params.sPCLKInput.ulDispEngClkFreq = -cpu_to_le32 (bp_params->target_pixel_clock /10 ); +cpu_to_le32 (bp_params->target_pixel_clock_100hz /100 );if (bp_params->flags.SET_EXTERNAL_REF_DIV_SRC) params.sPCLKInput.ucMiscInfo |=PIXEL_CLOCK_MISC_REF_DIV_SRC ;drivers/gpu/drm/amd/display/dc/bios/command_table2.c +2
-4@@ -301,9 +301,7 @@ static enum bp_result set_pixel_clock_v7( cmd_helper->encoder_mode_bp_to_atom ( bp_params->signal_type, false); -/* We need to convert from KHz units into 10KHz units */ - clk.pixclk_100hz =cpu_to_le32 (bp_params->target_pixel_clock * -10 ); + clk.pixclk_100hz =cpu_to_le32 (bp_params->target_pixel_clock_100hz); clk.deep_color_ratio = (uint8_t) bp->cmd_helper->@@ -311,7 +309,7 @@ static enum bp_result set_pixel_clock_v7( bp_params->color_depth);DC_LOG_BIOS ("%s:program display clock = %d" \"colorDepth = %d\n" , __func__,\ - bp_params->target_pixel_clock, bp_params->color_depth); + bp_params->target_pixel_clock_100hz, bp_params->color_depth);if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) clk.miscinfo |=PIXEL_CLOCK_V7_MISC_FORCE_PROG_PPLL ;drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +5
-5@@ -2792,7 +2792,7 @@ static void populate_initial_data( data->lpt_en[num_displays +4 ] = false; data->h_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.h_total); data->v_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.v_total); - data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pipe[i].stream->timing.pix_clk_khz,1000 ); + data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pipe[i].stream->timing.pix_clk_100hz,10000 ); data->src_width[num_displays +4 ] =bw_int_to_fixed (pipe[i].plane_res.scl_data.viewport.width); data->pitch_in_pixels[num_displays +4 ] = data->src_width[num_displays +4 ]; data->src_height[num_displays +4 ] =bw_int_to_fixed (pipe[i].plane_res.scl_data.viewport.height);@@ -2881,7 +2881,7 @@ static void populate_initial_data(/* Pipes without underlay after */ for (i =0 ; i < pipe_count; i++) { -unsigned int pixel_clock_khz; +unsigned int pixel_clock_100hz;if (!pipe[i].stream || pipe[i].bottom_pipe)continue ;@@ -2890,10 +2890,10 @@ static void populate_initial_data( data->lpt_en[num_displays +4 ] = false; data->h_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.h_total); data->v_total[num_displays +4 ] =bw_int_to_fixed (pipe[i].stream->timing.v_total); - pixel_clock_khz = pipe[i].stream->timing.pix_clk_khz; + pixel_clock_100hz = pipe[i].stream->timing.pix_clk_100hz;if (pipe[i].stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) - pixel_clock_khz *=2 ; - data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pixel_clock_khz,1000 ); + pixel_clock_100hz *=2 ; + data->pixel_rate[num_displays +4 ] =bw_frc_to_fixed (pixel_clock_100hz,10000 );if (pipe[i].plane_state) { data->src_width[num_displays +4 ] =bw_int_to_fixed (pipe[i].plane_res.scl_data.viewport.width); data->pitch_in_pixels[num_displays +4 ] = data->src_width[num_displays +4 ];drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +5
-5@@ -416,7 +416,7 @@ static void pipe_ctx_to_e2e_pipe_params ( - pipe->stream->timing.v_addressable - pipe->stream->timing.v_border_bottom - pipe->stream->timing.v_border_top; - input->dest.pixel_rate_mhz = pipe->stream->timing.pix_clk_khz/1000.0 ; + input->dest.pixel_rate_mhz = pipe->stream->timing.pix_clk_100hz/10000.0 ; input->dest.vstartup_start = pipe->pipe_dlg_param.vstartup_start; input->dest.vupdate_offset = pipe->pipe_dlg_param.vupdate_offset; input->dest.vupdate_offset = pipe->pipe_dlg_param.vupdate_offset;@@ -663,9 +663,9 @@ static void hack_disable_optional_pipe_split(struct dcn_bw_internal_vars *v) }static void hack_force_pipe_split (struct dcn_bw_internal_vars *v, -unsigned int pixel_rate_khz) +unsigned int pixel_rate_100hz) { -float pixel_rate_mhz = pixel_rate_khz /1000 ; +float pixel_rate_mhz = pixel_rate_100hz /10000 ;/* * force enabling pipe split by lower dpp clock for DPM0 to just @@ -688,7 +688,7 @@ static void hack_bounding_box(struct dcn_bw_internal_vars *v,if (context->stream_count ==1 && dbg->force_single_disp_pipe_split) -hack_force_pipe_split (v, context->streams[0 ]->timing.pix_clk_khz); +hack_force_pipe_split (v, context->streams[0 ]->timing.pix_clk_100hz); } bool dcn_validate_bandwidth(@@ -845,7 +845,7 @@ bool dcn_validate_bandwidth( v->v_sync_plus_back_porch[input_idx] = pipe->stream->timing.v_total - v->vactive[input_idx] - pipe->stream->timing.v_front_porch; - v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_khz/1000.0 ; + v->pixel_clock[input_idx] = pipe->stream->timing.pix_clk_100hz/10000.0 ;if (pipe->stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) v->pixel_clock[input_idx] *=2 ;if (!pipe->plane_state) {drivers/gpu/drm/amd/display/dc/core/dc.c +1
-1@@ -1083,7 +1083,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c context->streams[i]->timing.v_addressable, context->streams[i]->timing.h_total, context->streams[i]->timing.v_total, - context->streams[i]->timing.pix_clk_khz); + context->streams[i]->timing.pix_clk_100hz / 10); }dc_enable_stereo (dc, context, dc_streams, context->stream_count);drivers/gpu/drm/amd/display/dc/core/dc_link.c +11
-11@@ -1934,7 +1934,7 @@ static void enable_link_hdmi(struct pipe_ctx *pipe_ctx) && (stream->timing.v_addressable ==480 );if (stream->phy_pix_clk ==0 ) - stream->phy_pix_clk = stream->timing.pix_clk_khz; + stream->phy_pix_clk = stream->timing.pix_clk_100hz /10 ;if (stream->phy_pix_clk >340000 ) is_over_340mhz = true;@@ -1988,7 +1988,7 @@ static void enable_link_lvds(struct pipe_ctx *pipe_ctx)struct dc_link *link = stream->link;if (stream->phy_pix_clk ==0 ) - stream->phy_pix_clk = stream->timing.pix_clk_khz; + stream->phy_pix_clk = stream->timing.pix_clk_100hz /10 ;memset (&stream->link->cur_link_settings,0 ,sizeof (struct dc_link_settings ));@@ -2063,7 +2063,7 @@ static bool dp_active_dongle_validate_timing(const struct dc_crtc_timing *timing, const struct dpcd_caps *dpcd_caps) { - unsigned int required_pix_clk = timing->pix_clk_khz; + unsigned int required_pix_clk_100hz = timing->pix_clk_100hz;const struct dc_dongle_caps *dongle_caps = &dpcd_caps->dongle_caps;switch (dpcd_caps->dongle_type) {@@ -2103,9 +2103,9 @@ static bool dp_active_dongle_validate_timing(/* Check Color Depth and Pixel Clock */ if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) - required_pix_clk /=2 ; + required_pix_clk_100hz /=2 ;else if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR422 ) - required_pix_clk = required_pix_clk *2 /3 ; + required_pix_clk_100hz = required_pix_clk_100hz *2 /3 ;switch (timing->display_color_depth) {case COLOR_DEPTH_666 :@@ -2115,12 +2115,12 @@ static bool dp_active_dongle_validate_timing(case COLOR_DEPTH_101010 :if (dongle_caps->dp_hdmi_max_bpc <10 )return false; - required_pix_clk = required_pix_clk *10 /8 ; + required_pix_clk_100hz = required_pix_clk_100hz *10 /8 ;break ;case COLOR_DEPTH_121212 :if (dongle_caps->dp_hdmi_max_bpc <12 )return false; - required_pix_clk = required_pix_clk *12 /8 ; + required_pix_clk_100hz = required_pix_clk_100hz *12 /8 ;break ;case COLOR_DEPTH_141414 :@@ -2130,7 +2130,7 @@ static bool dp_active_dongle_validate_timing(return false; } -if (required_pix_clk > dongle_caps->dp_hdmi_max_pixel_clk) +if (required_pix_clk_100hz > (dongle_caps->dp_hdmi_max_pixel_clk *10 ))return false;return true;@@ -2141,7 +2141,7 @@ enum dc_status dc_link_validate_mode_timing(struct dc_link *link, const struct dc_crtc_timing *timing) { - uint32_t max_pix_clk = stream->link->dongle_max_pix_clk; + uint32_t max_pix_clk = stream->link->dongle_max_pix_clk * 10;struct dpcd_caps *dpcd_caps = &link->dpcd_caps;/* A hack to avoid failing any modes for EDID override feature on @@ -2151,7 +2151,7 @@ enum dc_status dc_link_validate_mode_timing(return DC_OK ;/* Passive Dongle */ -if (0 != max_pix_clk && timing->pix_clk_khz > max_pix_clk) +if (0 != max_pix_clk && timing->pix_clk_100hz > max_pix_clk)return DC_EXCEED_DONGLE_CAP ;/* Active Dongle*/ @@ -2301,7 +2301,7 @@ static struct fixed31_32 get_pbn_from_timing(struct pipe_ctx *pipe_ctx)uint32_t denominator; bpc =get_color_depth (pipe_ctx->stream_res.pix_clk_params.color_depth); - kbps = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk * bpc *3 ; + kbps = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 * bpc *3 ;/* * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2
-2@@ -1419,7 +1419,7 @@ static uint32_t bandwidth_in_kbps_from_timing(ASSERT (bits_per_channel !=0 ); - kbps = timing->pix_clk_khz; + kbps = timing->pix_clk_100hz /10 ; kbps *= bits_per_channel;if (timing->flags.Y_ONLY !=1 ) {@@ -1461,7 +1461,7 @@ bool dp_validate_mode_timing(const struct dc_link_settings *link_setting;/*always DP fail safe mode*/ -if (timing->pix_clk_khz == (uint32_t )25175 && +if ((timing->pix_clk_100hz /10 ) == (uint32_t )25175 && timing->h_addressable == (uint32_t )640 && timing->v_addressable == (uint32_t )480 )return true;drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +2
-2@@ -74,8 +74,8 @@ void dp_enable_link_phy(if (pipes[i].clock_source !=NULL && pipes[i].clock_source->id !=CLOCK_SOURCE_ID_DP_DTO ) { pipes[i].clock_source = dp_cs; - pipes[i].stream_res.pix_clk_params.requested_pix_clk = - pipes[i].stream->timing.pix_clk_khz; + pipes[i].stream_res.pix_clk_params.requested_pix_clk_100hz = + pipes[i].stream->timing.pix_clk_100hz; pipes[i].clock_source->funcs->program_pix_clk( pipes[i].clock_source, &pipes[i].stream_res.pix_clk_params,drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5
-5@@ -351,8 +351,8 @@ bool resource_are_streams_timing_synchronizable( != stream2->timing.v_addressable)return false; -if (stream1->timing.pix_clk_khz - != stream2->timing.pix_clk_khz) +if (stream1->timing.pix_clk_100hz + != stream2->timing.pix_clk_100hz)return false;if (stream1->clamping.c_depth != stream2->clamping.c_depth)@@ -1755,7 +1755,7 @@ static struct dc_stream_state *find_pll_sharable_stream(static int get_norm_pix_clk (const struct dc_crtc_timing *timing) { -uint32_t pix_clk = timing->pix_clk_khz; +uint32_t pix_clk = timing->pix_clk_100hz;uint32_t normalized_pix_clk = pix_clk;if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 )@@ -1787,10 +1787,10 @@ static void calculate_phy_pix_clks(struct dc_stream_state *stream)/* update actual pixel clock on all streams */ if (dc_is_hdmi_signal (stream->signal)) stream->phy_pix_clk =get_norm_pix_clk ( - &stream->timing); + &stream->timing) /10 ;else stream->phy_pix_clk = - stream->timing.pix_clk_khz; + stream->timing.pix_clk_100hz /10 ;if (stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) stream->phy_pix_clk *=2 ;drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2
-2@@ -44,7 +44,7 @@ void update_stream_signal(struct dc_stream_state *stream, struct dc_sink *sink)if (dc_is_dvi_signal (stream->signal)) {if (stream->ctx->dc->caps.dual_link_dvi && - stream->timing.pix_clk_khz >TMDS_MAX_PIXEL_CLOCK && + (stream->timing.pix_clk_100hz /10 ) >TMDS_MAX_PIXEL_CLOCK && sink->sink_signal !=SIGNAL_TYPE_DVI_SINGLE_LINK ) stream->signal =SIGNAL_TYPE_DVI_DUAL_LINK ;else @@ -361,7 +361,7 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream) stream->output_color_space); DC_LOG_DC( "\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n", - stream->timing.pix_clk_khz, + stream->timing.pix_clk_100hz / 10, stream->timing.h_total, stream->timing.v_total, stream->timing.pixel_encoding,drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1
-1@@ -730,7 +730,7 @@ struct dc_crtc_timing {uint32_t v_front_porch;uint32_t v_sync_width; -uint32_t pix_clk_khz; +uint32_t pix_clk_100hz;uint32_t vic;uint32_t hdmi_vic;drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +6
-6@@ -194,8 +194,8 @@ static uint32_t get_max_pixel_clock_for_all_paths(struct dc_state *context)if (pipe_ctx->top_pipe)continue ; -if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk > max_pix_clk) - max_pix_clk = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; +if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 > max_pix_clk) + max_pix_clk = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 ;/* raise clock state for HBR3/2 if required. Confirmed with HW DCE/DPCS * logic for HBR3 still needs Nominal (0.8V) on VDDC rail @@ -257,7 +257,7 @@ static int dce_set_clock( clk_mgr_dce->dentist_vco_freq_khz / 64);/* Prepare to program display clock*/ - pxl_clk_params.target_pixel_clock = requested_clk_khz; + pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz *10 ; pxl_clk_params.pll_id =CLOCK_SOURCE_ID_DFS ;if (clk_mgr_dce->dfs_bypass_active)@@ -494,7 +494,7 @@ void dce110_fill_display_configs( stream->link->cur_link_settings.link_spread; cfg->sym_clock = stream->phy_pix_clk;/* Round v_refresh*/ - cfg->v_refresh = stream->timing.pix_clk_khz *1000 ; + cfg->v_refresh = stream->timing.pix_clk_100hz *100 ; cfg->v_refresh /= stream->timing.h_total; cfg->v_refresh = (cfg->v_refresh + stream->timing.v_total /2 ) / stream->timing.v_total;@@ -518,7 +518,7 @@ static uint32_t dce110_get_min_vblank_time_us(const struct dc_state *context) - stream->timing.v_addressable); vertical_blank_time = vertical_blank_in_pixels - *1000 / stream->timing.pix_clk_khz; + *10000 / stream->timing.pix_clk_100hz;if (min_vertical_blank_time > vertical_blank_time) min_vertical_blank_time = vertical_blank_time;@@ -612,7 +612,7 @@ static void dce11_pplib_apply_display_requirements( pp_display_cfg->crtc_index = pp_display_cfg->disp_configs[0 ].pipe_idx; - pp_display_cfg->line_time_in_us = timing->h_total *1000 / timing->pix_clk_khz; + pp_display_cfg->line_time_in_us = timing->h_total *10000 / timing->pix_clk_100hz; }if (memcmp (&dc->current_state->pp_display_cfg, pp_display_cfg,sizeof (*pp_display_cfg)) !=0 )drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +98
-98@@ -108,28 +108,28 @@ static const struct spread_spectrum_data *get_ss_data_entry( }/** -* Function: calculate_fb_and_fractional_fb_divider -* -* * DESCRIPTION: Calculates feedback and fractional feedback dividers values -* -*PARAMETERS: -* targetPixelClock Desired frequency in 10 KHz -* ref_divider Reference divider (already known) -* postDivider Post Divider (already known) -* feedback_divider_param Pointer where to store -* calculated feedback divider value -* fract_feedback_divider_param Pointer where to store -* calculated fract feedback divider value -* -*RETURNS: -* It fills the locations pointed by feedback_divider_param -* and fract_feedback_divider_param -* It returns - true if feedback divider not 0 -* - false should never happen) -*/ +* Function: calculate_fb_and_fractional_fb_divider +* +* * DESCRIPTION: Calculates feedback and fractional feedback dividers values +* +*PARAMETERS: +* targetPixelClock Desired frequency in 100 Hz +* ref_divider Reference divider (already known) +* postDivider Post Divider (already known) +* feedback_divider_param Pointer where to store +* calculated feedback divider value +* fract_feedback_divider_param Pointer where to store +* calculated fract feedback divider value +* +*RETURNS: +* It fills the locations pointed by feedback_divider_param +* and fract_feedback_divider_param +* It returns - true if feedback divider not 0 +* - false should never happen) +*/ static bool calculate_fb_and_fractional_fb_divider( struct calc_pll_clock_source *calc_pll_cs, - uint32_t target_pix_clk_khz, + uint32_t target_pix_clk_100hz, uint32_t ref_divider, uint32_t post_divider, uint32_t *feedback_divider_param,@@ -138,11 +138,11 @@ static bool calculate_fb_and_fractional_fb_divider(uint64_t feedback_divider; feedback_divider = - (uint64_t )target_pix_clk_khz * ref_divider * post_divider; + (uint64_t )target_pix_clk_100hz * ref_divider * post_divider; feedback_divider *=10 ;/* additional factor, since we divide by 10 afterwards */ feedback_divider *= (uint64_t )(calc_pll_cs->fract_fb_divider_factor); - feedback_divider =div_u64 (feedback_divider, calc_pll_cs->ref_freq_khz); + feedback_divider =div_u64 (feedback_divider, calc_pll_cs->ref_freq_khz *10ull );/*Round to the number of precision * The following code replace the old code (ullfeedbackDivider + 5)/10 @@ -195,36 +195,36 @@ static bool calc_fb_divider_checking_tolerance( {uint32_t feedback_divider;uint32_t fract_feedback_divider; -uint32_t actual_calculated_clock_khz; +uint32_t actual_calculated_clock_100hz;uint32_t abs_err; -uint64_t actual_calc_clk_khz; +uint64_t actual_calc_clk_100hz;calculate_fb_and_fractional_fb_divider ( calc_pll_cs, - pll_settings->adjusted_pix_clk, + pll_settings->adjusted_pix_clk_100hz, ref_divider, post_divider, &feedback_divider, &fract_feedback_divider);/*Actual calculated value*/ - actual_calc_clk_khz = (uint64_t )feedback_divider * + actual_calc_clk_100hz = (uint64_t )feedback_divider * calc_pll_cs->fract_fb_divider_factor + fract_feedback_divider; - actual_calc_clk_khz *= calc_pll_cs->ref_freq_khz; - actual_calc_clk_khz = -div_u64 (actual_calc_clk_khz, + actual_calc_clk_100hz *= calc_pll_cs->ref_freq_khz *10 ; + actual_calc_clk_100hz = +div_u64 (actual_calc_clk_100hz, ref_divider * post_divider * calc_pll_cs->fract_fb_divider_factor); - actual_calculated_clock_khz = (uint32_t )(actual_calc_clk_khz); + actual_calculated_clock_100hz = (uint32_t )(actual_calc_clk_100hz); - abs_err = (actual_calculated_clock_khz > - pll_settings->adjusted_pix_clk) - ? actual_calculated_clock_khz - - pll_settings->adjusted_pix_clk - : pll_settings->adjusted_pix_clk - - actual_calculated_clock_khz; + abs_err = (actual_calculated_clock_100hz > + pll_settings->adjusted_pix_clk_100hz) + ? actual_calculated_clock_100hz - + pll_settings->adjusted_pix_clk_100hz + : pll_settings->adjusted_pix_clk_100hz - + actual_calculated_clock_100hz;if (abs_err <= tolerance) {/*found good values*/ @@ -233,10 +233,10 @@ static bool calc_fb_divider_checking_tolerance( pll_settings->feedback_divider = feedback_divider; pll_settings->fract_feedback_divider = fract_feedback_divider; pll_settings->pix_clk_post_divider = post_divider; - pll_settings->calculated_pix_clk = - actual_calculated_clock_khz; + pll_settings->calculated_pix_clk_100hz = + actual_calculated_clock_100hz; pll_settings->vco_freq = - actual_calculated_clock_khz * post_divider; + actual_calculated_clock_100hz * post_divider /10 ;return true; }return false;@@ -257,8 +257,8 @@ static bool calc_pll_dividers_in_range(/* This is err_tolerance / 10000 = 0.0025 - acceptable error of 0.25% * This is errorTolerance / 10000 = 0.0001 - acceptable error of 0.01%*/ - tolerance = (pll_settings->adjusted_pix_clk * err_tolerance) / -10000 ; + tolerance = (pll_settings->adjusted_pix_clk_100hz * err_tolerance) / +100000 ;if (tolerance <CALC_PLL_CLK_SRC_ERR_TOLERANCE ) tolerance =CALC_PLL_CLK_SRC_ERR_TOLERANCE ;@@ -294,7 +294,7 @@ static uint32_t calculate_pixel_clock_pll_dividers(uint32_t min_ref_divider;uint32_t max_ref_divider; -if (pll_settings->adjusted_pix_clk ==0 ) { +if (pll_settings->adjusted_pix_clk_100hz ==0 ) {DC_LOG_ERROR ("%s Bad requested pixel clock" , __func__);return MAX_PLL_CALC_ERROR ;@@ -306,21 +306,21 @@ static uint32_t calculate_pixel_clock_pll_dividers( max_post_divider = pll_settings->pix_clk_post_divider; }else { min_post_divider = calc_pll_cs->min_pix_clock_pll_post_divider; -if (min_post_divider * pll_settings->adjusted_pix_clk < - calc_pll_cs->min_vco_khz) { - min_post_divider = calc_pll_cs->min_vco_khz / - pll_settings->adjusted_pix_clk; +if (min_post_divider * pll_settings->adjusted_pix_clk_100hz < + calc_pll_cs->min_vco_khz *10 ) { + min_post_divider = calc_pll_cs->min_vco_khz *10 / + pll_settings->adjusted_pix_clk_100hz;if ((min_post_divider * - pll_settings->adjusted_pix_clk) < - calc_pll_cs->min_vco_khz) + pll_settings->adjusted_pix_clk_100hz) < + calc_pll_cs->min_vco_khz *10 ) min_post_divider++; } max_post_divider = calc_pll_cs->max_pix_clock_pll_post_divider; -if (max_post_divider * pll_settings->adjusted_pix_clk - > calc_pll_cs->max_vco_khz) - max_post_divider = calc_pll_cs->max_vco_khz / - pll_settings->adjusted_pix_clk; +if (max_post_divider * pll_settings->adjusted_pix_clk_100hz + > calc_pll_cs->max_vco_khz *10 ) + max_post_divider = calc_pll_cs->max_vco_khz *10 / + pll_settings->adjusted_pix_clk_100hz; }/* 2) Find Reference divider ranges @@ -392,47 +392,47 @@ static bool pll_adjust_pix_clk(struct pixel_clk_params *pix_clk_params, struct pll_settings *pll_settings) { - uint32_t actual_pix_clk_khz = 0; -uint32_t requested_clk_khz =0 ; + uint32_t actual_pix_clk_100hz = 0; +uint32_t requested_clk_100hz =0 ;struct bp_adjust_pixel_clock_parameters bp_adjust_pixel_clock_params = {0 };enum bp_result bp_result;switch (pix_clk_params->signal_type) {case SIGNAL_TYPE_HDMI_TYPE_A : { - requested_clk_khz = pix_clk_params->requested_pix_clk; + requested_clk_100hz = pix_clk_params->requested_pix_clk_100hz;if (pix_clk_params->pixel_encoding !=PIXEL_ENCODING_YCBCR422 ) {switch (pix_clk_params->color_depth) {case COLOR_DEPTH_101010 : - requested_clk_khz = (requested_clk_khz *5 ) >>2 ; + requested_clk_100hz = (requested_clk_100hz *5 ) >>2 ;break ;/* x1.25*/ case COLOR_DEPTH_121212 : - requested_clk_khz = (requested_clk_khz *6 ) >>2 ; + requested_clk_100hz = (requested_clk_100hz *6 ) >>2 ;break ;/* x1.5*/ case COLOR_DEPTH_161616 : - requested_clk_khz = requested_clk_khz *2 ; + requested_clk_100hz = requested_clk_100hz *2 ;break ;/* x2.0*/ default :break ; } } - actual_pix_clk_khz = requested_clk_khz; + actual_pix_clk_100hz = requested_clk_100hz; }break ;case SIGNAL_TYPE_DISPLAY_PORT :case SIGNAL_TYPE_DISPLAY_PORT_MST :case SIGNAL_TYPE_EDP : - requested_clk_khz = pix_clk_params->requested_sym_clk; - actual_pix_clk_khz = pix_clk_params->requested_pix_clk; + requested_clk_100hz = pix_clk_params->requested_sym_clk *10 ; + actual_pix_clk_100hz = pix_clk_params->requested_pix_clk_100hz;break ;default : - requested_clk_khz = pix_clk_params->requested_pix_clk; - actual_pix_clk_khz = pix_clk_params->requested_pix_clk; + requested_clk_100hz = pix_clk_params->requested_pix_clk_100hz; + actual_pix_clk_100hz = pix_clk_params->requested_pix_clk_100hz;break ; } - bp_adjust_pixel_clock_params.pixel_clock = requested_clk_khz; + bp_adjust_pixel_clock_params.pixel_clock = requested_clk_100hz /10 ; bp_adjust_pixel_clock_params. encoder_object_id = pix_clk_params->encoder_object_id; bp_adjust_pixel_clock_params.signal_type = pix_clk_params->signal_type;@@ -441,9 +441,9 @@ static bool pll_adjust_pix_clk( bp_result = clk_src->bios->funcs->adjust_pixel_clock ( clk_src->bios, &bp_adjust_pixel_clock_params);if (bp_result ==BP_RESULT_OK ) { - pll_settings->actual_pix_clk = actual_pix_clk_khz; - pll_settings->adjusted_pix_clk = - bp_adjust_pixel_clock_params.adjusted_pixel_clock; + pll_settings->actual_pix_clk_100hz = actual_pix_clk_100hz; + pll_settings->adjusted_pix_clk_100hz = + bp_adjust_pixel_clock_params.adjusted_pixel_clock *10 ; pll_settings->reference_divider = bp_adjust_pixel_clock_params.reference_divider; pll_settings->pix_clk_post_divider =@@ -490,7 +490,7 @@ static uint32_t dce110_get_pix_clk_dividers_helper (const struct spread_spectrum_data *ss_data =get_ss_data_entry ( clk_src, pix_clk_params->signal_type, - pll_settings->adjusted_pix_clk); + pll_settings->adjusted_pix_clk_100hz /10 );if (NULL != ss_data) pll_settings->ss_percentage = ss_data->percentage;@@ -502,13 +502,13 @@ static uint32_t dce110_get_pix_clk_dividers_helper (* to continue. */ DC_LOG_ERROR ("%s: Failed to adjust pixel clock!!" , __func__); - pll_settings->actual_pix_clk = - pix_clk_params->requested_pix_clk; - pll_settings->adjusted_pix_clk = - pix_clk_params->requested_pix_clk; + pll_settings->actual_pix_clk_100hz = + pix_clk_params->requested_pix_clk_100hz; + pll_settings->adjusted_pix_clk_100hz = + pix_clk_params->requested_pix_clk_100hz;if (dc_is_dp_signal (pix_clk_params->signal_type)) - pll_settings->adjusted_pix_clk =100000 ; + pll_settings->adjusted_pix_clk_100hz =1000000 ; }/* Calculate Dividers */ @@ -533,28 +533,28 @@ static void dce112_get_pix_clk_dividers_helper (struct pll_settings *pll_settings, struct pixel_clk_params *pix_clk_params) { - uint32_t actualPixelClockInKHz; + uint32_t actual_pixel_clock_100hz; - actualPixelClockInKHz = pix_clk_params->requested_pix_clk; + actual_pixel_clock_100hz = pix_clk_params->requested_pix_clk_100hz;/* Calculate Dividers */ if (pix_clk_params->signal_type ==SIGNAL_TYPE_HDMI_TYPE_A ) {switch (pix_clk_params->color_depth) {case COLOR_DEPTH_101010 : - actualPixelClockInKHz = (actualPixelClockInKHz *5 ) >>2 ; + actual_pixel_clock_100hz = (actual_pixel_clock_100hz *5 ) >>2 ;break ;case COLOR_DEPTH_121212 : - actualPixelClockInKHz = (actualPixelClockInKHz *6 ) >>2 ; + actual_pixel_clock_100hz = (actual_pixel_clock_100hz *6 ) >>2 ;break ;case COLOR_DEPTH_161616 : - actualPixelClockInKHz = actualPixelClockInKHz *2 ; + actual_pixel_clock_100hz = actual_pixel_clock_100hz *2 ;break ;default :break ; } } - pll_settings->actual_pix_clk = actualPixelClockInKHz; - pll_settings->adjusted_pix_clk = actualPixelClockInKHz; - pll_settings->calculated_pix_clk = pix_clk_params->requested_pix_clk; + pll_settings->actual_pix_clk_100hz = actual_pixel_clock_100hz; + pll_settings->adjusted_pix_clk_100hz = actual_pixel_clock_100hz; + pll_settings->calculated_pix_clk_100hz = pix_clk_params->requested_pix_clk_100hz; } static uint32_t dce110_get_pix_clk_dividers(@@ -567,7 +567,7 @@ static uint32_t dce110_get_pix_clk_dividers(DC_LOGGER_INIT ();if (pix_clk_params ==NULL || pll_settings ==NULL - || pix_clk_params->requested_pix_clk ==0 ) { + || pix_clk_params->requested_pix_clk_100hz ==0 ) {DC_LOG_ERROR ("%s: Invalid parameters!!\n" , __func__);return pll_calc_error;@@ -577,10 +577,10 @@ static uint32_t dce110_get_pix_clk_dividers(if (cs->id ==CLOCK_SOURCE_ID_DP_DTO || cs->id ==CLOCK_SOURCE_ID_EXTERNAL ) { - pll_settings->adjusted_pix_clk = clk_src->ext_clk_khz; - pll_settings->calculated_pix_clk = clk_src->ext_clk_khz; - pll_settings->actual_pix_clk = - pix_clk_params->requested_pix_clk; + pll_settings->adjusted_pix_clk_100hz = clk_src->ext_clk_khz *10 ; + pll_settings->calculated_pix_clk_100hz = clk_src->ext_clk_khz *10 ; + pll_settings->actual_pix_clk_100hz = + pix_clk_params->requested_pix_clk_100hz;return 0 ; }@@ -599,7 +599,7 @@ static uint32_t dce112_get_pix_clk_dividers(DC_LOGGER_INIT ();if (pix_clk_params ==NULL || pll_settings ==NULL - || pix_clk_params->requested_pix_clk ==0 ) { + || pix_clk_params->requested_pix_clk_100hz ==0 ) {DC_LOG_ERROR ("%s: Invalid parameters!!\n" , __func__);return -1 ;@@ -609,10 +609,10 @@ static uint32_t dce112_get_pix_clk_dividers(if (cs->id ==CLOCK_SOURCE_ID_DP_DTO || cs->id ==CLOCK_SOURCE_ID_EXTERNAL ) { - pll_settings->adjusted_pix_clk = clk_src->ext_clk_khz; - pll_settings->calculated_pix_clk = clk_src->ext_clk_khz; - pll_settings->actual_pix_clk = - pix_clk_params->requested_pix_clk; + pll_settings->adjusted_pix_clk_100hz = clk_src->ext_clk_khz *10 ; + pll_settings->calculated_pix_clk_100hz = clk_src->ext_clk_khz *10 ; + pll_settings->actual_pix_clk_100hz = + pix_clk_params->requested_pix_clk_100hz;return -1 ; }@@ -714,7 +714,7 @@ static bool enable_spread_spectrum( ss_data =get_ss_data_entry ( clk_src, signal, - pll_settings->calculated_pix_clk); + pll_settings->calculated_pix_clk_100hz /10 );/* Pixel clock PLL has been programmed to generate desired pixel clock, * now enable SS on pixel clock */ @@ -853,7 +853,7 @@ static bool dce110_program_pix_clk(/*ATOMBIOS expects pixel rate adjusted by deep color ratio)*/ bp_pc_params.controller_id = pix_clk_params->controller_id; bp_pc_params.pll_id = clock_source->id; - bp_pc_params.target_pixel_clock = pll_settings->actual_pix_clk; + bp_pc_params.target_pixel_clock_100hz = pll_settings->actual_pix_clk_100hz; bp_pc_params.encoder_object_id = pix_clk_params->encoder_object_id; bp_pc_params.signal_type = pix_clk_params->signal_type;@@ -903,12 +903,12 @@ static bool dce112_program_pix_clk(#if defined(CONFIG_DRM_AMD_DC_DCN1_0 )if (IS_FPGA_MAXIMUS_DC (clock_source->ctx->dce_environment)) {unsigned int inst = pix_clk_params->controller_id -CONTROLLER_ID_D0 ; -unsigned dp_dto_ref_kHz =700000 ; -unsigned clock_kHz = pll_settings->actual_pix_clk; +unsigned dp_dto_ref_100hz =7000000 ; +unsigned clock_100hz = pll_settings->actual_pix_clk_100hz;/* Set DTO values: phase = target clock, modulo = reference clock */ -REG_WRITE (PHASE [inst], clock_kHz); -REG_WRITE (MODULO [inst], dp_dto_ref_kHz); +REG_WRITE (PHASE [inst], clock_100hz); +REG_WRITE (MODULO [inst], dp_dto_ref_100hz);/* Enable DTO */ REG_UPDATE (PIXEL_RATE_CNTL [inst],DP_DTO0_ENABLE ,1 );@@ -927,7 +927,7 @@ static bool dce112_program_pix_clk(/*ATOMBIOS expects pixel rate adjusted by deep color ratio)*/ bp_pc_params.controller_id = pix_clk_params->controller_id; bp_pc_params.pll_id = clock_source->id; - bp_pc_params.target_pixel_clock = pll_settings->actual_pix_clk; + bp_pc_params.target_pixel_clock_100hz = pll_settings->actual_pix_clk_100hz; bp_pc_params.encoder_object_id = pix_clk_params->encoder_object_id; bp_pc_params.signal_type = pix_clk_params->signal_type;drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +3
-3@@ -599,12 +599,12 @@ bool dce110_link_encoder_validate_dvi_output(if ((connector_signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || connector_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) && signal !=SIGNAL_TYPE_HDMI_TYPE_A && - crtc_timing->pix_clk_khz >TMDS_MAX_PIXEL_CLOCK ) + crtc_timing->pix_clk_100hz > (TMDS_MAX_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz <TMDS_MIN_PIXEL_CLOCK ) +if (crtc_timing->pix_clk_100hz < (TMDS_MIN_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz > max_pixel_clock) +if (crtc_timing->pix_clk_100hz > (max_pixel_clock *10 ))return false;/* DVI supports 6/8bpp single-link and 10/16bpp dual-link */ drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +2
-2@@ -662,7 +662,7 @@ static void dce110_stream_encoder_dvi_set_stream_attribute( cntl.signal = is_dual_link ?SIGNAL_TYPE_DVI_DUAL_LINK :SIGNAL_TYPE_DVI_SINGLE_LINK ; cntl.enable_dp_audio = false; - cntl.pixel_clock = crtc_timing->pix_clk_khz; + cntl.pixel_clock = crtc_timing->pix_clk_100hz /10 ; cntl.lanes_number = (is_dual_link) ?LANE_COUNT_EIGHT :LANE_COUNT_FOUR ; if (enc110->base.bp->funcs->encoder_control(@@ -686,7 +686,7 @@ static void dce110_stream_encoder_lvds_set_stream_attribute( cntl.engine_id = enc110->base.id; cntl.signal =SIGNAL_TYPE_LVDS ; cntl.enable_dp_audio = false; - cntl.pixel_clock = crtc_timing->pix_clk_khz; + cntl.pixel_clock = crtc_timing->pix_clk_100hz /10 ; cntl.lanes_number =LANE_COUNT_FOUR ; if (enc110->base.bp->funcs->encoder_control(drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +10
-10@@ -1074,7 +1074,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,/* only 3 items below are used by unblank */ params.pixel_clk_khz = - pipe_ctx->stream->timing.pix_clk_khz; + pipe_ctx->stream->timing.pix_clk_100hz /10 ; params.link_settings.link_rate = link_settings->link_rate;if (dc_is_dp_signal (pipe_ctx->stream->signal))@@ -1160,27 +1160,27 @@ static void build_audio_output( stream->timing.flags.INTERLACE; audio_output->crtc_info.refresh_rate = - (stream->timing.pix_clk_khz*1000 )/ + (stream->timing.pix_clk_100hz*10000 )/ (stream->timing.h_total*stream->timing.v_total); audio_output->crtc_info.color_depth = stream->timing.display_color_depth; audio_output->crtc_info.requested_pixel_clock = - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; + pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 ; audio_output->crtc_info.calculated_pixel_clock = - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; + pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz /10 ;/*for HDMI, audio ACR is with deep color ratio factor*/ if (dc_is_hdmi_signal (pipe_ctx->stream->signal) && audio_output->crtc_info.requested_pixel_clock == - stream->timing.pix_clk_khz) { + (stream->timing.pix_clk_100hz /10 )) {if (pipe_ctx->stream_res.pix_clk_params.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) { audio_output->crtc_info.requested_pixel_clock = audio_output->crtc_info.requested_pixel_clock/2 ; audio_output->crtc_info.calculated_pixel_clock = - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk/2 ; + pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz/20 ; } }@@ -1621,8 +1621,8 @@ static uint32_t compute_pstate_blackout_duration( pstate_blackout_duration_ns =1000 * blackout_duration.value >>24 ; total_dest_line_time_ns =1000000UL * - stream->timing.h_total / - stream->timing.pix_clk_khz + + (stream->timing.h_total *10 ) / + stream->timing.pix_clk_100hz + pstate_blackout_duration_ns;return total_dest_line_time_ns;@@ -2567,7 +2567,7 @@ static void dce110_apply_ctx_for_surface( pipe_ctx->plane_res.mi, pipe_ctx->stream->timing.h_total, pipe_ctx->stream->timing.v_total, - pipe_ctx->stream->timing.pix_clk_khz, + pipe_ctx->stream->timing.pix_clk_100hz /10 , context->stream_count);dce110_program_front_end_for_pipe (dc, pipe_ctx);@@ -2622,7 +2622,7 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp;struct mem_input *mi = pipe_ctx->plane_res.mi;struct dc_cursor_mi_param param = { - .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_khz, + .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_100hz /10 , .ref_clk_khz = pipe_ctx->stream->ctx->dc->res_pool->ref_clock_inKhz, .viewport = pipe_ctx->plane_res.scl_data.viewport, .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +5
-5@@ -779,7 +779,7 @@ static void get_pixel_clock_parameters(* the pixel clock normalization for hdmi up to here instead of doing it * in pll_adjust_pix_clk */ - pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; + pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz; pixel_clk_params->encoder_object_id = stream->link->link_enc->id; pixel_clk_params->signal_type = pipe_ctx->stream->signal; pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst +1 ;@@ -797,10 +797,10 @@ static void get_pixel_clock_parameters( pixel_clk_params->color_depth =COLOR_DEPTH_888 ; }if (stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) { - pixel_clk_params->requested_pix_clk = pixel_clk_params->requested_pix_clk /2 ; + pixel_clk_params->requested_pix_clk_100hz = pixel_clk_params->requested_pix_clk_100hz /2 ; }if (stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) - pixel_clk_params->requested_pix_clk *=2 ; + pixel_clk_params->requested_pix_clk_100hz *=2 ; }@@ -874,7 +874,7 @@ static bool dce110_validate_bandwidth( __func__, context->streams[0 ]->timing.h_addressable, context->streams[0 ]->timing.v_addressable, - context->streams[0]->timing.pix_clk_khz); + context->streams[0]->timing.pix_clk_100hz / 10);if (memcmp (&dc->current_state->bw.dce, &context->bw.dce,sizeof (context->bw.dce))) {@@ -1055,7 +1055,7 @@ static struct pipe_ctx *dce110_acquire_underlay( pipe_ctx->plane_res.mi->funcs->allocate_mem_input (pipe_ctx->plane_res.mi, stream->timing.h_total, stream->timing.v_total, - stream->timing.pix_clk_khz, + stream->timing.pix_clk_100hz /10 , context->stream_count); color_space_to_black_color(dc,drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +4
-4@@ -84,17 +84,17 @@ static const struct dce110_timing_generator_offsets reg_offsets[] = {#define DCP_REG (reg) (reg + tg110->offsets.dcp)#define DMIF_REG (reg) (reg + tg110->offsets.dmif) -static void program_pix_dur (struct timing_generator *tg,uint32_t pix_clk_khz) +static void program_pix_dur (struct timing_generator *tg,uint32_t pix_clk_100hz) {uint64_t pix_dur;uint32_t addr = mmDMIF_PG0_DPG_PIPE_ARBITRATION_CONTROL1 +DCE110TG_FROM_TG (tg)->offsets.dmif;uint32_t value =dm_read_reg (tg->ctx, addr); -if (pix_clk_khz ==0 ) +if (pix_clk_100hz ==0 )return ; - pix_dur =1000000000 / pix_clk_khz; + pix_dur =10000000000ull / pix_clk_100hz; set_reg_field_value( value,@@ -110,7 +110,7 @@ static void program_timing(struct timing_generator *tg, bool use_vbios) {if (!use_vbios) -program_pix_dur (tg, timing->pix_clk_khz); +program_pix_dur (tg, timing->pix_clk_100hz);dce110_tg_program_timing (tg, timing, use_vbios); }drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1
-1@@ -2655,7 +2655,7 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)struct hubp *hubp = pipe_ctx->plane_res.hubp;struct dpp *dpp = pipe_ctx->plane_res.dpp;struct dc_cursor_mi_param param = { - .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_khz, + .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_100hz /10 , .ref_clk_khz = pipe_ctx->stream->ctx->dc->res_pool->ref_clock_inKhz, .viewport = pipe_ctx->plane_res.scl_data.viewport, .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c +1
-1@@ -429,7 +429,7 @@ static unsigned int dcn10_get_otg_states(struct dc *dc, char *pBuf, unsigned intint pix_clk =0 ;optc1_read_otg_state (DCN10TG_FROM_TG (tg), &s); - pix_clk = dc->current_state->res_ctx.pipe_ctx[i].stream_res.pix_clk_params.requested_pix_clk; + pix_clk = dc->current_state->res_ctx.pipe_ctx[i].stream_res.pix_clk_params.requested_pix_clk_100hz /10 ;//only print if OTG master is enabled if (s.otg_enabled &1 ) {drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +9
-9@@ -543,12 +543,12 @@ bool dcn10_link_encoder_validate_dvi_output(if ((connector_signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || connector_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) && signal !=SIGNAL_TYPE_HDMI_TYPE_A && - crtc_timing->pix_clk_khz >TMDS_MAX_PIXEL_CLOCK ) + crtc_timing->pix_clk_100hz > (TMDS_MAX_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz <TMDS_MIN_PIXEL_CLOCK ) +if (crtc_timing->pix_clk_100hz < (TMDS_MIN_PIXEL_CLOCK *10 ))return false; -if (crtc_timing->pix_clk_khz > max_pixel_clock) +if (crtc_timing->pix_clk_100hz > (max_pixel_clock *10 ))return false;/* DVI supports 6/8bpp single-link and 10/16bpp dual-link */ @@ -571,7 +571,7 @@ bool dcn10_link_encoder_validate_dvi_output(static bool dcn10_link_encoder_validate_hdmi_output (const struct dcn10_link_encoder *enc10,const struct dc_crtc_timing *crtc_timing, -int adjusted_pix_clk_khz) +int adjusted_pix_clk_100hz) {enum dc_color_depth max_deep_color = enc10->base.features.max_hdmi_deep_color;@@ -581,11 +581,11 @@ static bool dcn10_link_encoder_validate_hdmi_output(if (crtc_timing->display_color_depth <COLOR_DEPTH_888 )return false; -if (adjusted_pix_clk_khz <TMDS_MIN_PIXEL_CLOCK ) +if (adjusted_pix_clk_100hz < (TMDS_MIN_PIXEL_CLOCK *10 ))return false; -if ((adjusted_pix_clk_khz ==0 ) || - (adjusted_pix_clk_khz > enc10->base.features.max_hdmi_pixel_clock)) +if ((adjusted_pix_clk_100hz ==0 ) || + (adjusted_pix_clk_100hz > (enc10->base.features.max_hdmi_pixel_clock *10 )))return false;/* DCE11 HW does not support 420 */ @@ -594,7 +594,7 @@ static bool dcn10_link_encoder_validate_hdmi_output(return false;if (!enc10->base.features.flags.bits.HDMI_6GB_EN && - adjusted_pix_clk_khz >=300000 ) + adjusted_pix_clk_100hz >=3000000 )return false;if (enc10->base.ctx->dc->debug.hdmi20_disable && crtc_timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 )@@ -746,7 +746,7 @@ bool dcn10_link_encoder_validate_output_with_stream( is_valid =dcn10_link_encoder_validate_hdmi_output ( enc10, &stream->timing, - stream->phy_pix_clk); + stream->phy_pix_clk *10 );break ;case SIGNAL_TYPE_DISPLAY_PORT :case SIGNAL_TYPE_DISPLAY_PORT_MST :drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +1
-1@@ -126,7 +126,7 @@ void optc1_program_vline_interrupt(struct optc *optc1 =DCN10TG_FROM_TG (optc);unsigned long long req_delta_tens_of_usec =div64_u64 ((vsync_delta +9999 ),10000 ); -unsigned long long pix_clk_hundreds_khz =div64_u64 ((dc_crtc_timing->pix_clk_khz +99 ),100 ); +unsigned long long pix_clk_hundreds_khz =div64_u64 ((dc_crtc_timing->pix_clk_100hz +999 ),1000 );uint32_t req_delta_lines = (uint32_t )div64_u64 ( (req_delta_tens_of_usec * pix_clk_hundreds_khz + dc_crtc_timing->h_total -1 ), dc_crtc_timing->h_total);drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +3
-3@@ -974,7 +974,7 @@ static void get_pixel_clock_parameters( struct pixel_clk_params *pixel_clk_params) {const struct dc_stream_state *stream = pipe_ctx->stream; - pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; + pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz; pixel_clk_params->encoder_object_id = stream->link->link_enc->id; pixel_clk_params->signal_type = pipe_ctx->stream->signal; pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst +1 ;@@ -991,9 +991,9 @@ static void get_pixel_clock_parameters( pixel_clk_params->color_depth =COLOR_DEPTH_888 ;if (stream->timing.pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) - pixel_clk_params->requested_pix_clk /=2 ; + pixel_clk_params->requested_pix_clk_100hz /=2 ;if (stream->timing.timing_3d_format ==TIMING_3D_FORMAT_HW_FRAME_PACKING ) - pixel_clk_params->requested_pix_clk *=2 ; + pixel_clk_params->requested_pix_clk_100hz *=2 ; }drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +1
-1@@ -594,7 +594,7 @@ void enc1_stream_encoder_dvi_set_stream_attribute( cntl.signal = is_dual_link ?SIGNAL_TYPE_DVI_DUAL_LINK :SIGNAL_TYPE_DVI_SINGLE_LINK ; cntl.enable_dp_audio = false; - cntl.pixel_clock = crtc_timing->pix_clk_khz; + cntl.pixel_clock = crtc_timing->pix_clk_100hz /10 ; cntl.lanes_number = (is_dual_link) ?LANE_COUNT_EIGHT :LANE_COUNT_FOUR ; if (enc1->base.bp->funcs->encoder_control(drivers/gpu/drm/amd/display/dc/inc/clock_source.h +4
-4@@ -78,7 +78,7 @@ struct csdp_ref_clk_ds_params { };struct pixel_clk_params { -uint32_t requested_pix_clk;/* in KHz */ +uint32_t requested_pix_clk_100hz;/*> Requested Pixel Clock * (based on Video Timing standard used for requested mode)*/ uint32_t requested_sym_clk;/* in KHz */ @@ -104,9 +104,9 @@ struct pixel_clk_params {* with actually calculated Clock and reference Crystal frequency */ struct pll_settings { -uint32_t actual_pix_clk; -uint32_t adjusted_pix_clk; -uint32_t calculated_pix_clk; +uint32_t actual_pix_clk_100hz; +uint32_t adjusted_pix_clk_100hz; +uint32_t calculated_pix_clk_100hz;uint32_t vco_freq;uint32_t reference_freq;uint32_t reference_divider;drivers/gpu/drm/amd/display/include/bios_parser_types.h +2
-2@@ -210,8 +210,8 @@ struct bp_pixel_clock_parameters {/* signal_type -> Encoder Mode - needed by VBIOS Exec table */ enum signal_type signal_type;/* Adjusted Pixel Clock (after VBIOS exec table) -* that becomes Target Pixel Clock (KHz) */ -uint32_t target_pixel_clock; +* that becomes Target Pixel Clock (100 Hz units) */ +uint32_t target_pixel_clock_100hz;/* Calculated Reference divider of Display PLL */ uint32_t reference_divider;/* Calculated Feedback divider of Display PLL */ drivers/gpu/drm/amd/display/modules/freesync/freesync.c +5
-5@@ -108,8 +108,8 @@ static unsigned int calc_duration_in_us_from_v_total( {unsigned int duration_in_us = (unsigned int )(div64_u64 (((unsigned long long )(v_total) - *1000 ) * stream->timing.h_total, - stream->timing.pix_clk_khz)); + *10000 ) * stream->timing.h_total, + stream->timing.pix_clk_100hz));return duration_in_us; }@@ -126,7 +126,7 @@ static unsigned int calc_v_total_from_refresh( refresh_in_uhz))); v_total =div64_u64 (div64_u64 (((unsigned long long )( - frame_duration_in_ns) * stream->timing.pix_clk_khz), + frame_duration_in_ns) * (stream->timing.pix_clk_100hz /10 )), stream->timing.h_total),1000000 );/* v_total cannot be less than nominal */ @@ -152,7 +152,7 @@ static unsigned int calc_v_total_from_duration( duration_in_us = vrr->max_duration_in_us; v_total =div64_u64 (div64_u64 (((unsigned long long )( - duration_in_us) * stream->timing.pix_clk_khz), + duration_in_us) * (stream->timing.pix_clk_100hz /10 )), stream->timing.h_total),1000 );/* v_total cannot be less than nominal */ @@ -227,7 +227,7 @@ static void update_v_total_for_static_ramp( } v_total =div64_u64 (div64_u64 (((unsigned long long )( - current_duration_in_us) * stream->timing.pix_clk_khz), + current_duration_in_us) * (stream->timing.pix_clk_100hz /10 )), stream->timing.h_total),1000 ); in_out_vrr->adjust.v_total_min = v_total;
drivers/gpu/drm/amd/display/modules/freesync/freesync.c unsigned long long mod_freesync_calc_nominal_field_rate( · line 978
Quoted 8 lines
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +1
-1@@ -972,7 +972,7 @@ unsigned long long mod_freesync_calc_nominal_field_rate(unsigned long long nominal_field_rate_in_uhz =0 ;/* Calculate nominal field rate for stream */ - nominal_field_rate_in_uhz = stream->timing.pix_clk_khz; + nominal_field_rate_in_uhz = stream->timing.pix_clk_100hz /10 ; nominal_field_rate_in_uhz *=1000ULL *1000ULL *1000ULL ; nominal_field_rate_in_uhz =div_u64 (nominal_field_rate_in_uhz, stream->timing.h_total);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 2cf9b879-6c37-6879-e4bb-12fb309f8e94-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
RE: [PATCH 29/45] drm/amd/display: Use 100 Hz precision for pipe pixel clocks
Quoted 10 lines
Quoted 9 lines
From: Ken Chalmers <[email protected]>
[Why]
Users would like more accurate pixel clocks, especially for fractional "TV" frame rates like 59.94 Hz.[How]
Store and communicate pixel clocks with 100 Hz accuracy fromdc_crtc_timingthrough to BIOS command table setpixelclock call.
Quoted 6 lines
Why not directly use Hz?
I mean we don't have any pixel clocks above 4GHz, don't we? So a 32bit integer should be a perfect fit.
Christian.
Currently the VBIOS only supports 100 Hz precision, so there's no immediate benefit to moving to greater than 100 Hz precision.
Even so, using Hz directly was actually discussed during development, but the summary from an architect was:
Quoted 5 lines
I agree long term HZ is better. Pixel clock value will fit within 32bit, but we have many calculation based on pixel clock and changing to HZ will require bigger effort to make sure the math (there are places we multiple pixel clock) doesn’t overflow 32bit integer. 100hz is a compromised short term solution.
-Ken
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 30/45 drm/amd/display: Improve logging of validation failures during atomic_check
In reply to a message not in the archiveFrom: Eric Bernstein <[email protected]>
[Why]
There are different reasons for Validation failure error during atomic_check
[How]
Add better logging of the reason for validation failure
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +- .../drm/amd/display/dc/dml/display_mode_enums.h | 26 ++++++++++++++++++++ .../gpu/drm/amd/display/dc/dml/display_mode_lib.c | 28 ++++++++++++++++++++++ .../gpu/drm/amd/display/dc/dml/display_mode_lib.h | 2 ++ drivers/gpu/drm/amd/display/dc/inc/core_status.h | 2 +- 5 files changed, 58 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
@@ -1838,7 +1838,7 @@ enum dc_status resource_map_pool_resources( &context->res_ctx, pool, stream);if (!pipe_ctx->stream_res.stream_enc) -return DC_NO_STREAM_ENG_RESOURCE ; +return DC_NO_STREAM_ENC_RESOURCE ; update_stream_engine_usage( &context->res_ctx, pool,
drivers/gpu/drm/amd/display/dc/dml/display_mode_enums.h +26 -0
@@ -121,4 +121,30 @@ enum self_refresh_affinity {dm_neither_self_refresh_nor_mclk_switch }; +enum dm_validation_status { +DML_VALIDATION_OK , +DML_FAIL_SCALE_RATIO_TAP , +DML_FAIL_SOURCE_PIXEL_FORMAT , +DML_FAIL_VIEWPORT_SIZE , +DML_FAIL_TOTAL_V_ACTIVE_BW , +DML_FAIL_DIO_SUPPORT , +DML_FAIL_NOT_ENOUGH_DSC , +DML_FAIL_DSC_CLK_REQUIRED , +DML_FAIL_URGENT_LATENCY , +DML_FAIL_REORDERING_BUFFER , +DML_FAIL_DISPCLK_DPPCLK , +DML_FAIL_TOTAL_AVAILABLE_PIPES , +DML_FAIL_NUM_OTG , +DML_FAIL_WRITEBACK_MODE , +DML_FAIL_WRITEBACK_LATENCY , +DML_FAIL_WRITEBACK_SCALE_RATIO_TAP , +DML_FAIL_CURSOR_SUPPORT , +DML_FAIL_PITCH_SUPPORT , +DML_FAIL_PTE_BUFFER_SIZE , +DML_FAIL_HOST_VM_IMMEDIATE_FLIP , +DML_FAIL_DSC_INPUT_BPC , +DML_FAIL_PREFETCH_SUPPORT , +DML_FAIL_V_RATIO_PREFETCH , +}; +#endif
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c +28 -0
@@ -62,3 +62,31 @@ void dml_init_instance(struct display_mode_lib *lib, enum dml_project project) } } +const char *dml_get_status_message (enum dm_validation_status status) +{ +switch (status) { +case DML_VALIDATION_OK :return "Validation OK" ; +case DML_FAIL_SCALE_RATIO_TAP :return "Scale ratio/tap" ; +case DML_FAIL_SOURCE_PIXEL_FORMAT :return "Source pixel format" ; +case DML_FAIL_VIEWPORT_SIZE :return "Viewport size" ; +case DML_FAIL_TOTAL_V_ACTIVE_BW :return "Total vertical active bandwidth" ; +case DML_FAIL_DIO_SUPPORT :return "DIO support" ; +case DML_FAIL_NOT_ENOUGH_DSC :return "Not enough DSC Units" ; +case DML_FAIL_DSC_CLK_REQUIRED :return "DSC clock required" ; +case DML_FAIL_URGENT_LATENCY :return "Urgent latency" ; +case DML_FAIL_REORDERING_BUFFER :return "Re-ordering buffer" ; +case DML_FAIL_DISPCLK_DPPCLK :return "Dispclk and Dppclk" ; +case DML_FAIL_TOTAL_AVAILABLE_PIPES :return "Total available pipes" ; +case DML_FAIL_NUM_OTG :return "Number of OTG" ; +case DML_FAIL_WRITEBACK_MODE :return "Writeback mode" ; +case DML_FAIL_WRITEBACK_LATENCY :return "Writeback latency" ; +case DML_FAIL_WRITEBACK_SCALE_RATIO_TAP :return "Writeback scale ratio/tap" ; +case DML_FAIL_CURSOR_SUPPORT :return "Cursor support" ; +case DML_FAIL_PITCH_SUPPORT :return "Pitch support" ; +case DML_FAIL_PTE_BUFFER_SIZE :return "PTE buffer size" ; +case DML_FAIL_DSC_INPUT_BPC :return "DSC input bpc" ; +case DML_FAIL_PREFETCH_SUPPORT :return "Prefetch support" ; +case DML_FAIL_V_RATIO_PREFETCH :return "Vertical ratio prefetch" ; +default :return "Unknown Status" ; + } +}
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h +2 -0
@@ -43,4 +43,6 @@ struct display_mode_lib {void dml_init_instance (struct display_mode_lib *lib,enum dml_project project); +const char *dml_get_status_message (enum dm_validation_status status); +#endif
drivers/gpu/drm/amd/display/dc/inc/core_status.h +1 -1
@@ -30,7 +30,7 @@ enum dc_status {DC_OK =1 ,DC_NO_CONTROLLER_RESOURCE =2 , -DC_NO_STREAM_ENG_RESOURCE =3 , +DC_NO_STREAM_ENC_RESOURCE =3 ,DC_NO_CLOCK_SOURCE_RESOURCE =4 ,DC_FAIL_CONTROLLER_VALIDATE =5 , DC_FAIL_ENC_VALIDATE = 6,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 31/45 drm/amd/display: Add DCE_VERSION_12_1 enum for Vega 20
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
We'll need a way to differentiate Vega 20 in DC
[How]
Add a DCE_VERSION_12_1 enum, which will be returned as the DC version if the ASIC used is a Vega 20.
--- drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 +++++- drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c | 1 + drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c | 1 + drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c | 1 + drivers/gpu/drm/amd/display/include/dal_types.h | 1 + 6 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +1 -0
@@ -67,6 +67,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(return true;#endif case DCE_VERSION_12_0 : +case DCE_VERSION_12_1 : *h =dal_cmd_tbl_helper_dce112_get_table2 ();return true;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5 -1
@@ -83,7 +83,10 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id) dc_version =DCE_VERSION_11_22 ;break ;case FAMILY_AI : - dc_version =DCE_VERSION_12_0 ; +if (ASICREV_IS_VEGA20_P (asic_id.hw_internal_rev)) + dc_version =DCE_VERSION_12_1 ; +else + dc_version =DCE_VERSION_12_0 ;break ;#if defined(CONFIG_DRM_AMD_DC_DCN1_0 )case FAMILY_RV :
@@ -136,6 +139,7 @@ struct resource_pool *dc_create_resource_pool( num_virtual_links, dc);break ;case DCE_VERSION_12_0 : +case DCE_VERSION_12_1 : res_pool =dce120_create_resource_pool ( num_virtual_links, dc);break ;
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +1 -0
@@ -79,6 +79,7 @@ bool dal_hw_factory_init(dal_hw_factory_dce110_init (factory);return true;case DCE_VERSION_12_0 : +case DCE_VERSION_12_1 :dal_hw_factory_dce120_init (factory);return true;#if defined(CONFIG_DRM_AMD_DC_DCN1_0 )
drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +1 -0
@@ -76,6 +76,7 @@ bool dal_hw_translate_init(dal_hw_translate_dce110_init (translate);return true;case DCE_VERSION_12_0 : +case DCE_VERSION_12_1 :dal_hw_translate_dce120_init (translate);return true;#if defined(CONFIG_DRM_AMD_DC_DCN1_0 )
drivers/gpu/drm/amd/display/dc/i2caux/i2caux.c +1 -0
@@ -90,6 +90,7 @@ struct i2caux *dal_i2caux_create(case DCE_VERSION_10_0 :return dal_i2caux_dce100_create (ctx);case DCE_VERSION_12_0 : +case DCE_VERSION_12_1 :return dal_i2caux_dce120_create (ctx);#if defined(CONFIG_DRM_AMD_DC_DCN1_0 )case DCN_VERSION_1_0 :
drivers/gpu/drm/amd/display/include/dal_types.h +1 -0
@@ -42,6 +42,7 @@ enum dce_version {DCE_VERSION_11_2 ,DCE_VERSION_11_22 ,DCE_VERSION_12_0 , +DCE_VERSION_12_1 ,DCE_VERSION_MAX ,DCN_VERSION_1_0 , #if defined(CONFIG_DRM_AMD_DC_DCN1_01)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 32/45 drm/amd/display: Add functionality to get XGMI SS info
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
When XGMI is enabled, the DP reference clock needs to be adjusted according to the XGMI spread spectrum percentage and mode. But first, we need the ability to fetch this info.
[How]
Within the BIOS parser, Read from vBIOS when XGMI SS info is requested.
In addition, diags build uses include_legacy/atomfirmware.h for the smu_info_v3_3 table headers. Update that as well.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 15 +++++++++++++++ drivers/gpu/drm/amd/display/include/bios_parser_types.h | 1 + 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +15 -0
@@ -638,6 +638,7 @@ static enum bp_result get_ss_info_v4_1( {enum bp_result result =BP_RESULT_OK ;struct atom_display_controller_info_v4_1 *disp_cntl_tbl =NULL ; +struct atom_smu_info_v3_3 *smu_info =NULL ;if (!ss_info)return BP_RESULT_BADINPUT ;
@@ -650,6 +651,7 @@ static enum bp_result get_ss_info_v4_1(if (!disp_cntl_tbl)return BP_RESULT_BADBIOSTABLE ; + ss_info->type.STEP_AND_DELAY_INFO = false; ss_info->spread_percentage_divider =1000 ;/* BIOS no longer uses target clock. Always enable for now */
@@ -688,6 +690,19 @@ static enum bp_result get_ss_info_v4_1(*/ result =BP_RESULT_UNSUPPORTED ;break ; +case AS_SIGNAL_TYPE_XGMI : + smu_info = GET_IMAGE(struct atom_smu_info_v3_3, +DATA_TABLES (smu_info)); +if (!smu_info) +return BP_RESULT_BADBIOSTABLE ; + + ss_info->spread_spectrum_percentage = + smu_info->waflclk_ss_percentage; + ss_info->spread_spectrum_range = + smu_info->gpuclk_ss_rate_10hz *10 ; +if (smu_info->waflclk_ss_mode &ATOM_SS_CENTRE_SPREAD_MODE ) + ss_info->type.CENTER_MODE = true; +break ;default : result =BP_RESULT_UNSUPPORTED ; }
drivers/gpu/drm/amd/display/include/bios_parser_types.h +1 -0
@@ -41,6 +41,7 @@ enum as_signal_type {AS_SIGNAL_TYPE_LVDS ,AS_SIGNAL_TYPE_DISPLAY_PORT ,AS_SIGNAL_TYPE_GPU_PLL , +AS_SIGNAL_TYPE_XGMI , AS_SIGNAL_TYPE_UNKNOWN };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 33/45 drm/amd/display: Use local variable instead of caching global
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]context->bw.dce.dispclk_khz is being cached into unpatched_clock, then restored at end of function call. This is needlessly complex
[How]
Instead, use a local patched_clock variable. Leave context->bw.dce.dispclk_khz alone.
No functional change is intended.
--- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 37 ++++++++++-------------- 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +15 -22
@@ -625,11 +625,11 @@ static void dce_update_clocks(struct clk_mgr *clk_mgr, {struct dce_clk_mgr *clk_mgr_dce =TO_DCE_CLK_MGR (clk_mgr);struct dm_pp_power_level_change_request level_change_req; -int unpatched_disp_clk = context->bw.dce.dispclk_khz; +int patched_disp_clk = context->bw.dce.dispclk_khz;/*TODO: W/A for dal3 linux, investigate why this works */ if (!clk_mgr_dce->dfs_bypass_active) - context->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz *115 /100 ; + patched_disp_clk = patched_disp_clk *115 /100 ; level_change_req.power_level =dce_get_required_clocks_state (clk_mgr, context);/* get max clock state from PPLIB */
@@ -639,13 +639,11 @@ static void dce_update_clocks(struct clk_mgr *clk_mgr, clk_mgr_dce->cur_min_clks_state = level_change_req.power_level; } -if (should_set_clock (safe_to_lower, context->bw.dce.dispclk_khz, clk_mgr->clks.dispclk_khz)) { - context->bw.dce.dispclk_khz =dce_set_clock (clk_mgr, context->bw.dce.dispclk_khz); - clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz; +if (should_set_clock (safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) { + patched_disp_clk =dce_set_clock (clk_mgr, patched_disp_clk); + clk_mgr->clks.dispclk_khz = patched_disp_clk; }dce_pplib_apply_display_requirements (clk_mgr->ctx->dc, context); - - context->bw.dce.dispclk_khz = unpatched_disp_clk; } static void dce11_update_clocks(struct clk_mgr *clk_mgr,
@@ -676,11 +674,11 @@ static void dce112_update_clocks(struct clk_mgr *clk_mgr, {struct dce_clk_mgr *clk_mgr_dce =TO_DCE_CLK_MGR (clk_mgr);struct dm_pp_power_level_change_request level_change_req; -int unpatched_disp_clk = context->bw.dce.dispclk_khz; +int patched_disp_clk = context->bw.dce.dispclk_khz;/*TODO: W/A for dal3 linux, investigate why this works */ if (!clk_mgr_dce->dfs_bypass_active) - context->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz *115 /100 ; + patched_disp_clk = patched_disp_clk *115 /100 ; level_change_req.power_level =dce_get_required_clocks_state (clk_mgr, context);/* get max clock state from PPLIB */
@@ -690,13 +688,11 @@ static void dce112_update_clocks(struct clk_mgr *clk_mgr, clk_mgr_dce->cur_min_clks_state = level_change_req.power_level; } -if (should_set_clock (safe_to_lower, context->bw.dce.dispclk_khz, clk_mgr->clks.dispclk_khz)) { - context->bw.dce.dispclk_khz =dce112_set_clock (clk_mgr, context->bw.dce.dispclk_khz); - clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz; +if (should_set_clock (safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) { + patched_disp_clk =dce112_set_clock (clk_mgr, patched_disp_clk); + clk_mgr->clks.dispclk_khz = patched_disp_clk; }dce11_pplib_apply_display_requirements (clk_mgr->ctx->dc, context); - - context->bw.dce.dispclk_khz = unpatched_disp_clk; } static void dce12_update_clocks(struct clk_mgr *clk_mgr,
@@ -706,17 +702,16 @@ static void dce12_update_clocks(struct clk_mgr *clk_mgr,struct dce_clk_mgr *clk_mgr_dce =TO_DCE_CLK_MGR (clk_mgr);struct dm_pp_clock_for_voltage_req clock_voltage_req = {0 };int max_pix_clk =get_max_pixel_clock_for_all_paths (context); -int unpatched_disp_clk = context->bw.dce.dispclk_khz; +int patched_disp_clk = context->bw.dce.dispclk_khz;/*TODO: W/A for dal3 linux, investigate why this works */ if (!clk_mgr_dce->dfs_bypass_active) - context->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz *115 /100 ; + patched_disp_clk = patched_disp_clk *115 /100 ; -if (should_set_clock (safe_to_lower, context->bw.dce.dispclk_khz, clk_mgr->clks.dispclk_khz)) { +if (should_set_clock (safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) { clock_voltage_req.clk_type =DM_PP_CLOCK_TYPE_DISPLAY_CLK ; - clock_voltage_req.clocks_in_khz = context->bw.dce.dispclk_khz; - context->bw.dce.dispclk_khz =dce112_set_clock (clk_mgr, context->bw.dce.dispclk_khz); - clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz; + clock_voltage_req.clocks_in_khz = patched_disp_clk; + clk_mgr->clks.dispclk_khz =dce112_set_clock (clk_mgr, patched_disp_clk);dm_pp_apply_clock_for_voltage_request (clk_mgr->ctx, &clock_voltage_req); }
@@ -729,8 +724,6 @@ static void dce12_update_clocks(struct clk_mgr *clk_mgr,dm_pp_apply_clock_for_voltage_request (clk_mgr->ctx, &clock_voltage_req); }dce11_pplib_apply_display_requirements (clk_mgr->ctx->dc, context); - - context->bw.dce.dispclk_khz = unpatched_disp_clk; }static const struct clk_mgr_funcs dce120_funcs = {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 34/45 drm/amd/display: Compensate for XGMI SS downspread on dprefclk
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
When XGMI is enabled, we need to adjust the dprefclk according to the WAFL link's spread spectrum info. This is for VG20 (DCE121) only.
[How]dce_clk_mgr already stores SS info, currently being used by audio clock. Therefore, patch the clk_mgr's SS info with the xGMI SS info, if xGMI is enabled. For display clock, adjust it during dce12_update_clocks() before calling set_clock().
Since we rely on a mmhub register to reliably determine if xGMI is enabled, the patching step needs to happen after resource_construct() has initialized the hardware sequencer.
--- drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | 64 +++++++++++++++++ drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.h | 35 +++++++++- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 12 ++++ .../amd/display/dc/dce120/dce120_hw_sequencer.c | 15 ++++ .../amd/display/dc/dce120/dce120_hw_sequencer.h | 1 + .../drm/amd/display/dc/dce120/dce120_resource.c | 81 ++++++++++++++++++++-- 6 files changed, 198 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +64 -0
@@ -450,6 +450,42 @@ void dce_clock_read_ss_info(struct dce_clk_mgr *clk_mgr_dce) } } +/** +* dce121_clock_patch_xgmi_ss_info() - Save XGMI spread spectrum info +* @clk_mgr: clock manager base structure +* +* Reads from VBIOS the XGMI spread spectrum info and saves it within +* the dce clock manager. This operation will overwrite the existing dprefclk +* SS values if the vBIOS query succeeds. Otherwise, it does nothing. It also +* sets the ->xgmi_enabled flag. +*/ +void dce121_clock_patch_xgmi_ss_info (struct clk_mgr *clk_mgr) +{ +struct dce_clk_mgr *clk_mgr_dce =TO_DCE_CLK_MGR (clk_mgr); +enum bp_result result; +struct spread_spectrum_info info = { {0 } }; +struct dc_bios *bp = clk_mgr_dce->base.ctx->dc_bios; + + clk_mgr_dce->xgmi_enabled = false; + + result = bp->funcs->get_spread_spectrum_info (bp,AS_SIGNAL_TYPE_XGMI , +0 , &info); +if (result ==BP_RESULT_OK && info.spread_spectrum_percentage !=0 ) { + clk_mgr_dce->xgmi_enabled = true; + clk_mgr_dce->ss_on_dprefclk = true; + clk_mgr_dce->dprefclk_ss_divider = + info.spread_percentage_divider; + +if (info.type.CENTER_MODE ==0 ) { +/* Currently for DP Reference clock we +* need only SS percentage for +* downspread */ + clk_mgr_dce->dprefclk_ss_percentage = + info.spread_spectrum_percentage; + } + } +} +void dce110_fill_display_configs (const struct dc_state *context,struct dm_pp_display_configuration *pp_display_cfg)
@@ -710,6 +746,13 @@ static void dce12_update_clocks(struct clk_mgr *clk_mgr,if (should_set_clock (safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) { clock_voltage_req.clk_type =DM_PP_CLOCK_TYPE_DISPLAY_CLK ; +/* +* When xGMI is enabled, the display clk needs to be adjusted +* with the WAFL link's SS percentage. +*/ +if (clk_mgr_dce->xgmi_enabled) + patched_disp_clk =clk_mgr_adjust_dp_ref_freq_for_ss ( + clk_mgr_dce, patched_disp_clk); clock_voltage_req.clocks_in_khz = patched_disp_clk; clk_mgr->clks.dispclk_khz =dce112_set_clock (clk_mgr, patched_disp_clk);
@@ -875,6 +918,27 @@ struct clk_mgr *dce120_clk_mgr_create(struct dc_context *ctx)return &clk_mgr_dce->base; } +struct clk_mgr *dce121_clk_mgr_create (struct dc_context *ctx) +{ +struct dce_clk_mgr *clk_mgr_dce =kzalloc (sizeof (*clk_mgr_dce), +GFP_KERNEL ); + +if (clk_mgr_dce ==NULL ) { +BREAK_TO_DEBUGGER (); +return NULL ; + } + +memcpy (clk_mgr_dce->max_clks_by_state, dce120_max_clks_by_state, +sizeof (dce120_max_clks_by_state)); + +dce_clk_mgr_construct (clk_mgr_dce, ctx,NULL ,NULL ,NULL ); + + clk_mgr_dce->dprefclk_khz =625000 ; + clk_mgr_dce->base.funcs = &dce120_funcs; + +return &clk_mgr_dce->base; +} +void dce_clk_mgr_destroy (struct clk_mgr **clk_mgr) {struct dce_clk_mgr *clk_mgr_dce =TO_DCE_CLK_MGR (*clk_mgr);
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.h +32 -3
@@ -94,11 +94,37 @@ struct dce_clk_mgr {* This is basically "Crystal Frequency In KHz" (XTALIN) frequency */ int dfs_bypass_disp_clk; -/* Flag for Enabled SS on DPREFCLK */ +/** +* @ss_on_dprefclk: +* +* True if spread spectrum is enabled on the DP ref clock. +*/ bool ss_on_dprefclk; -/* DPREFCLK SS percentage (if down-spread enabled) */ + +/** +* @xgmi_enabled: +* +* True if xGMI is enabled. On VG20, both audio and display clocks need +* to be adjusted with the WAFL link's SS info if xGMI is enabled. +*/ +bool xgmi_enabled; + +/** +* @dprefclk_ss_percentage: +* +* DPREFCLK SS percentage (if down-spread enabled). +* +* Note that if XGMI is enabled, the SS info (percentage and divider) +* from the WAFL link is used instead. This is decided during +* dce_clk_mgr initialization. +*/ int dprefclk_ss_percentage; -/* DPREFCLK SS percentage Divider (100 or 1000) */ + +/** +* @dprefclk_ss_divider: +* +* DPREFCLK SS percentage Divider (100 or 1000). +*/ int dprefclk_ss_divider;int dprefclk_khz;
@@ -163,6 +189,9 @@ struct clk_mgr *dce112_clk_mgr_create(struct clk_mgr *dce120_clk_mgr_create (struct dc_context *ctx); +struct clk_mgr *dce121_clk_mgr_create (struct dc_context *ctx); +void dce121_clock_patch_xgmi_ss_info (struct clk_mgr *clk_mgr); +void dce_clk_mgr_destroy (struct clk_mgr **clk_mgr);int dentist_get_divider_from_did (int did);
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +12 -0
@@ -133,6 +133,10 @@SR (DCHUB_AGP_TOP ), \ BL_REG_LIST() +#define HWSEQ_VG20_REG_LIST () \ + HWSEQ_DCE120_REG_LIST(),\ + MMHUB_SR(MC_VM_XGMI_LFB_CNTL) +#define HWSEQ_DCE112_REG_LIST () \ HWSEQ_DCE10_REG_LIST(), \ HWSEQ_PIXEL_RATE_REG_LIST(CRTC), \
@@ -298,6 +302,7 @@ struct dce_hwseq_registers {uint32_t MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ;uint32_t MC_VM_SYSTEM_APERTURE_LOW_ADDR ;uint32_t MC_VM_SYSTEM_APERTURE_HIGH_ADDR ; +uint32_t MC_VM_XGMI_LFB_CNTL ;uint32_t AZALIA_AUDIO_DTO ;uint32_t AZALIA_CONTROLLER_CLOCK_GATING ; };
@@ -382,6 +387,11 @@ struct dce_hwseq_registers { HWS_SF(, LVTMA_PWRSEQ_CNTL, LVTMA_BLON, mask_sh), \ HWS_SF(, LVTMA_PWRSEQ_STATE, LVTMA_PWRSEQ_TARGET_STATE_R, mask_sh) +#define HWSEQ_VG20_MASK_SH_LIST (mask_sh)\ + HWSEQ_DCE12_MASK_SH_LIST(mask_sh),\ + HWS_SF(, MC_VM_XGMI_LFB_CNTL, PF_LFB_REGION, mask_sh),\ + HWS_SF(, MC_VM_XGMI_LFB_CNTL, PF_MAX_REGION, mask_sh) +#define HWSEQ_DCN_MASK_SH_LIST (mask_sh)\ HWSEQ_PIXEL_RATE_MASK_SH_LIST(mask_sh, OTG0_),\ HWS_SF1(OTG0_, PHYPLL_PIXEL_RATE_CNTL, PHYPLL_PIXEL_RATE_SOURCE, mask_sh), \
@@ -470,6 +480,8 @@ struct dce_hwseq_registers {type PHYSICAL_PAGE_NUMBER_MSB ;\type PHYSICAL_PAGE_NUMBER_LSB ;\type LOGICAL_ADDR ; \ +type PF_LFB_REGION ;\ +type PF_MAX_REGION ;\type ENABLE_L1_TLB ;\type SYSTEM_ACCESS_MODE ;\type LVTMA_BLON ;\
drivers/gpu/drm/amd/display/dc/dce120/dce120_hw_sequencer.c +15 -0
@@ -244,6 +244,21 @@ static void dce120_update_dchub( dh_data->dchub_info_valid = false; } +/** +* dce121_xgmi_enabled() - Check if xGMI is enabled +* @hws: DCE hardware sequencer object +* +* Return true if xGMI is enabled. False otherwise. +*/ +bool dce121_xgmi_enabled (struct dce_hwseq *hws) +{ +uint32_t pf_max_region; + +REG_GET (MC_VM_XGMI_LFB_CNTL ,PF_MAX_REGION , &pf_max_region); +/* PF_MAX_REGION == 0 means xgmi is disabled */ +return !!pf_max_region; +} +void dce120_hw_sequencer_construct (struct dc *dc) {/* All registers used by dce11.2 match those in dce11 in offset and
drivers/gpu/drm/amd/display/dc/dce120/dce120_hw_sequencer.h +1 -0
@@ -30,6 +30,7 @@struct dc ; +bool dce121_xgmi_enabled (struct dce_hwseq *hws);void dce120_hw_sequencer_construct (struct dc *dc);#endif /* __DC_HWSS_DCE112_H__ */
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +74 -7
142 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 35/45 drm/amd/display: 3.2.11
In reply to a message not in the archiveFrom: Steven Chiu <[email protected]>
--- 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
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.10" +#define DC_VER "3.2.11"#define MAX_SURFACES 3#define MAX_STREAMS 6
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 36/45 drm/amd/display: Start using the new pp_smu interface
In reply to a message not in the archiveFrom: Fatemeh Darbehani <[email protected]>
[Why]
PPLib has impelemented the new pp_smu interface
[How]
Use the new functions if available instead of the old interface 'set_display_requirement' and 'dcn1_pplib_apply_display_requirements'.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 103 ++++++--------------- 1 file changed, 26 insertions(+), 77 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c +26 -77
@@ -161,58 +161,6 @@ static int get_active_display_cnt(return display_count; } -static void notify_deep_sleep_dcfclk_to_smu ( -struct pp_smu_funcs_rv *pp_smu,int min_dcef_deep_sleep_clk_khz) -{ -int min_dcef_deep_sleep_clk_mhz;//minimum required DCEF Deep Sleep clock in mhz -/* -* if function pointer not set up, this message is -* sent as part of pplib_apply_display_requirements. -* So just return. -*/ -if (!pp_smu || !pp_smu->set_min_deep_sleep_dcfclk) -return ; - - min_dcef_deep_sleep_clk_mhz = (min_dcef_deep_sleep_clk_khz +999 ) /1000 ;//Round up - pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, min_dcef_deep_sleep_clk_mhz); -} - -static void notify_hard_min_dcfclk_to_smu ( -struct pp_smu_funcs_rv *pp_smu,int min_dcf_clk_khz) -{ -int min_dcf_clk_mhz;//minimum required DCF clock in mhz - -/* -* if function pointer not set up, this message is -* sent as part of pplib_apply_display_requirements. -* So just return. -*/ -if (!pp_smu || !pp_smu->set_hard_min_dcfclk_by_freq) -return ; - - min_dcf_clk_mhz = min_dcf_clk_khz /1000 ; - - pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, min_dcf_clk_mhz); -} - -static void notify_hard_min_fclk_to_smu ( -struct pp_smu_funcs_rv *pp_smu,int min_f_clk_khz) -{ -int min_f_clk_mhz;//minimum required F clock in mhz - -/* -* if function pointer not set up, this message is -* sent as part of pplib_apply_display_requirements. -* So just return. -*/ -if (!pp_smu || !pp_smu->set_hard_min_fclk_by_freq) -return ; - - min_f_clk_mhz = min_f_clk_khz /1000 ; - - pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, min_f_clk_mhz); -} -static void dcn1_update_clocks (struct clk_mgr *clk_mgr,struct dc_state *context,bool safe_to_lower)
@@ -224,7 +172,6 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, &dc->res_pool->pp_smu_req;struct pp_smu_display_requirement_rv smu_req = *smu_req_cur;struct pp_smu_funcs_rv *pp_smu = dc->res_pool->pp_smu; -uint32_t requested_dcf_clock_in_khz =0 ;bool send_request_to_increase = false;bool send_request_to_lower = false;int display_count;
@@ -244,9 +191,8 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,*/ if (pp_smu->set_display_count) pp_smu->set_display_count (&pp_smu->pp_smu, display_count); -else - smu_req.display_count = display_count; + smu_req.display_count = display_count; } if (new_clocks->dispclk_khz > clk_mgr->clks.dispclk_khz
@@ -269,8 +215,6 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, clk_mgr->clks.fclk_khz = new_clocks->fclk_khz; smu_req.hard_min_fclk_mhz = new_clocks->fclk_khz /1000 ; -notify_hard_min_fclk_to_smu (pp_smu, new_clocks->fclk_khz); - send_request_to_lower = true; }
@@ -285,7 +229,7 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,if (should_set_clock (safe_to_lower, new_clocks->dcfclk_deep_sleep_khz, clk_mgr->clks.dcfclk_deep_sleep_khz)) { clk_mgr->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz; - smu_req.min_deep_sleep_dcefclk_mhz = new_clocks->dcfclk_deep_sleep_khz /1000 ; + smu_req.min_deep_sleep_dcefclk_mhz = (new_clocks->dcfclk_deep_sleep_khz +999 ) /1000 ; send_request_to_lower = true; }
@@ -295,15 +239,18 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,*/ if (send_request_to_increase) {/*use dcfclk to request voltage*/ - requested_dcf_clock_in_khz =dcn_find_dcfclk_suits_all (dc, new_clocks); - -notify_hard_min_dcfclk_to_smu (pp_smu, requested_dcf_clock_in_khz); - -if (pp_smu->set_display_requirement) - pp_smu->set_display_requirement (&pp_smu->pp_smu, &smu_req); - -notify_deep_sleep_dcfclk_to_smu (pp_smu, clk_mgr->clks.dcfclk_deep_sleep_khz); -dcn1_pplib_apply_display_requirements (dc, context); +if (pp_smu->set_hard_min_fclk_by_freq && + pp_smu->set_hard_min_dcfclk_by_freq && + pp_smu->set_min_deep_sleep_dcfclk) { + + pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_fclk_mhz); + pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_dcefclk_mhz); + pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, smu_req.min_deep_sleep_dcefclk_mhz); + }else { +if (pp_smu->set_display_requirement) + pp_smu->set_display_requirement (&pp_smu->pp_smu, &smu_req); +dcn1_pplib_apply_display_requirements (dc, context); + } }/* dcn1 dppclk is tied to dispclk */
@@ -318,18 +265,20 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,if (!send_request_to_increase && send_request_to_lower) {/*use dcfclk to request voltage*/ - requested_dcf_clock_in_khz =dcn_find_dcfclk_suits_all (dc, new_clocks); - -notify_hard_min_dcfclk_to_smu (pp_smu, requested_dcf_clock_in_khz); - -if (pp_smu->set_display_requirement) - pp_smu->set_display_requirement (&pp_smu->pp_smu, &smu_req); - -notify_deep_sleep_dcfclk_to_smu (pp_smu, clk_mgr->clks.dcfclk_deep_sleep_khz); -dcn1_pplib_apply_display_requirements (dc, context); +if (pp_smu->set_hard_min_fclk_by_freq && + pp_smu->set_hard_min_dcfclk_by_freq && + pp_smu->set_min_deep_sleep_dcfclk) { + + pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_fclk_mhz); + pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_dcefclk_mhz); + pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, smu_req.min_deep_sleep_dcefclk_mhz); + }else { +if (pp_smu->set_display_requirement) + pp_smu->set_display_requirement (&pp_smu->pp_smu, &smu_req); +dcn1_pplib_apply_display_requirements (dc, context); + } } - *smu_req_cur = smu_req; }static const struct clk_mgr_funcs dcn1_funcs = {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 37/45 drm/amd/display: Fix bug with not updating VSP infoframe
In reply to a message not in the archiveFrom: SivapiriyanKumarasamy <[email protected]>
[WHY]
Currently, when the VSP infopacket is rebuilt in DM, it is not updated when being programmed in encoder.
[HOW]
Add new VSP case for update_info_frame
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
@@ -1486,7 +1486,8 @@ static void commit_planes_do_stream_update(struct dc *dc,if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket || - stream_update->vsc_infopacket) { + stream_update->vsc_infopacket || + stream_update->vsp_infopacket) {resource_build_info_frame (pipe_ctx); dc->hwss.update_info_frame (pipe_ctx); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 38/45 drm/amd/display: add dsclk to pipe bw struct
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
This will allow us to program dscclk to required value
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -2048,7 +2048,7 @@ void update_dchubp_dpp( dc->res_pool->dccg->funcs->update_dpp_dto ( dc->res_pool->dccg, dpp->inst, - pipe_ctx->plane_res.bw.calc.dppclk_khz); + pipe_ctx->plane_res.bw.dppclk_khz); else dc->res_pool->clk_mgr->clks.dppclk_khz = should_divided_by_2 ? dc->res_pool->clk_mgr->clks.dispclk_khz / 2 :
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -6
@@ -180,13 +180,8 @@ struct resource_pool {const struct resource_caps *res_cap; }; -struct dcn_fe_clocks { -int dppclk_khz; -}; -struct dcn_fe_bandwidth { -struct dcn_fe_clocks calc; -struct dcn_fe_clocks cur; +int dppclk_khz; };struct stream_resource {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 39/45 drm/amd/display: move AYCrCb8888 format to video section
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
This is a dual channel format and should be treated like other video formats
--- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 -1
@@ -192,7 +192,6 @@ enum surface_pixel_format {/*swaped & float*/ SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F ,/*grow graphics here if necessary */ - SURFACE_PIXEL_FORMAT_VIDEO_AYCrCb8888,SURFACE_PIXEL_FORMAT_VIDEO_BEGIN , SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr = SURFACE_PIXEL_FORMAT_VIDEO_BEGIN,
@@ -200,6 +199,7 @@ enum surface_pixel_format { SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr, SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb,SURFACE_PIXEL_FORMAT_SUBSAMPLE_END , + SURFACE_PIXEL_FORMAT_VIDEO_AYCrCb8888,SURFACE_PIXEL_FORMAT_INVALID /*grow 444 video here if necessary */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 40/45 drm/amd/display: Don't log error if we have no connectors
In reply to a message not in the archiveFrom: Harry Wentland <[email protected]>
[Why]
In certain configurations, such as PX configs or some Vega20 parts DC gets created without connectors.
[How]
Drop the dm_error print when no connectors.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -4
@@ -151,10 +151,6 @@ static bool create_links(return false; } -if (connectors_num ==0 && num_virtual_links ==0 ) { -dm_error ("DC: Number of connectors is zero!\n" ); - } - dm_output_to_console( "DC: %s: connectors_num: physical:%d, virtual:%d\n", __func__,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 41/45 drm/amd/display: verify lane status before exiting verify link cap
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
[why]
DP LL CTS1.4 4.3.2.1 test failure.
[how]
The failure is caused by not handling DP link loss
hpd short pusle during set mode. The change is to read link status before set mode link training. If link is lost, re-verify link caps.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 243 +++++++++++---------- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 3 +- 2 files changed, 127 insertions(+), 119 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +125 -118
@@ -1089,6 +1089,121 @@ static struct dc_link_settings get_max_link_cap(struct dc_link *link)return max_link_cap; } +static enum dc_status read_hpd_rx_irq_data ( +struct dc_link *link, +union hpd_irq_data *irq_data) +{ +static enum dc_status retval; + +/* The HW reads 16 bytes from 200h on HPD, +* but if we get an AUX_DEFER, the HW cannot retry +* and this causes the CTS tests 4.3.2.1 - 3.2.4 to +* fail, so we now explicitly read 6 bytes which is +* the req from the above mentioned test cases. +* +* For DP 1.4 we need to read those from 2002h range. +*/ +if (link->dpcd_caps.dpcd_rev.raw <DPCD_REV_14 ) + retval =core_link_read_dpcd ( + link, +DP_SINK_COUNT , + irq_data->raw, +sizeof (union hpd_irq_data )); +else { +/* Read 14 bytes in a single read and then copy only the required fields. +* This is more efficient than doing it in two separate AUX reads. */ + +uint8_t tmp[DP_SINK_STATUS_ESI -DP_SINK_COUNT_ESI +1 ]; + + retval =core_link_read_dpcd ( + link, +DP_SINK_COUNT_ESI , + tmp, +sizeof (tmp)); + +if (retval !=DC_OK ) +return retval; + + irq_data->bytes.sink_cnt.raw = tmp[DP_SINK_COUNT_ESI -DP_SINK_COUNT_ESI ]; + irq_data->bytes.device_service_irq.raw = tmp[DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 -DP_SINK_COUNT_ESI ]; + irq_data->bytes.lane01_status.raw = tmp[DP_LANE0_1_STATUS_ESI -DP_SINK_COUNT_ESI ]; + irq_data->bytes.lane23_status.raw = tmp[DP_LANE2_3_STATUS_ESI -DP_SINK_COUNT_ESI ]; + irq_data->bytes.lane_status_updated.raw = tmp[DP_LANE_ALIGN_STATUS_UPDATED_ESI -DP_SINK_COUNT_ESI ]; + irq_data->bytes.sink_status.raw = tmp[DP_SINK_STATUS_ESI -DP_SINK_COUNT_ESI ]; + } + +return retval; +} + +static bool hpd_rx_irq_check_link_loss_status ( +struct dc_link *link, +union hpd_irq_data *hpd_irq_dpcd_data) +{ +uint8_t irq_reg_rx_power_state =0 ; +enum dc_status dpcd_result =DC_ERROR_UNEXPECTED ; +union lane_status lane_status; +uint32_t lane; +bool sink_status_changed; +bool return_code; + + sink_status_changed = false; + return_code = false; + +if (link->cur_link_settings.lane_count ==0 ) +return return_code; + +/*1. Check that Link Status changed, before re-training.*/ + +/*parse lane status*/ +for (lane =0 ; lane < link->cur_link_settings.lane_count; lane++) { +/* check status of lanes 0,1 +* changed DpcdAddress_Lane01Status (0x202) +*/ + lane_status.raw =get_nibble_at_index ( + &hpd_irq_dpcd_data->bytes.lane01_status.raw, + lane); + +if (!lane_status.bits.CHANNEL_EQ_DONE_0 || + !lane_status.bits.CR_DONE_0 || + !lane_status.bits.SYMBOL_LOCKED_0) { +/* if one of the channel equalization, clock +* recovery or symbol lock is dropped +* consider it as (link has been +* dropped) dp sink status has changed +*/ + sink_status_changed = true; +break ; + } + } + +/* Check interlane align.*/ +if (sink_status_changed || + !hpd_irq_dpcd_data->bytes.lane_status_updated.bits.INTERLANE_ALIGN_DONE) { + +DC_LOG_HW_HPD_IRQ ("%s: Link Status changed.\n" , __func__); + + return_code = true; + +/*2. Check that we can handle interrupt: Not in FS DOS, +* Not in "Display Timeout" state, Link is trained. +*/ + dpcd_result =core_link_read_dpcd (link, +DP_SET_POWER , + &irq_reg_rx_power_state, +sizeof (irq_reg_rx_power_state)); + +if (dpcd_result !=DC_OK ) { +DC_LOG_HW_HPD_IRQ ("%s: DPCD read failed to obtain power state.\n" , + __func__); + }else { +if (irq_reg_rx_power_state !=DP_SET_POWER_D0 ) + return_code = false; + } + } + +return return_code; +} + bool dp_verify_link_cap( struct dc_link *link, struct dc_link_settings *known_limit_link_setting,
@@ -1104,12 +1219,14 @@ bool dp_verify_link_cap(struct clock_source *dp_cs;enum clock_source_id dp_cs_id =CLOCK_SOURCE_ID_EXTERNAL ;enum link_training_result status; +union hpd_irq_data irq_data;if (link->dc->debug.skip_detection_link_training) { link->verified_link_cap = *known_limit_link_setting;return true; } +memset (&irq_data,0 ,sizeof (irq_data)); success = false; skip_link_training = false;
@@ -1168,9 +1285,15 @@ bool dp_verify_link_cap( (*fail_count)++; } -if (success) +if (success) { link->verified_link_cap = *cur; - +udelay (1000 ); +if (read_hpd_rx_irq_data (link, &irq_data) ==DC_OK ) +if (hpd_rx_irq_check_link_loss_status ( + link, + &irq_data)) + (*fail_count)++; + }/* always disable the link before trying another * setting or before returning we'll enable it later * based on the actual mode we're driving
@@ -1572,122 +1695,6 @@ void decide_link_settings(struct dc_stream_state *stream, }/*************************Short Pulse IRQ***************************/ - -static bool hpd_rx_irq_check_link_loss_status ( -struct dc_link *link, -union hpd_irq_data *hpd_irq_dpcd_data) -{ -uint8_t irq_reg_rx_power_state =0 ; -enum dc_status dpcd_result =DC_ERROR_UNEXPECTED ; -union lane_status lane_status; -uint32_t lane; -bool sink_status_changed; -bool return_code; - - sink_status_changed = false; - return_code = false; - -if (link->cur_link_settings.lane_count ==0 ) -return return_code; - -/*1. Check that Link Status changed, before re-training.*/ - -/*parse lane status*/ -for (lane =0 ; lane < link->cur_link_settings.lane_count; lane++) { -/* check status of lanes 0,1 -* changed DpcdAddress_Lane01Status (0x202) -*/ - lane_status.raw =get_nibble_at_index ( - &hpd_irq_dpcd_data->bytes.lane01_status.raw, - lane); - -if (!lane_status.bits.CHANNEL_EQ_DONE_0 || - !lane_status.bits.CR_DONE_0 || - !lane_status.bits.SYMBOL_LOCKED_0) { -/* if one of the channel equalization, clock -* recovery or symbol lock is dropped -* consider it as (link has been -* dropped) dp sink status has changed -*/ - sink_status_changed = true; -break ; - } - } - -/* Check interlane align.*/ -if (sink_status_changed || - !hpd_irq_dpcd_data->bytes.lane_status_updated.bits.INTERLANE_ALIGN_DONE) { - -DC_LOG_HW_HPD_IRQ ("%s: Link Status changed.\n" , __func__); - - return_code = true; - -/*2. Check that we can handle interrupt: Not in FS DOS, -* Not in "Display Timeout" state, Link is trained. -*/ - dpcd_result =core_link_read_dpcd (link, -DP_SET_POWER , - &irq_reg_rx_power_state, -sizeof (irq_reg_rx_power_state)); - -if (dpcd_result !=DC_OK ) { -DC_LOG_HW_HPD_IRQ ("%s: DPCD read failed to obtain power state.\n" , - __func__); - }else { -if (irq_reg_rx_power_state !=DP_SET_POWER_D0 ) - return_code = false; - } - } - -return return_code; -} - -static enum dc_status read_hpd_rx_irq_data ( -struct dc_link *link, -union hpd_irq_data *irq_data) -{ -static enum dc_status retval; - -/* The HW reads 16 bytes from 200h on HPD, -* but if we get an AUX_DEFER, the HW cannot retry -* and this causes the CTS tests 4.3.2.1 - 3.2.4 to -* fail, so we now explicitly read 6 bytes which is -* the req from the above mentioned test cases. -* -* For DP 1.4 we need to read those from 2002h range. -*/ -if (link->dpcd_caps.dpcd_rev.raw <DPCD_REV_14 ) - retval =core_link_read_dpcd ( - link, -DP_SINK_COUNT , - irq_data->raw, -sizeof (union hpd_irq_data )); -else { -/* Read 14 bytes in a single read and then copy only the required fields. -* This is more efficient than doing it in two separate AUX reads. */ - -uint8_t tmp[DP_SINK_STATUS_ESI -DP_SINK_COUNT_ESI +1 ]; - - retval =core_link_read_dpcd ( - link, -DP_SINK_COUNT_ESI , - tmp, -sizeof (tmp)); - -if (retval !=DC_OK ) -return retval; - - irq_data->bytes.sink_cnt.raw = tmp[DP_SINK_COUNT_ESI -DP_SINK_COUNT_ESI ]; - irq_data->bytes.device_service_irq.raw = tmp[DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 -DP_SINK_COUNT_ESI ]; - irq_data->bytes.lane01_status.raw = tmp[DP_LANE0_1_STATUS_ESI -DP_SINK_COUNT_ESI ]; - irq_data->bytes.lane23_status.raw = tmp[DP_LANE2_3_STATUS_ESI -DP_SINK_COUNT_ESI ]; - irq_data->bytes.lane_status_updated.raw = tmp[DP_LANE_ALIGN_STATUS_UPDATED_ESI -DP_SINK_COUNT_ESI ]; - irq_data->bytes.sink_status.raw = tmp[DP_SINK_STATUS_ESI -DP_SINK_COUNT_ESI ]; - } - -return retval; -} -static bool allow_hpd_rx_irq (const struct dc_link *link) {/*
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +2 -1
@@ -95,6 +95,7 @@ void dp_enable_link_phy( link_settings, clock_source); } + link->cur_link_settings = *link_settings;dp_receiver_power_ctrl (link, true); }
@@ -304,6 +305,7 @@ void dp_retrain_link_dp_test(struct dc_link *link, link->link_enc, link_setting, pipes[i].clock_source->id); + link->cur_link_settings = *link_setting;dp_receiver_power_ctrl (link, true);
@@ -313,7 +315,6 @@ void dp_retrain_link_dp_test(struct dc_link *link, skip_video_pattern, LINK_TRAINING_ATTEMPTS); - link->cur_link_settings = *link_setting; link->dc->hwss.enable_stream (&pipes[i]);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 42/45 drm/amd/display: Optimize passive update planes.
In reply to a message not in the archiveFrom: Yongqiang Sun <[email protected]>
[Why]
passive update planes still spends a litte more
time on some cases.
[How]
Remove unnecessary trace which involving in some register read. Disable debug output for release build.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -3
@@ -1585,9 +1585,6 @@ static void commit_planes_for_stream(struct dc *dc, } } -if (update_type ==UPDATE_TYPE_FULL ) -context_timing_trace (dc, &context->res_ctx); -// Update Type FAST, Surface updates if (update_type ==UPDATE_TYPE_FAST ) {/* Lock the top pipe while updating plane addrs, since freesync requires
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 43/45 drm/amd/display: Expand set_pixel_clock debug log message
In reply to a message not in the archiveFrom: Ken Chalmers <[email protected]>
[Why]
For more informative debugging.
[How]
Add timing generator and PLL ids to output, to make it clear which pixel clock is being set.
--- drivers/gpu/drm/amd/display/dc/bios/command_table2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/command_table2.c +5 -3
@@ -307,9 +307,11 @@ static enum bp_result set_pixel_clock_v7( (uint8_t ) bp->cmd_helper->transmitter_color_depth_to_atom ( bp_params->color_depth); -DC_LOG_BIOS ("%s:program display clock = %d" \ -"colorDepth = %d\n" , __func__,\ - bp_params->target_pixel_clock_100hz, bp_params->color_depth); + +DC_LOG_BIOS ("%s:program display clock = %d, tg = %d, pll = %d, " \ +"colorDepth = %d\n" , __func__, + bp_params->target_pixel_clock_100hz, (int )controller_id, + pll_id, bp_params->color_depth);if (bp_params->flags.FORCE_PROGRAMMING_OF_PLL) clk.miscinfo |=PIXEL_CLOCK_V7_MISC_FORCE_PROG_PPLL ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 44/45 drm/amd/display: validate extended dongle caps
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
[why]
Some dongle doesn't have a valid extended dongle caps, but we still set the extended dongle caps to be valid. This causes validation fails for all timing.
[how]
If no dp_hdmi_max_pixel_clk is provided,
don't use extended dongle caps.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2 -1
@@ -2247,7 +2247,8 @@ static void get_active_converter_info(translate_dpcd_max_bpc ( hdmi_color_caps.bits.MAX_BITS_PER_COLOR_COMPONENT); - link->dpcd_caps.dongle_caps.extendedCapValid = true; +if (link->dpcd_caps.dongle_caps.dp_hdmi_max_pixel_clk !=0 ) + link->dpcd_caps.dongle_caps.extendedCapValid = true; }break ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 45/45 drm/amd/display: Remove unused parameter plane_states
In reply to a message not in the archiveFrom: David Francis <[email protected]>
[Why]
The function dc_commit_updates_for_stream had a parameter called plane_states. It was never used. It was getting in the way of some cleanup work
[How]
Remove it
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- drivers/gpu/drm/amd/display/dc/core/dc.c | 1 - drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -4566,7 +4566,6 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,1 , acrtc_state->stream, &stream_update, - &surface_updates->surface, state); DRM_DEBUG_DRIVER("%s Flipping to hi: 0x%x, low: 0x%x \n",
@@ -4662,7 +4661,7 @@ static bool commit_planes_to_stream( dc, updates, new_plane_count, - dc_stream, stream_update, plane_states, state); + dc_stream, stream_update, state);kfree (flip_addr);kfree (plane_info);
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -1
@@ -1620,7 +1620,6 @@ void dc_commit_updates_for_stream(struct dc *dc,int surface_count, struct dc_stream_state *stream, struct dc_stream_update *stream_update, - struct dc_plane_state **plane_states, struct dc_state *state) { const struct dc_stream_status *stream_status;
drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -1
@@ -180,7 +180,6 @@ void dc_commit_updates_for_stream(struct dc *dc,int surface_count, struct dc_stream_state *stream, struct dc_stream_update *stream_update, - struct dc_plane_state **plane_states, struct dc_state *state);/* * Log the current stream state.
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx