0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "display_mode_lib.h"
0027 #include "dc_features.h"
0028 #include "dcn20/display_mode_vba_20.h"
0029 #include "dcn20/display_rq_dlg_calc_20.h"
0030 #include "dcn20/display_mode_vba_20v2.h"
0031 #include "dcn20/display_rq_dlg_calc_20v2.h"
0032 #include "dcn21/display_mode_vba_21.h"
0033 #include "dcn21/display_rq_dlg_calc_21.h"
0034 #include "dcn30/display_mode_vba_30.h"
0035 #include "dcn30/display_rq_dlg_calc_30.h"
0036 #include "dcn31/display_mode_vba_31.h"
0037 #include "dcn31/display_rq_dlg_calc_31.h"
0038 #include "dcn314/display_mode_vba_314.h"
0039 #include "dcn314/display_rq_dlg_calc_314.h"
0040 #include "dcn32/display_mode_vba_32.h"
0041 #include "dcn32/display_rq_dlg_calc_32.h"
0042 #include "dml_logger.h"
0043
0044 const struct dml_funcs dml20_funcs = {
0045 .validate = dml20_ModeSupportAndSystemConfigurationFull,
0046 .recalculate = dml20_recalculate,
0047 .rq_dlg_get_dlg_reg = dml20_rq_dlg_get_dlg_reg,
0048 .rq_dlg_get_rq_reg = dml20_rq_dlg_get_rq_reg
0049 };
0050
0051 const struct dml_funcs dml20v2_funcs = {
0052 .validate = dml20v2_ModeSupportAndSystemConfigurationFull,
0053 .recalculate = dml20v2_recalculate,
0054 .rq_dlg_get_dlg_reg = dml20v2_rq_dlg_get_dlg_reg,
0055 .rq_dlg_get_rq_reg = dml20v2_rq_dlg_get_rq_reg
0056 };
0057
0058 const struct dml_funcs dml21_funcs = {
0059 .validate = dml21_ModeSupportAndSystemConfigurationFull,
0060 .recalculate = dml21_recalculate,
0061 .rq_dlg_get_dlg_reg = dml21_rq_dlg_get_dlg_reg,
0062 .rq_dlg_get_rq_reg = dml21_rq_dlg_get_rq_reg
0063 };
0064
0065 const struct dml_funcs dml30_funcs = {
0066 .validate = dml30_ModeSupportAndSystemConfigurationFull,
0067 .recalculate = dml30_recalculate,
0068 .rq_dlg_get_dlg_reg = dml30_rq_dlg_get_dlg_reg,
0069 .rq_dlg_get_rq_reg = dml30_rq_dlg_get_rq_reg
0070 };
0071
0072 const struct dml_funcs dml31_funcs = {
0073 .validate = dml31_ModeSupportAndSystemConfigurationFull,
0074 .recalculate = dml31_recalculate,
0075 .rq_dlg_get_dlg_reg = dml31_rq_dlg_get_dlg_reg,
0076 .rq_dlg_get_rq_reg = dml31_rq_dlg_get_rq_reg
0077 };
0078
0079 const struct dml_funcs dml314_funcs = {
0080 .validate = dml314_ModeSupportAndSystemConfigurationFull,
0081 .recalculate = dml314_recalculate,
0082 .rq_dlg_get_dlg_reg = dml314_rq_dlg_get_dlg_reg,
0083 .rq_dlg_get_rq_reg = dml314_rq_dlg_get_rq_reg
0084 };
0085
0086 const struct dml_funcs dml32_funcs = {
0087 .validate = dml32_ModeSupportAndSystemConfigurationFull,
0088 .recalculate = dml32_recalculate,
0089 .rq_dlg_get_dlg_reg_v2 = dml32_rq_dlg_get_dlg_reg,
0090 .rq_dlg_get_rq_reg_v2 = dml32_rq_dlg_get_rq_reg
0091 };
0092
0093 void dml_init_instance(struct display_mode_lib *lib,
0094 const struct _vcs_dpi_soc_bounding_box_st *soc_bb,
0095 const struct _vcs_dpi_ip_params_st *ip_params,
0096 enum dml_project project)
0097 {
0098 lib->soc = *soc_bb;
0099 lib->ip = *ip_params;
0100 lib->project = project;
0101 switch (project) {
0102 case DML_PROJECT_NAVI10:
0103 case DML_PROJECT_DCN201:
0104 lib->funcs = dml20_funcs;
0105 break;
0106 case DML_PROJECT_NAVI10v2:
0107 lib->funcs = dml20v2_funcs;
0108 break;
0109 case DML_PROJECT_DCN21:
0110 lib->funcs = dml21_funcs;
0111 break;
0112 case DML_PROJECT_DCN30:
0113 lib->funcs = dml30_funcs;
0114 break;
0115 case DML_PROJECT_DCN31:
0116 case DML_PROJECT_DCN31_FPGA:
0117 lib->funcs = dml31_funcs;
0118 break;
0119 case DML_PROJECT_DCN314:
0120 lib->funcs = dml314_funcs;
0121 break;
0122 case DML_PROJECT_DCN32:
0123 lib->funcs = dml32_funcs;
0124 break;
0125
0126 default:
0127 break;
0128 }
0129 }
0130
0131 const char *dml_get_status_message(enum dm_validation_status status)
0132 {
0133 switch (status) {
0134 case DML_VALIDATION_OK: return "Validation OK";
0135 case DML_FAIL_SCALE_RATIO_TAP: return "Scale ratio/tap";
0136 case DML_FAIL_SOURCE_PIXEL_FORMAT: return "Source pixel format";
0137 case DML_FAIL_VIEWPORT_SIZE: return "Viewport size";
0138 case DML_FAIL_TOTAL_V_ACTIVE_BW: return "Total vertical active bandwidth";
0139 case DML_FAIL_DIO_SUPPORT: return "DIO support";
0140 case DML_FAIL_NOT_ENOUGH_DSC: return "Not enough DSC Units";
0141 case DML_FAIL_DSC_CLK_REQUIRED: return "DSC clock required";
0142 case DML_FAIL_URGENT_LATENCY: return "Urgent latency";
0143 case DML_FAIL_REORDERING_BUFFER: return "Re-ordering buffer";
0144 case DML_FAIL_DISPCLK_DPPCLK: return "Dispclk and Dppclk";
0145 case DML_FAIL_TOTAL_AVAILABLE_PIPES: return "Total available pipes";
0146 case DML_FAIL_NUM_OTG: return "Number of OTG";
0147 case DML_FAIL_WRITEBACK_MODE: return "Writeback mode";
0148 case DML_FAIL_WRITEBACK_LATENCY: return "Writeback latency";
0149 case DML_FAIL_WRITEBACK_SCALE_RATIO_TAP: return "Writeback scale ratio/tap";
0150 case DML_FAIL_CURSOR_SUPPORT: return "Cursor support";
0151 case DML_FAIL_PITCH_SUPPORT: return "Pitch support";
0152 case DML_FAIL_PTE_BUFFER_SIZE: return "PTE buffer size";
0153 case DML_FAIL_DSC_INPUT_BPC: return "DSC input bpc";
0154 case DML_FAIL_PREFETCH_SUPPORT: return "Prefetch support";
0155 case DML_FAIL_V_RATIO_PREFETCH: return "Vertical ratio prefetch";
0156 default: return "Unknown Status";
0157 }
0158 }
0159
0160 void dml_log_pipe_params(
0161 struct display_mode_lib *mode_lib,
0162 display_e2e_pipe_params_st *pipes,
0163 int pipe_cnt)
0164 {
0165 display_pipe_source_params_st *pipe_src;
0166 display_pipe_dest_params_st *pipe_dest;
0167 scaler_ratio_depth_st *scale_ratio_depth;
0168 scaler_taps_st *scale_taps;
0169 display_output_params_st *dout;
0170 display_clocks_and_cfg_st *clks_cfg;
0171 int i;
0172
0173 for (i = 0; i < pipe_cnt; i++) {
0174 pipe_src = &(pipes[i].pipe.src);
0175 pipe_dest = &(pipes[i].pipe.dest);
0176 scale_ratio_depth = &(pipes[i].pipe.scale_ratio_depth);
0177 scale_taps = &(pipes[i].pipe.scale_taps);
0178 dout = &(pipes[i].dout);
0179 clks_cfg = &(pipes[i].clks_cfg);
0180
0181 dml_print("DML PARAMS: =====================================\n");
0182 dml_print("DML PARAMS: PIPE [%d] SOURCE PARAMS:\n", i);
0183 dml_print("DML PARAMS: source_format = %d\n", pipe_src->source_format);
0184 dml_print("DML PARAMS: dcc = %d\n", pipe_src->dcc);
0185 dml_print("DML PARAMS: dcc_rate = %d\n", pipe_src->dcc_rate);
0186 dml_print("DML PARAMS: dcc_use_global = %d\n", pipe_src->dcc_use_global);
0187 dml_print("DML PARAMS: vm = %d\n", pipe_src->vm);
0188 dml_print("DML PARAMS: gpuvm = %d\n", pipe_src->gpuvm);
0189 dml_print("DML PARAMS: hostvm = %d\n", pipe_src->hostvm);
0190 dml_print("DML PARAMS: gpuvm_levels_force_en = %d\n", pipe_src->gpuvm_levels_force_en);
0191 dml_print("DML PARAMS: gpuvm_levels_force = %d\n", pipe_src->gpuvm_levels_force);
0192 dml_print("DML PARAMS: source_scan = %d\n", pipe_src->source_scan);
0193 dml_print("DML PARAMS: sw_mode = %d\n", pipe_src->sw_mode);
0194 dml_print("DML PARAMS: macro_tile_size = %d\n", pipe_src->macro_tile_size);
0195 dml_print("DML PARAMS: viewport_width = %d\n", pipe_src->viewport_width);
0196 dml_print("DML PARAMS: viewport_height = %d\n", pipe_src->viewport_height);
0197 dml_print("DML PARAMS: viewport_y_y = %d\n", pipe_src->viewport_y_y);
0198 dml_print("DML PARAMS: viewport_y_c = %d\n", pipe_src->viewport_y_c);
0199 dml_print("DML PARAMS: viewport_width_c = %d\n", pipe_src->viewport_width_c);
0200 dml_print("DML PARAMS: viewport_height_c = %d\n", pipe_src->viewport_height_c);
0201 dml_print("DML PARAMS: data_pitch = %d\n", pipe_src->data_pitch);
0202 dml_print("DML PARAMS: data_pitch_c = %d\n", pipe_src->data_pitch_c);
0203 dml_print("DML PARAMS: meta_pitch = %d\n", pipe_src->meta_pitch);
0204 dml_print("DML PARAMS: meta_pitch_c = %d\n", pipe_src->meta_pitch_c);
0205 dml_print("DML PARAMS: cur0_src_width = %d\n", pipe_src->cur0_src_width);
0206 dml_print("DML PARAMS: cur0_bpp = %d\n", pipe_src->cur0_bpp);
0207 dml_print("DML PARAMS: cur1_src_width = %d\n", pipe_src->cur1_src_width);
0208 dml_print("DML PARAMS: cur1_bpp = %d\n", pipe_src->cur1_bpp);
0209 dml_print("DML PARAMS: num_cursors = %d\n", pipe_src->num_cursors);
0210 dml_print("DML PARAMS: is_hsplit = %d\n", pipe_src->is_hsplit);
0211 dml_print("DML PARAMS: hsplit_grp = %d\n", pipe_src->hsplit_grp);
0212 dml_print("DML PARAMS: dynamic_metadata_enable = %d\n", pipe_src->dynamic_metadata_enable);
0213 dml_print("DML PARAMS: dmdata_lines_before_active = %d\n", pipe_src->dynamic_metadata_lines_before_active);
0214 dml_print("DML PARAMS: dmdata_xmit_bytes = %d\n", pipe_src->dynamic_metadata_xmit_bytes);
0215 dml_print("DML PARAMS: immediate_flip = %d\n", pipe_src->immediate_flip);
0216 dml_print("DML PARAMS: v_total_min = %d\n", pipe_src->v_total_min);
0217 dml_print("DML PARAMS: v_total_max = %d\n", pipe_src->v_total_max);
0218 dml_print("DML PARAMS: =====================================\n");
0219
0220 dml_print("DML PARAMS: PIPE [%d] DESTINATION PARAMS:\n", i);
0221 dml_print("DML PARAMS: recout_width = %d\n", pipe_dest->recout_width);
0222 dml_print("DML PARAMS: recout_height = %d\n", pipe_dest->recout_height);
0223 dml_print("DML PARAMS: full_recout_width = %d\n", pipe_dest->full_recout_width);
0224 dml_print("DML PARAMS: full_recout_height = %d\n", pipe_dest->full_recout_height);
0225 dml_print("DML PARAMS: hblank_start = %d\n", pipe_dest->hblank_start);
0226 dml_print("DML PARAMS: hblank_end = %d\n", pipe_dest->hblank_end);
0227 dml_print("DML PARAMS: vblank_start = %d\n", pipe_dest->vblank_start);
0228 dml_print("DML PARAMS: vblank_end = %d\n", pipe_dest->vblank_end);
0229 dml_print("DML PARAMS: htotal = %d\n", pipe_dest->htotal);
0230 dml_print("DML PARAMS: vtotal = %d\n", pipe_dest->vtotal);
0231 dml_print("DML PARAMS: vactive = %d\n", pipe_dest->vactive);
0232 dml_print("DML PARAMS: hactive = %d\n", pipe_dest->hactive);
0233 dml_print("DML PARAMS: vstartup_start = %d\n", pipe_dest->vstartup_start);
0234 dml_print("DML PARAMS: vupdate_offset = %d\n", pipe_dest->vupdate_offset);
0235 dml_print("DML PARAMS: vupdate_width = %d\n", pipe_dest->vupdate_width);
0236 dml_print("DML PARAMS: vready_offset = %d\n", pipe_dest->vready_offset);
0237 dml_print("DML PARAMS: interlaced = %d\n", pipe_dest->interlaced);
0238 dml_print("DML PARAMS: pixel_rate_mhz = %3.2f\n", pipe_dest->pixel_rate_mhz);
0239 dml_print("DML PARAMS: sync_vblank_all_planes = %d\n", pipe_dest->synchronized_vblank_all_planes);
0240 dml_print("DML PARAMS: otg_inst = %d\n", pipe_dest->otg_inst);
0241 dml_print("DML PARAMS: odm_combine = %d\n", pipe_dest->odm_combine);
0242 dml_print("DML PARAMS: use_maximum_vstartup = %d\n", pipe_dest->use_maximum_vstartup);
0243 dml_print("DML PARAMS: vtotal_max = %d\n", pipe_dest->vtotal_max);
0244 dml_print("DML PARAMS: vtotal_min = %d\n", pipe_dest->vtotal_min);
0245 dml_print("DML PARAMS: =====================================\n");
0246
0247 dml_print("DML PARAMS: PIPE [%d] SCALER PARAMS:\n", i);
0248 dml_print("DML PARAMS: hscl_ratio = %3.4f\n", scale_ratio_depth->hscl_ratio);
0249 dml_print("DML PARAMS: vscl_ratio = %3.4f\n", scale_ratio_depth->vscl_ratio);
0250 dml_print("DML PARAMS: hscl_ratio_c = %3.4f\n", scale_ratio_depth->hscl_ratio_c);
0251 dml_print("DML PARAMS: vscl_ratio_c = %3.4f\n", scale_ratio_depth->vscl_ratio_c);
0252 dml_print("DML PARAMS: vinit = %3.4f\n", scale_ratio_depth->vinit);
0253 dml_print("DML PARAMS: vinit_c = %3.4f\n", scale_ratio_depth->vinit_c);
0254 dml_print("DML PARAMS: vinit_bot = %3.4f\n", scale_ratio_depth->vinit_bot);
0255 dml_print("DML PARAMS: vinit_bot_c = %3.4f\n", scale_ratio_depth->vinit_bot_c);
0256 dml_print("DML PARAMS: lb_depth = %d\n", scale_ratio_depth->lb_depth);
0257 dml_print("DML PARAMS: scl_enable = %d\n", scale_ratio_depth->scl_enable);
0258 dml_print("DML PARAMS: htaps = %d\n", scale_taps->htaps);
0259 dml_print("DML PARAMS: vtaps = %d\n", scale_taps->vtaps);
0260 dml_print("DML PARAMS: htaps_c = %d\n", scale_taps->htaps_c);
0261 dml_print("DML PARAMS: vtaps_c = %d\n", scale_taps->vtaps_c);
0262 dml_print("DML PARAMS: =====================================\n");
0263
0264 dml_print("DML PARAMS: PIPE [%d] DISPLAY OUTPUT PARAMS:\n", i);
0265 dml_print("DML PARAMS: output_type = %d\n", dout->output_type);
0266 dml_print("DML PARAMS: output_format = %d\n", dout->output_format);
0267 dml_print("DML PARAMS: dsc_input_bpc = %d\n", dout->dsc_input_bpc);
0268 dml_print("DML PARAMS: output_bpp = %3.4f\n", dout->output_bpp);
0269 dml_print("DML PARAMS: dp_lanes = %d\n", dout->dp_lanes);
0270 dml_print("DML PARAMS: dsc_enable = %d\n", dout->dsc_enable);
0271 dml_print("DML PARAMS: dsc_slices = %d\n", dout->dsc_slices);
0272 dml_print("DML PARAMS: wb_enable = %d\n", dout->wb_enable);
0273 dml_print("DML PARAMS: num_active_wb = %d\n", dout->num_active_wb);
0274 dml_print("DML PARAMS: =====================================\n");
0275
0276 dml_print("DML PARAMS: PIPE [%d] CLOCK CONFIG PARAMS:\n", i);
0277 dml_print("DML PARAMS: voltage = %d\n", clks_cfg->voltage);
0278 dml_print("DML PARAMS: dppclk_mhz = %3.2f\n", clks_cfg->dppclk_mhz);
0279 dml_print("DML PARAMS: refclk_mhz = %3.2f\n", clks_cfg->refclk_mhz);
0280 dml_print("DML PARAMS: dispclk_mhz = %3.2f\n", clks_cfg->dispclk_mhz);
0281 dml_print("DML PARAMS: dcfclk_mhz = %3.2f\n", clks_cfg->dcfclk_mhz);
0282 dml_print("DML PARAMS: socclk_mhz = %3.2f\n", clks_cfg->socclk_mhz);
0283 dml_print("DML PARAMS: =====================================\n");
0284 }
0285 }
0286
0287 void dml_log_mode_support_params(struct display_mode_lib *mode_lib)
0288 {
0289 int i;
0290
0291 for (i = mode_lib->vba.soc.num_states; i >= 0; i--) {
0292 dml_print("DML SUPPORT: ===============================================\n");
0293 dml_print("DML SUPPORT: Voltage State %d\n", i);
0294 dml_print("DML SUPPORT: Mode Supported : %s\n", mode_lib->vba.ModeSupport[i][0] ? "Supported" : "NOT Supported");
0295 dml_print("DML SUPPORT: Mode Supported (pipe split) : %s\n", mode_lib->vba.ModeSupport[i][1] ? "Supported" : "NOT Supported");
0296 dml_print("DML SUPPORT: Scale Ratio And Taps : %s\n", mode_lib->vba.ScaleRatioAndTapsSupport ? "Supported" : "NOT Supported");
0297 dml_print("DML SUPPORT: Source Format Pixel And Scan : %s\n", mode_lib->vba.SourceFormatPixelAndScanSupport ? "Supported" : "NOT Supported");
0298 dml_print("DML SUPPORT: Viewport Size : [%s, %s]\n", mode_lib->vba.ViewportSizeSupport[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.ViewportSizeSupport[i][1] ? "Supported" : "NOT Supported");
0299 dml_print("DML SUPPORT: DIO Support : %s\n", mode_lib->vba.DIOSupport[i] ? "Supported" : "NOT Supported");
0300 dml_print("DML SUPPORT: ODM Combine 4To1 Support Check : %s\n", mode_lib->vba.ODMCombine4To1SupportCheckOK[i] ? "Supported" : "NOT Supported");
0301 dml_print("DML SUPPORT: DSC Units : %s\n", mode_lib->vba.NotEnoughDSCUnits[i] ? "Not Supported" : "Supported");
0302 dml_print("DML SUPPORT: DSCCLK Required : %s\n", mode_lib->vba.DSCCLKRequiredMoreThanSupported[i] ? "Not Supported" : "Supported");
0303 dml_print("DML SUPPORT: DTBCLK Required : %s\n", mode_lib->vba.DTBCLKRequiredMoreThanSupported[i] ? "Not Supported" : "Supported");
0304 dml_print("DML SUPPORT: Re-ordering Buffer : [%s, %s]\n", mode_lib->vba.ROBSupport[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.ROBSupport[i][1] ? "Supported" : "NOT Supported");
0305 dml_print("DML SUPPORT: DISPCLK and DPPCLK : [%s, %s]\n", mode_lib->vba.DISPCLK_DPPCLK_Support[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.DISPCLK_DPPCLK_Support[i][1] ? "Supported" : "NOT Supported");
0306 dml_print("DML SUPPORT: Total Available Pipes : [%s, %s]\n", mode_lib->vba.TotalAvailablePipesSupport[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.TotalAvailablePipesSupport[i][1] ? "Supported" : "NOT Supported");
0307 dml_print("DML SUPPORT: Writeback Latency : %s\n", mode_lib->vba.WritebackLatencySupport ? "Supported" : "NOT Supported");
0308 dml_print("DML SUPPORT: Writeback Scale Ratio And Taps : %s\n", mode_lib->vba.WritebackScaleRatioAndTapsSupport ? "Supported" : "NOT Supported");
0309 dml_print("DML SUPPORT: Cursor : %s\n", mode_lib->vba.CursorSupport ? "Supported" : "NOT Supported");
0310 dml_print("DML SUPPORT: Pitch : %s\n", mode_lib->vba.PitchSupport ? "Supported" : "NOT Supported");
0311 dml_print("DML SUPPORT: Prefetch : [%s, %s]\n", mode_lib->vba.PrefetchSupported[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.PrefetchSupported[i][1] ? "Supported" : "NOT Supported");
0312 dml_print("DML SUPPORT: Dynamic Metadata : [%s, %s]\n", mode_lib->vba.DynamicMetadataSupported[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.DynamicMetadataSupported[i][1] ? "Supported" : "NOT Supported");
0313 dml_print("DML SUPPORT: Total Vertical Active Bandwidth : [%s, %s]\n", mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][1] ? "Supported" : "NOT Supported");
0314 dml_print("DML SUPPORT: VRatio In Prefetch : [%s, %s]\n", mode_lib->vba.VRatioInPrefetchSupported[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.VRatioInPrefetchSupported[i][1] ? "Supported" : "NOT Supported");
0315 dml_print("DML SUPPORT: PTE Buffer Size Not Exceeded : [%s, %s]\n", mode_lib->vba.PTEBufferSizeNotExceeded[i][0] ? "Supported" : "NOT Supported", mode_lib->vba.PTEBufferSizeNotExceeded[i][1] ? "Supported" : "NOT Supported");
0316 dml_print("DML SUPPORT: DSC Input BPC : %s\n", mode_lib->vba.NonsupportedDSCInputBPC ? "Not Supported" : "Supported");
0317 dml_print("DML SUPPORT: HostVMEnable : %d\n", mode_lib->vba.HostVMEnable);
0318 dml_print("DML SUPPORT: ImmediateFlipSupportedForState : [%d, %d]\n", mode_lib->vba.ImmediateFlipSupportedForState[i][0], mode_lib->vba.ImmediateFlipSupportedForState[i][1]);
0319 }
0320 }