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.
26 #include "display_mode_lib.h"
27 #include "display_mode_vba.h"
28 #include "display_rq_dlg_calc.h"
30 static void calculate_ttu_cursor(struct display_mode_lib *mode_lib,
31 double *refcyc_per_req_delivery_pre_cur,
32 double *refcyc_per_req_delivery_cur,
33 double refclk_freq_in_mhz,
34 double ref_freq_to_pix_freq,
35 double hscale_pixel_rate_l,
39 unsigned int cur_width,
40 enum cursor_bpp cur_bpp);
42 #include "dml_inline_defs.h"
44 static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma)
46 unsigned int ret_val = 0;
48 if (source_format == dm_444_16) {
51 } else if (source_format == dm_444_32) {
54 } else if (source_format == dm_444_64) {
57 } else if (source_format == dm_420_8) {
62 } else if (source_format == dm_420_10) {
67 } else if (source_format == dm_444_8) {
73 static bool is_dual_plane(enum source_format_class source_format)
77 if ((source_format == dm_420_8) || (source_format == dm_420_10))
83 static double get_refcyc_per_delivery(struct display_mode_lib *mode_lib,
84 double refclk_freq_in_mhz,
85 double pclk_freq_in_mhz,
87 unsigned int recout_width,
90 double hscale_pixel_rate,
91 unsigned int delivery_width,
92 unsigned int req_per_swath_ub)
94 double refcyc_per_delivery = 0.0;
98 refcyc_per_delivery = (double) refclk_freq_in_mhz
99 * dml_min((double) recout_width, (double) hactive / 2.0)
100 / pclk_freq_in_mhz / (double) req_per_swath_ub;
102 refcyc_per_delivery = (double) refclk_freq_in_mhz * (double) recout_width
103 / pclk_freq_in_mhz / (double) req_per_swath_ub;
105 refcyc_per_delivery = (double) refclk_freq_in_mhz * (double) delivery_width
106 / (double) hscale_pixel_rate / (double) req_per_swath_ub;
109 dml_print("DML_DLG: %s: refclk_freq_in_mhz = %3.2f\n", __func__, refclk_freq_in_mhz);
110 dml_print("DML_DLG: %s: pclk_freq_in_mhz = %3.2f\n", __func__, pclk_freq_in_mhz);
111 dml_print("DML_DLG: %s: recout_width = %d\n", __func__, recout_width);
112 dml_print("DML_DLG: %s: vratio = %3.2f\n", __func__, vratio);
113 dml_print("DML_DLG: %s: req_per_swath_ub = %d\n", __func__, req_per_swath_ub);
114 dml_print("DML_DLG: %s: refcyc_per_delivery= %3.2f\n", __func__, refcyc_per_delivery);
116 return refcyc_per_delivery;
120 static unsigned int get_blk_size_bytes(const enum source_macro_tile_size tile_size)
122 if (tile_size == dm_256k_tile)
124 else if (tile_size == dm_64k_tile)
130 static void extract_rq_sizing_regs(struct display_mode_lib *mode_lib,
131 display_data_rq_regs_st *rq_regs,
132 const display_data_rq_sizing_params_st rq_sizing)
134 dml_print("DML_DLG: %s: rq_sizing param\n", __func__);
135 print__data_rq_sizing_params_st(mode_lib, rq_sizing);
137 rq_regs->chunk_size = dml_log2(rq_sizing.chunk_bytes) - 10;
139 if (rq_sizing.min_chunk_bytes == 0)
140 rq_regs->min_chunk_size = 0;
142 rq_regs->min_chunk_size = dml_log2(rq_sizing.min_chunk_bytes) - 8 + 1;
144 rq_regs->meta_chunk_size = dml_log2(rq_sizing.meta_chunk_bytes) - 10;
145 if (rq_sizing.min_meta_chunk_bytes == 0)
146 rq_regs->min_meta_chunk_size = 0;
148 rq_regs->min_meta_chunk_size = dml_log2(rq_sizing.min_meta_chunk_bytes) - 6 + 1;
150 rq_regs->dpte_group_size = dml_log2(rq_sizing.dpte_group_bytes) - 6;
151 rq_regs->mpte_group_size = dml_log2(rq_sizing.mpte_group_bytes) - 6;
154 static void extract_rq_regs(struct display_mode_lib *mode_lib,
155 display_rq_regs_st *rq_regs,
156 const display_rq_params_st rq_param)
158 unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
159 unsigned int detile_buf_plane1_addr = 0;
161 extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), rq_param.sizing.rq_l);
163 rq_regs->rq_regs_l.pte_row_height_linear = dml_floor(dml_log2(rq_param.dlg.rq_l.dpte_row_height),
166 if (rq_param.yuv420) {
167 extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), rq_param.sizing.rq_c);
168 rq_regs->rq_regs_c.pte_row_height_linear = dml_floor(dml_log2(rq_param.dlg.rq_c.dpte_row_height),
172 rq_regs->rq_regs_l.swath_height = dml_log2(rq_param.dlg.rq_l.swath_height);
173 rq_regs->rq_regs_c.swath_height = dml_log2(rq_param.dlg.rq_c.swath_height);
175 // FIXME: take the max between luma, chroma chunk size?
176 // okay for now, as we are setting chunk_bytes to 8kb anyways
177 if (rq_param.sizing.rq_l.chunk_bytes >= 32 * 1024) { //32kb
178 rq_regs->drq_expansion_mode = 0;
180 rq_regs->drq_expansion_mode = 2;
182 rq_regs->prq_expansion_mode = 1;
183 rq_regs->mrq_expansion_mode = 1;
184 rq_regs->crq_expansion_mode = 1;
186 if (rq_param.yuv420) {
187 if ((double) rq_param.misc.rq_l.stored_swath_bytes
188 / (double) rq_param.misc.rq_c.stored_swath_bytes <= 1.5) {
189 detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 64.0); // half to chroma
191 detile_buf_plane1_addr = dml_round_to_multiple((unsigned int) ((2.0 * detile_buf_size_in_bytes) / 3.0),
193 0) / 64.0; // 2/3 to chroma
196 rq_regs->plane1_base_address = detile_buf_plane1_addr;
199 static void handle_det_buf_split(struct display_mode_lib *mode_lib,
200 display_rq_params_st *rq_param,
201 const display_pipe_source_params_st pipe_src_param)
203 unsigned int total_swath_bytes = 0;
204 unsigned int swath_bytes_l = 0;
205 unsigned int swath_bytes_c = 0;
206 unsigned int full_swath_bytes_packed_l = 0;
207 unsigned int full_swath_bytes_packed_c = 0;
210 bool surf_linear = (pipe_src_param.sw_mode == dm_sw_linear);
211 bool surf_vert = (pipe_src_param.source_scan == dm_vert);
212 unsigned int log2_swath_height_l = 0;
213 unsigned int log2_swath_height_c = 0;
214 unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
216 full_swath_bytes_packed_l = rq_param->misc.rq_l.full_swath_bytes;
217 full_swath_bytes_packed_c = rq_param->misc.rq_c.full_swath_bytes;
219 if (rq_param->yuv420_10bpc) {
220 full_swath_bytes_packed_l = dml_round_to_multiple(rq_param->misc.rq_l.full_swath_bytes * 2 / 3,
223 full_swath_bytes_packed_c = dml_round_to_multiple(rq_param->misc.rq_c.full_swath_bytes * 2 / 3,
228 if (rq_param->yuv420) {
229 total_swath_bytes = 2 * full_swath_bytes_packed_l + 2 * full_swath_bytes_packed_c;
231 if (total_swath_bytes <= detile_buf_size_in_bytes) { //full 256b request
234 swath_bytes_l = full_swath_bytes_packed_l;
235 swath_bytes_c = full_swath_bytes_packed_c;
236 } else { //128b request (for luma only for yuv420 8bpc)
239 swath_bytes_l = full_swath_bytes_packed_l / 2;
240 swath_bytes_c = full_swath_bytes_packed_c;
242 // Note: assumption, the config that pass in will fit into
243 // the detiled buffer.
245 total_swath_bytes = 2 * full_swath_bytes_packed_l;
247 if (total_swath_bytes <= detile_buf_size_in_bytes)
252 swath_bytes_l = total_swath_bytes;
255 rq_param->misc.rq_l.stored_swath_bytes = swath_bytes_l;
256 rq_param->misc.rq_c.stored_swath_bytes = swath_bytes_c;
259 log2_swath_height_l = 0;
260 log2_swath_height_c = 0;
261 } else if (!surf_vert) {
262 log2_swath_height_l = dml_log2(rq_param->misc.rq_l.blk256_height) - req128_l;
263 log2_swath_height_c = dml_log2(rq_param->misc.rq_c.blk256_height) - req128_c;
265 log2_swath_height_l = dml_log2(rq_param->misc.rq_l.blk256_width) - req128_l;
266 log2_swath_height_c = dml_log2(rq_param->misc.rq_c.blk256_width) - req128_c;
268 rq_param->dlg.rq_l.swath_height = 1 << log2_swath_height_l;
269 rq_param->dlg.rq_c.swath_height = 1 << log2_swath_height_c;
271 dml_print("DML_DLG: %s: req128_l = %0d\n", __func__, req128_l);
272 dml_print("DML_DLG: %s: req128_c = %0d\n", __func__, req128_c);
273 dml_print("DML_DLG: %s: full_swath_bytes_packed_l = %0d\n",
275 full_swath_bytes_packed_l);
276 dml_print("DML_DLG: %s: full_swath_bytes_packed_c = %0d\n",
278 full_swath_bytes_packed_c);
281 static void get_meta_and_pte_attr(struct display_mode_lib *mode_lib,
282 display_data_rq_dlg_params_st *rq_dlg_param,
283 display_data_rq_misc_params_st *rq_misc_param,
284 display_data_rq_sizing_params_st *rq_sizing_param,
285 unsigned int vp_width,
286 unsigned int vp_height,
287 unsigned int data_pitch,
288 unsigned int meta_pitch,
289 unsigned int source_format,
291 unsigned int macro_tile_size,
292 unsigned int source_scan,
293 unsigned int is_chroma)
295 bool surf_linear = (tiling == dm_sw_linear);
296 bool surf_vert = (source_scan == dm_vert);
298 unsigned int bytes_per_element;
299 unsigned int bytes_per_element_y = get_bytes_per_element((enum source_format_class)(source_format),
301 unsigned int bytes_per_element_c = get_bytes_per_element((enum source_format_class)(source_format),
304 unsigned int blk256_width = 0;
305 unsigned int blk256_height = 0;
307 unsigned int blk256_width_y = 0;
308 unsigned int blk256_height_y = 0;
309 unsigned int blk256_width_c = 0;
310 unsigned int blk256_height_c = 0;
311 unsigned int log2_bytes_per_element;
312 unsigned int log2_blk256_width;
313 unsigned int log2_blk256_height;
314 unsigned int blk_bytes;
315 unsigned int log2_blk_bytes;
316 unsigned int log2_blk_height;
317 unsigned int log2_blk_width;
318 unsigned int log2_meta_req_bytes;
319 unsigned int log2_meta_req_height;
320 unsigned int log2_meta_req_width;
321 unsigned int meta_req_width;
322 unsigned int meta_req_height;
323 unsigned int log2_meta_row_height;
324 unsigned int meta_row_width_ub;
325 unsigned int log2_meta_chunk_bytes;
326 unsigned int log2_meta_chunk_height;
328 //full sized meta chunk width in unit of data elements
329 unsigned int log2_meta_chunk_width;
330 unsigned int log2_min_meta_chunk_bytes;
331 unsigned int min_meta_chunk_width;
332 unsigned int meta_chunk_width;
333 unsigned int meta_chunk_per_row_int;
334 unsigned int meta_row_remainder;
335 unsigned int meta_chunk_threshold;
336 unsigned int meta_blk_bytes;
337 unsigned int meta_blk_height;
338 unsigned int meta_blk_width;
339 unsigned int meta_surface_bytes;
340 unsigned int vmpg_bytes;
341 unsigned int meta_pte_req_per_frame_ub;
342 unsigned int meta_pte_bytes_per_frame_ub;
343 const unsigned int log2_vmpg_bytes = dml_log2(mode_lib->soc.vmm_page_size_bytes);
344 const unsigned int dpte_buf_in_pte_reqs = mode_lib->ip.dpte_buffer_size_in_pte_reqs;
345 const unsigned int pde_proc_buffer_size_64k_reqs =
346 mode_lib->ip.pde_proc_buffer_size_64k_reqs;
348 unsigned int log2_vmpg_height = 0;
349 unsigned int log2_vmpg_width = 0;
350 unsigned int log2_dpte_req_height_ptes = 0;
351 unsigned int log2_dpte_req_height = 0;
352 unsigned int log2_dpte_req_width = 0;
353 unsigned int log2_dpte_row_height_linear = 0;
354 unsigned int log2_dpte_row_height = 0;
355 unsigned int log2_dpte_group_width = 0;
356 unsigned int dpte_row_width_ub = 0;
357 unsigned int dpte_req_height = 0;
358 unsigned int dpte_req_width = 0;
359 unsigned int dpte_group_width = 0;
360 unsigned int log2_dpte_group_bytes = 0;
361 unsigned int log2_dpte_group_length = 0;
362 unsigned int pde_buf_entries;
363 bool yuv420 = (source_format == dm_420_8 || source_format == dm_420_10);
365 Calculate256BBlockSizes((enum source_format_class)(source_format),
366 (enum dm_swizzle_mode)(tiling),
375 blk256_width = blk256_width_y;
376 blk256_height = blk256_height_y;
377 bytes_per_element = bytes_per_element_y;
379 blk256_width = blk256_width_c;
380 blk256_height = blk256_height_c;
381 bytes_per_element = bytes_per_element_c;
384 log2_bytes_per_element = dml_log2(bytes_per_element);
386 dml_print("DML_DLG: %s: surf_linear = %d\n", __func__, surf_linear);
387 dml_print("DML_DLG: %s: surf_vert = %d\n", __func__, surf_vert);
388 dml_print("DML_DLG: %s: blk256_width = %d\n", __func__, blk256_width);
389 dml_print("DML_DLG: %s: blk256_height = %d\n", __func__, blk256_height);
391 log2_blk256_width = dml_log2((double) blk256_width);
392 log2_blk256_height = dml_log2((double) blk256_height);
393 blk_bytes = surf_linear ?
394 256 : get_blk_size_bytes((enum source_macro_tile_size) macro_tile_size);
395 log2_blk_bytes = dml_log2((double) blk_bytes);
400 // "+" in log is multiply
401 // "-" in log is divide
402 // "/2" is like square root
403 // blk is vertical biased
404 if (tiling != dm_sw_linear)
405 log2_blk_height = log2_blk256_height
406 + dml_ceil((double) (log2_blk_bytes - 8) / 2.0, 1);
408 log2_blk_height = 0; // blk height of 1
410 log2_blk_width = log2_blk_bytes - log2_bytes_per_element - log2_blk_height;
413 rq_dlg_param->swath_width_ub = dml_round_to_multiple(vp_width - 1, blk256_width, 1)
415 rq_dlg_param->req_per_swath_ub = rq_dlg_param->swath_width_ub >> log2_blk256_width;
417 rq_dlg_param->swath_width_ub = dml_round_to_multiple(vp_height - 1, blk256_height, 1)
419 rq_dlg_param->req_per_swath_ub = rq_dlg_param->swath_width_ub >> log2_blk256_height;
423 rq_misc_param->full_swath_bytes = rq_dlg_param->swath_width_ub * blk256_height
426 rq_misc_param->full_swath_bytes = rq_dlg_param->swath_width_ub * blk256_width
429 rq_misc_param->blk256_height = blk256_height;
430 rq_misc_param->blk256_width = blk256_width;
435 log2_meta_req_bytes = 6; // meta request is 64b and is 8x8byte meta element
437 // each 64b meta request for dcn is 8x8 meta elements and
438 // a meta element covers one 256b block of the the data surface.
439 log2_meta_req_height = log2_blk256_height + 3; // meta req is 8x8 byte, each byte represent 1 blk256
440 log2_meta_req_width = log2_meta_req_bytes + 8 - log2_bytes_per_element
441 - log2_meta_req_height;
442 meta_req_width = 1 << log2_meta_req_width;
443 meta_req_height = 1 << log2_meta_req_height;
444 log2_meta_row_height = 0;
445 meta_row_width_ub = 0;
447 // the dimensions of a meta row are meta_row_width x meta_row_height in elements.
448 // calculate upper bound of the meta_row_width
450 log2_meta_row_height = log2_meta_req_height;
451 meta_row_width_ub = dml_round_to_multiple(vp_width - 1, meta_req_width, 1)
453 rq_dlg_param->meta_req_per_row_ub = meta_row_width_ub / meta_req_width;
455 log2_meta_row_height = log2_meta_req_width;
456 meta_row_width_ub = dml_round_to_multiple(vp_height - 1, meta_req_height, 1)
458 rq_dlg_param->meta_req_per_row_ub = meta_row_width_ub / meta_req_height;
460 rq_dlg_param->meta_bytes_per_row_ub = rq_dlg_param->meta_req_per_row_ub * 64;
462 rq_dlg_param->meta_row_height = 1 << log2_meta_row_height;
464 log2_meta_chunk_bytes = dml_log2(rq_sizing_param->meta_chunk_bytes);
465 log2_meta_chunk_height = log2_meta_row_height;
467 //full sized meta chunk width in unit of data elements
468 log2_meta_chunk_width = log2_meta_chunk_bytes + 8 - log2_bytes_per_element
469 - log2_meta_chunk_height;
470 log2_min_meta_chunk_bytes = dml_log2(rq_sizing_param->min_meta_chunk_bytes);
471 min_meta_chunk_width = 1
472 << (log2_min_meta_chunk_bytes + 8 - log2_bytes_per_element
473 - log2_meta_chunk_height);
474 meta_chunk_width = 1 << log2_meta_chunk_width;
475 meta_chunk_per_row_int = (unsigned int) (meta_row_width_ub / meta_chunk_width);
476 meta_row_remainder = meta_row_width_ub % meta_chunk_width;
477 meta_chunk_threshold = 0;
478 meta_blk_bytes = 4096;
479 meta_blk_height = blk256_height * 64;
480 meta_blk_width = meta_blk_bytes * 256 / bytes_per_element / meta_blk_height;
481 meta_surface_bytes = meta_pitch
482 * (dml_round_to_multiple(vp_height - 1, meta_blk_height, 1) + meta_blk_height)
483 * bytes_per_element / 256;
484 vmpg_bytes = mode_lib->soc.vmm_page_size_bytes;
485 meta_pte_req_per_frame_ub = (dml_round_to_multiple(meta_surface_bytes - vmpg_bytes,
487 1) + 8 * vmpg_bytes) / (8 * vmpg_bytes);
488 meta_pte_bytes_per_frame_ub = meta_pte_req_per_frame_ub * 64; //64B mpte request
489 rq_dlg_param->meta_pte_bytes_per_frame_ub = meta_pte_bytes_per_frame_ub;
491 dml_print("DML_DLG: %s: meta_blk_height = %d\n", __func__, meta_blk_height);
492 dml_print("DML_DLG: %s: meta_blk_width = %d\n", __func__, meta_blk_width);
493 dml_print("DML_DLG: %s: meta_surface_bytes = %d\n", __func__, meta_surface_bytes);
494 dml_print("DML_DLG: %s: meta_pte_req_per_frame_ub = %d\n",
496 meta_pte_req_per_frame_ub);
497 dml_print("DML_DLG: %s: meta_pte_bytes_per_frame_ub = %d\n",
499 meta_pte_bytes_per_frame_ub);
502 meta_chunk_threshold = 2 * min_meta_chunk_width - meta_req_width;
504 meta_chunk_threshold = 2 * min_meta_chunk_width - meta_req_height;
506 if (meta_row_remainder <= meta_chunk_threshold)
507 rq_dlg_param->meta_chunks_per_row_ub = meta_chunk_per_row_int + 1;
509 rq_dlg_param->meta_chunks_per_row_ub = meta_chunk_per_row_int + 2;
515 log2_vmpg_height = 0; // one line high
517 log2_vmpg_height = (log2_vmpg_bytes - 8) / 2 + log2_blk256_height;
519 log2_vmpg_width = log2_vmpg_bytes - log2_bytes_per_element - log2_vmpg_height;
521 // only 3 possible shapes for dpte request in dimensions of ptes: 8x1, 4x2, 2x4.
522 if (surf_linear) { //one 64B PTE request returns 8 PTEs
523 log2_dpte_req_height_ptes = 0;
524 log2_dpte_req_width = log2_vmpg_width + 3;
525 log2_dpte_req_height = 0;
526 } else if (log2_blk_bytes == 12) { //4KB tile means 4kB page size
527 //one 64B req gives 8x1 PTEs for 4KB tile
528 log2_dpte_req_height_ptes = 0;
529 log2_dpte_req_width = log2_blk_width + 3;
530 log2_dpte_req_height = log2_blk_height + 0;
531 } else if ((log2_blk_bytes >= 16) && (log2_vmpg_bytes == 12)) { // tile block >= 64KB
532 //two 64B reqs of 2x4 PTEs give 16 PTEs to cover 64KB
533 log2_dpte_req_height_ptes = 4;
534 log2_dpte_req_width = log2_blk256_width + 4; // log2_64KB_width
535 log2_dpte_req_height = log2_blk256_height + 4; // log2_64KB_height
536 } else { //64KB page size and must 64KB tile block
537 //one 64B req gives 8x1 PTEs for 64KB tile
538 log2_dpte_req_height_ptes = 0;
539 log2_dpte_req_width = log2_blk_width + 3;
540 log2_dpte_req_height = log2_blk_height + 0;
543 // The dpte request dimensions in data elements is dpte_req_width x dpte_req_height
544 // log2_vmpg_width is how much 1 pte represent, now calculating how much a 64b pte req represent
545 // That depends on the pte shape (i.e. 8x1, 4x2, 2x4)
546 //log2_dpte_req_height = log2_vmpg_height + log2_dpte_req_height_ptes;
547 //log2_dpte_req_width = log2_vmpg_width + log2_dpte_req_width_ptes;
548 dpte_req_height = 1 << log2_dpte_req_height;
549 dpte_req_width = 1 << log2_dpte_req_width;
551 // calculate pitch dpte row buffer can hold
552 // round the result down to a power of two.
553 pde_buf_entries = yuv420 ? (pde_proc_buffer_size_64k_reqs >> 1) : pde_proc_buffer_size_64k_reqs;
555 unsigned int dpte_row_height;
557 log2_dpte_row_height_linear = dml_floor(dml_log2(dml_min(64 * 1024 * pde_buf_entries
564 ASSERT(log2_dpte_row_height_linear >= 3);
566 if (log2_dpte_row_height_linear > 7)
567 log2_dpte_row_height_linear = 7;
569 log2_dpte_row_height = log2_dpte_row_height_linear;
570 // For linear, the dpte row is pitch dependent and the pte requests wrap at the pitch boundary.
571 // the dpte_row_width_ub is the upper bound of data_pitch*dpte_row_height in elements with this unique buffering.
572 dpte_row_height = 1 << log2_dpte_row_height;
573 dpte_row_width_ub = dml_round_to_multiple(data_pitch * dpte_row_height - 1,
576 rq_dlg_param->dpte_req_per_row_ub = dpte_row_width_ub / dpte_req_width;
578 // the upper bound of the dpte_row_width without dependency on viewport position follows.
579 // for tiled mode, row height is the same as req height and row store up to vp size upper bound
581 log2_dpte_row_height = log2_dpte_req_height;
582 dpte_row_width_ub = dml_round_to_multiple(vp_width - 1, dpte_req_width, 1)
584 rq_dlg_param->dpte_req_per_row_ub = dpte_row_width_ub / dpte_req_width;
586 log2_dpte_row_height =
587 (log2_blk_width < log2_dpte_req_width) ?
588 log2_blk_width : log2_dpte_req_width;
589 dpte_row_width_ub = dml_round_to_multiple(vp_height - 1, dpte_req_height, 1)
591 rq_dlg_param->dpte_req_per_row_ub = dpte_row_width_ub / dpte_req_height;
594 if (log2_blk_bytes >= 16 && log2_vmpg_bytes == 12) // tile block >= 64KB
595 rq_dlg_param->dpte_bytes_per_row_ub = rq_dlg_param->dpte_req_per_row_ub * 128; //2*64B dpte request
597 rq_dlg_param->dpte_bytes_per_row_ub = rq_dlg_param->dpte_req_per_row_ub * 64; //64B dpte request
599 rq_dlg_param->dpte_row_height = 1 << log2_dpte_row_height;
601 // the dpte_group_bytes is reduced for the specific case of vertical
602 // access of a tile surface that has dpte request of 8x1 ptes.
603 if (!surf_linear & (log2_dpte_req_height_ptes == 0) & surf_vert) //reduced, in this case, will have page fault within a group
604 rq_sizing_param->dpte_group_bytes = 512;
607 rq_sizing_param->dpte_group_bytes = 2048;
609 //since pte request size is 64byte, the number of data pte requests per full sized group is as follows.
610 log2_dpte_group_bytes = dml_log2(rq_sizing_param->dpte_group_bytes);
611 log2_dpte_group_length = log2_dpte_group_bytes - 6; //length in 64b requests
613 // full sized data pte group width in elements
615 log2_dpte_group_width = log2_dpte_group_length + log2_dpte_req_width;
617 log2_dpte_group_width = log2_dpte_group_length + log2_dpte_req_height;
619 //But if the tile block >=64KB and the page size is 4KB, then each dPTE request is 2*64B
620 if ((log2_blk_bytes >= 16) && (log2_vmpg_bytes == 12)) // tile block >= 64KB
621 log2_dpte_group_width = log2_dpte_group_width - 1;
623 dpte_group_width = 1 << log2_dpte_group_width;
625 // since dpte groups are only aligned to dpte_req_width and not dpte_group_width,
626 // the upper bound for the dpte groups per row is as follows.
627 rq_dlg_param->dpte_groups_per_row_ub = dml_ceil((double) dpte_row_width_ub / dpte_group_width,
631 static void get_surf_rq_param(struct display_mode_lib *mode_lib,
632 display_data_rq_sizing_params_st *rq_sizing_param,
633 display_data_rq_dlg_params_st *rq_dlg_param,
634 display_data_rq_misc_params_st *rq_misc_param,
635 const display_pipe_source_params_st pipe_src_param,
639 unsigned int vp_width = 0;
640 unsigned int vp_height = 0;
641 unsigned int data_pitch = 0;
642 unsigned int meta_pitch = 0;
643 unsigned int ppe = mode_422 ? 2 : 1;
645 // FIXME check if ppe apply for both luma and chroma in 422 case
647 vp_width = pipe_src_param.viewport_width_c / ppe;
648 vp_height = pipe_src_param.viewport_height_c;
649 data_pitch = pipe_src_param.data_pitch_c;
650 meta_pitch = pipe_src_param.meta_pitch_c;
652 vp_width = pipe_src_param.viewport_width / ppe;
653 vp_height = pipe_src_param.viewport_height;
654 data_pitch = pipe_src_param.data_pitch;
655 meta_pitch = pipe_src_param.meta_pitch;
658 rq_sizing_param->chunk_bytes = 8192;
660 if (rq_sizing_param->chunk_bytes == 64 * 1024)
661 rq_sizing_param->min_chunk_bytes = 0;
663 rq_sizing_param->min_chunk_bytes = 1024;
665 rq_sizing_param->meta_chunk_bytes = 2048;
666 rq_sizing_param->min_meta_chunk_bytes = 256;
668 rq_sizing_param->mpte_group_bytes = 2048;
670 get_meta_and_pte_attr(mode_lib,
678 pipe_src_param.source_format,
679 pipe_src_param.sw_mode,
680 pipe_src_param.macro_tile_size,
681 pipe_src_param.source_scan,
685 void dml_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib,
686 display_rq_params_st *rq_param,
687 const display_pipe_source_params_st pipe_src_param)
689 // get param for luma surface
690 rq_param->yuv420 = pipe_src_param.source_format == dm_420_8
691 || pipe_src_param.source_format == dm_420_10;
692 rq_param->yuv420_10bpc = pipe_src_param.source_format == dm_420_10;
694 get_surf_rq_param(mode_lib,
695 &(rq_param->sizing.rq_l),
696 &(rq_param->dlg.rq_l),
697 &(rq_param->misc.rq_l),
701 if (is_dual_plane((enum source_format_class)(pipe_src_param.source_format))) {
702 // get param for chroma surface
703 get_surf_rq_param(mode_lib,
704 &(rq_param->sizing.rq_c),
705 &(rq_param->dlg.rq_c),
706 &(rq_param->misc.rq_c),
711 // calculate how to split the det buffer space between luma and chroma
712 handle_det_buf_split(mode_lib, rq_param, pipe_src_param);
713 print__rq_params_st(mode_lib, *rq_param);
716 void dml_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib,
717 display_rq_regs_st *rq_regs,
718 const display_pipe_source_params_st pipe_src_param)
720 display_rq_params_st rq_param = {0};
722 memset(rq_regs, 0, sizeof(*rq_regs));
723 dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_src_param);
724 extract_rq_regs(mode_lib, rq_regs, rq_param);
726 print__rq_regs_st(mode_lib, *rq_regs);
729 // Note: currently taken in as is.
730 // Nice to decouple code from hw register implement and extract code that are repeated for luma and chroma.
731 void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
732 const display_e2e_pipe_params_st *e2e_pipe_param,
733 const unsigned int num_pipes,
734 const unsigned int pipe_idx,
735 display_dlg_regs_st *disp_dlg_regs,
736 display_ttu_regs_st *disp_ttu_regs,
737 const display_rq_dlg_params_st rq_dlg_param,
738 const display_dlg_sys_params_st dlg_sys_param,
739 const bool cstate_en,
740 const bool pstate_en,
742 const bool ignore_viewport_pos,
743 const bool immediate_flip_support)
745 const display_pipe_source_params_st *src = &e2e_pipe_param[pipe_idx].pipe.src;
746 const display_pipe_dest_params_st *dst = &e2e_pipe_param[pipe_idx].pipe.dest;
747 const display_output_params_st *dout = &e2e_pipe_param[pipe_idx].dout;
748 const display_clocks_and_cfg_st *clks = &e2e_pipe_param[pipe_idx].clks_cfg;
749 const scaler_ratio_depth_st *scl = &e2e_pipe_param[pipe_idx].pipe.scale_ratio_depth;
750 const scaler_taps_st *taps = &e2e_pipe_param[pipe_idx].pipe.scale_taps;
752 // -------------------------
753 // Section 1.15.2.1: OTG dependent Params
754 // -------------------------
756 unsigned int htotal = dst->htotal;
757 // unsigned int hblank_start = dst.hblank_start; // TODO: Remove
758 unsigned int hblank_end = dst->hblank_end;
759 unsigned int vblank_start = dst->vblank_start;
760 unsigned int vblank_end = dst->vblank_end;
761 unsigned int min_vblank = mode_lib->ip.min_vblank_lines;
763 double dppclk_freq_in_mhz = clks->dppclk_mhz;
764 double dispclk_freq_in_mhz = clks->dispclk_mhz;
765 double refclk_freq_in_mhz = clks->refclk_mhz;
766 double pclk_freq_in_mhz = dst->pixel_rate_mhz;
767 bool interlaced = dst->interlaced;
769 double ref_freq_to_pix_freq = refclk_freq_in_mhz / pclk_freq_in_mhz;
771 double min_dcfclk_mhz;
773 double min_ttu_vblank;
775 double min_dst_y_ttu_vblank;
776 unsigned int dlg_vblank_start;
779 unsigned int access_dir;
780 unsigned int vp_height_l;
781 unsigned int vp_width_l;
782 unsigned int vp_height_c;
783 unsigned int vp_width_c;
786 unsigned int htaps_l;
787 unsigned int htaps_c;
794 double line_time_in_us;
797 // double vinit_bot_l;
798 // double vinit_bot_c;
800 // unsigned int swath_height_l;
801 unsigned int swath_width_ub_l;
802 // unsigned int dpte_bytes_per_row_ub_l;
803 unsigned int dpte_groups_per_row_ub_l;
804 // unsigned int meta_pte_bytes_per_frame_ub_l;
805 // unsigned int meta_bytes_per_row_ub_l;
807 // unsigned int swath_height_c;
808 unsigned int swath_width_ub_c;
809 // unsigned int dpte_bytes_per_row_ub_c;
810 unsigned int dpte_groups_per_row_ub_c;
812 unsigned int meta_chunks_per_row_ub_l;
813 unsigned int meta_chunks_per_row_ub_c;
814 unsigned int vupdate_offset;
815 unsigned int vupdate_width;
816 unsigned int vready_offset;
818 unsigned int dppclk_delay_subtotal;
819 unsigned int dispclk_delay_subtotal;
820 unsigned int pixel_rate_delay_subtotal;
822 unsigned int vstartup_start;
823 unsigned int dst_x_after_scaler;
824 unsigned int dst_y_after_scaler;
826 double dst_y_prefetch;
827 double dst_y_per_vm_vblank;
828 double dst_y_per_row_vblank;
829 double dst_y_per_vm_flip;
830 double dst_y_per_row_flip;
831 double min_dst_y_per_vm_vblank;
832 double min_dst_y_per_row_vblank;
836 unsigned int req_per_swath_ub_l;
837 unsigned int req_per_swath_ub_c;
838 unsigned int meta_row_height_l;
839 unsigned int meta_row_height_c;
840 unsigned int swath_width_pixels_ub_l;
841 unsigned int swath_width_pixels_ub_c;
842 unsigned int scaler_rec_in_width_l;
843 unsigned int scaler_rec_in_width_c;
844 unsigned int dpte_row_height_l;
845 unsigned int dpte_row_height_c;
846 double hscale_pixel_rate_l;
847 double hscale_pixel_rate_c;
848 double min_hratio_fact_l;
849 double min_hratio_fact_c;
850 double refcyc_per_line_delivery_pre_l;
851 double refcyc_per_line_delivery_pre_c;
852 double refcyc_per_line_delivery_l;
853 double refcyc_per_line_delivery_c;
855 double refcyc_per_req_delivery_pre_l;
856 double refcyc_per_req_delivery_pre_c;
857 double refcyc_per_req_delivery_l;
858 double refcyc_per_req_delivery_c;
860 unsigned int full_recout_width;
861 double xfc_transfer_delay;
862 double xfc_precharge_delay;
863 double xfc_remote_surface_flip_latency;
864 double xfc_dst_y_delta_drq_limit;
865 double xfc_prefetch_margin;
866 double refcyc_per_req_delivery_pre_cur0;
867 double refcyc_per_req_delivery_cur0;
868 double refcyc_per_req_delivery_pre_cur1;
869 double refcyc_per_req_delivery_cur1;
871 memset(disp_dlg_regs, 0, sizeof(*disp_dlg_regs));
872 memset(disp_ttu_regs, 0, sizeof(*disp_ttu_regs));
874 dml_print("DML_DLG: %s: cstate_en = %d\n", __func__, cstate_en);
875 dml_print("DML_DLG: %s: pstate_en = %d\n", __func__, pstate_en);
876 dml_print("DML_DLG: %s: vm_en = %d\n", __func__, vm_en);
877 dml_print("DML_DLG: %s: ignore_viewport_pos = %d\n", __func__, ignore_viewport_pos);
878 dml_print("DML_DLG: %s: immediate_flip_support = %d\n", __func__, immediate_flip_support);
880 dml_print("DML_DLG: %s: dppclk_freq_in_mhz = %3.2f\n", __func__, dppclk_freq_in_mhz);
881 dml_print("DML_DLG: %s: dispclk_freq_in_mhz = %3.2f\n", __func__, dispclk_freq_in_mhz);
882 dml_print("DML_DLG: %s: refclk_freq_in_mhz = %3.2f\n", __func__, refclk_freq_in_mhz);
883 dml_print("DML_DLG: %s: pclk_freq_in_mhz = %3.2f\n", __func__, pclk_freq_in_mhz);
884 dml_print("DML_DLG: %s: interlaced = %d\n", __func__, interlaced);
885 ASSERT(ref_freq_to_pix_freq < 4.0);
887 disp_dlg_regs->ref_freq_to_pix_freq =
888 (unsigned int) (ref_freq_to_pix_freq * dml_pow(2, 19));
889 disp_dlg_regs->refcyc_per_htotal = (unsigned int) (ref_freq_to_pix_freq * (double) htotal
891 disp_dlg_regs->dlg_vblank_end = interlaced ? (vblank_end / 2) : vblank_end; // 15 bits
892 disp_dlg_regs->refcyc_h_blank_end = (unsigned int) ((double) hblank_end
893 * (double) ref_freq_to_pix_freq);
894 ASSERT(disp_dlg_regs->refcyc_h_blank_end < (unsigned int) dml_pow(2, 13));
896 min_dcfclk_mhz = dlg_sys_param.deepsleep_dcfclk_mhz;
897 set_prefetch_mode(mode_lib, cstate_en, pstate_en, ignore_viewport_pos, immediate_flip_support);
898 t_calc_us = get_tcalc(mode_lib, e2e_pipe_param, num_pipes);
899 min_ttu_vblank = get_min_ttu_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
901 min_dst_y_ttu_vblank = min_ttu_vblank * pclk_freq_in_mhz / (double) htotal;
902 dlg_vblank_start = interlaced ? (vblank_start / 2) : vblank_start;
904 disp_dlg_regs->min_dst_y_next_start = (unsigned int) (((double) dlg_vblank_start
905 + min_dst_y_ttu_vblank) * dml_pow(2, 2));
906 ASSERT(disp_dlg_regs->min_dst_y_next_start < (unsigned int) dml_pow(2, 18));
908 dml_print("DML_DLG: %s: min_dcfclk_mhz = %3.2f\n",
911 dml_print("DML_DLG: %s: min_ttu_vblank = %3.2f\n",
914 dml_print("DML_DLG: %s: min_dst_y_ttu_vblank = %3.2f\n",
916 min_dst_y_ttu_vblank);
917 dml_print("DML_DLG: %s: t_calc_us = %3.2f\n",
920 dml_print("DML_DLG: %s: disp_dlg_regs->min_dst_y_next_start = 0x%0x\n",
922 disp_dlg_regs->min_dst_y_next_start);
923 dml_print("DML_DLG: %s: ref_freq_to_pix_freq = %3.2f\n",
925 ref_freq_to_pix_freq);
927 // -------------------------
928 // Section 1.15.2.2: Prefetch, Active and TTU
929 // -------------------------
933 dual_plane = is_dual_plane((enum source_format_class)(src->source_format));
934 mode_422 = 0; // FIXME
935 access_dir = (src->source_scan == dm_vert); // vp access direction: horizontal or vertical accessed
936 // bytes_per_element_l = get_bytes_per_element(source_format_class(src.source_format), 0);
937 // bytes_per_element_c = get_bytes_per_element(source_format_class(src.source_format), 1);
938 vp_height_l = src->viewport_height;
939 vp_width_l = src->viewport_width;
940 vp_height_c = src->viewport_height_c;
941 vp_width_c = src->viewport_width_c;
944 htaps_l = taps->htaps;
945 htaps_c = taps->htaps_c;
946 hratio_l = scl->hscl_ratio;
947 hratio_c = scl->hscl_ratio_c;
948 vratio_l = scl->vscl_ratio;
949 vratio_c = scl->vscl_ratio_c;
950 scl_enable = scl->scl_enable;
952 line_time_in_us = (htotal / pclk_freq_in_mhz);
953 // vinit_l = scl.vinit;
954 // vinit_c = scl.vinit_c;
955 // vinit_bot_l = scl.vinit_bot;
956 // vinit_bot_c = scl.vinit_bot_c;
958 // unsigned int swath_height_l = rq_dlg_param.rq_l.swath_height;
959 swath_width_ub_l = rq_dlg_param.rq_l.swath_width_ub;
960 // unsigned int dpte_bytes_per_row_ub_l = rq_dlg_param.rq_l.dpte_bytes_per_row_ub;
961 dpte_groups_per_row_ub_l = rq_dlg_param.rq_l.dpte_groups_per_row_ub;
962 // unsigned int meta_pte_bytes_per_frame_ub_l = rq_dlg_param.rq_l.meta_pte_bytes_per_frame_ub;
963 // unsigned int meta_bytes_per_row_ub_l = rq_dlg_param.rq_l.meta_bytes_per_row_ub;
965 // unsigned int swath_height_c = rq_dlg_param.rq_c.swath_height;
966 swath_width_ub_c = rq_dlg_param.rq_c.swath_width_ub;
967 // dpte_bytes_per_row_ub_c = rq_dlg_param.rq_c.dpte_bytes_per_row_ub;
968 dpte_groups_per_row_ub_c = rq_dlg_param.rq_c.dpte_groups_per_row_ub;
970 meta_chunks_per_row_ub_l = rq_dlg_param.rq_l.meta_chunks_per_row_ub;
971 meta_chunks_per_row_ub_c = rq_dlg_param.rq_c.meta_chunks_per_row_ub;
972 vupdate_offset = dst->vupdate_offset;
973 vupdate_width = dst->vupdate_width;
974 vready_offset = dst->vready_offset;
976 dppclk_delay_subtotal = mode_lib->ip.dppclk_delay_subtotal;
977 dispclk_delay_subtotal = mode_lib->ip.dispclk_delay_subtotal;
980 dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_scl;
982 dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_scl_lb_only;
984 dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_cnvc_formatter
985 + src->num_cursors * mode_lib->ip.dppclk_delay_cnvc_cursor;
987 if (dout->dsc_enable) {
988 double dsc_delay = get_dsc_delay(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
990 dispclk_delay_subtotal += dsc_delay;
993 pixel_rate_delay_subtotal = dppclk_delay_subtotal * pclk_freq_in_mhz / dppclk_freq_in_mhz
994 + dispclk_delay_subtotal * pclk_freq_in_mhz / dispclk_freq_in_mhz;
996 vstartup_start = dst->vstartup_start;
998 if (vstartup_start / 2.0
999 - (double) (vready_offset + vupdate_width + vupdate_offset) / htotal
1000 <= vblank_end / 2.0)
1001 disp_dlg_regs->vready_after_vcount0 = 1;
1003 disp_dlg_regs->vready_after_vcount0 = 0;
1006 - (double) (vready_offset + vupdate_width + vupdate_offset) / htotal
1008 disp_dlg_regs->vready_after_vcount0 = 1;
1010 disp_dlg_regs->vready_after_vcount0 = 0;
1013 // TODO: Where is this coming from?
1015 vstartup_start = vstartup_start / 2;
1017 // TODO: What if this min_vblank doesn't match the value in the dml_config_settings.cpp?
1018 if (vstartup_start >= min_vblank) {
1019 dml_print("WARNING: DML_DLG: %s: vblank_start=%d vblank_end=%d\n",
1023 dml_print("WARNING: DML_DLG: %s: vstartup_start=%d should be less than min_vblank=%d\n",
1027 min_vblank = vstartup_start + 1;
1028 dml_print("WARNING: DML_DLG: %s: vstartup_start=%d should be less than min_vblank=%d\n",
1034 dst_x_after_scaler = get_dst_x_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1035 dst_y_after_scaler = get_dst_y_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1037 dml_print("DML_DLG: %s: htotal = %d\n", __func__, htotal);
1038 dml_print("DML_DLG: %s: pixel_rate_delay_subtotal = %d\n",
1040 pixel_rate_delay_subtotal);
1041 dml_print("DML_DLG: %s: dst_x_after_scaler = %d\n",
1043 dst_x_after_scaler);
1044 dml_print("DML_DLG: %s: dst_y_after_scaler = %d\n",
1046 dst_y_after_scaler);
1049 line_wait = mode_lib->soc.urgent_latency_us;
1051 line_wait = dml_max(mode_lib->soc.sr_enter_plus_exit_time_us, line_wait);
1053 line_wait = dml_max(mode_lib->soc.dram_clock_change_latency_us
1054 + mode_lib->soc.urgent_latency_us,
1056 line_wait = line_wait / line_time_in_us;
1058 dst_y_prefetch = get_dst_y_prefetch(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1059 dml_print("DML_DLG: %s: dst_y_prefetch (after rnd) = %3.2f\n", __func__, dst_y_prefetch);
1061 dst_y_per_vm_vblank = get_dst_y_per_vm_vblank(mode_lib,
1065 dst_y_per_row_vblank = get_dst_y_per_row_vblank(mode_lib,
1069 dst_y_per_vm_flip = get_dst_y_per_vm_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1070 dst_y_per_row_flip = get_dst_y_per_row_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1072 min_dst_y_per_vm_vblank = 8.0;
1073 min_dst_y_per_row_vblank = 16.0;
1078 min_dst_y_per_vm_vblank = 100.0;
1079 min_dst_y_per_row_vblank = 100.0;
1082 dml_print("DML_DLG: %s: dst_y_per_vm_vblank = %3.2f\n", __func__, dst_y_per_vm_vblank);
1083 dml_print("DML_DLG: %s: dst_y_per_row_vblank = %3.2f\n", __func__, dst_y_per_row_vblank);
1085 ASSERT(dst_y_per_vm_vblank < min_dst_y_per_vm_vblank);
1086 ASSERT(dst_y_per_row_vblank < min_dst_y_per_row_vblank);
1088 ASSERT(dst_y_prefetch > (dst_y_per_vm_vblank + dst_y_per_row_vblank));
1089 lsw = dst_y_prefetch - (dst_y_per_vm_vblank + dst_y_per_row_vblank);
1091 dml_print("DML_DLG: %s: lsw = %3.2f\n", __func__, lsw);
1093 vratio_pre_l = get_vratio_prefetch_l(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1094 vratio_pre_c = get_vratio_prefetch_c(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1096 dml_print("DML_DLG: %s: vratio_pre_l=%3.2f\n", __func__, vratio_pre_l);
1097 dml_print("DML_DLG: %s: vratio_pre_c=%3.2f\n", __func__, vratio_pre_c);
1100 req_per_swath_ub_l = rq_dlg_param.rq_l.req_per_swath_ub;
1101 req_per_swath_ub_c = rq_dlg_param.rq_c.req_per_swath_ub;
1102 meta_row_height_l = rq_dlg_param.rq_l.meta_row_height;
1103 meta_row_height_c = rq_dlg_param.rq_c.meta_row_height;
1104 swath_width_pixels_ub_l = 0;
1105 swath_width_pixels_ub_c = 0;
1106 scaler_rec_in_width_l = 0;
1107 scaler_rec_in_width_c = 0;
1108 dpte_row_height_l = rq_dlg_param.rq_l.dpte_row_height;
1109 dpte_row_height_c = rq_dlg_param.rq_c.dpte_row_height;
1112 swath_width_pixels_ub_l = swath_width_ub_l * 2; // *2 for 2 pixel per element
1113 swath_width_pixels_ub_c = swath_width_ub_c * 2;
1115 swath_width_pixels_ub_l = swath_width_ub_l * 1;
1116 swath_width_pixels_ub_c = swath_width_ub_c * 1;
1119 hscale_pixel_rate_l = 0.;
1120 hscale_pixel_rate_c = 0.;
1121 min_hratio_fact_l = 1.0;
1122 min_hratio_fact_c = 1.0;
1125 min_hratio_fact_l = 2.0;
1126 else if (htaps_l <= 6) {
1127 if ((hratio_l * 2.0) > 4.0)
1128 min_hratio_fact_l = 4.0;
1130 min_hratio_fact_l = hratio_l * 2.0;
1133 min_hratio_fact_l = 4.0;
1135 min_hratio_fact_l = hratio_l;
1138 hscale_pixel_rate_l = min_hratio_fact_l * dppclk_freq_in_mhz;
1141 min_hratio_fact_c = 2.0;
1142 else if (htaps_c <= 6) {
1143 if ((hratio_c * 2.0) > 4.0)
1144 min_hratio_fact_c = 4.0;
1146 min_hratio_fact_c = hratio_c * 2.0;
1149 min_hratio_fact_c = 4.0;
1151 min_hratio_fact_c = hratio_c;
1154 hscale_pixel_rate_c = min_hratio_fact_c * dppclk_freq_in_mhz;
1156 refcyc_per_line_delivery_pre_l = 0.;
1157 refcyc_per_line_delivery_pre_c = 0.;
1158 refcyc_per_line_delivery_l = 0.;
1159 refcyc_per_line_delivery_c = 0.;
1161 refcyc_per_req_delivery_pre_l = 0.;
1162 refcyc_per_req_delivery_pre_c = 0.;
1163 refcyc_per_req_delivery_l = 0.;
1164 refcyc_per_req_delivery_c = 0.;
1166 full_recout_width = 0;
1168 if (src->is_hsplit) {
1169 // This "hack" is only allowed (and valid) for MPC combine. In ODM
1170 // combine, you MUST specify the full_recout_width...according to Oswin
1171 if (dst->full_recout_width == 0 && !dst->odm_combine) {
1172 dml_print("DML_DLG: %s: Warning: full_recout_width not set in hsplit mode\n",
1174 full_recout_width = dst->recout_width * 2; // assume half split for dcn1
1176 full_recout_width = dst->full_recout_width;
1178 full_recout_width = dst->recout_width;
1180 // mpc_combine and odm_combine are mutually exclusive
1181 refcyc_per_line_delivery_pre_l = get_refcyc_per_delivery(mode_lib,
1188 hscale_pixel_rate_l,
1189 swath_width_pixels_ub_l,
1192 refcyc_per_line_delivery_l = get_refcyc_per_delivery(mode_lib,
1199 hscale_pixel_rate_l,
1200 swath_width_pixels_ub_l,
1203 dml_print("DML_DLG: %s: full_recout_width = %d\n",
1206 dml_print("DML_DLG: %s: hscale_pixel_rate_l = %3.2f\n",
1208 hscale_pixel_rate_l);
1209 dml_print("DML_DLG: %s: refcyc_per_line_delivery_pre_l = %3.2f\n",
1211 refcyc_per_line_delivery_pre_l);
1212 dml_print("DML_DLG: %s: refcyc_per_line_delivery_l = %3.2f\n",
1214 refcyc_per_line_delivery_l);
1217 refcyc_per_line_delivery_pre_c = get_refcyc_per_delivery(mode_lib,
1224 hscale_pixel_rate_c,
1225 swath_width_pixels_ub_c,
1228 refcyc_per_line_delivery_c = get_refcyc_per_delivery(mode_lib,
1235 hscale_pixel_rate_c,
1236 swath_width_pixels_ub_c,
1239 dml_print("DML_DLG: %s: refcyc_per_line_delivery_pre_c = %3.2f\n",
1241 refcyc_per_line_delivery_pre_c);
1242 dml_print("DML_DLG: %s: refcyc_per_line_delivery_c = %3.2f\n",
1244 refcyc_per_line_delivery_c);
1247 // TTU - Luma / Chroma
1248 if (access_dir) { // vertical access
1249 scaler_rec_in_width_l = vp_height_l;
1250 scaler_rec_in_width_c = vp_height_c;
1252 scaler_rec_in_width_l = vp_width_l;
1253 scaler_rec_in_width_c = vp_width_c;
1256 refcyc_per_req_delivery_pre_l = get_refcyc_per_delivery(mode_lib,
1263 hscale_pixel_rate_l,
1264 scaler_rec_in_width_l,
1265 req_per_swath_ub_l); // per req
1266 refcyc_per_req_delivery_l = get_refcyc_per_delivery(mode_lib,
1273 hscale_pixel_rate_l,
1274 scaler_rec_in_width_l,
1275 req_per_swath_ub_l); // per req
1277 dml_print("DML_DLG: %s: refcyc_per_req_delivery_pre_l = %3.2f\n",
1279 refcyc_per_req_delivery_pre_l);
1280 dml_print("DML_DLG: %s: refcyc_per_req_delivery_l = %3.2f\n",
1282 refcyc_per_req_delivery_l);
1284 ASSERT(refcyc_per_req_delivery_pre_l < dml_pow(2, 13));
1285 ASSERT(refcyc_per_req_delivery_l < dml_pow(2, 13));
1288 refcyc_per_req_delivery_pre_c = get_refcyc_per_delivery(mode_lib,
1295 hscale_pixel_rate_c,
1296 scaler_rec_in_width_c,
1297 req_per_swath_ub_c); // per req
1298 refcyc_per_req_delivery_c = get_refcyc_per_delivery(mode_lib,
1305 hscale_pixel_rate_c,
1306 scaler_rec_in_width_c,
1307 req_per_swath_ub_c); // per req
1309 dml_print("DML_DLG: %s: refcyc_per_req_delivery_pre_c = %3.2f\n",
1311 refcyc_per_req_delivery_pre_c);
1312 dml_print("DML_DLG: %s: refcyc_per_req_delivery_c = %3.2f\n",
1314 refcyc_per_req_delivery_c);
1316 ASSERT(refcyc_per_req_delivery_pre_c < dml_pow(2, 13));
1317 ASSERT(refcyc_per_req_delivery_c < dml_pow(2, 13));
1321 xfc_transfer_delay = get_xfc_transfer_delay(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
1322 xfc_precharge_delay = get_xfc_precharge_delay(mode_lib,
1326 xfc_remote_surface_flip_latency = get_xfc_remote_surface_flip_latency(mode_lib,
1330 xfc_dst_y_delta_drq_limit = xfc_remote_surface_flip_latency;
1331 xfc_prefetch_margin = get_xfc_prefetch_margin(mode_lib,
1337 refcyc_per_req_delivery_pre_cur0 = 0.0;
1338 refcyc_per_req_delivery_cur0 = 0.0;
1339 if (src->num_cursors > 0) {
1340 calculate_ttu_cursor(mode_lib,
1341 &refcyc_per_req_delivery_pre_cur0,
1342 &refcyc_per_req_delivery_cur0,
1344 ref_freq_to_pix_freq,
1345 hscale_pixel_rate_l,
1349 src->cur0_src_width,
1350 (enum cursor_bpp)(src->cur0_bpp));
1353 refcyc_per_req_delivery_pre_cur1 = 0.0;
1354 refcyc_per_req_delivery_cur1 = 0.0;
1355 if (src->num_cursors > 1) {
1356 calculate_ttu_cursor(mode_lib,
1357 &refcyc_per_req_delivery_pre_cur1,
1358 &refcyc_per_req_delivery_cur1,
1360 ref_freq_to_pix_freq,
1361 hscale_pixel_rate_l,
1365 src->cur1_src_width,
1366 (enum cursor_bpp)(src->cur1_bpp));
1372 // Assignment to register structures
1373 disp_dlg_regs->dst_y_after_scaler = dst_y_after_scaler; // in terms of line
1374 disp_dlg_regs->refcyc_x_after_scaler = dst_x_after_scaler * ref_freq_to_pix_freq; // in terms of refclk
1375 ASSERT(disp_dlg_regs->refcyc_x_after_scaler < (unsigned int) dml_pow(2, 13));
1376 disp_dlg_regs->dst_y_prefetch = (unsigned int) (dst_y_prefetch * dml_pow(2, 2));
1377 disp_dlg_regs->dst_y_per_vm_vblank = (unsigned int) (dst_y_per_vm_vblank * dml_pow(2, 2));
1378 disp_dlg_regs->dst_y_per_row_vblank = (unsigned int) (dst_y_per_row_vblank * dml_pow(2, 2));
1379 disp_dlg_regs->dst_y_per_vm_flip = (unsigned int) (dst_y_per_vm_flip * dml_pow(2, 2));
1380 disp_dlg_regs->dst_y_per_row_flip = (unsigned int) (dst_y_per_row_flip * dml_pow(2, 2));
1382 disp_dlg_regs->vratio_prefetch = (unsigned int) (vratio_pre_l * dml_pow(2, 19));
1383 disp_dlg_regs->vratio_prefetch_c = (unsigned int) (vratio_pre_c * dml_pow(2, 19));
1385 disp_dlg_regs->refcyc_per_pte_group_vblank_l =
1386 (unsigned int) (dst_y_per_row_vblank * (double) htotal
1387 * ref_freq_to_pix_freq / (double) dpte_groups_per_row_ub_l);
1388 ASSERT(disp_dlg_regs->refcyc_per_pte_group_vblank_l < (unsigned int) dml_pow(2, 13));
1391 disp_dlg_regs->refcyc_per_pte_group_vblank_c = (unsigned int) (dst_y_per_row_vblank
1392 * (double) htotal * ref_freq_to_pix_freq
1393 / (double) dpte_groups_per_row_ub_c);
1394 ASSERT(disp_dlg_regs->refcyc_per_pte_group_vblank_c
1395 < (unsigned int) dml_pow(2, 13));
1398 disp_dlg_regs->refcyc_per_meta_chunk_vblank_l =
1399 (unsigned int) (dst_y_per_row_vblank * (double) htotal
1400 * ref_freq_to_pix_freq / (double) meta_chunks_per_row_ub_l);
1401 ASSERT(disp_dlg_regs->refcyc_per_meta_chunk_vblank_l < (unsigned int) dml_pow(2, 13));
1403 disp_dlg_regs->refcyc_per_meta_chunk_vblank_c =
1404 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
1406 disp_dlg_regs->refcyc_per_pte_group_flip_l = (unsigned int) (dst_y_per_row_flip * htotal
1407 * ref_freq_to_pix_freq) / dpte_groups_per_row_ub_l;
1408 disp_dlg_regs->refcyc_per_meta_chunk_flip_l = (unsigned int) (dst_y_per_row_flip * htotal
1409 * ref_freq_to_pix_freq) / meta_chunks_per_row_ub_l;
1412 disp_dlg_regs->refcyc_per_pte_group_flip_c = (unsigned int) (dst_y_per_row_flip
1413 * htotal * ref_freq_to_pix_freq) / dpte_groups_per_row_ub_c;
1414 disp_dlg_regs->refcyc_per_meta_chunk_flip_c = (unsigned int) (dst_y_per_row_flip
1415 * htotal * ref_freq_to_pix_freq) / meta_chunks_per_row_ub_c;
1418 disp_dlg_regs->dst_y_per_pte_row_nom_l = (unsigned int) ((double) dpte_row_height_l
1419 / (double) vratio_l * dml_pow(2, 2));
1420 ASSERT(disp_dlg_regs->dst_y_per_pte_row_nom_l < (unsigned int) dml_pow(2, 17));
1423 disp_dlg_regs->dst_y_per_pte_row_nom_c = (unsigned int) ((double) dpte_row_height_c
1424 / (double) vratio_c * dml_pow(2, 2));
1425 if (disp_dlg_regs->dst_y_per_pte_row_nom_c >= (unsigned int) dml_pow(2, 17)) {
1426 dml_print("DML_DLG: %s: Warning dst_y_per_pte_row_nom_c %u larger than supported by register format U15.2 %u\n",
1428 disp_dlg_regs->dst_y_per_pte_row_nom_c,
1429 (unsigned int) dml_pow(2, 17) - 1);
1433 disp_dlg_regs->dst_y_per_meta_row_nom_l = (unsigned int) ((double) meta_row_height_l
1434 / (double) vratio_l * dml_pow(2, 2));
1435 ASSERT(disp_dlg_regs->dst_y_per_meta_row_nom_l < (unsigned int) dml_pow(2, 17));
1437 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
1439 disp_dlg_regs->refcyc_per_pte_group_nom_l = (unsigned int) ((double) dpte_row_height_l
1440 / (double) vratio_l * (double) htotal * ref_freq_to_pix_freq
1441 / (double) dpte_groups_per_row_ub_l);
1442 if (disp_dlg_regs->refcyc_per_pte_group_nom_l >= (unsigned int) dml_pow(2, 23))
1443 disp_dlg_regs->refcyc_per_pte_group_nom_l = dml_pow(2, 23) - 1;
1444 disp_dlg_regs->refcyc_per_meta_chunk_nom_l = (unsigned int) ((double) meta_row_height_l
1445 / (double) vratio_l * (double) htotal * ref_freq_to_pix_freq
1446 / (double) meta_chunks_per_row_ub_l);
1447 if (disp_dlg_regs->refcyc_per_meta_chunk_nom_l >= (unsigned int) dml_pow(2, 23))
1448 disp_dlg_regs->refcyc_per_meta_chunk_nom_l = dml_pow(2, 23) - 1;
1451 disp_dlg_regs->refcyc_per_pte_group_nom_c =
1452 (unsigned int) ((double) dpte_row_height_c / (double) vratio_c
1453 * (double) htotal * ref_freq_to_pix_freq
1454 / (double) dpte_groups_per_row_ub_c);
1455 if (disp_dlg_regs->refcyc_per_pte_group_nom_c >= (unsigned int) dml_pow(2, 23))
1456 disp_dlg_regs->refcyc_per_pte_group_nom_c = dml_pow(2, 23) - 1;
1458 // TODO: Is this the right calculation? Does htotal need to be halved?
1459 disp_dlg_regs->refcyc_per_meta_chunk_nom_c =
1460 (unsigned int) ((double) meta_row_height_c / (double) vratio_c
1461 * (double) htotal * ref_freq_to_pix_freq
1462 / (double) meta_chunks_per_row_ub_c);
1463 if (disp_dlg_regs->refcyc_per_meta_chunk_nom_c >= (unsigned int) dml_pow(2, 23))
1464 disp_dlg_regs->refcyc_per_meta_chunk_nom_c = dml_pow(2, 23) - 1;
1467 disp_dlg_regs->refcyc_per_line_delivery_pre_l = (unsigned int) dml_floor(refcyc_per_line_delivery_pre_l,
1469 disp_dlg_regs->refcyc_per_line_delivery_l = (unsigned int) dml_floor(refcyc_per_line_delivery_l,
1471 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_pre_l < (unsigned int) dml_pow(2, 13));
1472 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_l < (unsigned int) dml_pow(2, 13));
1474 disp_dlg_regs->refcyc_per_line_delivery_pre_c = (unsigned int) dml_floor(refcyc_per_line_delivery_pre_c,
1476 disp_dlg_regs->refcyc_per_line_delivery_c = (unsigned int) dml_floor(refcyc_per_line_delivery_c,
1478 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_pre_c < (unsigned int) dml_pow(2, 13));
1479 ASSERT(disp_dlg_regs->refcyc_per_line_delivery_c < (unsigned int) dml_pow(2, 13));
1481 disp_dlg_regs->chunk_hdl_adjust_cur0 = 3;
1482 disp_dlg_regs->dst_y_offset_cur0 = 0;
1483 disp_dlg_regs->chunk_hdl_adjust_cur1 = 3;
1484 disp_dlg_regs->dst_y_offset_cur1 = 0;
1486 disp_dlg_regs->xfc_reg_transfer_delay = xfc_transfer_delay;
1487 disp_dlg_regs->xfc_reg_precharge_delay = xfc_precharge_delay;
1488 disp_dlg_regs->xfc_reg_remote_surface_flip_latency = xfc_remote_surface_flip_latency;
1489 disp_dlg_regs->xfc_reg_prefetch_margin = dml_ceil(xfc_prefetch_margin * refclk_freq_in_mhz,
1492 // slave has to have this value also set to off
1493 if (src->xfc_enable && !src->xfc_slave)
1494 disp_dlg_regs->dst_y_delta_drq_limit = dml_ceil(xfc_dst_y_delta_drq_limit, 1);
1496 disp_dlg_regs->dst_y_delta_drq_limit = 0x7fff; // off
1498 disp_ttu_regs->refcyc_per_req_delivery_pre_l = (unsigned int) (refcyc_per_req_delivery_pre_l
1500 disp_ttu_regs->refcyc_per_req_delivery_l = (unsigned int) (refcyc_per_req_delivery_l
1502 disp_ttu_regs->refcyc_per_req_delivery_pre_c = (unsigned int) (refcyc_per_req_delivery_pre_c
1504 disp_ttu_regs->refcyc_per_req_delivery_c = (unsigned int) (refcyc_per_req_delivery_c
1506 disp_ttu_regs->refcyc_per_req_delivery_pre_cur0 =
1507 (unsigned int) (refcyc_per_req_delivery_pre_cur0 * dml_pow(2, 10));
1508 disp_ttu_regs->refcyc_per_req_delivery_cur0 = (unsigned int) (refcyc_per_req_delivery_cur0
1510 disp_ttu_regs->refcyc_per_req_delivery_pre_cur1 =
1511 (unsigned int) (refcyc_per_req_delivery_pre_cur1 * dml_pow(2, 10));
1512 disp_ttu_regs->refcyc_per_req_delivery_cur1 = (unsigned int) (refcyc_per_req_delivery_cur1
1514 disp_ttu_regs->qos_level_low_wm = 0;
1515 ASSERT(disp_ttu_regs->qos_level_low_wm < dml_pow(2, 14));
1516 disp_ttu_regs->qos_level_high_wm = (unsigned int) (4.0 * (double) htotal
1517 * ref_freq_to_pix_freq);
1518 ASSERT(disp_ttu_regs->qos_level_high_wm < dml_pow(2, 14));
1520 disp_ttu_regs->qos_level_flip = 14;
1521 disp_ttu_regs->qos_level_fixed_l = 8;
1522 disp_ttu_regs->qos_level_fixed_c = 8;
1523 disp_ttu_regs->qos_level_fixed_cur0 = 8;
1524 disp_ttu_regs->qos_ramp_disable_l = 0;
1525 disp_ttu_regs->qos_ramp_disable_c = 0;
1526 disp_ttu_regs->qos_ramp_disable_cur0 = 0;
1528 disp_ttu_regs->min_ttu_vblank = min_ttu_vblank * refclk_freq_in_mhz;
1529 ASSERT(disp_ttu_regs->min_ttu_vblank < dml_pow(2, 24));
1531 print__ttu_regs_st(mode_lib, *disp_ttu_regs);
1532 print__dlg_regs_st(mode_lib, *disp_dlg_regs);
1535 void dml_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib,
1536 display_dlg_regs_st *dlg_regs,
1537 display_ttu_regs_st *ttu_regs,
1538 display_e2e_pipe_params_st *e2e_pipe_param,
1539 const unsigned int num_pipes,
1540 const unsigned int pipe_idx,
1541 const bool cstate_en,
1542 const bool pstate_en,
1544 const bool ignore_viewport_pos,
1545 const bool immediate_flip_support)
1547 display_rq_params_st rq_param = {0};
1548 display_dlg_sys_params_st dlg_sys_param = {0};
1550 // Get watermark and Tex.
1551 dlg_sys_param.t_urg_wm_us = get_wm_urgent(mode_lib, e2e_pipe_param, num_pipes);
1552 dlg_sys_param.deepsleep_dcfclk_mhz = get_clk_dcf_deepsleep(mode_lib,
1555 dlg_sys_param.t_extra_us = get_urgent_extra_latency(mode_lib, e2e_pipe_param, num_pipes);
1556 dlg_sys_param.mem_trip_us = get_wm_memory_trip(mode_lib, e2e_pipe_param, num_pipes);
1557 dlg_sys_param.t_mclk_wm_us = get_wm_dram_clock_change(mode_lib, e2e_pipe_param, num_pipes);
1558 dlg_sys_param.t_sr_wm_us = get_wm_stutter_enter_exit(mode_lib, e2e_pipe_param, num_pipes);
1559 dlg_sys_param.total_flip_bw = get_total_immediate_flip_bw(mode_lib,
1562 dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib,
1565 dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency
1566 / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated
1568 print__dlg_sys_params_st(mode_lib, dlg_sys_param);
1570 // system parameter calculation done
1572 dml_print("DML_DLG: Calculation for pipe[%d] start\n\n", pipe_idx);
1573 dml_rq_dlg_get_rq_params(mode_lib, &rq_param, e2e_pipe_param[pipe_idx].pipe.src);
1574 dml_rq_dlg_get_dlg_params(mode_lib,
1585 ignore_viewport_pos,
1586 immediate_flip_support);
1587 dml_print("DML_DLG: Calculation for pipe[%d] end\n", pipe_idx);
1590 void dml_rq_dlg_get_arb_params(struct display_mode_lib *mode_lib, display_arb_params_st *arb_param)
1592 memset(arb_param, 0, sizeof(*arb_param));
1593 arb_param->max_req_outstanding = 256;
1594 arb_param->min_req_outstanding = 68;
1595 arb_param->sat_level_us = 60;
1598 void calculate_ttu_cursor(struct display_mode_lib *mode_lib,
1599 double *refcyc_per_req_delivery_pre_cur,
1600 double *refcyc_per_req_delivery_cur,
1601 double refclk_freq_in_mhz,
1602 double ref_freq_to_pix_freq,
1603 double hscale_pixel_rate_l,
1605 double vratio_pre_l,
1607 unsigned int cur_width,
1608 enum cursor_bpp cur_bpp)
1610 unsigned int cur_src_width = cur_width;
1611 unsigned int cur_req_size = 0;
1612 unsigned int cur_req_width = 0;
1613 double cur_width_ub = 0.0;
1614 double cur_req_per_width = 0.0;
1615 double hactive_cur = 0.0;
1617 ASSERT(cur_src_width <= 256);
1619 *refcyc_per_req_delivery_pre_cur = 0.0;
1620 *refcyc_per_req_delivery_cur = 0.0;
1621 if (cur_src_width > 0) {
1622 unsigned int cur_bit_per_pixel = 0;
1624 if (cur_bpp == dm_cur_2bit) {
1625 cur_req_size = 64; // byte
1626 cur_bit_per_pixel = 2;
1628 cur_bit_per_pixel = 32;
1629 if (cur_src_width >= 1 && cur_src_width <= 16)
1631 else if (cur_src_width >= 17 && cur_src_width <= 31)
1637 cur_req_width = (double) cur_req_size / ((double) cur_bit_per_pixel / 8.0);
1638 cur_width_ub = dml_ceil((double) cur_src_width / (double) cur_req_width, 1)
1639 * (double) cur_req_width;
1640 cur_req_per_width = cur_width_ub / (double) cur_req_width;
1641 hactive_cur = (double) cur_src_width / hscl_ratio; // FIXME: oswin to think about what to do for cursor
1643 if (vratio_pre_l <= 1.0) {
1644 *refcyc_per_req_delivery_pre_cur = hactive_cur * ref_freq_to_pix_freq
1645 / (double) cur_req_per_width;
1647 *refcyc_per_req_delivery_pre_cur = (double) refclk_freq_in_mhz
1648 * (double) cur_src_width / hscale_pixel_rate_l
1649 / (double) cur_req_per_width;
1652 ASSERT(*refcyc_per_req_delivery_pre_cur < dml_pow(2, 13));
1654 if (vratio_l <= 1.0) {
1655 *refcyc_per_req_delivery_cur = hactive_cur * ref_freq_to_pix_freq
1656 / (double) cur_req_per_width;
1658 *refcyc_per_req_delivery_cur = (double) refclk_freq_in_mhz
1659 * (double) cur_src_width / hscale_pixel_rate_l
1660 / (double) cur_req_per_width;
1663 dml_print("DML_DLG: %s: cur_req_width = %d\n",
1666 dml_print("DML_DLG: %s: cur_width_ub = %3.2f\n",
1669 dml_print("DML_DLG: %s: cur_req_per_width = %3.2f\n",
1672 dml_print("DML_DLG: %s: hactive_cur = %3.2f\n",
1675 dml_print("DML_DLG: %s: refcyc_per_req_delivery_pre_cur = %3.2f\n",
1677 *refcyc_per_req_delivery_pre_cur);
1678 dml_print("DML_DLG: %s: refcyc_per_req_delivery_cur = %3.2f\n",
1680 *refcyc_per_req_delivery_cur);
1682 ASSERT(*refcyc_per_req_delivery_cur < dml_pow(2, 13));
1686 unsigned int dml_rq_dlg_get_calculated_vstartup(struct display_mode_lib *mode_lib,
1687 display_e2e_pipe_params_st *e2e_pipe_param,
1688 const unsigned int num_pipes,
1689 const unsigned int pipe_idx)
1691 unsigned int vstartup_pipe[DC__NUM_PIPES__MAX];
1692 bool visited[DC__NUM_PIPES__MAX];
1693 unsigned int pipe_inst = 0;
1694 unsigned int i, j, k;
1696 for (k = 0; k < num_pipes; ++k)
1699 for (i = 0; i < num_pipes; i++) {
1700 if (e2e_pipe_param[i].pipe.src.is_hsplit && !visited[i]) {
1701 unsigned int grp = e2e_pipe_param[i].pipe.src.hsplit_grp;
1703 for (j = i; j < num_pipes; j++) {
1704 if (e2e_pipe_param[j].pipe.src.hsplit_grp == grp
1705 && e2e_pipe_param[j].pipe.src.is_hsplit
1707 vstartup_pipe[j] = get_vstartup_calculated(mode_lib,
1719 vstartup_pipe[i] = get_vstartup_calculated(mode_lib,
1728 return vstartup_pipe[pipe_idx];
1732 void dml_rq_dlg_get_row_heights(struct display_mode_lib *mode_lib,
1733 unsigned int *o_dpte_row_height,
1734 unsigned int *o_meta_row_height,
1735 unsigned int vp_width,
1736 unsigned int data_pitch,
1739 int macro_tile_size,
1743 display_data_rq_dlg_params_st rq_dlg_param;
1744 display_data_rq_misc_params_st rq_misc_param;
1745 display_data_rq_sizing_params_st rq_sizing_param;
1747 get_meta_and_pte_attr(mode_lib,
1761 *o_dpte_row_height = rq_dlg_param.dpte_row_height;
1762 *o_meta_row_height = rq_dlg_param.meta_row_height;