[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202103082251.Dllr8aVq-lkp@intel.com>
Date: Mon, 8 Mar 2021 22:08:59 +0800
From: kernel test robot <lkp@...el.com>
To: Alex Deucher <alexander.deucher@....com>
Cc: kbuild-all@...org, clang-built-linux@...glegroups.com,
linux-kernel@...r.kernel.org, Luben Tuikov <luben.tuikov@....com>
Subject: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c:963:13:
warning: stack frame size of 2112 bytes in function
'dml_rq_dlg_get_dlg_params'
Hi Alex,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 144c79ef33536b4ecb4951e07dbc1f2b7fa99d32
commit: 20f2ffe504728612d7b0c34e4f8280e34251e704 drm/amdgpu: fold CONFIG_DRM_AMD_DC_DCN3* into CONFIG_DRM_AMD_DC_DCN (v3)
date: 4 months ago
config: powerpc-randconfig-r003-20210307 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4d90e460bcc7b3e5ff6c7e2e05e974772489c4b8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=20f2ffe504728612d7b0c34e4f8280e34251e704
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 20f2ffe504728612d7b0c34e4f8280e34251e704
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c:963:13: warning: stack frame size of 2112 bytes in function 'dml_rq_dlg_get_dlg_params' [-Wframe-larger-than=]
static void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
^
1 warning generated.
vim +/dml_rq_dlg_get_dlg_params +963 drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 960
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 961 // Note: currently taken in as is.
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 962 // Nice to decouple code from hw register implement and extract code that are repeated for luma and chroma.
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 @963 static void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 964 const display_e2e_pipe_params_st *e2e_pipe_param,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 965 const unsigned int num_pipes,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 966 const unsigned int pipe_idx,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 967 display_dlg_regs_st *disp_dlg_regs,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 968 display_ttu_regs_st *disp_ttu_regs,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 969 const display_rq_dlg_params_st rq_dlg_param,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 970 const display_dlg_sys_params_st dlg_sys_param,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 971 const bool cstate_en,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 972 const bool pstate_en,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 973 const bool vm_en,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 974 const bool ignore_viewport_pos,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 975 const bool immediate_flip_support)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 976 {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 977 const display_pipe_source_params_st *src = &e2e_pipe_param[pipe_idx].pipe.src;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 978 const display_pipe_dest_params_st *dst = &e2e_pipe_param[pipe_idx].pipe.dest;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 979 const display_output_params_st *dout = &e2e_pipe_param[pipe_idx].dout;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 980 const display_clocks_and_cfg_st *clks = &e2e_pipe_param[pipe_idx].clks_cfg;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 981 const scaler_ratio_depth_st *scl = &e2e_pipe_param[pipe_idx].pipe.scale_ratio_depth;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 982 const scaler_taps_st *taps = &e2e_pipe_param[pipe_idx].pipe.scale_taps;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 983
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 984 // -------------------------
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 985 // Section 1.15.2.1: OTG dependent Params
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 986 // -------------------------
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 987 // Timing
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 988 unsigned int htotal = dst->htotal;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 989 // unsigned int hblank_start = dst.hblank_start; // TODO: Remove
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 990 unsigned int hblank_end = dst->hblank_end;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 991 unsigned int vblank_start = dst->vblank_start;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 992 unsigned int vblank_end = dst->vblank_end;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 993 unsigned int min_vblank = mode_lib->ip.min_vblank_lines;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 994
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 995 double dppclk_freq_in_mhz = clks->dppclk_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 996 double dispclk_freq_in_mhz = clks->dispclk_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 997 double refclk_freq_in_mhz = clks->refclk_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 998 double pclk_freq_in_mhz = dst->pixel_rate_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 999 bool interlaced = dst->interlaced;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1000
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1001 double ref_freq_to_pix_freq = refclk_freq_in_mhz / pclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1002
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1003 double min_dcfclk_mhz = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1004 double t_calc_us = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1005 double min_ttu_vblank = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1006
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1007 double min_dst_y_ttu_vblank = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1008 unsigned int dlg_vblank_start = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1009 bool dual_plane = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1010 bool mode_422 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1011 unsigned int access_dir = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1012 unsigned int vp_height_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1013 unsigned int vp_width_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1014 unsigned int vp_height_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1015 unsigned int vp_width_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1016
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1017 // Scaling
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1018 unsigned int htaps_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1019 unsigned int htaps_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1020 double hratio_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1021 double hratio_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1022 double vratio_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1023 double vratio_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1024 bool scl_enable = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1025
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1026 double line_time_in_us = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1027 // double vinit_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1028 // double vinit_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1029 // double vinit_bot_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1030 // double vinit_bot_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1031
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1032 // unsigned int swath_height_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1033 unsigned int swath_width_ub_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1034 // unsigned int dpte_bytes_per_row_ub_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1035 unsigned int dpte_groups_per_row_ub_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1036 // unsigned int meta_pte_bytes_per_frame_ub_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1037 // unsigned int meta_bytes_per_row_ub_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1038
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1039 // unsigned int swath_height_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1040 unsigned int swath_width_ub_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1041 // unsigned int dpte_bytes_per_row_ub_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1042 unsigned int dpte_groups_per_row_ub_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1043
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1044 unsigned int meta_chunks_per_row_ub_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1045 unsigned int meta_chunks_per_row_ub_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1046 unsigned int vupdate_offset = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1047 unsigned int vupdate_width = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1048 unsigned int vready_offset = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1049
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1050 unsigned int dppclk_delay_subtotal = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1051 unsigned int dispclk_delay_subtotal = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1052 unsigned int pixel_rate_delay_subtotal = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1053
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1054 unsigned int vstartup_start = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1055 unsigned int dst_x_after_scaler = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1056 unsigned int dst_y_after_scaler = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1057 double line_wait = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1058 double dst_y_prefetch = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1059 double dst_y_per_vm_vblank = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1060 double dst_y_per_row_vblank = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1061 double dst_y_per_vm_flip = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1062 double dst_y_per_row_flip = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1063 double max_dst_y_per_vm_vblank = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1064 double max_dst_y_per_row_vblank = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1065 double lsw = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1066 double vratio_pre_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1067 double vratio_pre_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1068 unsigned int req_per_swath_ub_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1069 unsigned int req_per_swath_ub_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1070 unsigned int meta_row_height_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1071 unsigned int meta_row_height_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1072 unsigned int swath_width_pixels_ub_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1073 unsigned int swath_width_pixels_ub_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1074 unsigned int scaler_rec_in_width_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1075 unsigned int scaler_rec_in_width_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1076 unsigned int dpte_row_height_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1077 unsigned int dpte_row_height_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1078 double hscale_pixel_rate_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1079 double hscale_pixel_rate_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1080 double min_hratio_fact_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1081 double min_hratio_fact_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1082 double refcyc_per_line_delivery_pre_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1083 double refcyc_per_line_delivery_pre_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1084 double refcyc_per_line_delivery_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1085 double refcyc_per_line_delivery_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1086
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1087 double refcyc_per_req_delivery_pre_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1088 double refcyc_per_req_delivery_pre_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1089 double refcyc_per_req_delivery_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1090 double refcyc_per_req_delivery_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1091
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1092 unsigned int full_recout_width = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1093 double refcyc_per_req_delivery_pre_cur0 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1094 double refcyc_per_req_delivery_cur0 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1095 double refcyc_per_req_delivery_pre_cur1 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1096 double refcyc_per_req_delivery_cur1 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1097
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1098 unsigned int pipe_index_in_combine[DC__NUM_PIPES__MAX] = { 0 };
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1099
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1100 memset(disp_dlg_regs, 0, sizeof(*disp_dlg_regs));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1101 memset(disp_ttu_regs, 0, sizeof(*disp_ttu_regs));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1102
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1103 dml_print("DML_DLG: %s: cstate_en = %d\n", __func__, cstate_en);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1104 dml_print("DML_DLG: %s: pstate_en = %d\n", __func__, pstate_en);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1105 dml_print("DML_DLG: %s: vm_en = %d\n", __func__, vm_en);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1106 dml_print("DML_DLG: %s: ignore_viewport_pos = %d\n", __func__, ignore_viewport_pos);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1107 dml_print("DML_DLG: %s: immediate_flip_support = %d\n", __func__, immediate_flip_support);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1108
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1109 dml_print("DML_DLG: %s: dppclk_freq_in_mhz = %3.2f\n", __func__, dppclk_freq_in_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1110 dml_print("DML_DLG: %s: dispclk_freq_in_mhz = %3.2f\n", __func__, dispclk_freq_in_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1111 dml_print("DML_DLG: %s: refclk_freq_in_mhz = %3.2f\n", __func__, refclk_freq_in_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1112 dml_print("DML_DLG: %s: pclk_freq_in_mhz = %3.2f\n", __func__, pclk_freq_in_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1113 dml_print("DML_DLG: %s: interlaced = %d\n", __func__, interlaced);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1114 ASSERT(ref_freq_to_pix_freq < 4.0);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1115
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1116 disp_dlg_regs->ref_freq_to_pix_freq =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1117 (unsigned int)(ref_freq_to_pix_freq * dml_pow(2, 19));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1118 disp_dlg_regs->refcyc_per_htotal = (unsigned int)(ref_freq_to_pix_freq * (double)htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1119 * dml_pow(2, 8));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1120 disp_dlg_regs->dlg_vblank_end = interlaced ? (vblank_end / 2) : vblank_end; // 15 bits
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1121
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1122 min_dcfclk_mhz = dlg_sys_param.deepsleep_dcfclk_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1123 t_calc_us = get_tcalc(mode_lib, e2e_pipe_param, num_pipes);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1124 min_ttu_vblank = get_min_ttu_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1125
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1126 min_dst_y_ttu_vblank = min_ttu_vblank * pclk_freq_in_mhz / (double)htotal;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1127 dlg_vblank_start = interlaced ? (vblank_start / 2) : vblank_start;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1128
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1129 disp_dlg_regs->min_dst_y_next_start = (unsigned int)(((double)dlg_vblank_start
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1130 ) * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1131 ASSERT(disp_dlg_regs->min_dst_y_next_start < (unsigned int)dml_pow(2, 18));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1132
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1133 dml_print("DML_DLG: %s: min_dcfclk_mhz = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1134 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1135 min_dcfclk_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1136 dml_print("DML_DLG: %s: min_ttu_vblank = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1137 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1138 min_ttu_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1139 dml_print("DML_DLG: %s: min_dst_y_ttu_vblank = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1140 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1141 min_dst_y_ttu_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1142 dml_print("DML_DLG: %s: t_calc_us = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1143 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1144 t_calc_us);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1145 dml_print("DML_DLG: %s: disp_dlg_regs->min_dst_y_next_start = 0x%0x\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1146 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1147 disp_dlg_regs->min_dst_y_next_start);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1148 dml_print("DML_DLG: %s: ref_freq_to_pix_freq = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1149 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1150 ref_freq_to_pix_freq);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1151
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1152 // -------------------------
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1153 // Section 1.15.2.2: Prefetch, Active and TTU
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1154 // -------------------------
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1155 // Prefetch Calc
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1156 // Source
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1157 // dcc_en = src.dcc;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1158 dual_plane = is_dual_plane((enum source_format_class)(src->source_format));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1159 mode_422 = 0; // TODO
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1160 access_dir = (src->source_scan == dm_vert); // vp access direction: horizontal or vertical accessed
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1161 vp_height_l = src->viewport_height;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1162 vp_width_l = src->viewport_width;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1163 vp_height_c = src->viewport_height_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1164 vp_width_c = src->viewport_width_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1165
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1166 // Scaling
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1167 htaps_l = taps->htaps;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1168 htaps_c = taps->htaps_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1169 hratio_l = scl->hscl_ratio;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1170 hratio_c = scl->hscl_ratio_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1171 vratio_l = scl->vscl_ratio;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1172 vratio_c = scl->vscl_ratio_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1173 scl_enable = scl->scl_enable;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1174
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1175 line_time_in_us = (htotal / pclk_freq_in_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1176 swath_width_ub_l = rq_dlg_param.rq_l.swath_width_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1177 dpte_groups_per_row_ub_l = rq_dlg_param.rq_l.dpte_groups_per_row_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1178 swath_width_ub_c = rq_dlg_param.rq_c.swath_width_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1179 dpte_groups_per_row_ub_c = rq_dlg_param.rq_c.dpte_groups_per_row_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1180
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1181 meta_chunks_per_row_ub_l = rq_dlg_param.rq_l.meta_chunks_per_row_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1182 meta_chunks_per_row_ub_c = rq_dlg_param.rq_c.meta_chunks_per_row_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1183 vupdate_offset = dst->vupdate_offset;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1184 vupdate_width = dst->vupdate_width;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1185 vready_offset = dst->vready_offset;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1186
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1187 dppclk_delay_subtotal = mode_lib->ip.dppclk_delay_subtotal;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1188 dispclk_delay_subtotal = mode_lib->ip.dispclk_delay_subtotal;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1189
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1190 if (scl_enable)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1191 dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_scl;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1192 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1193 dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_scl_lb_only;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1194
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1195 dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_cnvc_formatter
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1196 + src->num_cursors * mode_lib->ip.dppclk_delay_cnvc_cursor;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1197
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1198 if (dout->dsc_enable) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1199 double dsc_delay = get_dsc_delay(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1200
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1201 dispclk_delay_subtotal += dsc_delay;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1202 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1203
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1204 pixel_rate_delay_subtotal = dppclk_delay_subtotal * pclk_freq_in_mhz / dppclk_freq_in_mhz
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1205 + dispclk_delay_subtotal * pclk_freq_in_mhz / dispclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1206
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1207 vstartup_start = dst->vstartup_start;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1208 if (interlaced) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1209 if (vstartup_start / 2.0
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1210 - (double)(vready_offset + vupdate_width + vupdate_offset) / htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1211 <= vblank_end / 2.0)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1212 disp_dlg_regs->vready_after_vcount0 = 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1213 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1214 disp_dlg_regs->vready_after_vcount0 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1215 } else {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1216 if (vstartup_start
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1217 - (double)(vready_offset + vupdate_width + vupdate_offset) / htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1218 <= vblank_end)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1219 disp_dlg_regs->vready_after_vcount0 = 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1220 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1221 disp_dlg_regs->vready_after_vcount0 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1222 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1223
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1224 // TODO: Where is this coming from?
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1225 if (interlaced)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1226 vstartup_start = vstartup_start / 2;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1227
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1228 // TODO: What if this min_vblank doesn't match the value in the dml_config_settings.cpp?
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1229 if (vstartup_start >= min_vblank) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1230 dml_print("WARNING: DML_DLG: %s: vblank_start=%d vblank_end=%d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1231 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1232 vblank_start,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1233 vblank_end);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1234 dml_print("WARNING: DML_DLG: %s: vstartup_start=%d should be less than min_vblank=%d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1235 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1236 vstartup_start,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1237 min_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1238 min_vblank = vstartup_start + 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1239 dml_print("WARNING: DML_DLG: %s: vstartup_start=%d should be less than min_vblank=%d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1240 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1241 vstartup_start,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1242 min_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1243 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1244
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1245 dst_x_after_scaler = get_dst_x_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1246 dst_y_after_scaler = get_dst_y_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1247
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1248 // do some adjustment on the dst_after scaler to account for odm combine mode
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1249 dml_print("DML_DLG: %s: input dst_x_after_scaler = %d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1250 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1251 dst_x_after_scaler);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1252 dml_print("DML_DLG: %s: input dst_y_after_scaler = %d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1253 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1254 dst_y_after_scaler);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1255
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1256 // need to figure out which side of odm combine we're in
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1257 if (dst->odm_combine) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1258 // figure out which pipes go together
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1259 bool visited[DC__NUM_PIPES__MAX] = { false };
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1260 unsigned int i, j, k;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1261
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1262 for (k = 0; k < num_pipes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1263 visited[k] = false;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1264 pipe_index_in_combine[k] = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1265 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1266
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1267 for (i = 0; i < num_pipes; i++) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1268 if (e2e_pipe_param[i].pipe.src.is_hsplit && !visited[i]) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1269
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1270 unsigned int grp = e2e_pipe_param[i].pipe.src.hsplit_grp;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1271 unsigned int grp_idx = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1272
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1273 for (j = i; j < num_pipes; j++) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1274 if (e2e_pipe_param[j].pipe.src.hsplit_grp == grp
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1275 && e2e_pipe_param[j].pipe.src.is_hsplit && !visited[j]) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1276 pipe_index_in_combine[j] = grp_idx;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1277 dml_print("DML_DLG: %s: pipe[%d] is in grp %d idx %d\n", __func__, j, grp, grp_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1278 grp_idx++;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1279 visited[j] = true;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1280 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1281 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1282 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1283 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1284
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1285 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1286
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1287 if (dst->odm_combine == dm_odm_combine_mode_disabled) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1288 disp_dlg_regs->refcyc_h_blank_end = (unsigned int)((double) hblank_end * ref_freq_to_pix_freq);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1289 } else {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1290 unsigned int odm_combine_factor = (dst->odm_combine == dm_odm_combine_mode_2to1 ? 2 : 4); // TODO: We should really check that 4to1 is supported before setting it to 4
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1291 unsigned int odm_pipe_index = pipe_index_in_combine[pipe_idx];
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1292 disp_dlg_regs->refcyc_h_blank_end = (unsigned int)(((double) hblank_end + odm_pipe_index * (double) dst->hactive / odm_combine_factor) * ref_freq_to_pix_freq);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1293 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1294 ASSERT(disp_dlg_regs->refcyc_h_blank_end < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1295
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1296 dml_print("DML_DLG: %s: htotal = %d\n", __func__, htotal);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1297 dml_print("DML_DLG: %s: pixel_rate_delay_subtotal = %d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1298 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1299 pixel_rate_delay_subtotal);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1300 dml_print("DML_DLG: %s: dst_x_after_scaler[%d] = %d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1301 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1302 pipe_idx,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1303 dst_x_after_scaler);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1304 dml_print("DML_DLG: %s: dst_y_after_scaler[%d] = %d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1305 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1306 pipe_idx,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1307 dst_y_after_scaler);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1308
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1309 // Lwait
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1310 // TODO: Should this be urgent_latency_pixel_mixed_with_vm_data_us?
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1311 line_wait = mode_lib->soc.urgent_latency_pixel_data_only_us;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1312 if (cstate_en)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1313 line_wait = dml_max(mode_lib->soc.sr_enter_plus_exit_time_us, line_wait);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1314 if (pstate_en)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1315 line_wait = dml_max(mode_lib->soc.dram_clock_change_latency_us
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1316 + mode_lib->soc.urgent_latency_pixel_data_only_us, // TODO: Should this be urgent_latency_pixel_mixed_with_vm_data_us?
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1317 line_wait);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1318 line_wait = line_wait / line_time_in_us;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1319
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1320 dst_y_prefetch = get_dst_y_prefetch(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1321 dml_print("DML_DLG: %s: dst_y_prefetch (after rnd) = %3.2f\n", __func__, dst_y_prefetch);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1322
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1323 dst_y_per_vm_vblank = get_dst_y_per_vm_vblank(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1324 e2e_pipe_param,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1325 num_pipes,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1326 pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1327 dst_y_per_row_vblank = get_dst_y_per_row_vblank(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1328 e2e_pipe_param,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1329 num_pipes,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1330 pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1331 dst_y_per_vm_flip = get_dst_y_per_vm_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1332 dst_y_per_row_flip = get_dst_y_per_row_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1333
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1334 max_dst_y_per_vm_vblank = 32.0; //U5.2
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1335 max_dst_y_per_row_vblank = 16.0; //U4.2
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1336
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1337 // magic!
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1338 if (htotal <= 75) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1339 min_vblank = 300;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1340 max_dst_y_per_vm_vblank = 100.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1341 max_dst_y_per_row_vblank = 100.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1342 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1343
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1344 dml_print("DML_DLG: %s: dst_y_per_vm_flip = %3.2f\n", __func__, dst_y_per_vm_flip);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1345 dml_print("DML_DLG: %s: dst_y_per_row_flip = %3.2f\n", __func__, dst_y_per_row_flip);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1346 dml_print("DML_DLG: %s: dst_y_per_vm_vblank = %3.2f\n", __func__, dst_y_per_vm_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1347 dml_print("DML_DLG: %s: dst_y_per_row_vblank = %3.2f\n", __func__, dst_y_per_row_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1348
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1349 ASSERT(dst_y_per_vm_vblank < max_dst_y_per_vm_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1350 ASSERT(dst_y_per_row_vblank < max_dst_y_per_row_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1351
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1352 ASSERT(dst_y_prefetch > (dst_y_per_vm_vblank + dst_y_per_row_vblank));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1353 lsw = dst_y_prefetch - (dst_y_per_vm_vblank + dst_y_per_row_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1354
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1355 dml_print("DML_DLG: %s: lsw = %3.2f\n", __func__, lsw);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1356
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1357 vratio_pre_l = get_vratio_prefetch_l(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1358 vratio_pre_c = get_vratio_prefetch_c(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1359
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1360 dml_print("DML_DLG: %s: vratio_pre_l=%3.2f\n", __func__, vratio_pre_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1361 dml_print("DML_DLG: %s: vratio_pre_c=%3.2f\n", __func__, vratio_pre_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1362
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1363 // Active
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1364 req_per_swath_ub_l = rq_dlg_param.rq_l.req_per_swath_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1365 req_per_swath_ub_c = rq_dlg_param.rq_c.req_per_swath_ub;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1366 meta_row_height_l = rq_dlg_param.rq_l.meta_row_height;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1367 meta_row_height_c = rq_dlg_param.rq_c.meta_row_height;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1368 swath_width_pixels_ub_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1369 swath_width_pixels_ub_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1370 scaler_rec_in_width_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1371 scaler_rec_in_width_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1372 dpte_row_height_l = rq_dlg_param.rq_l.dpte_row_height;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1373 dpte_row_height_c = rq_dlg_param.rq_c.dpte_row_height;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1374
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1375 if (mode_422) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1376 swath_width_pixels_ub_l = swath_width_ub_l * 2; // *2 for 2 pixel per element
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1377 swath_width_pixels_ub_c = swath_width_ub_c * 2;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1378 } else {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1379 swath_width_pixels_ub_l = swath_width_ub_l * 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1380 swath_width_pixels_ub_c = swath_width_ub_c * 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1381 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1382
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1383 hscale_pixel_rate_l = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1384 hscale_pixel_rate_c = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1385 min_hratio_fact_l = 1.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1386 min_hratio_fact_c = 1.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1387
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1388 if (hratio_l <= 1)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1389 min_hratio_fact_l = 2.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1390 else if (htaps_l <= 6) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1391 if ((hratio_l * 2.0) > 4.0)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1392 min_hratio_fact_l = 4.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1393 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1394 min_hratio_fact_l = hratio_l * 2.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1395 } else {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1396 if (hratio_l > 4.0)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1397 min_hratio_fact_l = 4.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1398 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1399 min_hratio_fact_l = hratio_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1400 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1401
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1402 hscale_pixel_rate_l = min_hratio_fact_l * dppclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1403
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1404 if (hratio_c <= 1)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1405 min_hratio_fact_c = 2.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1406 else if (htaps_c <= 6) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1407 if ((hratio_c * 2.0) > 4.0)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1408 min_hratio_fact_c = 4.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1409 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1410 min_hratio_fact_c = hratio_c * 2.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1411 } else {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1412 if (hratio_c > 4.0)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1413 min_hratio_fact_c = 4.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1414 else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1415 min_hratio_fact_c = hratio_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1416 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1417
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1418 hscale_pixel_rate_c = min_hratio_fact_c * dppclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1419
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1420 refcyc_per_line_delivery_pre_l = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1421 refcyc_per_line_delivery_pre_c = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1422 refcyc_per_line_delivery_l = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1423 refcyc_per_line_delivery_c = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1424
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1425 refcyc_per_req_delivery_pre_l = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1426 refcyc_per_req_delivery_pre_c = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1427 refcyc_per_req_delivery_l = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1428 refcyc_per_req_delivery_c = 0.;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1429
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1430 full_recout_width = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1431 // In ODM
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1432 if (src->is_hsplit) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1433 // This "hack" is only allowed (and valid) for MPC combine. In ODM
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1434 // combine, you MUST specify the full_recout_width...according to Oswin
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1435 if (dst->full_recout_width == 0 && !dst->odm_combine) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1436 dml_print("DML_DLG: %s: Warning: full_recout_width not set in hsplit mode\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1437 __func__);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1438 full_recout_width = dst->recout_width * 2; // assume half split for dcn1
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1439 } else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1440 full_recout_width = dst->full_recout_width;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1441 } else
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1442 full_recout_width = dst->recout_width;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1443
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1444 // As of DCN2, mpc_combine and odm_combine are mutually exclusive
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1445 refcyc_per_line_delivery_pre_l = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1446 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1447 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1448 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1449 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1450 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1451 vratio_pre_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1452 hscale_pixel_rate_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1453 swath_width_pixels_ub_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1454 1); // per line
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1455
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1456 refcyc_per_line_delivery_l = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1457 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1458 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1459 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1460 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1461 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1462 vratio_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1463 hscale_pixel_rate_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1464 swath_width_pixels_ub_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1465 1); // per line
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1466
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1467 dml_print("DML_DLG: %s: full_recout_width = %d\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1468 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1469 full_recout_width);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1470 dml_print("DML_DLG: %s: hscale_pixel_rate_l = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1471 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1472 hscale_pixel_rate_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1473 dml_print("DML_DLG: %s: refcyc_per_line_delivery_pre_l = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1474 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1475 refcyc_per_line_delivery_pre_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1476 dml_print("DML_DLG: %s: refcyc_per_line_delivery_l = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1477 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1478 refcyc_per_line_delivery_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1479
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1480 if (dual_plane) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1481 refcyc_per_line_delivery_pre_c = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1482 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1483 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1484 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1485 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1486 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1487 vratio_pre_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1488 hscale_pixel_rate_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1489 swath_width_pixels_ub_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1490 1); // per line
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1491
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1492 refcyc_per_line_delivery_c = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1493 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1494 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1495 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1496 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1497 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1498 vratio_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1499 hscale_pixel_rate_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1500 swath_width_pixels_ub_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1501 1); // per line
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1502
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1503 dml_print("DML_DLG: %s: refcyc_per_line_delivery_pre_c = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1504 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1505 refcyc_per_line_delivery_pre_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1506 dml_print("DML_DLG: %s: refcyc_per_line_delivery_c = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1507 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1508 refcyc_per_line_delivery_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1509 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1510
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1511 // smehta: this is a hack added until we get the real dml, sorry, need to make progress
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1512 if (src->dynamic_metadata_enable && src->gpuvm) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1513 unsigned int levels = mode_lib->ip.gpuvm_max_page_table_levels;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1514 double ref_cycles;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1515
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1516 if (src->hostvm)
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1517 levels = levels * (mode_lib->ip.hostvm_max_page_table_levels+1);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1518
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1519 ref_cycles = (levels * mode_lib->soc.urgent_latency_vm_data_only_us) * refclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1520 dml_print("BENyamin: dst_y_prefetch = %f %d %f %f \n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1521 ref_cycles, levels, mode_lib->soc.urgent_latency_vm_data_only_us, refclk_freq_in_mhz);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1522 disp_dlg_regs->refcyc_per_vm_dmdata = (unsigned int) ref_cycles;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1523 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1524 dml_print("BENyamin: dmdta_en vm = %d %d \n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1525 src->dynamic_metadata_enable, src->vm);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1526 // TTU - Luma / Chroma
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1527 if (access_dir) { // vertical access
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1528 scaler_rec_in_width_l = vp_height_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1529 scaler_rec_in_width_c = vp_height_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1530 } else {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1531 scaler_rec_in_width_l = vp_width_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1532 scaler_rec_in_width_c = vp_width_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1533 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1534
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1535 refcyc_per_req_delivery_pre_l = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1536 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1537 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1538 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1539 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1540 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1541 vratio_pre_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1542 hscale_pixel_rate_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1543 scaler_rec_in_width_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1544 req_per_swath_ub_l); // per req
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1545 refcyc_per_req_delivery_l = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1546 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1547 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1548 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1549 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1550 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1551 vratio_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1552 hscale_pixel_rate_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1553 scaler_rec_in_width_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1554 req_per_swath_ub_l); // per req
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1555
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1556 dml_print("DML_DLG: %s: refcyc_per_req_delivery_pre_l = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1557 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1558 refcyc_per_req_delivery_pre_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1559 dml_print("DML_DLG: %s: refcyc_per_req_delivery_l = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1560 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1561 refcyc_per_req_delivery_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1562
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1563 ASSERT(refcyc_per_req_delivery_pre_l < dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1564 ASSERT(refcyc_per_req_delivery_l < dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1565
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1566 if (dual_plane) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1567 refcyc_per_req_delivery_pre_c = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1568 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1569 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1570 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1571 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1572 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1573 vratio_pre_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1574 hscale_pixel_rate_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1575 scaler_rec_in_width_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1576 req_per_swath_ub_c); // per req
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1577 refcyc_per_req_delivery_c = get_refcyc_per_delivery(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1578 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1579 pclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1580 dst->odm_combine,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1581 full_recout_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1582 dst->hactive,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1583 vratio_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1584 hscale_pixel_rate_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1585 scaler_rec_in_width_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1586 req_per_swath_ub_c); // per req
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1587
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1588 dml_print("DML_DLG: %s: refcyc_per_req_delivery_pre_c = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1589 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1590 refcyc_per_req_delivery_pre_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1591 dml_print("DML_DLG: %s: refcyc_per_req_delivery_c = %3.2f\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1592 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1593 refcyc_per_req_delivery_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1594
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1595 ASSERT(refcyc_per_req_delivery_pre_c < dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1596 ASSERT(refcyc_per_req_delivery_c < dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1597 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1598
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1599 // TTU - Cursor
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1600 refcyc_per_req_delivery_pre_cur0 = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1601 refcyc_per_req_delivery_cur0 = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1602 if (src->num_cursors > 0) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1603 calculate_ttu_cursor(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1604 &refcyc_per_req_delivery_pre_cur0,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1605 &refcyc_per_req_delivery_cur0,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1606 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1607 ref_freq_to_pix_freq,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1608 hscale_pixel_rate_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1609 scl->hscl_ratio,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1610 vratio_pre_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1611 vratio_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1612 src->cur0_src_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1613 (enum cursor_bpp)(src->cur0_bpp));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1614 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1615
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1616 refcyc_per_req_delivery_pre_cur1 = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1617 refcyc_per_req_delivery_cur1 = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1618 if (src->num_cursors > 1) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1619 calculate_ttu_cursor(mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1620 &refcyc_per_req_delivery_pre_cur1,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1621 &refcyc_per_req_delivery_cur1,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1622 refclk_freq_in_mhz,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1623 ref_freq_to_pix_freq,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1624 hscale_pixel_rate_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1625 scl->hscl_ratio,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1626 vratio_pre_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1627 vratio_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1628 src->cur1_src_width,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1629 (enum cursor_bpp)(src->cur1_bpp));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1630 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1631
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1632 // TTU - Misc
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1633 // all hard-coded
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1634
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1635 // Assignment to register structures
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1636 disp_dlg_regs->dst_y_after_scaler = dst_y_after_scaler; // in terms of line
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1637 ASSERT(disp_dlg_regs->dst_y_after_scaler < (unsigned int)8);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1638 disp_dlg_regs->refcyc_x_after_scaler = dst_x_after_scaler * ref_freq_to_pix_freq; // in terms of refclk
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1639 ASSERT(disp_dlg_regs->refcyc_x_after_scaler < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1640 disp_dlg_regs->dst_y_prefetch = (unsigned int)(dst_y_prefetch * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1641 disp_dlg_regs->dst_y_per_vm_vblank = (unsigned int)(dst_y_per_vm_vblank * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1642 disp_dlg_regs->dst_y_per_row_vblank = (unsigned int)(dst_y_per_row_vblank * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1643 disp_dlg_regs->dst_y_per_vm_flip = (unsigned int)(dst_y_per_vm_flip * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1644 disp_dlg_regs->dst_y_per_row_flip = (unsigned int)(dst_y_per_row_flip * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1645
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1646 disp_dlg_regs->vratio_prefetch = (unsigned int)(vratio_pre_l * dml_pow(2, 19));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1647 disp_dlg_regs->vratio_prefetch_c = (unsigned int)(vratio_pre_c * dml_pow(2, 19));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1648
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1649 dml_print("DML_DLG: %s: disp_dlg_regs->dst_y_per_vm_vblank = 0x%x\n", __func__, disp_dlg_regs->dst_y_per_vm_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1650 dml_print("DML_DLG: %s: disp_dlg_regs->dst_y_per_row_vblank = 0x%x\n", __func__, disp_dlg_regs->dst_y_per_row_vblank);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1651 dml_print("DML_DLG: %s: disp_dlg_regs->dst_y_per_vm_flip = 0x%x\n", __func__, disp_dlg_regs->dst_y_per_vm_flip);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1652 dml_print("DML_DLG: %s: disp_dlg_regs->dst_y_per_row_flip = 0x%x\n", __func__, disp_dlg_regs->dst_y_per_row_flip);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1653 disp_dlg_regs->refcyc_per_pte_group_vblank_l =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1654 (unsigned int)(dst_y_per_row_vblank * (double)htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1655 * ref_freq_to_pix_freq / (double)dpte_groups_per_row_ub_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1656 ASSERT(disp_dlg_regs->refcyc_per_pte_group_vblank_l < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1657
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1658 if (dual_plane) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1659 disp_dlg_regs->refcyc_per_pte_group_vblank_c = (unsigned int)(dst_y_per_row_vblank
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1660 * (double)htotal * ref_freq_to_pix_freq
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1661 / (double)dpte_groups_per_row_ub_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1662 ASSERT(disp_dlg_regs->refcyc_per_pte_group_vblank_c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1663 < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1664 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1665
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1666 disp_dlg_regs->refcyc_per_meta_chunk_vblank_l =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1667 (unsigned int)(dst_y_per_row_vblank * (double)htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1668 * ref_freq_to_pix_freq / (double)meta_chunks_per_row_ub_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1669 ASSERT(disp_dlg_regs->refcyc_per_meta_chunk_vblank_l < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1670
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1671 disp_dlg_regs->refcyc_per_meta_chunk_vblank_c =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1672 disp_dlg_regs->refcyc_per_meta_chunk_vblank_l; // dcc for 4:2:0 is not supported in dcn1.0. assigned to be the same as _l for now
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1673
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1674 disp_dlg_regs->refcyc_per_pte_group_flip_l = (unsigned int)(dst_y_per_row_flip * htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1675 * ref_freq_to_pix_freq) / dpte_groups_per_row_ub_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1676 disp_dlg_regs->refcyc_per_meta_chunk_flip_l = (unsigned int)(dst_y_per_row_flip * htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1677 * ref_freq_to_pix_freq) / meta_chunks_per_row_ub_l;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1678
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1679 if (dual_plane) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1680 disp_dlg_regs->refcyc_per_pte_group_flip_c = (unsigned int)(dst_y_per_row_flip
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1681 * htotal * ref_freq_to_pix_freq) / dpte_groups_per_row_ub_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1682 disp_dlg_regs->refcyc_per_meta_chunk_flip_c = (unsigned int)(dst_y_per_row_flip
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1683 * htotal * ref_freq_to_pix_freq) / meta_chunks_per_row_ub_c;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1684 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1685
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1686 disp_dlg_regs->refcyc_per_vm_group_vblank = get_refcyc_per_vm_group_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1687 disp_dlg_regs->refcyc_per_vm_group_flip = get_refcyc_per_vm_group_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1688 disp_dlg_regs->refcyc_per_vm_req_vblank = get_refcyc_per_vm_req_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz * dml_pow(2, 10);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1689 disp_dlg_regs->refcyc_per_vm_req_flip = get_refcyc_per_vm_req_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz * dml_pow(2, 10);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1690
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1691 // Clamp to max for now
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1692 if (disp_dlg_regs->refcyc_per_vm_group_vblank >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1693 disp_dlg_regs->refcyc_per_vm_group_vblank = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1694
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1695 if (disp_dlg_regs->refcyc_per_vm_group_flip >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1696 disp_dlg_regs->refcyc_per_vm_group_flip = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1697
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1698 if (disp_dlg_regs->refcyc_per_vm_req_vblank >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1699 disp_dlg_regs->refcyc_per_vm_req_vblank = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1700
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1701 if (disp_dlg_regs->refcyc_per_vm_req_flip >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1702 disp_dlg_regs->refcyc_per_vm_req_flip = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1703
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1704 disp_dlg_regs->dst_y_per_pte_row_nom_l = (unsigned int)((double)dpte_row_height_l
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1705 / (double)vratio_l * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1706 ASSERT(disp_dlg_regs->dst_y_per_pte_row_nom_l < (unsigned int)dml_pow(2, 17));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1707
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1708 if (dual_plane) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1709 disp_dlg_regs->dst_y_per_pte_row_nom_c = (unsigned int)((double)dpte_row_height_c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1710 / (double)vratio_c * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1711 if (disp_dlg_regs->dst_y_per_pte_row_nom_c >= (unsigned int)dml_pow(2, 17)) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1712 dml_print("DML_DLG: %s: Warning dst_y_per_pte_row_nom_c %u larger than supported by register format U15.2 %u\n",
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1713 __func__,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1714 disp_dlg_regs->dst_y_per_pte_row_nom_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1715 (unsigned int)dml_pow(2, 17) - 1);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1716 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1717 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1718
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1719 disp_dlg_regs->dst_y_per_meta_row_nom_l = (unsigned int)((double)meta_row_height_l
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1720 / (double)vratio_l * dml_pow(2, 2));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1721 ASSERT(disp_dlg_regs->dst_y_per_meta_row_nom_l < (unsigned int)dml_pow(2, 17));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1722
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1723 disp_dlg_regs->dst_y_per_meta_row_nom_c = disp_dlg_regs->dst_y_per_meta_row_nom_l; // TODO: dcc for 4:2:0 is not supported in dcn1.0. assigned to be the same as _l for now
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1724
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1725 dml_print("DML: Trow: %fus\n", line_time_in_us * (double)dpte_row_height_l / (double)vratio_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1726
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1727 disp_dlg_regs->refcyc_per_pte_group_nom_l = (unsigned int)((double)dpte_row_height_l
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1728 / (double)vratio_l * (double)htotal * ref_freq_to_pix_freq
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1729 / (double)dpte_groups_per_row_ub_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1730 if (disp_dlg_regs->refcyc_per_pte_group_nom_l >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1731 disp_dlg_regs->refcyc_per_pte_group_nom_l = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1732 disp_dlg_regs->refcyc_per_meta_chunk_nom_l = (unsigned int)((double)meta_row_height_l
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1733 / (double)vratio_l * (double)htotal * ref_freq_to_pix_freq
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1734 / (double)meta_chunks_per_row_ub_l);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1735 if (disp_dlg_regs->refcyc_per_meta_chunk_nom_l >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1736 disp_dlg_regs->refcyc_per_meta_chunk_nom_l = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1737
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1738 if (dual_plane) {
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1739 disp_dlg_regs->refcyc_per_pte_group_nom_c =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1740 (unsigned int)((double)dpte_row_height_c / (double)vratio_c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1741 * (double)htotal * ref_freq_to_pix_freq
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1742 / (double)dpte_groups_per_row_ub_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1743 if (disp_dlg_regs->refcyc_per_pte_group_nom_c >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1744 disp_dlg_regs->refcyc_per_pte_group_nom_c = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1745
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1746 // TODO: Is this the right calculation? Does htotal need to be halved?
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1747 disp_dlg_regs->refcyc_per_meta_chunk_nom_c =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1748 (unsigned int)((double)meta_row_height_c / (double)vratio_c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1749 * (double)htotal * ref_freq_to_pix_freq
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1750 / (double)meta_chunks_per_row_ub_c);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1751 if (disp_dlg_regs->refcyc_per_meta_chunk_nom_c >= (unsigned int)dml_pow(2, 23))
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1752 disp_dlg_regs->refcyc_per_meta_chunk_nom_c = dml_pow(2, 23) - 1;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1753 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1754
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1755 disp_dlg_regs->refcyc_per_line_delivery_pre_l = (unsigned int)dml_floor(refcyc_per_line_delivery_pre_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1756 1);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1757 disp_dlg_regs->refcyc_per_line_delivery_l = (unsigned int)dml_floor(refcyc_per_line_delivery_l,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1758 1);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1759 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_pre_l < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1760 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_l < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1761
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1762 disp_dlg_regs->refcyc_per_line_delivery_pre_c = (unsigned int)dml_floor(refcyc_per_line_delivery_pre_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1763 1);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1764 disp_dlg_regs->refcyc_per_line_delivery_c = (unsigned int)dml_floor(refcyc_per_line_delivery_c,
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1765 1);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1766 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_pre_c < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1767 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_c < (unsigned int)dml_pow(2, 13));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1768
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1769 disp_dlg_regs->chunk_hdl_adjust_cur0 = 3;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1770 disp_dlg_regs->dst_y_offset_cur0 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1771 disp_dlg_regs->chunk_hdl_adjust_cur1 = 3;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1772 disp_dlg_regs->dst_y_offset_cur1 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1773
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1774 disp_dlg_regs->dst_y_delta_drq_limit = 0x7fff; // off
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1775
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1776 disp_ttu_regs->refcyc_per_req_delivery_pre_l = (unsigned int)(refcyc_per_req_delivery_pre_l
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1777 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1778 disp_ttu_regs->refcyc_per_req_delivery_l = (unsigned int)(refcyc_per_req_delivery_l
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1779 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1780 disp_ttu_regs->refcyc_per_req_delivery_pre_c = (unsigned int)(refcyc_per_req_delivery_pre_c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1781 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1782 disp_ttu_regs->refcyc_per_req_delivery_c = (unsigned int)(refcyc_per_req_delivery_c
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1783 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1784 disp_ttu_regs->refcyc_per_req_delivery_pre_cur0 =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1785 (unsigned int)(refcyc_per_req_delivery_pre_cur0 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1786 disp_ttu_regs->refcyc_per_req_delivery_cur0 = (unsigned int)(refcyc_per_req_delivery_cur0
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1787 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1788 disp_ttu_regs->refcyc_per_req_delivery_pre_cur1 =
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1789 (unsigned int)(refcyc_per_req_delivery_pre_cur1 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1790 disp_ttu_regs->refcyc_per_req_delivery_cur1 = (unsigned int)(refcyc_per_req_delivery_cur1
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1791 * dml_pow(2, 10));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1792 disp_ttu_regs->qos_level_low_wm = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1793 ASSERT(disp_ttu_regs->qos_level_low_wm < dml_pow(2, 14));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1794 disp_ttu_regs->qos_level_high_wm = (unsigned int)(4.0 * (double)htotal
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1795 * ref_freq_to_pix_freq);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1796 ASSERT(disp_ttu_regs->qos_level_high_wm < dml_pow(2, 14));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1797
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1798 disp_ttu_regs->qos_level_flip = 14;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1799 disp_ttu_regs->qos_level_fixed_l = 8;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1800 disp_ttu_regs->qos_level_fixed_c = 8;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1801 disp_ttu_regs->qos_level_fixed_cur0 = 8;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1802 disp_ttu_regs->qos_ramp_disable_l = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1803 disp_ttu_regs->qos_ramp_disable_c = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1804 disp_ttu_regs->qos_ramp_disable_cur0 = 0;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1805
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1806 disp_ttu_regs->min_ttu_vblank = min_ttu_vblank * refclk_freq_in_mhz;
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1807 ASSERT(disp_ttu_regs->min_ttu_vblank < dml_pow(2, 24));
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1808
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1809 print__ttu_regs_st(mode_lib, *disp_ttu_regs);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1810 print__dlg_regs_st(mode_lib, *disp_dlg_regs);
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1811 }
6725a88f88a7e9 Bhawanpreet Lakha 2020-05-21 1812
:::::: The code at line 963 was first introduced by commit
:::::: 6725a88f88a7e922e91c45bf83d320487810c192 drm/amd/display: Add DCN3 DML
:::::: TO: Bhawanpreet Lakha <Bhawanpreet.Lakha@....com>
:::::: CC: Alex Deucher <alexander.deucher@....com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (33526 bytes)
Powered by blists - more mailing lists