2 * Copyright 2017 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
27 #include "display_mode_lib.h"
28 #include "display_mode_vba.h"
29 #include "dml_inline_defs.h"
33 * This file is gcc-parsable HW gospel, coming straight from HW engineers.
35 * It doesn't adhere to Linux kernel style and sometimes will do things in odd
36 * ways. Unless there is something clearly wrong with it the code should
37 * remain as-is as it provides us with a guarantee from HW that it is correct.
41 static void fetch_socbb_params(struct display_mode_lib *mode_lib);
42 static void fetch_ip_params(struct display_mode_lib *mode_lib);
43 static void fetch_pipe_params(struct display_mode_lib *mode_lib);
44 static void recalculate_params(
45 struct display_mode_lib *mode_lib,
46 const display_e2e_pipe_params_st *pipes,
47 unsigned int num_pipes);
49 static unsigned int CursorBppEnumToBits(enum cursor_bpp ebpp);
50 static void cache_debug_params(struct display_mode_lib *mode_lib);
52 unsigned int dml_get_voltage_level(
53 struct display_mode_lib *mode_lib,
54 const display_e2e_pipe_params_st *pipes,
55 unsigned int num_pipes)
57 bool need_recalculate = memcmp(&mode_lib->soc, &mode_lib->vba.soc, sizeof(mode_lib->vba.soc)) != 0
58 || memcmp(&mode_lib->ip, &mode_lib->vba.ip, sizeof(mode_lib->vba.ip)) != 0
59 || num_pipes != mode_lib->vba.cache_num_pipes
60 || memcmp(pipes, mode_lib->vba.cache_pipes,
61 sizeof(display_e2e_pipe_params_st) * num_pipes) != 0;
63 mode_lib->vba.soc = mode_lib->soc;
64 mode_lib->vba.ip = mode_lib->ip;
65 memcpy(mode_lib->vba.cache_pipes, pipes, sizeof(*pipes) * num_pipes);
66 mode_lib->vba.cache_num_pipes = num_pipes;
68 if (need_recalculate && pipes[0].clks_cfg.dppclk_mhz != 0)
69 mode_lib->funcs.recalculate(mode_lib);
71 fetch_socbb_params(mode_lib);
72 fetch_ip_params(mode_lib);
73 fetch_pipe_params(mode_lib);
74 PixelClockAdjustmentForProgressiveToInterlaceUnit(mode_lib);
76 mode_lib->funcs.validate(mode_lib);
77 cache_debug_params(mode_lib);
79 return mode_lib->vba.VoltageLevel;
82 #define dml_get_attr_func(attr, var) double get_##attr(struct display_mode_lib *mode_lib, const display_e2e_pipe_params_st *pipes, unsigned int num_pipes) \
84 recalculate_params(mode_lib, pipes, num_pipes); \
88 dml_get_attr_func(clk_dcf_deepsleep, mode_lib->vba.DCFCLKDeepSleep);
89 dml_get_attr_func(wm_urgent, mode_lib->vba.UrgentWatermark);
90 dml_get_attr_func(wm_memory_trip, mode_lib->vba.UrgentLatency);
91 dml_get_attr_func(wm_writeback_urgent, mode_lib->vba.WritebackUrgentWatermark);
92 dml_get_attr_func(wm_stutter_exit, mode_lib->vba.StutterExitWatermark);
93 dml_get_attr_func(wm_stutter_enter_exit, mode_lib->vba.StutterEnterPlusExitWatermark);
94 dml_get_attr_func(wm_z8_stutter_exit, mode_lib->vba.Z8StutterExitWatermark);
95 dml_get_attr_func(wm_z8_stutter_enter_exit, mode_lib->vba.Z8StutterEnterPlusExitWatermark);
96 dml_get_attr_func(stutter_efficiency_z8, mode_lib->vba.Z8StutterEfficiency);
97 dml_get_attr_func(stutter_num_bursts_z8, mode_lib->vba.Z8NumberOfStutterBurstsPerFrame);
98 dml_get_attr_func(wm_dram_clock_change, mode_lib->vba.DRAMClockChangeWatermark);
99 dml_get_attr_func(wm_writeback_dram_clock_change, mode_lib->vba.WritebackDRAMClockChangeWatermark);
100 dml_get_attr_func(stutter_efficiency, mode_lib->vba.StutterEfficiency);
101 dml_get_attr_func(stutter_efficiency_no_vblank, mode_lib->vba.StutterEfficiencyNotIncludingVBlank);
102 dml_get_attr_func(stutter_period, mode_lib->vba.StutterPeriod);
103 dml_get_attr_func(urgent_latency, mode_lib->vba.UrgentLatency);
104 dml_get_attr_func(urgent_extra_latency, mode_lib->vba.UrgentExtraLatency);
105 dml_get_attr_func(nonurgent_latency, mode_lib->vba.NonUrgentLatencyTolerance);
106 dml_get_attr_func(dram_clock_change_latency, mode_lib->vba.MinActiveDRAMClockChangeLatencySupported);
107 dml_get_attr_func(dispclk_calculated, mode_lib->vba.DISPCLK_calculated);
108 dml_get_attr_func(total_data_read_bw, mode_lib->vba.TotalDataReadBandwidth);
109 dml_get_attr_func(return_bw, mode_lib->vba.ReturnBW);
110 dml_get_attr_func(tcalc, mode_lib->vba.TCalc);
111 dml_get_attr_func(fraction_of_urgent_bandwidth, mode_lib->vba.FractionOfUrgentBandwidth);
112 dml_get_attr_func(fraction_of_urgent_bandwidth_imm_flip, mode_lib->vba.FractionOfUrgentBandwidthImmediateFlip);
113 dml_get_attr_func(cstate_max_cap_mode, mode_lib->vba.DCHUBBUB_ARB_CSTATE_MAX_CAP_MODE);
114 dml_get_attr_func(comp_buffer_size_kbytes, mode_lib->vba.CompressedBufferSizeInkByte);
115 dml_get_attr_func(pixel_chunk_size_in_kbyte, mode_lib->vba.PixelChunkSizeInKByte);
116 dml_get_attr_func(alpha_pixel_chunk_size_in_kbyte, mode_lib->vba.AlphaPixelChunkSizeInKByte);
117 dml_get_attr_func(meta_chunk_size_in_kbyte, mode_lib->vba.MetaChunkSize);
118 dml_get_attr_func(min_pixel_chunk_size_in_byte, mode_lib->vba.MinPixelChunkSizeBytes);
119 dml_get_attr_func(min_meta_chunk_size_in_byte, mode_lib->vba.MinMetaChunkSizeBytes);
120 dml_get_attr_func(fclk_watermark, mode_lib->vba.Watermark.FCLKChangeWatermark);
121 dml_get_attr_func(usr_retraining_watermark, mode_lib->vba.Watermark.USRRetrainingWatermark);
123 #define dml_get_pipe_attr_func(attr, var) double get_##attr(struct display_mode_lib *mode_lib, const display_e2e_pipe_params_st *pipes, unsigned int num_pipes, unsigned int which_pipe) \
125 unsigned int which_plane; \
126 recalculate_params(mode_lib, pipes, num_pipes); \
127 which_plane = mode_lib->vba.pipe_plane[which_pipe]; \
128 return var[which_plane]; \
131 dml_get_pipe_attr_func(dsc_delay, mode_lib->vba.DSCDelay);
132 dml_get_pipe_attr_func(dppclk_calculated, mode_lib->vba.DPPCLK_calculated);
133 dml_get_pipe_attr_func(dscclk_calculated, mode_lib->vba.DSCCLK_calculated);
134 dml_get_pipe_attr_func(min_ttu_vblank, mode_lib->vba.MinTTUVBlank);
135 dml_get_pipe_attr_func(min_ttu_vblank_in_us, mode_lib->vba.MinTTUVBlank);
136 dml_get_pipe_attr_func(vratio_prefetch_l, mode_lib->vba.VRatioPrefetchY);
137 dml_get_pipe_attr_func(vratio_prefetch_c, mode_lib->vba.VRatioPrefetchC);
138 dml_get_pipe_attr_func(dst_x_after_scaler, mode_lib->vba.DSTXAfterScaler);
139 dml_get_pipe_attr_func(dst_y_after_scaler, mode_lib->vba.DSTYAfterScaler);
140 dml_get_pipe_attr_func(dst_y_per_vm_vblank, mode_lib->vba.DestinationLinesToRequestVMInVBlank);
141 dml_get_pipe_attr_func(dst_y_per_row_vblank, mode_lib->vba.DestinationLinesToRequestRowInVBlank);
142 dml_get_pipe_attr_func(dst_y_prefetch, mode_lib->vba.DestinationLinesForPrefetch);
143 dml_get_pipe_attr_func(dst_y_per_vm_flip, mode_lib->vba.DestinationLinesToRequestVMInImmediateFlip);
144 dml_get_pipe_attr_func(dst_y_per_row_flip, mode_lib->vba.DestinationLinesToRequestRowInImmediateFlip);
145 dml_get_pipe_attr_func(refcyc_per_vm_group_vblank, mode_lib->vba.TimePerVMGroupVBlank);
146 dml_get_pipe_attr_func(refcyc_per_vm_group_flip, mode_lib->vba.TimePerVMGroupFlip);
147 dml_get_pipe_attr_func(refcyc_per_vm_req_vblank, mode_lib->vba.TimePerVMRequestVBlank);
148 dml_get_pipe_attr_func(refcyc_per_vm_req_flip, mode_lib->vba.TimePerVMRequestFlip);
149 dml_get_pipe_attr_func(refcyc_per_vm_group_vblank_in_us, mode_lib->vba.TimePerVMGroupVBlank);
150 dml_get_pipe_attr_func(refcyc_per_vm_group_flip_in_us, mode_lib->vba.TimePerVMGroupFlip);
151 dml_get_pipe_attr_func(refcyc_per_vm_req_vblank_in_us, mode_lib->vba.TimePerVMRequestVBlank);
152 dml_get_pipe_attr_func(refcyc_per_vm_req_flip_in_us, mode_lib->vba.TimePerVMRequestFlip);
153 dml_get_pipe_attr_func(refcyc_per_vm_dmdata_in_us, mode_lib->vba.Tdmdl_vm);
154 dml_get_pipe_attr_func(dmdata_dl_delta_in_us, mode_lib->vba.Tdmdl);
155 dml_get_pipe_attr_func(refcyc_per_line_delivery_l_in_us, mode_lib->vba.DisplayPipeLineDeliveryTimeLuma);
156 dml_get_pipe_attr_func(refcyc_per_line_delivery_c_in_us, mode_lib->vba.DisplayPipeLineDeliveryTimeChroma);
157 dml_get_pipe_attr_func(refcyc_per_line_delivery_pre_l_in_us, mode_lib->vba.DisplayPipeLineDeliveryTimeLumaPrefetch);
158 dml_get_pipe_attr_func(refcyc_per_line_delivery_pre_c_in_us, mode_lib->vba.DisplayPipeLineDeliveryTimeChromaPrefetch);
159 dml_get_pipe_attr_func(refcyc_per_req_delivery_l_in_us, mode_lib->vba.DisplayPipeRequestDeliveryTimeLuma);
160 dml_get_pipe_attr_func(refcyc_per_req_delivery_c_in_us, mode_lib->vba.DisplayPipeRequestDeliveryTimeChroma);
161 dml_get_pipe_attr_func(refcyc_per_req_delivery_pre_l_in_us, mode_lib->vba.DisplayPipeRequestDeliveryTimeLumaPrefetch);
162 dml_get_pipe_attr_func(refcyc_per_req_delivery_pre_c_in_us, mode_lib->vba.DisplayPipeRequestDeliveryTimeChromaPrefetch);
163 dml_get_pipe_attr_func(refcyc_per_cursor_req_delivery_in_us, mode_lib->vba.CursorRequestDeliveryTime);
164 dml_get_pipe_attr_func(refcyc_per_cursor_req_delivery_pre_in_us, mode_lib->vba.CursorRequestDeliveryTimePrefetch);
165 dml_get_pipe_attr_func(refcyc_per_meta_chunk_nom_l_in_us, mode_lib->vba.TimePerMetaChunkNominal);
166 dml_get_pipe_attr_func(refcyc_per_meta_chunk_nom_c_in_us, mode_lib->vba.TimePerChromaMetaChunkNominal);
167 dml_get_pipe_attr_func(refcyc_per_meta_chunk_vblank_l_in_us, mode_lib->vba.TimePerMetaChunkVBlank);
168 dml_get_pipe_attr_func(refcyc_per_meta_chunk_vblank_c_in_us, mode_lib->vba.TimePerChromaMetaChunkVBlank);
169 dml_get_pipe_attr_func(refcyc_per_meta_chunk_flip_l_in_us, mode_lib->vba.TimePerMetaChunkFlip);
170 dml_get_pipe_attr_func(refcyc_per_meta_chunk_flip_c_in_us, mode_lib->vba.TimePerChromaMetaChunkFlip);
171 dml_get_pipe_attr_func(vstartup, mode_lib->vba.VStartup);
172 dml_get_pipe_attr_func(vupdate_offset, mode_lib->vba.VUpdateOffsetPix);
173 dml_get_pipe_attr_func(vupdate_width, mode_lib->vba.VUpdateWidthPix);
174 dml_get_pipe_attr_func(vready_offset, mode_lib->vba.VReadyOffsetPix);
175 dml_get_pipe_attr_func(vready_at_or_after_vsync, mode_lib->vba.VREADY_AT_OR_AFTER_VSYNC);
176 dml_get_pipe_attr_func(min_dst_y_next_start, mode_lib->vba.MIN_DST_Y_NEXT_START);
177 dml_get_pipe_attr_func(dst_y_per_pte_row_nom_l, mode_lib->vba.DST_Y_PER_PTE_ROW_NOM_L);
178 dml_get_pipe_attr_func(dst_y_per_pte_row_nom_c, mode_lib->vba.DST_Y_PER_PTE_ROW_NOM_C);
179 dml_get_pipe_attr_func(dst_y_per_meta_row_nom_l, mode_lib->vba.DST_Y_PER_META_ROW_NOM_L);
180 dml_get_pipe_attr_func(dst_y_per_meta_row_nom_c, mode_lib->vba.DST_Y_PER_META_ROW_NOM_C);
181 dml_get_pipe_attr_func(refcyc_per_pte_group_nom_l_in_us, mode_lib->vba.time_per_pte_group_nom_luma);
182 dml_get_pipe_attr_func(refcyc_per_pte_group_nom_c_in_us, mode_lib->vba.time_per_pte_group_nom_chroma);
183 dml_get_pipe_attr_func(refcyc_per_pte_group_vblank_l_in_us, mode_lib->vba.time_per_pte_group_vblank_luma);
184 dml_get_pipe_attr_func(refcyc_per_pte_group_vblank_c_in_us, mode_lib->vba.time_per_pte_group_vblank_chroma);
185 dml_get_pipe_attr_func(refcyc_per_pte_group_flip_l_in_us, mode_lib->vba.time_per_pte_group_flip_luma);
186 dml_get_pipe_attr_func(refcyc_per_pte_group_flip_c_in_us, mode_lib->vba.time_per_pte_group_flip_chroma);
187 dml_get_pipe_attr_func(vstartup_calculated, mode_lib->vba.VStartup);
188 dml_get_pipe_attr_func(dpte_row_height_linear_c, mode_lib->vba.dpte_row_height_linear_chroma);
189 dml_get_pipe_attr_func(swath_height_l, mode_lib->vba.SwathHeightY);
190 dml_get_pipe_attr_func(swath_height_c, mode_lib->vba.SwathHeightC);
191 dml_get_pipe_attr_func(det_stored_buffer_size_l_bytes, mode_lib->vba.DETBufferSizeY);
192 dml_get_pipe_attr_func(det_stored_buffer_size_c_bytes, mode_lib->vba.DETBufferSizeC);
193 dml_get_pipe_attr_func(dpte_group_size_in_bytes, mode_lib->vba.dpte_group_bytes);
194 dml_get_pipe_attr_func(vm_group_size_in_bytes, mode_lib->vba.vm_group_bytes);
195 dml_get_pipe_attr_func(dpte_row_height_linear_l, mode_lib->vba.dpte_row_height_linear);
196 dml_get_pipe_attr_func(pte_buffer_mode, mode_lib->vba.PTE_BUFFER_MODE);
197 dml_get_pipe_attr_func(subviewport_lines_needed_in_mall, mode_lib->vba.SubViewportLinesNeededInMALL);
199 double get_total_immediate_flip_bytes(
200 struct display_mode_lib *mode_lib,
201 const display_e2e_pipe_params_st *pipes,
202 unsigned int num_pipes)
204 recalculate_params(mode_lib, pipes, num_pipes);
205 return mode_lib->vba.TotImmediateFlipBytes;
208 double get_total_immediate_flip_bw(
209 struct display_mode_lib *mode_lib,
210 const display_e2e_pipe_params_st *pipes,
211 unsigned int num_pipes)
214 double immediate_flip_bw = 0.0;
215 recalculate_params(mode_lib, pipes, num_pipes);
216 for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k)
217 immediate_flip_bw += mode_lib->vba.ImmediateFlipBW[k];
218 return immediate_flip_bw;
221 double get_total_prefetch_bw(
222 struct display_mode_lib *mode_lib,
223 const display_e2e_pipe_params_st *pipes,
224 unsigned int num_pipes)
227 double total_prefetch_bw = 0.0;
229 recalculate_params(mode_lib, pipes, num_pipes);
230 for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k)
231 total_prefetch_bw += mode_lib->vba.PrefetchBandwidth[k];
232 return total_prefetch_bw;
235 unsigned int get_total_surface_size_in_mall_bytes(
236 struct display_mode_lib *mode_lib,
237 const display_e2e_pipe_params_st *pipes,
238 unsigned int num_pipes)
241 unsigned int size = 0.0;
242 recalculate_params(mode_lib, pipes, num_pipes);
243 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
244 size += mode_lib->vba.SurfaceSizeInMALL[k];
248 unsigned int get_pipe_idx(struct display_mode_lib *mode_lib, unsigned int plane_idx)
253 ASSERT(plane_idx < DC__NUM_DPP__MAX);
255 for (i = 0; i < DC__NUM_DPP__MAX ; i++) {
256 if (plane_idx == mode_lib->vba.pipe_plane[i]) {
261 ASSERT(pipe_idx >= 0);
267 double get_det_buffer_size_kbytes(struct display_mode_lib *mode_lib, const display_e2e_pipe_params_st *pipes,
268 unsigned int num_pipes, unsigned int pipe_idx)
270 unsigned int plane_idx;
271 double det_buf_size_kbytes;
273 recalculate_params(mode_lib, pipes, num_pipes);
274 plane_idx = mode_lib->vba.pipe_plane[pipe_idx];
276 dml_print("DML::%s: num_pipes=%d pipe_idx=%d plane_idx=%0d\n", __func__, num_pipes, pipe_idx, plane_idx);
277 det_buf_size_kbytes = mode_lib->vba.DETBufferSizeInKByte[plane_idx]; // per hubp DET buffer size
279 dml_print("DML::%s: det_buf_size_kbytes=%3.2f\n", __func__, det_buf_size_kbytes);
281 return det_buf_size_kbytes;
284 bool get_is_phantom_pipe(struct display_mode_lib *mode_lib, const display_e2e_pipe_params_st *pipes,
285 unsigned int num_pipes, unsigned int pipe_idx)
287 unsigned int plane_idx;
289 recalculate_params(mode_lib, pipes, num_pipes);
290 plane_idx = mode_lib->vba.pipe_plane[pipe_idx];
291 dml_print("DML::%s: num_pipes=%d pipe_idx=%d UseMALLForPStateChange=%0d\n", __func__, num_pipes, pipe_idx,
292 mode_lib->vba.UsesMALLForPStateChange[plane_idx]);
293 return (mode_lib->vba.UsesMALLForPStateChange[plane_idx] == dm_use_mall_pstate_change_phantom_pipe);
296 static void fetch_socbb_params(struct display_mode_lib *mode_lib)
298 soc_bounding_box_st *soc = &mode_lib->vba.soc;
301 // SOC Bounding Box Parameters
302 mode_lib->vba.ReturnBusWidth = soc->return_bus_width_bytes;
303 mode_lib->vba.NumberOfChannels = soc->num_chans;
304 mode_lib->vba.PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelDataOnly =
305 soc->pct_ideal_dram_sdp_bw_after_urgent_pixel_only; // there's always that one bastard variable that's so long it throws everything out of alignment!
306 mode_lib->vba.PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData =
307 soc->pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm;
308 mode_lib->vba.PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly =
309 soc->pct_ideal_dram_sdp_bw_after_urgent_vm_only;
310 mode_lib->vba.MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation =
311 soc->max_avg_sdp_bw_use_normal_percent;
312 mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperation =
313 soc->max_avg_dram_bw_use_normal_percent;
314 mode_lib->vba.UrgentLatencyPixelDataOnly = soc->urgent_latency_pixel_data_only_us;
315 mode_lib->vba.UrgentLatencyPixelMixedWithVMData = soc->urgent_latency_pixel_mixed_with_vm_data_us;
316 mode_lib->vba.UrgentLatencyVMDataOnly = soc->urgent_latency_vm_data_only_us;
317 mode_lib->vba.RoundTripPingLatencyCycles = soc->round_trip_ping_latency_dcfclk_cycles;
318 mode_lib->vba.UrgentOutOfOrderReturnPerChannelPixelDataOnly =
319 soc->urgent_out_of_order_return_per_channel_pixel_only_bytes;
320 mode_lib->vba.UrgentOutOfOrderReturnPerChannelPixelMixedWithVMData =
321 soc->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes;
322 mode_lib->vba.UrgentOutOfOrderReturnPerChannelVMDataOnly =
323 soc->urgent_out_of_order_return_per_channel_vm_only_bytes;
324 mode_lib->vba.WritebackLatency = soc->writeback_latency_us;
325 mode_lib->vba.SRExitTime = soc->sr_exit_time_us;
326 mode_lib->vba.SREnterPlusExitTime = soc->sr_enter_plus_exit_time_us;
327 mode_lib->vba.PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency = soc->pct_ideal_sdp_bw_after_urgent;
328 mode_lib->vba.PercentOfIdealDRAMBWReceivedAfterUrgLatencyPixelMixedWithVMData = soc->pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm;
329 mode_lib->vba.PercentOfIdealDRAMBWReceivedAfterUrgLatencyPixelDataOnly = soc->pct_ideal_dram_sdp_bw_after_urgent_pixel_only;
330 mode_lib->vba.PercentOfIdealDRAMBWReceivedAfterUrgLatencyVMDataOnly = soc->pct_ideal_dram_sdp_bw_after_urgent_vm_only;
331 mode_lib->vba.MaxAveragePercentOfIdealFabricAndSDPPortBWDisplayCanUseInNormalSystemOperation =
332 soc->max_avg_sdp_bw_use_normal_percent;
333 mode_lib->vba.SRExitZ8Time = soc->sr_exit_z8_time_us;
334 mode_lib->vba.SREnterPlusExitZ8Time = soc->sr_enter_plus_exit_z8_time_us;
335 mode_lib->vba.FCLKChangeLatency = soc->fclk_change_latency_us;
336 mode_lib->vba.USRRetrainingLatency = soc->usr_retraining_latency_us;
337 mode_lib->vba.SMNLatency = soc->smn_latency_us;
338 mode_lib->vba.MALLAllocatedForDCNFinal = soc->mall_allocated_for_dcn_mbytes;
340 mode_lib->vba.PercentOfIdealDRAMBWReceivedAfterUrgLatencySTROBE = soc->pct_ideal_dram_bw_after_urgent_strobe;
341 mode_lib->vba.MaxAveragePercentOfIdealFabricBWDisplayCanUseInNormalSystemOperation =
342 soc->max_avg_fabric_bw_use_normal_percent;
343 mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperationSTROBE =
344 soc->max_avg_dram_bw_use_normal_strobe_percent;
346 mode_lib->vba.DRAMClockChangeRequirementFinal = soc->dram_clock_change_requirement_final;
347 mode_lib->vba.FCLKChangeRequirementFinal = 1;
348 mode_lib->vba.USRRetrainingRequiredFinal = 1;
349 mode_lib->vba.ConfigurableDETSizeEnFinal = 0;
350 mode_lib->vba.AllowForPStateChangeOrStutterInVBlankFinal = soc->allow_for_pstate_or_stutter_in_vblank_final;
351 mode_lib->vba.DRAMClockChangeLatency = soc->dram_clock_change_latency_us;
352 mode_lib->vba.DummyPStateCheck = soc->dram_clock_change_latency_us == soc->dummy_pstate_latency_us;
353 mode_lib->vba.DRAMClockChangeSupportsVActive = !soc->disable_dram_clock_change_vactive_support ||
354 mode_lib->vba.DummyPStateCheck;
355 mode_lib->vba.AllowDramClockChangeOneDisplayVactive = soc->allow_dram_clock_one_display_vactive;
356 mode_lib->vba.AllowDRAMSelfRefreshOrDRAMClockChangeInVblank =
357 soc->allow_dram_self_refresh_or_dram_clock_change_in_vblank;
359 mode_lib->vba.Downspreading = soc->downspread_percent;
360 mode_lib->vba.DRAMChannelWidth = soc->dram_channel_width_bytes; // new!
361 mode_lib->vba.FabricDatapathToDCNDataReturn = soc->fabric_datapath_to_dcn_data_return_bytes; // new!
362 mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading = soc->dcn_downspread_percent; // new
363 mode_lib->vba.DISPCLKDPPCLKVCOSpeed = soc->dispclk_dppclk_vco_speed_mhz; // new
364 mode_lib->vba.VMMPageSize = soc->vmm_page_size_bytes;
365 mode_lib->vba.GPUVMMinPageSize = soc->gpuvm_min_page_size_bytes / 1024;
366 mode_lib->vba.HostVMMinPageSize = soc->hostvm_min_page_size_bytes / 1024;
367 // Set the voltage scaling clocks as the defaults. Most of these will
368 // be set to different values by the test
369 for (i = 0; i < mode_lib->vba.soc.num_states; i++)
370 if (soc->clock_limits[i].state == mode_lib->vba.VoltageLevel)
373 mode_lib->vba.DCFCLK = soc->clock_limits[i].dcfclk_mhz;
374 mode_lib->vba.SOCCLK = soc->clock_limits[i].socclk_mhz;
375 mode_lib->vba.DRAMSpeed = soc->clock_limits[i].dram_speed_mts;
376 mode_lib->vba.FabricClock = soc->clock_limits[i].fabricclk_mhz;
378 mode_lib->vba.XFCBusTransportTime = soc->xfc_bus_transport_time_us;
379 mode_lib->vba.XFCXBUFLatencyTolerance = soc->xfc_xbuf_latency_tolerance_us;
380 mode_lib->vba.UseUrgentBurstBandwidth = soc->use_urgent_burst_bw;
382 mode_lib->vba.SupportGFX7CompatibleTilingIn32bppAnd64bpp = false;
383 mode_lib->vba.WritebackLumaAndChromaScalingSupported = true;
384 mode_lib->vba.MaxHSCLRatio = 4;
385 mode_lib->vba.MaxVSCLRatio = 4;
386 mode_lib->vba.Cursor64BppSupport = true;
387 for (i = 0; i <= mode_lib->vba.soc.num_states; i++) {
388 mode_lib->vba.DCFCLKPerState[i] = soc->clock_limits[i].dcfclk_mhz;
389 mode_lib->vba.FabricClockPerState[i] = soc->clock_limits[i].fabricclk_mhz;
390 mode_lib->vba.SOCCLKPerState[i] = soc->clock_limits[i].socclk_mhz;
391 mode_lib->vba.PHYCLKPerState[i] = soc->clock_limits[i].phyclk_mhz;
392 mode_lib->vba.PHYCLKD18PerState[i] = soc->clock_limits[i].phyclk_d18_mhz;
393 mode_lib->vba.PHYCLKD32PerState[i] = soc->clock_limits[i].phyclk_d32_mhz;
394 mode_lib->vba.MaxDppclk[i] = soc->clock_limits[i].dppclk_mhz;
395 mode_lib->vba.MaxDSCCLK[i] = soc->clock_limits[i].dscclk_mhz;
396 mode_lib->vba.DRAMSpeedPerState[i] = soc->clock_limits[i].dram_speed_mts;
397 //mode_lib->vba.DRAMSpeedPerState[i] = soc->clock_limits[i].dram_speed_mhz;
398 mode_lib->vba.MaxDispclk[i] = soc->clock_limits[i].dispclk_mhz;
399 mode_lib->vba.DTBCLKPerState[i] = soc->clock_limits[i].dtbclk_mhz;
402 mode_lib->vba.DoUrgentLatencyAdjustment =
403 soc->do_urgent_latency_adjustment;
404 mode_lib->vba.UrgentLatencyAdjustmentFabricClockComponent =
405 soc->urgent_latency_adjustment_fabric_clock_component_us;
406 mode_lib->vba.UrgentLatencyAdjustmentFabricClockReference =
407 soc->urgent_latency_adjustment_fabric_clock_reference_mhz;
410 static void fetch_ip_params(struct display_mode_lib *mode_lib)
412 ip_params_st *ip = &mode_lib->vba.ip;
415 mode_lib->vba.UseMinimumRequiredDCFCLK = ip->use_min_dcfclk;
416 mode_lib->vba.ClampMinDCFCLK = ip->clamp_min_dcfclk;
417 mode_lib->vba.MaxNumDPP = ip->max_num_dpp;
418 mode_lib->vba.MaxNumOTG = ip->max_num_otg;
419 mode_lib->vba.MaxNumHDMIFRLOutputs = ip->max_num_hdmi_frl_outputs;
420 mode_lib->vba.MaxNumWriteback = ip->max_num_wb;
421 mode_lib->vba.CursorChunkSize = ip->cursor_chunk_size;
422 mode_lib->vba.CursorBufferSize = ip->cursor_buffer_size;
424 mode_lib->vba.MaxDCHUBToPSCLThroughput = ip->max_dchub_pscl_bw_pix_per_clk;
425 mode_lib->vba.MaxPSCLToLBThroughput = ip->max_pscl_lb_bw_pix_per_clk;
426 mode_lib->vba.ROBBufferSizeInKByte = ip->rob_buffer_size_kbytes;
427 mode_lib->vba.DETBufferSizeInKByte[0] = ip->det_buffer_size_kbytes;
428 mode_lib->vba.ConfigReturnBufferSizeInKByte = ip->config_return_buffer_size_in_kbytes;
429 mode_lib->vba.CompressedBufferSegmentSizeInkByte = ip->compressed_buffer_segment_size_in_kbytes;
430 mode_lib->vba.MetaFIFOSizeInKEntries = ip->meta_fifo_size_in_kentries;
431 mode_lib->vba.ZeroSizeBufferEntries = ip->zero_size_buffer_entries;
432 mode_lib->vba.COMPBUF_RESERVED_SPACE_64B = ip->compbuf_reserved_space_64b;
433 mode_lib->vba.COMPBUF_RESERVED_SPACE_ZS = ip->compbuf_reserved_space_zs;
434 mode_lib->vba.MaximumDSCBitsPerComponent = ip->maximum_dsc_bits_per_component;
435 mode_lib->vba.DSC422NativeSupport = ip->dsc422_native_support;
436 /* In DCN3.2, nomDETInKByte should be initialized correctly. */
437 mode_lib->vba.nomDETInKByte = ip->det_buffer_size_kbytes;
438 mode_lib->vba.CompbufReservedSpace64B = ip->compbuf_reserved_space_64b;
439 mode_lib->vba.CompbufReservedSpaceZs = ip->compbuf_reserved_space_zs;
440 mode_lib->vba.CompressedBufferSegmentSizeInkByteFinal = ip->compressed_buffer_segment_size_in_kbytes;
441 mode_lib->vba.LineBufferSizeFinal = ip->line_buffer_size_bits;
442 mode_lib->vba.AlphaPixelChunkSizeInKByte = ip->alpha_pixel_chunk_size_kbytes; // not ysed
443 mode_lib->vba.MinPixelChunkSizeBytes = ip->min_pixel_chunk_size_bytes; // not used
444 mode_lib->vba.MaximumPixelsPerLinePerDSCUnit = ip->maximum_pixels_per_line_per_dsc_unit;
445 mode_lib->vba.MaxNumDP2p0Outputs = ip->max_num_dp2p0_outputs;
446 mode_lib->vba.MaxNumDP2p0Streams = ip->max_num_dp2p0_streams;
447 mode_lib->vba.DCCMetaBufferSizeBytes = ip->dcc_meta_buffer_size_bytes;
449 mode_lib->vba.PixelChunkSizeInKByte = ip->pixel_chunk_size_kbytes;
450 mode_lib->vba.MetaChunkSize = ip->meta_chunk_size_kbytes;
451 mode_lib->vba.MinMetaChunkSizeBytes = ip->min_meta_chunk_size_bytes;
452 mode_lib->vba.WritebackChunkSize = ip->writeback_chunk_size_kbytes;
453 mode_lib->vba.LineBufferSize = ip->line_buffer_size_bits;
454 mode_lib->vba.MaxLineBufferLines = ip->max_line_buffer_lines;
455 mode_lib->vba.PTEBufferSizeInRequestsLuma = ip->dpte_buffer_size_in_pte_reqs_luma;
456 mode_lib->vba.PTEBufferSizeInRequestsChroma = ip->dpte_buffer_size_in_pte_reqs_chroma;
457 mode_lib->vba.DPPOutputBufferPixels = ip->dpp_output_buffer_pixels;
458 mode_lib->vba.OPPOutputBufferLines = ip->opp_output_buffer_lines;
459 mode_lib->vba.MaxHSCLRatio = ip->max_hscl_ratio;
460 mode_lib->vba.MaxVSCLRatio = ip->max_vscl_ratio;
461 mode_lib->vba.WritebackInterfaceLumaBufferSize = ip->writeback_luma_buffer_size_kbytes * 1024;
462 mode_lib->vba.WritebackInterfaceChromaBufferSize = ip->writeback_chroma_buffer_size_kbytes * 1024;
464 mode_lib->vba.WritebackInterfaceBufferSize = ip->writeback_interface_buffer_size_kbytes;
465 mode_lib->vba.WritebackLineBufferSize = ip->writeback_line_buffer_buffer_size;
467 mode_lib->vba.WritebackChromaLineBufferWidth =
468 ip->writeback_chroma_line_buffer_width_pixels;
469 mode_lib->vba.WritebackLineBufferLumaBufferSize =
470 ip->writeback_line_buffer_luma_buffer_size;
471 mode_lib->vba.WritebackLineBufferChromaBufferSize =
472 ip->writeback_line_buffer_chroma_buffer_size;
473 mode_lib->vba.Writeback10bpc420Supported = ip->writeback_10bpc420_supported;
474 mode_lib->vba.WritebackMaxHSCLRatio = ip->writeback_max_hscl_ratio;
475 mode_lib->vba.WritebackMaxVSCLRatio = ip->writeback_max_vscl_ratio;
476 mode_lib->vba.WritebackMinHSCLRatio = ip->writeback_min_hscl_ratio;
477 mode_lib->vba.WritebackMinVSCLRatio = ip->writeback_min_vscl_ratio;
478 mode_lib->vba.WritebackMaxHSCLTaps = ip->writeback_max_hscl_taps;
479 mode_lib->vba.WritebackMaxVSCLTaps = ip->writeback_max_vscl_taps;
480 mode_lib->vba.WritebackConfiguration = dm_normal;
481 mode_lib->vba.GPUVMMaxPageTableLevels = ip->gpuvm_max_page_table_levels;
482 mode_lib->vba.HostVMMaxNonCachedPageTableLevels = ip->hostvm_max_page_table_levels;
483 mode_lib->vba.HostVMMaxPageTableLevels = ip->hostvm_max_page_table_levels;
484 mode_lib->vba.HostVMCachedPageTableLevels = ip->hostvm_cached_page_table_levels;
485 mode_lib->vba.MaxInterDCNTileRepeaters = ip->max_inter_dcn_tile_repeaters;
486 mode_lib->vba.NumberOfDSC = ip->num_dsc;
487 mode_lib->vba.ODMCapability = ip->odm_capable;
488 mode_lib->vba.DISPCLKRampingMargin = ip->dispclk_ramp_margin_percent;
490 mode_lib->vba.XFCSupported = ip->xfc_supported;
491 mode_lib->vba.XFCFillBWOverhead = ip->xfc_fill_bw_overhead_percent;
492 mode_lib->vba.XFCFillConstant = ip->xfc_fill_constant_bytes;
493 mode_lib->vba.DPPCLKDelaySubtotal = ip->dppclk_delay_subtotal;
494 mode_lib->vba.DPPCLKDelaySCL = ip->dppclk_delay_scl;
495 mode_lib->vba.DPPCLKDelaySCLLBOnly = ip->dppclk_delay_scl_lb_only;
496 mode_lib->vba.DPPCLKDelayCNVCFormater = ip->dppclk_delay_cnvc_formatter;
497 mode_lib->vba.DPPCLKDelayCNVCCursor = ip->dppclk_delay_cnvc_cursor;
498 mode_lib->vba.DISPCLKDelaySubtotal = ip->dispclk_delay_subtotal;
499 mode_lib->vba.DynamicMetadataVMEnabled = ip->dynamic_metadata_vm_enabled;
500 mode_lib->vba.ODMCombine4To1Supported = ip->odm_combine_4to1_supported;
501 mode_lib->vba.ProgressiveToInterlaceUnitInOPP = ip->ptoi_supported;
502 mode_lib->vba.PDEProcessingBufIn64KBReqs = ip->pde_proc_buffer_size_64k_reqs;
503 mode_lib->vba.PTEGroupSize = ip->pte_group_size_bytes;
504 mode_lib->vba.SupportGFX7CompatibleTilingIn32bppAnd64bpp = ip->gfx7_compat_tiling_supported;
507 static void fetch_pipe_params(struct display_mode_lib *mode_lib)
509 display_e2e_pipe_params_st *pipes = mode_lib->vba.cache_pipes;
510 ip_params_st *ip = &mode_lib->vba.ip;
512 unsigned int OTGInstPlane[DC__NUM_DPP__MAX];
514 bool PlaneVisited[DC__NUM_DPP__MAX];
515 bool visited[DC__NUM_DPP__MAX];
517 // Convert Pipes to Planes
518 for (k = 0; k < mode_lib->vba.cache_num_pipes; ++k)
521 mode_lib->vba.NumberOfActivePlanes = 0;
522 mode_lib->vba.NumberOfActiveSurfaces = 0;
523 mode_lib->vba.ImmediateFlipSupport = false;
524 for (j = 0; j < mode_lib->vba.cache_num_pipes; ++j) {
525 display_pipe_source_params_st *src = &pipes[j].pipe.src;
526 display_pipe_dest_params_st *dst = &pipes[j].pipe.dest;
527 scaler_ratio_depth_st *scl = &pipes[j].pipe.scale_ratio_depth;
528 scaler_taps_st *taps = &pipes[j].pipe.scale_taps;
529 display_output_params_st *dout = &pipes[j].dout;
530 display_clocks_and_cfg_st *clks = &pipes[j].clks_cfg;
536 mode_lib->vba.ImmediateFlipRequirement[j] = dm_immediate_flip_not_required;
537 mode_lib->vba.pipe_plane[j] = mode_lib->vba.NumberOfActivePlanes;
538 mode_lib->vba.DPPPerPlane[mode_lib->vba.NumberOfActivePlanes] = 1;
539 mode_lib->vba.SourceScan[mode_lib->vba.NumberOfActivePlanes] =
540 (enum scan_direction_class) (src->source_scan);
541 mode_lib->vba.ViewportWidth[mode_lib->vba.NumberOfActivePlanes] =
543 mode_lib->vba.ViewportWidthChroma[mode_lib->vba.NumberOfActivePlanes] =
544 src->viewport_width_c;
545 mode_lib->vba.ViewportHeight[mode_lib->vba.NumberOfActivePlanes] =
546 src->viewport_height;
547 mode_lib->vba.ViewportHeightChroma[mode_lib->vba.NumberOfActivePlanes] =
548 src->viewport_height_c;
549 mode_lib->vba.ViewportYStartY[mode_lib->vba.NumberOfActivePlanes] =
551 mode_lib->vba.ViewportYStartC[mode_lib->vba.NumberOfActivePlanes] =
553 mode_lib->vba.SourceRotation[mode_lib->vba.NumberOfActiveSurfaces] = src->source_rotation;
554 mode_lib->vba.ViewportXStartY[mode_lib->vba.NumberOfActiveSurfaces] = src->viewport_x_y;
555 mode_lib->vba.ViewportXStartC[mode_lib->vba.NumberOfActiveSurfaces] = src->viewport_x_c;
556 // TODO: Assign correct value to viewport_stationary
557 mode_lib->vba.ViewportStationary[mode_lib->vba.NumberOfActivePlanes] =
558 src->viewport_stationary;
559 mode_lib->vba.UsesMALLForPStateChange[mode_lib->vba.NumberOfActivePlanes] = src->use_mall_for_pstate_change;
560 mode_lib->vba.UseMALLForStaticScreen[mode_lib->vba.NumberOfActivePlanes] = src->use_mall_for_static_screen;
561 mode_lib->vba.GPUVMMinPageSizeKBytes[mode_lib->vba.NumberOfActivePlanes] = src->gpuvm_min_page_size_kbytes;
562 mode_lib->vba.RefreshRate[mode_lib->vba.NumberOfActivePlanes] = dst->refresh_rate; //todo remove this
563 mode_lib->vba.OutputLinkDPRate[mode_lib->vba.NumberOfActivePlanes] = dout->dp_rate;
564 mode_lib->vba.ODMUse[mode_lib->vba.NumberOfActivePlanes] = dst->odm_combine_policy;
565 mode_lib->vba.DETSizeOverride[mode_lib->vba.NumberOfActivePlanes] = src->det_size_override;
566 //TODO: Need to assign correct values to dp_multistream vars
567 mode_lib->vba.OutputMultistreamEn[mode_lib->vba.NumberOfActiveSurfaces] = dout->dp_multistream_en;
568 mode_lib->vba.OutputMultistreamId[mode_lib->vba.NumberOfActiveSurfaces] = dout->dp_multistream_id;
569 mode_lib->vba.PitchY[mode_lib->vba.NumberOfActivePlanes] = src->data_pitch;
570 mode_lib->vba.SurfaceWidthY[mode_lib->vba.NumberOfActivePlanes] = src->surface_width_y;
571 mode_lib->vba.SurfaceHeightY[mode_lib->vba.NumberOfActivePlanes] = src->surface_height_y;
572 mode_lib->vba.PitchC[mode_lib->vba.NumberOfActivePlanes] = src->data_pitch_c;
573 mode_lib->vba.SurfaceHeightC[mode_lib->vba.NumberOfActivePlanes] = src->surface_height_c;
574 mode_lib->vba.SurfaceWidthC[mode_lib->vba.NumberOfActivePlanes] = src->surface_width_c;
575 mode_lib->vba.DCCMetaPitchY[mode_lib->vba.NumberOfActivePlanes] = src->meta_pitch;
576 mode_lib->vba.DCCMetaPitchC[mode_lib->vba.NumberOfActivePlanes] = src->meta_pitch_c;
577 mode_lib->vba.HRatio[mode_lib->vba.NumberOfActivePlanes] = scl->hscl_ratio;
578 mode_lib->vba.HRatioChroma[mode_lib->vba.NumberOfActivePlanes] = scl->hscl_ratio_c;
579 mode_lib->vba.VRatio[mode_lib->vba.NumberOfActivePlanes] = scl->vscl_ratio;
580 mode_lib->vba.VRatioChroma[mode_lib->vba.NumberOfActivePlanes] = scl->vscl_ratio_c;
581 mode_lib->vba.ScalerEnabled[mode_lib->vba.NumberOfActivePlanes] = scl->scl_enable;
582 mode_lib->vba.Interlace[mode_lib->vba.NumberOfActivePlanes] = dst->interlaced;
583 if (dst->interlaced && !ip->ptoi_supported) {
584 mode_lib->vba.VRatio[mode_lib->vba.NumberOfActivePlanes] *= 2.0;
585 mode_lib->vba.VRatioChroma[mode_lib->vba.NumberOfActivePlanes] *= 2.0;
587 mode_lib->vba.htaps[mode_lib->vba.NumberOfActivePlanes] = taps->htaps;
588 mode_lib->vba.vtaps[mode_lib->vba.NumberOfActivePlanes] = taps->vtaps;
589 mode_lib->vba.HTAPsChroma[mode_lib->vba.NumberOfActivePlanes] = taps->htaps_c;
590 mode_lib->vba.VTAPsChroma[mode_lib->vba.NumberOfActivePlanes] = taps->vtaps_c;
591 mode_lib->vba.HTotal[mode_lib->vba.NumberOfActivePlanes] = dst->htotal;
592 mode_lib->vba.VTotal[mode_lib->vba.NumberOfActivePlanes] = dst->vtotal;
593 mode_lib->vba.VFrontPorch[mode_lib->vba.NumberOfActivePlanes] = dst->vfront_porch;
594 mode_lib->vba.DCCFractionOfZeroSizeRequestsLuma[mode_lib->vba.NumberOfActivePlanes] = src->dcc_fraction_of_zs_req_luma;
595 mode_lib->vba.DCCFractionOfZeroSizeRequestsChroma[mode_lib->vba.NumberOfActivePlanes] = src->dcc_fraction_of_zs_req_chroma;
596 mode_lib->vba.DCCEnable[mode_lib->vba.NumberOfActivePlanes] =
597 src->dcc_use_global ?
598 ip->dcc_supported : src->dcc && ip->dcc_supported;
599 mode_lib->vba.DCCRate[mode_lib->vba.NumberOfActivePlanes] = src->dcc_rate;
600 /* TODO: Needs to be set based on src->dcc_rate_luma/chroma */
601 mode_lib->vba.DCCRateLuma[mode_lib->vba.NumberOfActivePlanes] = src->dcc_rate;
602 mode_lib->vba.DCCRateChroma[mode_lib->vba.NumberOfActivePlanes] = src->dcc_rate_chroma;
603 mode_lib->vba.SourcePixelFormat[mode_lib->vba.NumberOfActivePlanes] = (enum source_format_class) (src->source_format);
604 mode_lib->vba.HActive[mode_lib->vba.NumberOfActivePlanes] = dst->hactive;
605 mode_lib->vba.VActive[mode_lib->vba.NumberOfActivePlanes] = dst->vactive;
606 mode_lib->vba.SurfaceTiling[mode_lib->vba.NumberOfActivePlanes] =
607 (enum dm_swizzle_mode) (src->sw_mode);
608 mode_lib->vba.ScalerRecoutWidth[mode_lib->vba.NumberOfActivePlanes] =
609 dst->recout_width; // TODO: or should this be full_recout_width???...maybe only when in hsplit mode?
610 mode_lib->vba.ODMCombineEnabled[mode_lib->vba.NumberOfActivePlanes] =
612 mode_lib->vba.OutputFormat[mode_lib->vba.NumberOfActivePlanes] =
613 (enum output_format_class) (dout->output_format);
614 mode_lib->vba.OutputBpp[mode_lib->vba.NumberOfActivePlanes] =
616 mode_lib->vba.Output[mode_lib->vba.NumberOfActivePlanes] =
617 (enum output_encoder_class) (dout->output_type);
618 mode_lib->vba.skip_dio_check[mode_lib->vba.NumberOfActivePlanes] =
621 if (!dout->dsc_enable)
622 mode_lib->vba.ForcedOutputLinkBPP[mode_lib->vba.NumberOfActivePlanes] = dout->output_bpp;
624 mode_lib->vba.ForcedOutputLinkBPP[mode_lib->vba.NumberOfActivePlanes] = 0.0;
626 mode_lib->vba.OutputLinkDPLanes[mode_lib->vba.NumberOfActivePlanes] =
628 /* TODO: Needs to be set based on dout->audio.audio_sample_rate_khz/sample_layout */
629 mode_lib->vba.AudioSampleRate[mode_lib->vba.NumberOfActivePlanes] =
630 dout->max_audio_sample_rate;
631 mode_lib->vba.AudioSampleLayout[mode_lib->vba.NumberOfActivePlanes] =
633 mode_lib->vba.DRAMClockChangeLatencyOverride = 0.0;
634 mode_lib->vba.DSCEnabled[mode_lib->vba.NumberOfActivePlanes] = dout->dsc_enable;
635 mode_lib->vba.DSCEnable[mode_lib->vba.NumberOfActivePlanes] = dout->dsc_enable;
636 mode_lib->vba.NumberOfDSCSlices[mode_lib->vba.NumberOfActivePlanes] =
638 if (!dout->dsc_input_bpc) {
639 mode_lib->vba.DSCInputBitPerComponent[mode_lib->vba.NumberOfActivePlanes] =
640 ip->maximum_dsc_bits_per_component;
642 mode_lib->vba.DSCInputBitPerComponent[mode_lib->vba.NumberOfActivePlanes] =
645 mode_lib->vba.WritebackEnable[mode_lib->vba.NumberOfActivePlanes] = dout->wb_enable;
646 mode_lib->vba.ActiveWritebacksPerPlane[mode_lib->vba.NumberOfActivePlanes] =
648 mode_lib->vba.WritebackSourceHeight[mode_lib->vba.NumberOfActivePlanes] =
649 dout->wb.wb_src_height;
650 mode_lib->vba.WritebackSourceWidth[mode_lib->vba.NumberOfActivePlanes] =
651 dout->wb.wb_src_width;
652 mode_lib->vba.WritebackDestinationWidth[mode_lib->vba.NumberOfActivePlanes] =
653 dout->wb.wb_dst_width;
654 mode_lib->vba.WritebackDestinationHeight[mode_lib->vba.NumberOfActivePlanes] =
655 dout->wb.wb_dst_height;
656 mode_lib->vba.WritebackHRatio[mode_lib->vba.NumberOfActivePlanes] =
658 mode_lib->vba.WritebackVRatio[mode_lib->vba.NumberOfActivePlanes] =
660 mode_lib->vba.WritebackPixelFormat[mode_lib->vba.NumberOfActivePlanes] =
661 (enum source_format_class) (dout->wb.wb_pixel_format);
662 mode_lib->vba.WritebackHTaps[mode_lib->vba.NumberOfActivePlanes] =
663 dout->wb.wb_htaps_luma;
664 mode_lib->vba.WritebackVTaps[mode_lib->vba.NumberOfActivePlanes] =
665 dout->wb.wb_vtaps_luma;
666 mode_lib->vba.WritebackLumaHTaps[mode_lib->vba.NumberOfActivePlanes] =
667 dout->wb.wb_htaps_luma;
668 mode_lib->vba.WritebackLumaVTaps[mode_lib->vba.NumberOfActivePlanes] =
669 dout->wb.wb_vtaps_luma;
670 mode_lib->vba.WritebackChromaHTaps[mode_lib->vba.NumberOfActivePlanes] =
671 dout->wb.wb_htaps_chroma;
672 mode_lib->vba.WritebackChromaVTaps[mode_lib->vba.NumberOfActivePlanes] =
673 dout->wb.wb_vtaps_chroma;
674 mode_lib->vba.WritebackHRatio[mode_lib->vba.NumberOfActivePlanes] =
676 mode_lib->vba.WritebackVRatio[mode_lib->vba.NumberOfActivePlanes] =
679 mode_lib->vba.DynamicMetadataEnable[mode_lib->vba.NumberOfActivePlanes] =
680 src->dynamic_metadata_enable;
681 mode_lib->vba.DynamicMetadataLinesBeforeActiveRequired[mode_lib->vba.NumberOfActivePlanes] =
682 src->dynamic_metadata_lines_before_active;
683 mode_lib->vba.DynamicMetadataTransmittedBytes[mode_lib->vba.NumberOfActivePlanes] =
684 src->dynamic_metadata_xmit_bytes;
686 mode_lib->vba.XFCEnabled[mode_lib->vba.NumberOfActivePlanes] = src->xfc_enable
687 && ip->xfc_supported;
688 mode_lib->vba.XFCSlvChunkSize = src->xfc_params.xfc_slv_chunk_size_bytes;
689 mode_lib->vba.XFCTSlvVupdateOffset = src->xfc_params.xfc_tslv_vupdate_offset_us;
690 mode_lib->vba.XFCTSlvVupdateWidth = src->xfc_params.xfc_tslv_vupdate_width_us;
691 mode_lib->vba.XFCTSlvVreadyOffset = src->xfc_params.xfc_tslv_vready_offset_us;
692 mode_lib->vba.PixelClock[mode_lib->vba.NumberOfActivePlanes] = dst->pixel_rate_mhz;
693 mode_lib->vba.PixelClockBackEnd[mode_lib->vba.NumberOfActivePlanes] = dst->pixel_rate_mhz;
694 mode_lib->vba.DPPCLK[mode_lib->vba.NumberOfActivePlanes] = clks->dppclk_mhz;
695 if (ip->is_line_buffer_bpp_fixed)
696 mode_lib->vba.LBBitPerPixel[mode_lib->vba.NumberOfActivePlanes] =
697 ip->line_buffer_fixed_bpp;
699 unsigned int lb_depth;
701 switch (scl->lb_depth) {
723 mode_lib->vba.LBBitPerPixel[mode_lib->vba.NumberOfActivePlanes] = lb_depth;
725 mode_lib->vba.NumberOfCursors[mode_lib->vba.NumberOfActivePlanes] = 0;
726 // The DML spreadsheet assumes that the two cursors utilize the same amount of bandwidth. We'll
727 // calculate things a little more accurately
728 for (k = 0; k < DC__NUM_CURSOR__MAX; ++k) {
731 mode_lib->vba.CursorBPP[mode_lib->vba.NumberOfActivePlanes][0] =
733 (enum cursor_bpp) (src->cur0_bpp));
734 mode_lib->vba.CursorWidth[mode_lib->vba.NumberOfActivePlanes][0] =
736 if (src->cur0_src_width > 0)
737 mode_lib->vba.NumberOfCursors[mode_lib->vba.NumberOfActivePlanes]++;
740 mode_lib->vba.CursorBPP[mode_lib->vba.NumberOfActivePlanes][1] =
742 (enum cursor_bpp) (src->cur1_bpp));
743 mode_lib->vba.CursorWidth[mode_lib->vba.NumberOfActivePlanes][1] =
745 if (src->cur1_src_width > 0)
746 mode_lib->vba.NumberOfCursors[mode_lib->vba.NumberOfActivePlanes]++;
750 "ERROR: Number of cursors specified exceeds supported maximum\n")
755 OTGInstPlane[mode_lib->vba.NumberOfActivePlanes] = dst->otg_inst;
758 mode_lib->vba.UseMaximumVStartup = dst->use_maximum_vstartup;
760 mode_lib->vba.UseMaximumVStartup = mode_lib->vba.UseMaximumVStartup
761 || dst->use_maximum_vstartup;
763 if (dst->odm_combine && !src->is_hsplit)
765 "ERROR: ODM Combine is specified but is_hsplit has not be specified for pipe %i\n",
768 if (src->is_hsplit) {
769 for (k = j + 1; k < mode_lib->vba.cache_num_pipes; ++k) {
770 display_pipe_source_params_st *src_k = &pipes[k].pipe.src;
771 display_pipe_dest_params_st *dst_k = &pipes[k].pipe.dest;
773 if (src_k->is_hsplit && !visited[k]
774 && src->hsplit_grp == src_k->hsplit_grp) {
775 mode_lib->vba.pipe_plane[k] =
776 mode_lib->vba.NumberOfActivePlanes;
777 mode_lib->vba.DPPPerPlane[mode_lib->vba.NumberOfActivePlanes]++;
778 if (mode_lib->vba.SourceScan[mode_lib->vba.NumberOfActivePlanes]
780 mode_lib->vba.ViewportWidth[mode_lib->vba.NumberOfActivePlanes] +=
781 src_k->viewport_width;
782 mode_lib->vba.ViewportWidthChroma[mode_lib->vba.NumberOfActivePlanes] +=
783 src_k->viewport_width_c;
784 mode_lib->vba.ScalerRecoutWidth[mode_lib->vba.NumberOfActivePlanes] +=
787 mode_lib->vba.ViewportHeight[mode_lib->vba.NumberOfActivePlanes] +=
788 src_k->viewport_height;
789 mode_lib->vba.ViewportHeightChroma[mode_lib->vba.NumberOfActivePlanes] +=
790 src_k->viewport_height_c;
797 if (src->viewport_width_max) {
798 int hdiv_c = src->source_format >= dm_420_8 && src->source_format <= dm_422_10 ? 2 : 1;
799 int vdiv_c = src->source_format >= dm_420_8 && src->source_format <= dm_420_12 ? 2 : 1;
801 if (mode_lib->vba.ViewportWidth[mode_lib->vba.NumberOfActivePlanes] > src->viewport_width_max)
802 mode_lib->vba.ViewportWidth[mode_lib->vba.NumberOfActivePlanes] = src->viewport_width_max;
803 if (mode_lib->vba.ViewportHeight[mode_lib->vba.NumberOfActivePlanes] > src->viewport_height_max)
804 mode_lib->vba.ViewportHeight[mode_lib->vba.NumberOfActivePlanes] = src->viewport_height_max;
805 if (mode_lib->vba.ViewportWidthChroma[mode_lib->vba.NumberOfActivePlanes] > src->viewport_width_max / hdiv_c)
806 mode_lib->vba.ViewportWidthChroma[mode_lib->vba.NumberOfActivePlanes] = src->viewport_width_max / hdiv_c;
807 if (mode_lib->vba.ViewportHeightChroma[mode_lib->vba.NumberOfActivePlanes] > src->viewport_height_max / vdiv_c)
808 mode_lib->vba.ViewportHeightChroma[mode_lib->vba.NumberOfActivePlanes] = src->viewport_height_max / vdiv_c;
811 if (pipes[j].pipe.src.immediate_flip) {
812 mode_lib->vba.ImmediateFlipSupport = true;
813 mode_lib->vba.ImmediateFlipRequirement[j] = dm_immediate_flip_required;
816 mode_lib->vba.NumberOfActivePlanes++;
817 mode_lib->vba.NumberOfActiveSurfaces++;
820 // handle overlays through BlendingAndTiming
821 // BlendingAndTiming tells you which instance to look at to get timing, the so called 'master'
823 for (j = 0; j < mode_lib->vba.NumberOfActivePlanes; ++j)
824 PlaneVisited[j] = false;
826 for (j = 0; j < mode_lib->vba.NumberOfActivePlanes; ++j) {
827 for (k = j + 1; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
828 if (!PlaneVisited[k] && OTGInstPlane[j] == OTGInstPlane[k]) {
829 // doesn't matter, so choose the smaller one
830 mode_lib->vba.BlendingAndTiming[j] = j;
831 PlaneVisited[j] = true;
832 mode_lib->vba.BlendingAndTiming[k] = j;
833 PlaneVisited[k] = true;
837 if (!PlaneVisited[j]) {
838 mode_lib->vba.BlendingAndTiming[j] = j;
839 PlaneVisited[j] = true;
843 mode_lib->vba.SynchronizeTimingsFinal = pipes[0].pipe.dest.synchronize_timings;
844 mode_lib->vba.DCCProgrammingAssumesScanDirectionUnknownFinal = false;
845 mode_lib->vba.UseUnboundedRequesting = dm_unbounded_requesting;
846 for (k = 0; k < mode_lib->vba.cache_num_pipes; ++k) {
847 if (pipes[k].pipe.src.unbounded_req_mode == 0)
848 mode_lib->vba.UseUnboundedRequesting = dm_unbounded_requesting_disable;
850 // TODO: ODMCombineEnabled => 2 * DPPPerPlane...actually maybe not since all pipes are specified
851 // Do we want the dscclk to automatically be halved? Guess not since the value is specified
852 mode_lib->vba.SynchronizedVBlank = pipes[0].pipe.dest.synchronized_vblank_all_planes;
853 for (k = 1; k < mode_lib->vba.cache_num_pipes; ++k) {
854 ASSERT(mode_lib->vba.SynchronizedVBlank == pipes[k].pipe.dest.synchronized_vblank_all_planes);
857 mode_lib->vba.GPUVMEnable = false;
858 mode_lib->vba.HostVMEnable = false;
859 mode_lib->vba.OverrideGPUVMPageTableLevels = 0;
860 mode_lib->vba.OverrideHostVMPageTableLevels = 0;
862 for (k = 0; k < mode_lib->vba.cache_num_pipes; ++k) {
863 mode_lib->vba.GPUVMEnable = mode_lib->vba.GPUVMEnable || !!pipes[k].pipe.src.gpuvm || !!pipes[k].pipe.src.vm;
864 mode_lib->vba.OverrideGPUVMPageTableLevels =
865 (pipes[k].pipe.src.gpuvm_levels_force_en
866 && mode_lib->vba.OverrideGPUVMPageTableLevels
867 < pipes[k].pipe.src.gpuvm_levels_force) ?
868 pipes[k].pipe.src.gpuvm_levels_force :
869 mode_lib->vba.OverrideGPUVMPageTableLevels;
871 mode_lib->vba.HostVMEnable = mode_lib->vba.HostVMEnable || !!pipes[k].pipe.src.hostvm || !!pipes[k].pipe.src.vm;
872 mode_lib->vba.OverrideHostVMPageTableLevels =
873 (pipes[k].pipe.src.hostvm_levels_force_en
874 && mode_lib->vba.OverrideHostVMPageTableLevels
875 < pipes[k].pipe.src.hostvm_levels_force) ?
876 pipes[k].pipe.src.hostvm_levels_force :
877 mode_lib->vba.OverrideHostVMPageTableLevels;
880 if (mode_lib->vba.OverrideGPUVMPageTableLevels)
881 mode_lib->vba.GPUVMMaxPageTableLevels = mode_lib->vba.OverrideGPUVMPageTableLevels;
883 if (mode_lib->vba.OverrideHostVMPageTableLevels)
884 mode_lib->vba.HostVMMaxPageTableLevels = mode_lib->vba.OverrideHostVMPageTableLevels;
886 mode_lib->vba.GPUVMEnable = mode_lib->vba.GPUVMEnable && !!ip->gpuvm_enable;
887 mode_lib->vba.HostVMEnable = mode_lib->vba.HostVMEnable && !!ip->hostvm_enable;
889 for (k = 0; k < mode_lib->vba.cache_num_pipes; ++k) {
890 mode_lib->vba.ForceOneRowForFrame[k] = pipes[k].pipe.src.force_one_row_for_frame;
891 mode_lib->vba.PteBufferMode[k] = pipes[k].pipe.src.pte_buffer_mode;
893 if (mode_lib->vba.PteBufferMode[k] == 0 && mode_lib->vba.GPUVMEnable) {
894 if (mode_lib->vba.ForceOneRowForFrame[k] ||
895 (mode_lib->vba.GPUVMMinPageSizeKBytes[k] > 64*1024) ||
896 (mode_lib->vba.UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_disable) ||
897 (mode_lib->vba.UseMALLForStaticScreen[k] != dm_use_mall_static_screen_disable)) {
898 #ifdef __DML_VBA_DEBUG__
899 dml_print("DML::%s: ERROR: Invalid PteBufferMode=%d for plane %0d!\n",
900 __func__, mode_lib->vba.PteBufferMode[k], k);
901 dml_print("DML::%s: - ForceOneRowForFrame = %d\n",
902 __func__, mode_lib->vba.ForceOneRowForFrame[k]);
903 dml_print("DML::%s: - GPUVMMinPageSizeKBytes = %d\n",
904 __func__, mode_lib->vba.GPUVMMinPageSizeKBytes[k]);
905 dml_print("DML::%s: - UseMALLForPStateChange = %d\n",
906 __func__, (int) mode_lib->vba.UsesMALLForPStateChange[k]);
907 dml_print("DML::%s: - UseMALLForStaticScreen = %d\n",
908 __func__, (int) mode_lib->vba.UseMALLForStaticScreen[k]);
917 * ********************************************************************************************
918 * cache_debug_params: Cache any params that needed to be maintained from the initial validation
919 * for debug purposes.
921 * The DML getters can modify some of the VBA params that we are interested in (for example when
922 * calculating with dummy p-state latency), so cache any params here that we want for debugging
924 * @param [in] mode_lib: mode_lib input/output of validate call
928 * ********************************************************************************************
930 static void cache_debug_params(struct display_mode_lib *mode_lib)
934 for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; k++)
935 mode_lib->vba.CachedActiveDRAMClockChangeLatencyMargin[k] = mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k];
938 // in wm mode we pull the parameters needed from the display_e2e_pipe_params_st structs
939 // rather than working them out as in recalculate_ms
940 static void recalculate_params(
941 struct display_mode_lib *mode_lib,
942 const display_e2e_pipe_params_st *pipes,
943 unsigned int num_pipes)
945 // This is only safe to use memcmp because there are non-POD types in struct display_mode_lib
946 if (memcmp(&mode_lib->soc, &mode_lib->vba.soc, sizeof(mode_lib->vba.soc)) != 0
947 || memcmp(&mode_lib->ip, &mode_lib->vba.ip, sizeof(mode_lib->vba.ip)) != 0
948 || num_pipes != mode_lib->vba.cache_num_pipes
951 mode_lib->vba.cache_pipes,
952 sizeof(display_e2e_pipe_params_st) * num_pipes) != 0) {
953 mode_lib->vba.soc = mode_lib->soc;
954 mode_lib->vba.ip = mode_lib->ip;
955 memcpy(mode_lib->vba.cache_pipes, pipes, sizeof(*pipes) * num_pipes);
956 mode_lib->vba.cache_num_pipes = num_pipes;
957 mode_lib->funcs.recalculate(mode_lib);
961 void Calculate256BBlockSizes(
962 enum source_format_class SourcePixelFormat,
963 enum dm_swizzle_mode SurfaceTiling,
964 unsigned int BytePerPixelY,
965 unsigned int BytePerPixelC,
966 unsigned int *BlockHeight256BytesY,
967 unsigned int *BlockHeight256BytesC,
968 unsigned int *BlockWidth256BytesY,
969 unsigned int *BlockWidth256BytesC)
971 if ((SourcePixelFormat == dm_444_64 || SourcePixelFormat == dm_444_32
972 || SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_8)) {
973 if (SurfaceTiling == dm_sw_linear) {
974 *BlockHeight256BytesY = 1;
975 } else if (SourcePixelFormat == dm_444_64) {
976 *BlockHeight256BytesY = 4;
977 } else if (SourcePixelFormat == dm_444_8) {
978 *BlockHeight256BytesY = 16;
980 *BlockHeight256BytesY = 8;
982 *BlockWidth256BytesY = 256 / BytePerPixelY / *BlockHeight256BytesY;
983 *BlockHeight256BytesC = 0;
984 *BlockWidth256BytesC = 0;
986 if (SurfaceTiling == dm_sw_linear) {
987 *BlockHeight256BytesY = 1;
988 *BlockHeight256BytesC = 1;
989 } else if (SourcePixelFormat == dm_420_8) {
990 *BlockHeight256BytesY = 16;
991 *BlockHeight256BytesC = 8;
993 *BlockHeight256BytesY = 8;
994 *BlockHeight256BytesC = 8;
996 *BlockWidth256BytesY = 256 / BytePerPixelY / *BlockHeight256BytesY;
997 *BlockWidth256BytesC = 256 / BytePerPixelC / *BlockHeight256BytesC;
1001 bool CalculateMinAndMaxPrefetchMode(
1002 enum self_refresh_affinity AllowDRAMSelfRefreshOrDRAMClockChangeInVblank,
1003 unsigned int *MinPrefetchMode,
1004 unsigned int *MaxPrefetchMode)
1006 if (AllowDRAMSelfRefreshOrDRAMClockChangeInVblank
1007 == dm_neither_self_refresh_nor_mclk_switch) {
1008 *MinPrefetchMode = 2;
1009 *MaxPrefetchMode = 2;
1011 } else if (AllowDRAMSelfRefreshOrDRAMClockChangeInVblank == dm_allow_self_refresh) {
1012 *MinPrefetchMode = 1;
1013 *MaxPrefetchMode = 1;
1015 } else if (AllowDRAMSelfRefreshOrDRAMClockChangeInVblank
1016 == dm_allow_self_refresh_and_mclk_switch) {
1017 *MinPrefetchMode = 0;
1018 *MaxPrefetchMode = 0;
1020 } else if (AllowDRAMSelfRefreshOrDRAMClockChangeInVblank
1021 == dm_try_to_allow_self_refresh_and_mclk_switch) {
1022 *MinPrefetchMode = 0;
1023 *MaxPrefetchMode = 2;
1026 *MinPrefetchMode = 0;
1027 *MaxPrefetchMode = 2;
1031 void PixelClockAdjustmentForProgressiveToInterlaceUnit(struct display_mode_lib *mode_lib)
1035 //Progressive To Interlace Unit Effect
1036 for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
1037 mode_lib->vba.PixelClockBackEnd[k] = mode_lib->vba.PixelClock[k];
1038 if (mode_lib->vba.Interlace[k] == 1
1039 && mode_lib->vba.ProgressiveToInterlaceUnitInOPP == true) {
1040 mode_lib->vba.PixelClock[k] = 2 * mode_lib->vba.PixelClock[k];
1045 static unsigned int CursorBppEnumToBits(enum cursor_bpp ebpp)
1059 void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib)
1061 soc_bounding_box_st *soc = &mode_lib->vba.soc;
1063 unsigned int total_pipes = 0;
1064 unsigned int pipe_idx = 0;
1066 mode_lib->vba.VoltageLevel = mode_lib->vba.cache_pipes[0].clks_cfg.voltage;
1067 mode_lib->vba.ReturnBW = mode_lib->vba.ReturnBWPerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb];
1068 if (mode_lib->vba.ReturnBW == 0)
1069 mode_lib->vba.ReturnBW = mode_lib->vba.ReturnBWPerState[mode_lib->vba.VoltageLevel][0];
1070 mode_lib->vba.FabricAndDRAMBandwidth = mode_lib->vba.FabricAndDRAMBandwidthPerState[mode_lib->vba.VoltageLevel];
1072 fetch_socbb_params(mode_lib);
1073 fetch_ip_params(mode_lib);
1074 fetch_pipe_params(mode_lib);
1076 mode_lib->vba.DCFCLK = mode_lib->vba.cache_pipes[0].clks_cfg.dcfclk_mhz;
1077 mode_lib->vba.SOCCLK = mode_lib->vba.cache_pipes[0].clks_cfg.socclk_mhz;
1078 if (mode_lib->vba.cache_pipes[0].clks_cfg.dispclk_mhz > 0.0)
1079 mode_lib->vba.DISPCLK = mode_lib->vba.cache_pipes[0].clks_cfg.dispclk_mhz;
1081 mode_lib->vba.DISPCLK = soc->clock_limits[mode_lib->vba.VoltageLevel].dispclk_mhz;
1083 // Total Available Pipes Support Check
1084 for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
1085 total_pipes += mode_lib->vba.DPPPerPlane[k];
1086 pipe_idx = get_pipe_idx(mode_lib, k);
1087 if (mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz > 0.0)
1088 mode_lib->vba.DPPCLK[k] = mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz;
1090 mode_lib->vba.DPPCLK[k] = soc->clock_limits[mode_lib->vba.VoltageLevel].dppclk_mhz;
1092 ASSERT(total_pipes <= DC__NUM_DPP__MAX);
1095 double CalculateWriteBackDISPCLK(
1096 enum source_format_class WritebackPixelFormat,
1098 double WritebackHRatio,
1099 double WritebackVRatio,
1100 unsigned int WritebackLumaHTaps,
1101 unsigned int WritebackLumaVTaps,
1102 unsigned int WritebackChromaHTaps,
1103 unsigned int WritebackChromaVTaps,
1104 double WritebackDestinationWidth,
1105 unsigned int HTotal,
1106 unsigned int WritebackChromaLineBufferWidth)
1108 double CalculateWriteBackDISPCLK = 1.01 * PixelClock * dml_max(
1109 dml_ceil(WritebackLumaHTaps / 4.0, 1) / WritebackHRatio,
1110 dml_max((WritebackLumaVTaps * dml_ceil(1.0 / WritebackVRatio, 1) * dml_ceil(WritebackDestinationWidth / 4.0, 1)
1111 + dml_ceil(WritebackDestinationWidth / 4.0, 1)) / (double) HTotal + dml_ceil(1.0 / WritebackVRatio, 1)
1112 * (dml_ceil(WritebackLumaVTaps / 4.0, 1) + 4.0) / (double) HTotal,
1113 dml_ceil(1.0 / WritebackVRatio, 1) * WritebackDestinationWidth / (double) HTotal));
1114 if (WritebackPixelFormat != dm_444_32) {
1115 CalculateWriteBackDISPCLK = dml_max(CalculateWriteBackDISPCLK, 1.01 * PixelClock * dml_max(
1116 dml_ceil(WritebackChromaHTaps / 2.0, 1) / (2 * WritebackHRatio),
1117 dml_max((WritebackChromaVTaps * dml_ceil(1 / (2 * WritebackVRatio), 1) * dml_ceil(WritebackDestinationWidth / 2.0 / 2.0, 1)
1118 + dml_ceil(WritebackDestinationWidth / 2.0 / WritebackChromaLineBufferWidth, 1)) / HTotal
1119 + dml_ceil(1 / (2 * WritebackVRatio), 1) * (dml_ceil(WritebackChromaVTaps / 4.0, 1) + 4) / HTotal,
1120 dml_ceil(1.0 / (2 * WritebackVRatio), 1) * WritebackDestinationWidth / 2.0 / HTotal)));
1122 return CalculateWriteBackDISPCLK;