xref: /linux/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c (revision 15b959534a39530a21d378190557cc8d1eab7b09)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright 2023 Advanced Micro Devices, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * Authors: AMD
24  *
25  */
26 
27 #include "display_mode_core.h"
28 #include "dml2_internal_types.h"
29 #include "dml2_translation_helper.h"
30 
31 #define NUM_DCFCLK_STAS 5
32 #define NUM_DCFCLK_STAS_NEW 8
33 
34 void dml2_init_ip_params(struct dml2_context *dml2, const struct dc *in_dc, struct ip_params_st *out)
35 {
36 	switch (dml2->v20.dml_core_ctx.project) {
37 	case dml_project_dcn32:
38 	case dml_project_dcn321:
39 	default:
40 		// Hardcoded values for DCN32x
41 		out->vblank_nom_default_us = 600;
42 		out->rob_buffer_size_kbytes = 128;
43 		out->config_return_buffer_size_in_kbytes = 1280;
44 		out->config_return_buffer_segment_size_in_kbytes = 64;
45 		out->compressed_buffer_segment_size_in_kbytes = 64;
46 		out->meta_fifo_size_in_kentries = 22;
47 		out->zero_size_buffer_entries = 512;
48 		out->dpte_buffer_size_in_pte_reqs_luma = 68;
49 		out->dpte_buffer_size_in_pte_reqs_chroma = 36;
50 		out->dcc_meta_buffer_size_bytes = 6272;
51 		out->gpuvm_max_page_table_levels = 4;
52 		out->hostvm_max_page_table_levels = 0;
53 		out->pixel_chunk_size_kbytes = 8;
54 		//out->alpha_pixel_chunk_size_kbytes;
55 		out->min_pixel_chunk_size_bytes = 1024;
56 		out->meta_chunk_size_kbytes = 2;
57 		out->min_meta_chunk_size_bytes = 256;
58 		out->writeback_chunk_size_kbytes = 8;
59 		out->line_buffer_size_bits = 1171920;
60 		out->max_line_buffer_lines = 32;
61 		out->writeback_interface_buffer_size_kbytes = 90;
62 		//Number of pipes after DCN Pipe harvesting
63 		out->max_num_dpp = dml2->config.dcn_pipe_count;
64 		out->max_num_otg = dml2->config.dcn_pipe_count;
65 		out->max_num_wb = 1;
66 		out->max_dchub_pscl_bw_pix_per_clk = 4;
67 		out->max_pscl_lb_bw_pix_per_clk = 2;
68 		out->max_lb_vscl_bw_pix_per_clk = 4;
69 		out->max_vscl_hscl_bw_pix_per_clk = 4;
70 		out->max_hscl_ratio = 6;
71 		out->max_vscl_ratio = 6;
72 		out->max_hscl_taps = 8;
73 		out->max_vscl_taps = 8;
74 		out->dispclk_ramp_margin_percent = 1;
75 		out->dppclk_delay_subtotal = 47;
76 		out->dppclk_delay_scl = 50;
77 		out->dppclk_delay_scl_lb_only = 16;
78 		out->dppclk_delay_cnvc_formatter = 28;
79 		out->dppclk_delay_cnvc_cursor = 6;
80 		out->cursor_buffer_size = 16;
81 		out->cursor_chunk_size = 2;
82 		out->dispclk_delay_subtotal = 125;
83 		out->max_inter_dcn_tile_repeaters = 8;
84 		out->writeback_max_hscl_ratio = 1;
85 		out->writeback_max_vscl_ratio = 1;
86 		out->writeback_min_hscl_ratio = 1;
87 		out->writeback_min_vscl_ratio = 1;
88 		out->writeback_max_hscl_taps = 1;
89 		out->writeback_max_vscl_taps = 1;
90 		out->writeback_line_buffer_buffer_size = 0;
91 		out->num_dsc = 4;
92 		out->maximum_dsc_bits_per_component = 12;
93 		out->maximum_pixels_per_line_per_dsc_unit = 6016;
94 		out->dsc422_native_support = true;
95 		out->dcc_supported = true;
96 		out->ptoi_supported = false;
97 
98 		out->gpuvm_enable = false;
99 		out->hostvm_enable = false;
100 		out->cursor_64bpp_support = false;
101 		out->dynamic_metadata_vm_enabled = false;
102 
103 		out->max_num_hdmi_frl_outputs = 1;
104 		out->max_num_dp2p0_outputs = 2;
105 		out->max_num_dp2p0_streams = 4;
106 		break;
107 
108 	case dml_project_dcn35:
109 	case dml_project_dcn351:
110 	case dml_project_dcn36:
111 		out->rob_buffer_size_kbytes = 64;
112 		out->config_return_buffer_size_in_kbytes = 1792;
113 		out->compressed_buffer_segment_size_in_kbytes = 64;
114 		out->meta_fifo_size_in_kentries = 32;
115 		out->zero_size_buffer_entries = 512;
116 		out->pixel_chunk_size_kbytes = 8;
117 		out->alpha_pixel_chunk_size_kbytes = 4;
118 		out->min_pixel_chunk_size_bytes = 1024;
119 		out->meta_chunk_size_kbytes = 2;
120 		out->min_meta_chunk_size_bytes = 256;
121 		out->writeback_chunk_size_kbytes = 8;
122 		out->dpte_buffer_size_in_pte_reqs_luma = 68;
123 		out->dpte_buffer_size_in_pte_reqs_chroma = 36;
124 		out->dcc_meta_buffer_size_bytes = 6272;
125 		out->gpuvm_enable = 1;
126 		out->hostvm_enable = 1;
127 		out->gpuvm_max_page_table_levels = 1;
128 		out->hostvm_max_page_table_levels = 2;
129 		out->num_dsc = 4;
130 		out->maximum_dsc_bits_per_component = 12;
131 		out->maximum_pixels_per_line_per_dsc_unit = 6016;
132 		out->dsc422_native_support = 1;
133 		out->line_buffer_size_bits = 986880;
134 		out->dcc_supported = 1;
135 		out->max_line_buffer_lines = 32;
136 		out->writeback_interface_buffer_size_kbytes = 90;
137 		out->max_num_dpp = 4;
138 		out->max_num_otg = 4;
139 		out->max_num_hdmi_frl_outputs = 1;
140 		out->max_num_dp2p0_outputs = 2;
141 		out->max_num_dp2p0_streams = 4;
142 		out->max_num_wb = 1;
143 
144 		out->max_dchub_pscl_bw_pix_per_clk = 4;
145 		out->max_pscl_lb_bw_pix_per_clk = 2;
146 		out->max_lb_vscl_bw_pix_per_clk = 4;
147 		out->max_vscl_hscl_bw_pix_per_clk = 4;
148 		out->max_hscl_ratio = 6;
149 		out->max_vscl_ratio = 6;
150 		out->max_hscl_taps = 8;
151 		out->max_vscl_taps = 8;
152 		out->dispclk_ramp_margin_percent = 1.11;
153 
154 		out->dppclk_delay_subtotal = 47;
155 		out->dppclk_delay_scl = 50;
156 		out->dppclk_delay_scl_lb_only = 16;
157 		out->dppclk_delay_cnvc_formatter = 28;
158 		out->dppclk_delay_cnvc_cursor = 6;
159 		out->dispclk_delay_subtotal = 125;
160 
161 		out->dynamic_metadata_vm_enabled = false;
162 		out->max_inter_dcn_tile_repeaters = 8;
163 		out->cursor_buffer_size = 16; // kBytes
164 		out->cursor_chunk_size = 2; // kBytes
165 
166 		out->writeback_line_buffer_buffer_size = 0;
167 		out->writeback_max_hscl_ratio = 1;
168 		out->writeback_max_vscl_ratio = 1;
169 		out->writeback_min_hscl_ratio = 1;
170 		out->writeback_min_vscl_ratio = 1;
171 		out->writeback_max_hscl_taps  = 1;
172 		out->writeback_max_vscl_taps  = 1;
173 		out->ptoi_supported	= 0;
174 
175 		out->vblank_nom_default_us = 668; /*not in dml, but in programming guide, hard coded in dml2_translate_ip_params*/
176 		out->config_return_buffer_segment_size_in_kbytes = 64; /*required, but not exist,, hard coded in dml2_translate_ip_params*/
177 		break;
178 
179 	case dml_project_dcn401:
180 		// Hardcoded values for DCN4m
181 		out->vblank_nom_default_us = 668;	//600;
182 		out->rob_buffer_size_kbytes = 192;	//128;
183 		out->config_return_buffer_size_in_kbytes = 1344;	//1280;
184 		out->config_return_buffer_segment_size_in_kbytes = 64;
185 		out->compressed_buffer_segment_size_in_kbytes = 64;
186 		out->meta_fifo_size_in_kentries = 22;
187 		out->dpte_buffer_size_in_pte_reqs_luma = 68;
188 		out->dpte_buffer_size_in_pte_reqs_chroma = 36;
189 		out->gpuvm_max_page_table_levels = 4;
190 		out->pixel_chunk_size_kbytes = 8;
191 		out->alpha_pixel_chunk_size_kbytes = 4;
192 		out->min_pixel_chunk_size_bytes = 1024;
193 		out->writeback_chunk_size_kbytes = 8;
194 		out->line_buffer_size_bits = 1171920;
195 		out->max_line_buffer_lines = 32;
196 		out->writeback_interface_buffer_size_kbytes = 90;
197 		//Number of pipes after DCN Pipe harvesting
198 		out->max_num_dpp = dml2->config.dcn_pipe_count;
199 		out->max_num_otg = dml2->config.dcn_pipe_count;
200 		out->max_num_wb = 1;
201 		out->max_dchub_pscl_bw_pix_per_clk = 4;
202 		out->max_pscl_lb_bw_pix_per_clk = 2;
203 		out->max_lb_vscl_bw_pix_per_clk = 4;
204 		out->max_vscl_hscl_bw_pix_per_clk = 4;
205 		out->max_hscl_ratio = 6;
206 		out->max_vscl_ratio = 6;
207 		out->max_hscl_taps = 8;
208 		out->max_vscl_taps = 8;
209 		out->dispclk_ramp_margin_percent = 1;
210 		out->dppclk_delay_subtotal = 47;
211 		out->dppclk_delay_scl = 50;
212 		out->dppclk_delay_scl_lb_only = 16;
213 		out->dppclk_delay_cnvc_formatter = 28;
214 		out->dppclk_delay_cnvc_cursor = 6;
215 		out->dispclk_delay_subtotal = 125;
216 		out->cursor_buffer_size = 24;	//16
217 		out->cursor_chunk_size = 2;
218 		out->max_inter_dcn_tile_repeaters = 8;
219 		out->writeback_max_hscl_ratio = 1;
220 		out->writeback_max_vscl_ratio = 1;
221 		out->writeback_min_hscl_ratio = 1;
222 		out->writeback_min_vscl_ratio = 1;
223 		out->writeback_max_hscl_taps = 1;
224 		out->writeback_max_vscl_taps = 1;
225 		out->writeback_line_buffer_buffer_size = 0;
226 		out->num_dsc = 4;
227 		out->maximum_dsc_bits_per_component = 12;
228 		out->maximum_pixels_per_line_per_dsc_unit = 5760;
229 		out->dsc422_native_support = true;
230 		out->dcc_supported = true;
231 		out->ptoi_supported = false;
232 
233 		out->gpuvm_enable = false;
234 		out->hostvm_enable = false;
235 		out->cursor_64bpp_support = true;	//false;
236 		out->dynamic_metadata_vm_enabled = false;
237 
238 		out->max_num_hdmi_frl_outputs = 1;
239 		out->max_num_dp2p0_outputs = 4;		//2;
240 		out->max_num_dp2p0_streams = 4;
241 		break;
242 	}
243 }
244 
245 void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, struct soc_bounding_box_st *out)
246 {
247 	out->dprefclk_mhz = dml2->config.bbox_overrides.dprefclk_mhz;
248 	out->xtalclk_mhz = dml2->config.bbox_overrides.xtalclk_mhz;
249 	out->pcierefclk_mhz = 100;
250 	out->refclk_mhz = dml2->config.bbox_overrides.dchub_refclk_mhz;
251 
252 	out->max_outstanding_reqs = 512;
253 	out->pct_ideal_sdp_bw_after_urgent = 100;
254 	out->pct_ideal_fabric_bw_after_urgent = 67;
255 	out->pct_ideal_dram_bw_after_urgent_pixel_only = 20;
256 	out->pct_ideal_dram_bw_after_urgent_pixel_and_vm = 60;
257 	out->pct_ideal_dram_bw_after_urgent_vm_only = 30;
258 	out->pct_ideal_dram_bw_after_urgent_strobe = 67;
259 	out->max_avg_sdp_bw_use_normal_percent = 80;
260 	out->max_avg_fabric_bw_use_normal_percent = 60;
261 	out->max_avg_dram_bw_use_normal_percent = 15;
262 	out->max_avg_dram_bw_use_normal_strobe_percent = 50;
263 
264 	out->urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096;
265 	out->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096;
266 	out->urgent_out_of_order_return_per_channel_vm_only_bytes = 4096;
267 	out->return_bus_width_bytes = 64;
268 	out->dram_channel_width_bytes = 2;
269 	out->fabric_datapath_to_dcn_data_return_bytes = 64;
270 	out->hostvm_min_page_size_kbytes = 0;
271 	out->gpuvm_min_page_size_kbytes = 256;
272 	out->phy_downspread_percent = 0.38;
273 	out->dcn_downspread_percent = 0.5;
274 	out->dispclk_dppclk_vco_speed_mhz = dml2->config.bbox_overrides.disp_pll_vco_speed_mhz;
275 	out->mall_allocated_for_dcn_mbytes = dml2->config.mall_cfg.max_cab_allocation_bytes / 1048576; // 64 or 32 MB;
276 
277 	out->do_urgent_latency_adjustment = true;
278 
279 	switch (dml2->v20.dml_core_ctx.project) {
280 
281 	case dml_project_dcn32:
282 	default:
283 		out->num_chans = 24;
284 		out->round_trip_ping_latency_dcfclk_cycles = 263;
285 		out->smn_latency_us = 2;
286 		break;
287 
288 	case dml_project_dcn321:
289 		out->num_chans = 8;
290 		out->round_trip_ping_latency_dcfclk_cycles = 207;
291 		out->smn_latency_us = 0;
292 		break;
293 
294 	case dml_project_dcn35:
295 	case dml_project_dcn351:
296 	case dml_project_dcn36:
297 		out->num_chans = 4;
298 		out->round_trip_ping_latency_dcfclk_cycles = 106;
299 		out->smn_latency_us = 2;
300 		out->dispclk_dppclk_vco_speed_mhz = 3600;
301 		out->pct_ideal_dram_bw_after_urgent_pixel_only = 65.0;
302 		break;
303 
304 	case dml_project_dcn401:
305 		out->pct_ideal_fabric_bw_after_urgent = 76;			//67;
306 		out->max_avg_sdp_bw_use_normal_percent = 75;		//80;
307 		out->max_avg_fabric_bw_use_normal_percent = 57;		//60;
308 
309 		out->urgent_out_of_order_return_per_channel_pixel_only_bytes = 0;	//4096;
310 		out->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 0;	//4096;
311 		out->urgent_out_of_order_return_per_channel_vm_only_bytes = 0;		//4096;
312 
313 		out->num_chans = 16;
314 		out->round_trip_ping_latency_dcfclk_cycles = 1000;	//263;
315 		out->smn_latency_us = 0;							//2 us
316 		out->mall_allocated_for_dcn_mbytes = dml2->config.mall_cfg.max_cab_allocation_bytes / 1048576; // 64;
317 		break;
318 	}
319 	/* ---Overrides if available--- */
320 	if (dml2->config.bbox_overrides.dram_num_chan)
321 		out->num_chans = dml2->config.bbox_overrides.dram_num_chan;
322 
323 	if (dml2->config.bbox_overrides.dram_chanel_width_bytes)
324 		out->dram_channel_width_bytes = dml2->config.bbox_overrides.dram_chanel_width_bytes;
325 }
326 
327 void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
328 	const struct soc_bounding_box_st *in_bbox, struct soc_states_st *out)
329 {
330 	struct dml2_policy_build_synthetic_soc_states_scratch *s = &dml2->v20.scratch.create_scratch.build_synthetic_socbb_scratch;
331 	struct dml2_policy_build_synthetic_soc_states_params *p = &dml2->v20.scratch.build_synthetic_socbb_params;
332 	unsigned int dcfclk_stas_mhz[NUM_DCFCLK_STAS] = {0};
333 	unsigned int dcfclk_stas_mhz_new[NUM_DCFCLK_STAS_NEW] = {0};
334 	unsigned int dml_project = dml2->v20.dml_core_ctx.project;
335 
336 	unsigned int i = 0;
337 	unsigned int transactions_per_mem_clock = 16; // project specific, depends on used Memory type
338 
339 	if (dml_project == dml_project_dcn351) {
340 		p->dcfclk_stas_mhz = dcfclk_stas_mhz_new;
341 		p->num_dcfclk_stas = NUM_DCFCLK_STAS_NEW;
342 	} else {
343 		p->dcfclk_stas_mhz = dcfclk_stas_mhz;
344 		p->num_dcfclk_stas = NUM_DCFCLK_STAS;
345 	}
346 
347 	p->in_bbox = in_bbox;
348 	p->out_states = out;
349 	p->in_states = &dml2->v20.scratch.create_scratch.in_states;
350 
351 
352 	/* Initial hardcoded values */
353 	switch (dml2->v20.dml_core_ctx.project) {
354 
355 	case dml_project_dcn32:
356 	default:
357 		p->in_states->num_states = 2;
358 		transactions_per_mem_clock = 16;
359 		p->in_states->state_array[0].socclk_mhz = 620.0;
360 		p->in_states->state_array[0].dscclk_mhz = 716.667;
361 		p->in_states->state_array[0].phyclk_mhz = 810;
362 		p->in_states->state_array[0].phyclk_d18_mhz = 667;
363 		p->in_states->state_array[0].phyclk_d32_mhz = 625;
364 		p->in_states->state_array[0].dtbclk_mhz = 1564.0;
365 		p->in_states->state_array[0].fabricclk_mhz = 450.0;
366 		p->in_states->state_array[0].dcfclk_mhz = 300.0;
367 		p->in_states->state_array[0].dispclk_mhz = 2150.0;
368 		p->in_states->state_array[0].dppclk_mhz = 2150.0;
369 		p->in_states->state_array[0].dram_speed_mts = 100 * transactions_per_mem_clock;
370 
371 		p->in_states->state_array[0].urgent_latency_pixel_data_only_us = 4;
372 		p->in_states->state_array[0].urgent_latency_pixel_mixed_with_vm_data_us = 0;
373 		p->in_states->state_array[0].urgent_latency_vm_data_only_us = 0;
374 		p->in_states->state_array[0].writeback_latency_us = 12;
375 		p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_component_us = 1;
376 		p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_reference_mhz = 3000;
377 		p->in_states->state_array[0].sr_exit_z8_time_us = 0;
378 		p->in_states->state_array[0].sr_enter_plus_exit_z8_time_us = 0;
379 		p->in_states->state_array[0].dram_clock_change_latency_us = 400;
380 		p->in_states->state_array[0].use_ideal_dram_bw_strobe = true;
381 		p->in_states->state_array[0].sr_exit_time_us = 42.97;
382 		p->in_states->state_array[0].sr_enter_plus_exit_time_us = 49.94;
383 		p->in_states->state_array[0].fclk_change_latency_us = 20;
384 		p->in_states->state_array[0].usr_retraining_latency_us = 2;
385 
386 		p->in_states->state_array[1].socclk_mhz = 1200.0;
387 		p->in_states->state_array[1].fabricclk_mhz = 2500.0;
388 		p->in_states->state_array[1].dcfclk_mhz = 1564.0;
389 		p->in_states->state_array[1].dram_speed_mts = 1125 * transactions_per_mem_clock;
390 		break;
391 
392 	case dml_project_dcn321:
393 		p->in_states->num_states = 2;
394 		transactions_per_mem_clock = 16;
395 		p->in_states->state_array[0].socclk_mhz = 582.0;
396 		p->in_states->state_array[0].dscclk_mhz = 573.333;
397 		p->in_states->state_array[0].phyclk_mhz = 810;
398 		p->in_states->state_array[0].phyclk_d18_mhz = 667;
399 		p->in_states->state_array[0].phyclk_d32_mhz = 313;
400 		p->in_states->state_array[0].dtbclk_mhz = 1564.0;
401 		p->in_states->state_array[0].fabricclk_mhz = 450.0;
402 		p->in_states->state_array[0].dcfclk_mhz = 300.0;
403 		p->in_states->state_array[0].dispclk_mhz = 1720.0;
404 		p->in_states->state_array[0].dppclk_mhz = 1720.0;
405 		p->in_states->state_array[0].dram_speed_mts = 100 * transactions_per_mem_clock;
406 
407 		p->in_states->state_array[0].urgent_latency_pixel_data_only_us = 4;
408 		p->in_states->state_array[0].urgent_latency_pixel_mixed_with_vm_data_us = 0;
409 		p->in_states->state_array[0].urgent_latency_vm_data_only_us = 0;
410 		p->in_states->state_array[0].writeback_latency_us = 12;
411 		p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_component_us = 1;
412 		p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_reference_mhz = 3000;
413 		p->in_states->state_array[0].sr_exit_z8_time_us = 0;
414 		p->in_states->state_array[0].sr_enter_plus_exit_z8_time_us = 0;
415 		p->in_states->state_array[0].dram_clock_change_latency_us = 400;
416 		p->in_states->state_array[0].use_ideal_dram_bw_strobe = true;
417 		p->in_states->state_array[0].sr_exit_time_us = 19.95;
418 		p->in_states->state_array[0].sr_enter_plus_exit_time_us = 24.36;
419 		p->in_states->state_array[0].fclk_change_latency_us = 7;
420 		p->in_states->state_array[0].usr_retraining_latency_us = 0;
421 
422 		p->in_states->state_array[1].socclk_mhz = 1200.0;
423 		p->in_states->state_array[1].fabricclk_mhz = 2250.0;
424 		p->in_states->state_array[1].dcfclk_mhz = 1434.0;
425 		p->in_states->state_array[1].dram_speed_mts = 1000 * transactions_per_mem_clock;
426 		break;
427 	case dml_project_dcn401:
428 		p->in_states->num_states = 2;
429 		transactions_per_mem_clock = 16;
430 		p->in_states->state_array[0].socclk_mhz = 300;		//620.0;
431 		p->in_states->state_array[0].dscclk_mhz = 666.667;	//716.667;
432 		p->in_states->state_array[0].phyclk_mhz = 810;
433 		p->in_states->state_array[0].phyclk_d18_mhz = 667;
434 		p->in_states->state_array[0].phyclk_d32_mhz = 625;
435 		p->in_states->state_array[0].dtbclk_mhz = 2000;		//1564.0;
436 		p->in_states->state_array[0].fabricclk_mhz = 300;	//450.0;
437 		p->in_states->state_array[0].dcfclk_mhz = 200;		//300.0;
438 		p->in_states->state_array[0].dispclk_mhz = 2000;	//2150.0;
439 		p->in_states->state_array[0].dppclk_mhz = 2000;		//2150.0;
440 		p->in_states->state_array[0].dram_speed_mts = 97 * transactions_per_mem_clock; //100 *
441 
442 		p->in_states->state_array[0].urgent_latency_pixel_data_only_us = 4;
443 		p->in_states->state_array[0].urgent_latency_pixel_mixed_with_vm_data_us = 0;
444 		p->in_states->state_array[0].urgent_latency_vm_data_only_us = 0;
445 		p->in_states->state_array[0].writeback_latency_us = 12;
446 		p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_component_us = 1;
447 		p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_reference_mhz = 1000;	//3000;
448 		p->in_states->state_array[0].sr_exit_z8_time_us = 0;
449 		p->in_states->state_array[0].sr_enter_plus_exit_z8_time_us = 0;
450 		p->in_states->state_array[0].dram_clock_change_latency_us = 400;
451 		p->in_states->state_array[0].use_ideal_dram_bw_strobe = true;
452 		p->in_states->state_array[0].sr_exit_time_us = 15.70;	//42.97;
453 		p->in_states->state_array[0].sr_enter_plus_exit_time_us = 20.20;	//49.94;
454 		p->in_states->state_array[0].fclk_change_latency_us = 0;	//20;
455 		p->in_states->state_array[0].usr_retraining_latency_us = 0;	//2;
456 
457 		p->in_states->state_array[1].socclk_mhz = 1600;		//1200.0;
458 		p->in_states->state_array[1].fabricclk_mhz = 2500;	//2500.0;
459 		p->in_states->state_array[1].dcfclk_mhz = 1800;		//1564.0;
460 		p->in_states->state_array[1].dram_speed_mts = 1125 * transactions_per_mem_clock;
461 		break;
462 	}
463 
464 	/* Override from passed values, if available */
465 	for (i = 0; i < p->in_states->num_states; i++) {
466 		if (dml2->config.bbox_overrides.sr_exit_latency_us) {
467 			p->in_states->state_array[i].sr_exit_time_us =
468 				dml2->config.bbox_overrides.sr_exit_latency_us;
469 		}
470 
471 		if (dml2->config.bbox_overrides.sr_enter_plus_exit_latency_us) {
472 			p->in_states->state_array[i].sr_enter_plus_exit_time_us =
473 				dml2->config.bbox_overrides.sr_enter_plus_exit_latency_us;
474 		}
475 
476 		if (dml2->config.bbox_overrides.sr_exit_z8_time_us) {
477 			p->in_states->state_array[i].sr_exit_z8_time_us =
478 				dml2->config.bbox_overrides.sr_exit_z8_time_us;
479 		}
480 
481 		if (dml2->config.bbox_overrides.sr_enter_plus_exit_z8_time_us) {
482 			p->in_states->state_array[i].sr_enter_plus_exit_z8_time_us =
483 				dml2->config.bbox_overrides.sr_enter_plus_exit_z8_time_us;
484 		}
485 
486 		if (dml2->config.bbox_overrides.urgent_latency_us) {
487 			p->in_states->state_array[i].urgent_latency_pixel_data_only_us =
488 				dml2->config.bbox_overrides.urgent_latency_us;
489 		}
490 
491 		if (dml2->config.bbox_overrides.dram_clock_change_latency_us) {
492 			p->in_states->state_array[i].dram_clock_change_latency_us =
493 				dml2->config.bbox_overrides.dram_clock_change_latency_us;
494 		}
495 
496 		if (dml2->config.bbox_overrides.fclk_change_latency_us) {
497 			p->in_states->state_array[i].fclk_change_latency_us =
498 				dml2->config.bbox_overrides.fclk_change_latency_us;
499 		}
500 	}
501 
502 	/* DCFCLK stas values are project specific */
503 	if ((dml2->v20.dml_core_ctx.project == dml_project_dcn32) ||
504 		(dml2->v20.dml_core_ctx.project == dml_project_dcn321)) {
505 		p->dcfclk_stas_mhz[0] = p->in_states->state_array[0].dcfclk_mhz;
506 		p->dcfclk_stas_mhz[1] = 615;
507 		p->dcfclk_stas_mhz[2] = 906;
508 		p->dcfclk_stas_mhz[3] = 1324;
509 		p->dcfclk_stas_mhz[4] = p->in_states->state_array[1].dcfclk_mhz;
510 	} else if (dml2->v20.dml_core_ctx.project != dml_project_dcn35 &&
511 			dml2->v20.dml_core_ctx.project != dml_project_dcn36 &&
512 			dml2->v20.dml_core_ctx.project != dml_project_dcn351) {
513 		p->dcfclk_stas_mhz[0] = 300;
514 		p->dcfclk_stas_mhz[1] = 615;
515 		p->dcfclk_stas_mhz[2] = 906;
516 		p->dcfclk_stas_mhz[3] = 1324;
517 		p->dcfclk_stas_mhz[4] = 1500;
518 	}
519 	/* Copy clocks tables entries, if available */
520 	if (dml2->config.bbox_overrides.clks_table.num_states) {
521 		p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;
522 		for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) {
523 			p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz;
524 		}
525 
526 		p->dcfclk_stas_mhz[0] = dml2->config.bbox_overrides.clks_table.clk_entries[0].dcfclk_mhz;
527 		if (i > 1)
528 			p->dcfclk_stas_mhz[4] = dml2->config.bbox_overrides.clks_table.clk_entries[i-1].dcfclk_mhz;
529 
530 		for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels; i++) {
531 			p->in_states->state_array[i].fabricclk_mhz =
532 				dml2->config.bbox_overrides.clks_table.clk_entries[i].fclk_mhz;
533 		}
534 
535 		for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels; i++) {
536 			p->in_states->state_array[i].dram_speed_mts =
537 				dml2->config.bbox_overrides.clks_table.clk_entries[i].memclk_mhz * transactions_per_mem_clock;
538 		}
539 
540 		for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_socclk_levels; i++) {
541 			p->in_states->state_array[i].socclk_mhz =
542 				dml2->config.bbox_overrides.clks_table.clk_entries[i].socclk_mhz;
543 		}
544 
545 		for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels; i++) {
546 			if (dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz > 0)
547 				p->in_states->state_array[i].dtbclk_mhz =
548 					dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz;
549 		}
550 
551 		for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dispclk_levels; i++) {
552 			p->in_states->state_array[i].dispclk_mhz =
553 				dml2->config.bbox_overrides.clks_table.clk_entries[i].dispclk_mhz;
554 			p->in_states->state_array[i].dppclk_mhz =
555 				dml2->config.bbox_overrides.clks_table.clk_entries[i].dppclk_mhz;
556 		}
557 	}
558 
559 	if (dml2->v20.dml_core_ctx.project == dml_project_dcn35 ||
560 	    dml2->v20.dml_core_ctx.project == dml_project_dcn36 ||
561 	    dml2->v20.dml_core_ctx.project == dml_project_dcn351) {
562 		int max_dcfclk_mhz = 0, max_dispclk_mhz = 0, max_dppclk_mhz = 0, max_phyclk_mhz = 0,
563 			max_dtbclk_mhz = 0, max_fclk_mhz = 0, max_uclk_mhz = 0, max_socclk_mhz = 0;
564 
565 		for (i = 0; i < p->in_states->num_states; i++) {
566 			if (p->in_states->state_array[i].dcfclk_mhz > max_dcfclk_mhz)
567 				max_dcfclk_mhz = (int)p->in_states->state_array[i].dcfclk_mhz;
568 			if (p->in_states->state_array[i].fabricclk_mhz > max_fclk_mhz)
569 				max_fclk_mhz = (int)p->in_states->state_array[i].fabricclk_mhz;
570 			if (p->in_states->state_array[i].socclk_mhz > max_socclk_mhz)
571 				max_socclk_mhz = (int)p->in_states->state_array[i].socclk_mhz;
572 			if (p->in_states->state_array[i].dram_speed_mts > max_uclk_mhz)
573 				max_uclk_mhz = (int)p->in_states->state_array[i].dram_speed_mts;
574 			if (p->in_states->state_array[i].dispclk_mhz > max_dispclk_mhz)
575 				max_dispclk_mhz = (int)p->in_states->state_array[i].dispclk_mhz;
576 			if (p->in_states->state_array[i].dppclk_mhz > max_dppclk_mhz)
577 				max_dppclk_mhz = (int)p->in_states->state_array[i].dppclk_mhz;
578 			if (p->in_states->state_array[i].phyclk_mhz > max_phyclk_mhz)
579 				max_phyclk_mhz = (int)p->in_states->state_array[i].phyclk_mhz;
580 			if (p->in_states->state_array[i].dtbclk_mhz > max_dtbclk_mhz)
581 				max_dtbclk_mhz = (int)p->in_states->state_array[i].dtbclk_mhz;
582 		}
583 
584 		for (i = 0; i < p->in_states->num_states; i++) {
585 			/* Independent states - including base (unlisted) parameters from state 0. */
586 			p->out_states->state_array[i] = p->in_states->state_array[0];
587 
588 			p->out_states->state_array[i].dispclk_mhz = max_dispclk_mhz;
589 			p->out_states->state_array[i].dppclk_mhz = max_dppclk_mhz;
590 			p->out_states->state_array[i].dtbclk_mhz = max_dtbclk_mhz;
591 			p->out_states->state_array[i].phyclk_mhz = max_phyclk_mhz;
592 
593 			p->out_states->state_array[i].phyclk_mhz = max_phyclk_mhz;
594 			p->out_states->state_array[i].dtbclk_mhz = max_dtbclk_mhz;
595 
596 			/* Dependent states. */
597 			p->out_states->state_array[i].dscclk_mhz = p->in_states->state_array[i].dscclk_mhz;
598 			p->out_states->state_array[i].dram_speed_mts = p->in_states->state_array[i].dram_speed_mts;
599 			p->out_states->state_array[i].fabricclk_mhz = p->in_states->state_array[i].fabricclk_mhz;
600 			p->out_states->state_array[i].socclk_mhz = p->in_states->state_array[i].socclk_mhz;
601 			p->out_states->state_array[i].dcfclk_mhz = p->in_states->state_array[i].dcfclk_mhz;
602 		}
603 
604 		p->out_states->num_states = p->in_states->num_states;
605 	} else {
606 		dml2_policy_build_synthetic_soc_states(s, p);
607 	}
608 }
609 
610 void dml2_translate_ip_params(const struct dc *in, struct ip_params_st *out)
611 {
612 	const struct _vcs_dpi_ip_params_st *in_ip_params = &in->dml.ip;
613 	/* Copy over the IP params tp dml2_ctx */
614 	out->compressed_buffer_segment_size_in_kbytes = in_ip_params->compressed_buffer_segment_size_in_kbytes;
615 	out->config_return_buffer_size_in_kbytes = in_ip_params->config_return_buffer_size_in_kbytes;
616 	out->cursor_buffer_size = in_ip_params->cursor_buffer_size;
617 	out->cursor_chunk_size = in_ip_params->cursor_chunk_size;
618 	out->dcc_meta_buffer_size_bytes = in_ip_params->dcc_meta_buffer_size_bytes;
619 	out->dcc_supported = in_ip_params->dcc_supported;
620 	out->dispclk_delay_subtotal = in_ip_params->dispclk_delay_subtotal;
621 	out->dispclk_ramp_margin_percent = in_ip_params->dispclk_ramp_margin_percent;
622 	out->dppclk_delay_cnvc_cursor = in_ip_params->dppclk_delay_cnvc_cursor;
623 	out->dppclk_delay_cnvc_formatter = in_ip_params->dppclk_delay_cnvc_formatter;
624 	out->dppclk_delay_scl = in_ip_params->dppclk_delay_scl;
625 	out->dppclk_delay_scl_lb_only = in_ip_params->dppclk_delay_scl_lb_only;
626 	out->dppclk_delay_subtotal = in_ip_params->dppclk_delay_subtotal;
627 	out->dpte_buffer_size_in_pte_reqs_chroma = in_ip_params->dpte_buffer_size_in_pte_reqs_chroma;
628 	out->dpte_buffer_size_in_pte_reqs_luma = in_ip_params->dpte_buffer_size_in_pte_reqs_luma;
629 	out->dsc422_native_support = in_ip_params->dsc422_native_support;
630 	out->dynamic_metadata_vm_enabled = in_ip_params->dynamic_metadata_vm_enabled;
631 	out->gpuvm_enable = in_ip_params->gpuvm_enable;
632 	out->gpuvm_max_page_table_levels = in_ip_params->gpuvm_max_page_table_levels;
633 	out->hostvm_enable = in_ip_params->hostvm_enable;
634 	out->hostvm_max_page_table_levels = in_ip_params->hostvm_max_page_table_levels;
635 	out->line_buffer_size_bits = in_ip_params->line_buffer_size_bits;
636 	out->maximum_dsc_bits_per_component = in_ip_params->maximum_dsc_bits_per_component;
637 	out->maximum_pixels_per_line_per_dsc_unit = in_ip_params->maximum_pixels_per_line_per_dsc_unit;
638 	out->max_dchub_pscl_bw_pix_per_clk = in_ip_params->max_dchub_pscl_bw_pix_per_clk;
639 	out->max_hscl_ratio = in_ip_params->max_hscl_ratio;
640 	out->max_hscl_taps = in_ip_params->max_hscl_taps;
641 	out->max_inter_dcn_tile_repeaters = in_ip_params->max_inter_dcn_tile_repeaters;
642 	out->max_lb_vscl_bw_pix_per_clk = in_ip_params->max_lb_vscl_bw_pix_per_clk;
643 	out->max_line_buffer_lines = in_ip_params->max_line_buffer_lines;
644 	out->max_num_dp2p0_outputs = in_ip_params->max_num_dp2p0_outputs;
645 	out->max_num_dp2p0_streams = in_ip_params->max_num_dp2p0_streams;
646 	out->max_num_dpp = in_ip_params->max_num_dpp;
647 	out->max_num_hdmi_frl_outputs = in_ip_params->max_num_hdmi_frl_outputs;
648 	out->max_num_otg = in_ip_params->max_num_otg;
649 	out->max_num_wb = in_ip_params->max_num_wb;
650 	out->max_pscl_lb_bw_pix_per_clk = in_ip_params->max_pscl_lb_bw_pix_per_clk;
651 	out->max_vscl_hscl_bw_pix_per_clk = in_ip_params->max_vscl_hscl_bw_pix_per_clk;
652 	out->max_vscl_ratio = in_ip_params->max_vscl_ratio;
653 	out->max_vscl_taps = in_ip_params->max_vscl_taps;
654 	out->meta_chunk_size_kbytes = in_ip_params->meta_chunk_size_kbytes;
655 	out->meta_fifo_size_in_kentries = in_ip_params->meta_fifo_size_in_kentries;
656 	out->min_meta_chunk_size_bytes = in_ip_params->min_meta_chunk_size_bytes;
657 	out->min_pixel_chunk_size_bytes = in_ip_params->min_pixel_chunk_size_bytes;
658 	out->num_dsc = in_ip_params->num_dsc;
659 	out->pixel_chunk_size_kbytes = in_ip_params->pixel_chunk_size_kbytes;
660 	out->ptoi_supported = in_ip_params->ptoi_supported;
661 	out->rob_buffer_size_kbytes = in_ip_params->rob_buffer_size_kbytes;
662 	out->writeback_chunk_size_kbytes = in_ip_params->writeback_chunk_size_kbytes;
663 	out->writeback_interface_buffer_size_kbytes = in_ip_params->writeback_interface_buffer_size_kbytes;
664 	out->writeback_line_buffer_buffer_size = in_ip_params->writeback_line_buffer_buffer_size;
665 	out->writeback_max_hscl_ratio = in_ip_params->writeback_max_hscl_ratio;
666 	out->writeback_max_hscl_taps = in_ip_params->writeback_max_hscl_taps;
667 	out->writeback_max_vscl_ratio = in_ip_params->writeback_max_vscl_ratio;
668 	out->writeback_max_vscl_taps = in_ip_params->writeback_max_vscl_taps;
669 	out->writeback_min_hscl_ratio = in_ip_params->writeback_min_hscl_ratio;
670 	out->writeback_min_vscl_ratio = in_ip_params->writeback_min_vscl_ratio;
671 	out->zero_size_buffer_entries = in_ip_params->zero_size_buffer_entries;
672 
673 	/* As per hardcoded reference / discussions */
674 	out->config_return_buffer_segment_size_in_kbytes = 64;
675 	//out->vblank_nom_default_us = 600;
676 	out->vblank_nom_default_us = in_ip_params->VBlankNomDefaultUS;
677 }
678 
679 void dml2_translate_socbb_params(const struct dc *in, struct soc_bounding_box_st *out)
680 {
681 	const struct _vcs_dpi_soc_bounding_box_st *in_soc_params = &in->dml.soc;
682 	/* Copy over the SOCBB params to dml2_ctx */
683 	out->dispclk_dppclk_vco_speed_mhz = in_soc_params->dispclk_dppclk_vco_speed_mhz;
684 	out->do_urgent_latency_adjustment = in_soc_params->do_urgent_latency_adjustment;
685 	out->dram_channel_width_bytes = (dml_uint_t)in_soc_params->dram_channel_width_bytes;
686 	out->fabric_datapath_to_dcn_data_return_bytes = (dml_uint_t)in_soc_params->fabric_datapath_to_dcn_data_return_bytes;
687 	out->gpuvm_min_page_size_kbytes = in_soc_params->gpuvm_min_page_size_bytes / 1024;
688 	out->hostvm_min_page_size_kbytes = in_soc_params->hostvm_min_page_size_bytes / 1024;
689 	out->mall_allocated_for_dcn_mbytes = (dml_uint_t)in_soc_params->mall_allocated_for_dcn_mbytes;
690 	out->max_avg_dram_bw_use_normal_percent = in_soc_params->max_avg_dram_bw_use_normal_percent;
691 	out->max_avg_fabric_bw_use_normal_percent = in_soc_params->max_avg_fabric_bw_use_normal_percent;
692 	out->max_avg_dram_bw_use_normal_strobe_percent = in_soc_params->max_avg_dram_bw_use_normal_strobe_percent;
693 	out->max_avg_sdp_bw_use_normal_percent = in_soc_params->max_avg_sdp_bw_use_normal_percent;
694 	out->max_outstanding_reqs = in_soc_params->max_request_size_bytes;
695 	out->num_chans = in_soc_params->num_chans;
696 	out->pct_ideal_dram_bw_after_urgent_strobe = in_soc_params->pct_ideal_dram_bw_after_urgent_strobe;
697 	out->pct_ideal_dram_bw_after_urgent_vm_only = in_soc_params->pct_ideal_dram_sdp_bw_after_urgent_vm_only;
698 	out->pct_ideal_fabric_bw_after_urgent = in_soc_params->pct_ideal_fabric_bw_after_urgent;
699 	out->pct_ideal_sdp_bw_after_urgent = in_soc_params->pct_ideal_sdp_bw_after_urgent;
700 	out->phy_downspread_percent = in_soc_params->downspread_percent;
701 	out->refclk_mhz = 50; // As per hardcoded reference.
702 	out->return_bus_width_bytes = in_soc_params->return_bus_width_bytes;
703 	out->round_trip_ping_latency_dcfclk_cycles = in_soc_params->round_trip_ping_latency_dcfclk_cycles;
704 	out->smn_latency_us = in_soc_params->smn_latency_us;
705 	out->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = in_soc_params->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes;
706 	out->urgent_out_of_order_return_per_channel_pixel_only_bytes = in_soc_params->urgent_out_of_order_return_per_channel_pixel_only_bytes;
707 	out->urgent_out_of_order_return_per_channel_vm_only_bytes = in_soc_params->urgent_out_of_order_return_per_channel_vm_only_bytes;
708 	out->pct_ideal_dram_bw_after_urgent_pixel_and_vm = in_soc_params->pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm;
709 	out->pct_ideal_dram_bw_after_urgent_pixel_only = in_soc_params->pct_ideal_dram_sdp_bw_after_urgent_pixel_only;
710 	out->dcn_downspread_percent = in_soc_params->dcn_downspread_percent;
711 }
712 
713 void dml2_translate_soc_states(const struct dc *dc, struct soc_states_st *out, int num_states)
714 {
715 	unsigned int i = 0;
716 	out->num_states = num_states;
717 
718 	for (i = 0; i < out->num_states; i++) {
719 		out->state_array[i].dcfclk_mhz = dc->dml.soc.clock_limits[i].dcfclk_mhz;
720 		out->state_array[i].dispclk_mhz = dc->dml.soc.clock_limits[i].dispclk_mhz;
721 		out->state_array[i].dppclk_mhz = dc->dml.soc.clock_limits[i].dppclk_mhz;
722 		out->state_array[i].dram_speed_mts = dc->dml.soc.clock_limits[i].dram_speed_mts;
723 		out->state_array[i].dtbclk_mhz = dc->dml.soc.clock_limits[i].dtbclk_mhz;
724 		out->state_array[i].socclk_mhz = dc->dml.soc.clock_limits[i].socclk_mhz;
725 		out->state_array[i].fabricclk_mhz = dc->dml.soc.clock_limits[i].fabricclk_mhz;
726 		out->state_array[i].dscclk_mhz = dc->dml.soc.clock_limits[i].dscclk_mhz;
727 		out->state_array[i].phyclk_d18_mhz = dc->dml.soc.clock_limits[i].phyclk_d18_mhz;
728 		out->state_array[i].phyclk_d32_mhz = dc->dml.soc.clock_limits[i].phyclk_d32_mhz;
729 		out->state_array[i].phyclk_mhz = dc->dml.soc.clock_limits[i].phyclk_mhz;
730 		out->state_array[i].sr_enter_plus_exit_time_us = dc->dml.soc.sr_enter_plus_exit_time_us;
731 		out->state_array[i].sr_exit_time_us = dc->dml.soc.sr_exit_time_us;
732 		out->state_array[i].fclk_change_latency_us = dc->dml.soc.fclk_change_latency_us;
733 		out->state_array[i].dram_clock_change_latency_us = dc->dml.soc.dram_clock_change_latency_us;
734 		out->state_array[i].usr_retraining_latency_us = dc->dml.soc.usr_retraining_latency_us;
735 		out->state_array[i].writeback_latency_us = dc->dml.soc.writeback_latency_us;
736 		/* Driver initialized values for these are different than the spreadsheet. Use the
737 		 * spreadsheet ones for now. We need to decided which ones to use.
738 		 */
739 		out->state_array[i].sr_exit_z8_time_us = dc->dml.soc.sr_exit_z8_time_us;
740 		out->state_array[i].sr_enter_plus_exit_z8_time_us = dc->dml.soc.sr_enter_plus_exit_z8_time_us;
741 		//out->state_array[i].sr_exit_z8_time_us = 5.20;
742 		//out->state_array[i].sr_enter_plus_exit_z8_time_us = 9.60;
743 		out->state_array[i].use_ideal_dram_bw_strobe = true;
744 		out->state_array[i].urgent_latency_pixel_data_only_us = dc->dml.soc.urgent_latency_pixel_data_only_us;
745 		out->state_array[i].urgent_latency_pixel_mixed_with_vm_data_us = dc->dml.soc.urgent_latency_pixel_mixed_with_vm_data_us;
746 		out->state_array[i].urgent_latency_vm_data_only_us = dc->dml.soc.urgent_latency_vm_data_only_us;
747 		out->state_array[i].urgent_latency_adjustment_fabric_clock_component_us = dc->dml.soc.urgent_latency_adjustment_fabric_clock_component_us;
748 		out->state_array[i].urgent_latency_adjustment_fabric_clock_reference_mhz = dc->dml.soc.urgent_latency_adjustment_fabric_clock_reference_mhz;
749 	}
750 }
751 
752 static void populate_dml_timing_cfg_from_stream_state(struct dml_timing_cfg_st *out, unsigned int location, const struct dc_stream_state *in)
753 {
754 	dml_uint_t hblank_start, vblank_start;
755 
756 	out->HActive[location] = in->timing.h_addressable + in->timing.h_border_left + in->timing.h_border_right;
757 	out->VActive[location] = in->timing.v_addressable + in->timing.v_border_bottom + in->timing.v_border_top;
758 	out->RefreshRate[location] = ((in->timing.pix_clk_100hz * 100) / in->timing.h_total) / in->timing.v_total;
759 	out->VFrontPorch[location] = in->timing.v_front_porch;
760 	out->PixelClock[location] = in->timing.pix_clk_100hz / 10000.00;
761 	if (in->timing.timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING)
762 		out->PixelClock[location] *= 2;
763 	out->HTotal[location] = in->timing.h_total;
764 	out->VTotal[location] = in->timing.v_total;
765 	out->Interlace[location] = in->timing.flags.INTERLACE;
766 	hblank_start = in->timing.h_total - in->timing.h_front_porch;
767 	out->HBlankEnd[location] = hblank_start
768 					- in->timing.h_addressable
769 					- in->timing.h_border_left
770 					- in->timing.h_border_right;
771 	vblank_start = in->timing.v_total - in->timing.v_front_porch;
772 	out->VBlankEnd[location] = vblank_start
773 					- in->timing.v_addressable
774 					- in->timing.v_border_top
775 					- in->timing.v_border_bottom;
776 	out->DRRDisplay[location] = false;
777 }
778 
779 static void populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st *out, unsigned int location,
780 				const struct dc_stream_state *in, const struct pipe_ctx *pipe, struct dml2_context *dml2)
781 {
782 	unsigned int output_bpc;
783 
784 	out->DSCEnable[location] = (enum dml_dsc_enable)in->timing.flags.DSC;
785 	out->OutputLinkDPLanes[location] = 4; // As per code in dcn20_resource.c
786 	out->DSCInputBitPerComponent[location] = 12; // As per code in dcn20_resource.c
787 	out->DSCSlices[location] = in->timing.dsc_cfg.num_slices_h;
788 
789 	switch (in->signal) {
790 	case SIGNAL_TYPE_DISPLAY_PORT_MST:
791 	case SIGNAL_TYPE_DISPLAY_PORT:
792 		out->OutputEncoder[location] = dml_dp;
793 		if (location < MAX_HPO_DP2_ENCODERS && dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location] != -1)
794 			out->OutputEncoder[dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location]] = dml_dp2p0;
795 		break;
796 	case SIGNAL_TYPE_EDP:
797 		out->OutputEncoder[location] = dml_edp;
798 		break;
799 	case SIGNAL_TYPE_HDMI_TYPE_A:
800 	case SIGNAL_TYPE_DVI_SINGLE_LINK:
801 	case SIGNAL_TYPE_DVI_DUAL_LINK:
802 		out->OutputEncoder[location] = dml_hdmi;
803 		break;
804 	default:
805 		out->OutputEncoder[location] = dml_dp;
806 	}
807 
808 	switch (in->timing.display_color_depth) {
809 	case COLOR_DEPTH_666:
810 		output_bpc = 6;
811 		break;
812 	case COLOR_DEPTH_888:
813 		output_bpc = 8;
814 		break;
815 	case COLOR_DEPTH_101010:
816 		output_bpc = 10;
817 		break;
818 	case COLOR_DEPTH_121212:
819 		output_bpc = 12;
820 		break;
821 	case COLOR_DEPTH_141414:
822 		output_bpc = 14;
823 		break;
824 	case COLOR_DEPTH_161616:
825 		output_bpc = 16;
826 		break;
827 	case COLOR_DEPTH_999:
828 		output_bpc = 9;
829 		break;
830 	case COLOR_DEPTH_111111:
831 		output_bpc = 11;
832 		break;
833 	default:
834 		output_bpc = 8;
835 		break;
836 	}
837 
838 	switch (in->timing.pixel_encoding) {
839 	case PIXEL_ENCODING_RGB:
840 	case PIXEL_ENCODING_YCBCR444:
841 		out->OutputFormat[location] = dml_444;
842 		out->OutputBpp[location] = (dml_float_t)output_bpc * 3;
843 		break;
844 	case PIXEL_ENCODING_YCBCR420:
845 		out->OutputFormat[location] = dml_420;
846 		out->OutputBpp[location] = (output_bpc * 3.0) / 2;
847 		break;
848 	case PIXEL_ENCODING_YCBCR422:
849 		if (in->timing.flags.DSC && !in->timing.dsc_cfg.ycbcr422_simple)
850 			out->OutputFormat[location] = dml_n422;
851 		else
852 			out->OutputFormat[location] = dml_s422;
853 		out->OutputBpp[location] = (dml_float_t)output_bpc * 2;
854 		break;
855 	default:
856 		out->OutputFormat[location] = dml_444;
857 		out->OutputBpp[location] = (dml_float_t)output_bpc * 3;
858 		break;
859 	}
860 
861 	if (in->timing.flags.DSC) {
862 		out->OutputBpp[location] = in->timing.dsc_cfg.bits_per_pixel / 16.0;
863 	}
864 
865 	// This has been false throughout DCN32x development. If needed we can change this later on.
866 	out->OutputMultistreamEn[location] = false;
867 
868 	switch (in->signal) {
869 	case SIGNAL_TYPE_NONE:
870 	case SIGNAL_TYPE_DVI_SINGLE_LINK:
871 	case SIGNAL_TYPE_DVI_DUAL_LINK:
872 	case SIGNAL_TYPE_HDMI_TYPE_A:
873 	case SIGNAL_TYPE_LVDS:
874 	case SIGNAL_TYPE_RGB:
875 	case SIGNAL_TYPE_DISPLAY_PORT:
876 	case SIGNAL_TYPE_DISPLAY_PORT_MST:
877 	case SIGNAL_TYPE_EDP:
878 	case SIGNAL_TYPE_VIRTUAL:
879 	default:
880 		out->OutputLinkDPRate[location] = dml_dp_rate_na;
881 		break;
882 	}
883 
884 	out->PixelClockBackEnd[location] = in->timing.pix_clk_100hz / 10000.00;
885 
886 	out->AudioSampleLayout[location] = in->audio_info.modes->sample_size;
887 	out->AudioSampleRate[location] = in->audio_info.modes->max_bit_rate;
888 
889 	out->OutputDisabled[location] = true;
890 }
891 
892 static void populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st *out, unsigned int location, const struct dc_stream_state *in)
893 {
894 	out->SurfaceWidthY[location] = in->timing.h_addressable;
895 	out->SurfaceHeightY[location] = in->timing.v_addressable;
896 	out->SurfaceWidthC[location] = in->timing.h_addressable;
897 	out->SurfaceHeightC[location] = in->timing.v_addressable;
898 	out->PitchY[location] = ((out->SurfaceWidthY[location] + 127) / 128) * 128;
899 	out->PitchC[location] = 0;
900 	out->DCCEnable[location] = false;
901 	out->DCCMetaPitchY[location] = 0;
902 	out->DCCMetaPitchC[location] = 0;
903 	out->DCCRateLuma[location] = 1.0;
904 	out->DCCRateChroma[location] = 1.0;
905 	out->DCCFractionOfZeroSizeRequestsLuma[location] = 0;
906 	out->DCCFractionOfZeroSizeRequestsChroma[location] = 0;
907 	out->SurfaceTiling[location] = dml_sw_64kb_r_x;
908 	out->SourcePixelFormat[location] = dml_444_32;
909 }
910 
911 static void populate_dml_surface_cfg_from_plane_state(enum dml_project_id dml2_project, struct dml_surface_cfg_st *out, unsigned int location, const struct dc_plane_state *in)
912 {
913 	out->PitchY[location] = in->plane_size.surface_pitch;
914 	out->SurfaceHeightY[location] = in->plane_size.surface_size.height;
915 	out->SurfaceWidthY[location] = in->plane_size.surface_size.width;
916 	out->SurfaceHeightC[location] = in->plane_size.chroma_size.height;
917 	out->SurfaceWidthC[location] = in->plane_size.chroma_size.width;
918 	out->PitchC[location] = in->plane_size.chroma_pitch;
919 	out->DCCEnable[location] = in->dcc.enable;
920 	out->DCCMetaPitchY[location] = in->dcc.meta_pitch;
921 	out->DCCMetaPitchC[location] = in->dcc.meta_pitch_c;
922 	out->DCCRateLuma[location] = 1.0;
923 	out->DCCRateChroma[location] = 1.0;
924 	out->DCCFractionOfZeroSizeRequestsLuma[location] = in->dcc.independent_64b_blks;
925 	out->DCCFractionOfZeroSizeRequestsChroma[location] = in->dcc.independent_64b_blks_c;
926 
927 	switch (dml2_project) {
928 	default:
929 		out->SurfaceTiling[location] = (enum dml_swizzle_mode)in->tiling_info.gfx9.swizzle;
930 		break;
931 	case dml_project_dcn401:
932 		// Temporary use gfx11 swizzle in dml, until proper dml for DCN4x is integrated/implemented
933 		switch (in->tiling_info.gfx_addr3.swizzle) {
934 		case DC_ADDR3_SW_4KB_2D:
935 		case DC_ADDR3_SW_64KB_2D:
936 		case DC_ADDR3_SW_256KB_2D:
937 		default:
938 			out->SurfaceTiling[location] = dml_sw_64kb_r_x;
939 			break;
940 		case DC_ADDR3_SW_LINEAR:
941 			out->SurfaceTiling[location] = dml_sw_linear;
942 			break;
943 		}
944 	}
945 
946 	switch (in->format) {
947 	case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
948 	case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
949 		out->SourcePixelFormat[location] = dml_420_8;
950 		break;
951 	case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:
952 	case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:
953 		out->SourcePixelFormat[location] = dml_420_10;
954 		break;
955 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
956 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F:
957 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
958 		out->SourcePixelFormat[location] = dml_444_64;
959 		break;
960 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
961 	case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
962 		out->SourcePixelFormat[location] = dml_444_16;
963 		break;
964 	case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS:
965 		out->SourcePixelFormat[location] = dml_444_8;
966 		break;
967 	case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA:
968 		out->SourcePixelFormat[location] = dml_rgbe_alpha;
969 		break;
970 	default:
971 		out->SourcePixelFormat[location] = dml_444_32;
972 		break;
973 	}
974 }
975 
976 static void get_scaler_data_for_plane(const struct dc_plane_state *in, struct dc_state *context, struct scaler_data *out)
977 {
978 	int i;
979 	struct pipe_ctx *temp_pipe = &context->res_ctx.temp_pipe;
980 
981 	memset(temp_pipe, 0, sizeof(struct pipe_ctx));
982 
983 	for (i = 0; i < MAX_PIPES; i++)	{
984 		const struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
985 
986 		if (pipe->plane_state == in && !pipe->prev_odm_pipe) {
987 			temp_pipe->stream = pipe->stream;
988 			temp_pipe->plane_state = pipe->plane_state;
989 			temp_pipe->plane_res.scl_data.taps = pipe->plane_res.scl_data.taps;
990 			temp_pipe->stream_res = pipe->stream_res;
991 			resource_build_scaling_params(temp_pipe);
992 			break;
993 		}
994 	}
995 
996 	ASSERT(i < MAX_PIPES);
997 	memcpy(out, &temp_pipe->plane_res.scl_data, sizeof(*out));
998 }
999 
1000 static void populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st *out, unsigned int location,
1001 					 const struct dc_stream_state *in,
1002 					 const struct soc_bounding_box_st *soc)
1003 {
1004 	dml_uint_t width, height;
1005 
1006 	if (in->timing.h_addressable > 3840)
1007 		width = 3840;
1008 	else
1009 		width = in->timing.h_addressable;	// 4K max
1010 
1011 	if (in->timing.v_addressable > 2160)
1012 		height = 2160;
1013 	else
1014 		height = in->timing.v_addressable;	// 4K max
1015 
1016 	out->CursorBPP[location] = dml_cur_32bit;
1017 	out->CursorWidth[location] = 256;
1018 
1019 	out->GPUVMMinPageSizeKBytes[location] = soc->gpuvm_min_page_size_kbytes;
1020 
1021 	out->ViewportWidth[location] = width;
1022 	out->ViewportHeight[location] = height;
1023 	out->ViewportStationary[location] = false;
1024 	out->ViewportWidthChroma[location] = 0;
1025 	out->ViewportHeightChroma[location] = 0;
1026 	out->ViewportXStart[location] = 0;
1027 	out->ViewportXStartC[location] = 0;
1028 	out->ViewportYStart[location] = 0;
1029 	out->ViewportYStartC[location] = 0;
1030 
1031 	out->ScalerEnabled[location] = false;
1032 	out->HRatio[location] = 1.0;
1033 	out->VRatio[location] = 1.0;
1034 	out->HRatioChroma[location] = 0;
1035 	out->VRatioChroma[location] = 0;
1036 	out->HTaps[location] = 1;
1037 	out->VTaps[location] = 1;
1038 	out->HTapsChroma[location] = 0;
1039 	out->VTapsChroma[location] = 0;
1040 	out->SourceScan[location] = dml_rotation_0;
1041 	out->ScalerRecoutWidth[location] = width;
1042 
1043 	out->LBBitPerPixel[location] = 57;
1044 
1045 	out->DynamicMetadataEnable[location] = false;
1046 
1047 	out->NumberOfCursors[location] = 1;
1048 	out->UseMALLForStaticScreen[location] = dml_use_mall_static_screen_disable;
1049 	out->UseMALLForPStateChange[location] = dml_use_mall_pstate_change_disable;
1050 
1051 	out->DETSizeOverride[location] = 256;
1052 
1053 	out->ScalerEnabled[location] = false;
1054 }
1055 
1056 static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out, unsigned int location,
1057 						    const struct dc_plane_state *in, struct dc_state *context,
1058 						    const struct soc_bounding_box_st *soc)
1059 {
1060 	struct scaler_data *scaler_data = kzalloc(sizeof(*scaler_data), GFP_KERNEL);
1061 	if (!scaler_data)
1062 		return;
1063 
1064 	get_scaler_data_for_plane(in, context, scaler_data);
1065 
1066 	out->CursorBPP[location] = dml_cur_32bit;
1067 	out->CursorWidth[location] = 256;
1068 
1069 	out->GPUVMMinPageSizeKBytes[location] = soc->gpuvm_min_page_size_kbytes;
1070 
1071 	out->ViewportWidth[location] = scaler_data->viewport.width;
1072 	out->ViewportHeight[location] = scaler_data->viewport.height;
1073 	out->ViewportWidthChroma[location] = scaler_data->viewport_c.width;
1074 	out->ViewportHeightChroma[location] = scaler_data->viewport_c.height;
1075 	out->ViewportXStart[location] = scaler_data->viewport.x;
1076 	out->ViewportYStart[location] = scaler_data->viewport.y;
1077 	out->ViewportXStartC[location] = scaler_data->viewport_c.x;
1078 	out->ViewportYStartC[location] = scaler_data->viewport_c.y;
1079 	out->ViewportStationary[location] = false;
1080 
1081 	out->ScalerEnabled[location] = scaler_data->ratios.horz.value != dc_fixpt_one.value ||
1082 				scaler_data->ratios.horz_c.value != dc_fixpt_one.value ||
1083 				scaler_data->ratios.vert.value != dc_fixpt_one.value ||
1084 				scaler_data->ratios.vert_c.value != dc_fixpt_one.value;
1085 
1086 	/* Current driver code base uses LBBitPerPixel as 57. There is a discrepancy
1087 	 * from the HW/DML teams about this value. Initialize LBBitPerPixel with the
1088 	 * value current used in Navi3x .
1089 	 */
1090 
1091 	out->LBBitPerPixel[location] = 57;
1092 
1093 	if (out->ScalerEnabled[location] == false) {
1094 		out->HRatio[location] = 1;
1095 		out->HRatioChroma[location] = 1;
1096 		out->VRatio[location] = 1;
1097 		out->VRatioChroma[location] = 1;
1098 	} else {
1099 		/* Follow the original dml_wrapper.c code direction to fix scaling issues */
1100 		out->HRatio[location] = (dml_float_t)scaler_data->ratios.horz.value / (1ULL << 32);
1101 		out->HRatioChroma[location] = (dml_float_t)scaler_data->ratios.horz_c.value / (1ULL << 32);
1102 		out->VRatio[location] = (dml_float_t)scaler_data->ratios.vert.value / (1ULL << 32);
1103 		out->VRatioChroma[location] = (dml_float_t)scaler_data->ratios.vert_c.value / (1ULL << 32);
1104 	}
1105 
1106 	if (!scaler_data->taps.h_taps) {
1107 		out->HTaps[location] = 1;
1108 		out->HTapsChroma[location] = 1;
1109 	} else {
1110 		out->HTaps[location] = scaler_data->taps.h_taps;
1111 		out->HTapsChroma[location] = scaler_data->taps.h_taps_c;
1112 	}
1113 	if (!scaler_data->taps.v_taps) {
1114 		out->VTaps[location] = 1;
1115 		out->VTapsChroma[location] = 1;
1116 	} else {
1117 		out->VTaps[location] = scaler_data->taps.v_taps;
1118 		out->VTapsChroma[location] = scaler_data->taps.v_taps_c;
1119 	}
1120 
1121 	out->SourceScan[location] = (enum dml_rotation_angle)in->rotation;
1122 	out->ScalerRecoutWidth[location] = in->dst_rect.width;
1123 
1124 	out->DynamicMetadataEnable[location] = false;
1125 	out->DynamicMetadataLinesBeforeActiveRequired[location] = 0;
1126 	out->DynamicMetadataTransmittedBytes[location] = 0;
1127 
1128 	out->NumberOfCursors[location] = 1;
1129 
1130 	kfree(scaler_data);
1131 }
1132 
1133 static unsigned int map_stream_to_dml_display_cfg(const struct dml2_context *dml2,
1134 		const struct dc_stream_state *stream, const struct dml_display_cfg_st *dml_dispcfg)
1135 {
1136 	int i = 0;
1137 	int location = -1;
1138 
1139 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1140 		if (dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[i] && dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[i] == stream->stream_id) {
1141 			location = i;
1142 			break;
1143 		}
1144 	}
1145 
1146 	return location;
1147 }
1148 
1149 static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *context, const struct dc_plane_state *plane,
1150 		unsigned int stream_id, unsigned int plane_index, unsigned int *plane_id)
1151 {
1152 	int i, j;
1153 	bool is_plane_duplicate = dml2->v20.scratch.plane_duplicate_exists;
1154 
1155 	if (!plane_id)
1156 		return false;
1157 
1158 	for (i = 0; i < context->stream_count; i++) {
1159 		if (context->streams[i]->stream_id == stream_id) {
1160 			for (j = 0; j < context->stream_status[i].plane_count; j++) {
1161 				if (context->stream_status[i].plane_states[j] == plane &&
1162 					(!is_plane_duplicate || (j == plane_index))) {
1163 					*plane_id = (i << 16) | j;
1164 					return true;
1165 				}
1166 			}
1167 		}
1168 	}
1169 
1170 	return false;
1171 }
1172 
1173 static unsigned int map_plane_to_dml_display_cfg(const struct dml2_context *dml2, const struct dc_plane_state *plane,
1174 		const struct dc_state *context, const struct dml_display_cfg_st *dml_dispcfg, unsigned int stream_id, int plane_index)
1175 {
1176 	unsigned int plane_id;
1177 	int i = 0;
1178 	int location = -1;
1179 
1180 	if (!get_plane_id(context->bw_ctx.dml2, context, plane, stream_id, plane_index, &plane_id)) {
1181 		ASSERT(false);
1182 		return -1;
1183 	}
1184 
1185 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1186 		if (dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[i] && dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id[i] == plane_id) {
1187 			location = i;
1188 			break;
1189 		}
1190 	}
1191 
1192 	return location;
1193 }
1194 
1195 static void apply_legacy_svp_drr_settings(struct dml2_context *dml2, const struct dc_state *state, struct dml_display_cfg_st *dml_dispcfg)
1196 {
1197 	int i;
1198 
1199 	if (state->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
1200 		ASSERT(state->stream_count == 1);
1201 		dml_dispcfg->timing.DRRDisplay[0] = true;
1202 	} else if (state->bw_ctx.bw.dcn.legacy_svp_drr_stream_index_valid) {
1203 
1204 		for (i = 0; i < dml_dispcfg->num_timings; i++) {
1205 			if (dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[i] == state->streams[state->bw_ctx.bw.dcn.legacy_svp_drr_stream_index]->stream_id)
1206 				dml_dispcfg->timing.DRRDisplay[i] = true;
1207 		}
1208 	}
1209 }
1210 
1211 static void dml2_populate_pipe_to_plane_index_mapping(struct dml2_context *dml2, struct dc_state *state)
1212 {
1213 	unsigned int i;
1214 	unsigned int pipe_index = 0;
1215 	unsigned int plane_index = 0;
1216 	struct dml2_dml_to_dc_pipe_mapping *dml_to_dc_pipe_mapping = &dml2->v20.scratch.dml_to_dc_pipe_mapping;
1217 
1218 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1219 		dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[i] = false;
1220 		dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index[i] = 0;
1221 	}
1222 
1223 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1224 		struct pipe_ctx *pipe = &state->res_ctx.pipe_ctx[i];
1225 
1226 		if (!pipe || !pipe->stream || !pipe->plane_state)
1227 			continue;
1228 
1229 		while (pipe) {
1230 			pipe_index = pipe->pipe_idx;
1231 
1232 			if (pipe->stream && dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[pipe_index] == false) {
1233 				dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index[pipe_index] = plane_index;
1234 				plane_index++;
1235 				dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[pipe_index] = true;
1236 			}
1237 
1238 			pipe = pipe->bottom_pipe;
1239 		}
1240 
1241 		plane_index = 0;
1242 	}
1243 }
1244 
1245 static void populate_dml_writeback_cfg_from_stream_state(struct dml_writeback_cfg_st *out,
1246 		unsigned int location, const struct dc_stream_state *in)
1247 {
1248 	if (in->num_wb_info > 0) {
1249 		for (int i = 0; i < __DML_NUM_DMB__; i++) {
1250 			const struct dc_writeback_info *wb_info = &in->writeback_info[i];
1251 			/*current dml support 1 dwb per stream, limitation*/
1252 			if (wb_info->wb_enabled) {
1253 				out->WritebackEnable[location] = wb_info->wb_enabled;
1254 				out->ActiveWritebacksPerSurface[location] = wb_info->dwb_params.cnv_params.src_width;
1255 				out->WritebackDestinationWidth[location] = wb_info->dwb_params.dest_width;
1256 				out->WritebackDestinationHeight[location] = wb_info->dwb_params.dest_height;
1257 
1258 				out->WritebackSourceWidth[location] = wb_info->dwb_params.cnv_params.crop_en ?
1259 					wb_info->dwb_params.cnv_params.crop_width :
1260 					wb_info->dwb_params.cnv_params.src_width;
1261 
1262 				out->WritebackSourceHeight[location] = wb_info->dwb_params.cnv_params.crop_en ?
1263 					wb_info->dwb_params.cnv_params.crop_height :
1264 					wb_info->dwb_params.cnv_params.src_height;
1265 				/*current design does not have chroma scaling, need to follow up*/
1266 				out->WritebackHTaps[location] = wb_info->dwb_params.scaler_taps.h_taps > 0 ?
1267 					wb_info->dwb_params.scaler_taps.h_taps : 1;
1268 				out->WritebackVTaps[location] = wb_info->dwb_params.scaler_taps.v_taps > 0 ?
1269 					wb_info->dwb_params.scaler_taps.v_taps : 1;
1270 
1271 				out->WritebackHRatio[location] = wb_info->dwb_params.cnv_params.crop_en ?
1272 					(double)wb_info->dwb_params.cnv_params.crop_width /
1273 						(double)wb_info->dwb_params.dest_width :
1274 					(double)wb_info->dwb_params.cnv_params.src_width /
1275 						(double)wb_info->dwb_params.dest_width;
1276 				out->WritebackVRatio[location] = wb_info->dwb_params.cnv_params.crop_en ?
1277 					(double)wb_info->dwb_params.cnv_params.crop_height /
1278 						(double)wb_info->dwb_params.dest_height :
1279 					(double)wb_info->dwb_params.cnv_params.src_height /
1280 						(double)wb_info->dwb_params.dest_height;
1281 			}
1282 		}
1283 	}
1284 }
1285 
1286 static void dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(struct dml2_context *dml2, struct dc_state *context)
1287 {
1288 	int i;
1289 	struct pipe_ctx *current_pipe_context;
1290 
1291 	/* Scratch gets reset to zero in dml, but link encoder instance can be zero, so reset to -1 */
1292 	for (i = 0; i < MAX_HPO_DP2_ENCODERS; i++) {
1293 		dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[i] = -1;
1294 	}
1295 
1296 	/* If an HPO stream encoder is allocated to a pipe, get the instance of it's allocated HPO Link encoder */
1297 	for (i = 0; i < MAX_PIPES; i++) {
1298 		current_pipe_context = &context->res_ctx.pipe_ctx[i];
1299 		if (current_pipe_context->stream &&
1300 			current_pipe_context->stream_res.hpo_dp_stream_enc &&
1301 			current_pipe_context->link_res.hpo_dp_link_enc &&
1302 			dc_is_dp_signal(current_pipe_context->stream->signal)) {
1303 				dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[current_pipe_context->stream_res.hpo_dp_stream_enc->inst] =
1304 					current_pipe_context->link_res.hpo_dp_link_enc->inst;
1305 			}
1306 	}
1307 }
1308 
1309 void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_state *context, struct dml_display_cfg_st *dml_dispcfg)
1310 {
1311 	int i = 0, j = 0, k = 0;
1312 	int disp_cfg_stream_location, disp_cfg_plane_location;
1313 	enum mall_stream_type stream_mall_type;
1314 	struct pipe_ctx *current_pipe_context;
1315 
1316 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1317 		dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[i] = false;
1318 		dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[i] = false;
1319 		dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id_valid[i] = false;
1320 		dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id_valid[i] = false;
1321 	}
1322 
1323 	//Generally these are set by referencing our latest BB/IP params in dcn32_resource.c file
1324 	dml_dispcfg->plane.GPUVMEnable = dml2->v20.dml_core_ctx.ip.gpuvm_enable;
1325 	dml_dispcfg->plane.GPUVMMaxPageTableLevels = dml2->v20.dml_core_ctx.ip.gpuvm_max_page_table_levels;
1326 	dml_dispcfg->plane.HostVMEnable = dml2->v20.dml_core_ctx.ip.hostvm_enable;
1327 	dml_dispcfg->plane.HostVMMaxPageTableLevels = dml2->v20.dml_core_ctx.ip.hostvm_max_page_table_levels;
1328 	if (dml2->v20.dml_core_ctx.ip.hostvm_enable)
1329 		dml2->v20.dml_core_ctx.policy.AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter;
1330 
1331 	dml2_populate_pipe_to_plane_index_mapping(dml2, context);
1332 	dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(dml2, context);
1333 
1334 	for (i = 0; i < context->stream_count; i++) {
1335 		current_pipe_context = NULL;
1336 		for (k = 0; k < MAX_PIPES; k++) {
1337 			/* find one pipe allocated to this stream for the purpose of getting
1338 			info about the link later */
1339 			if (context->streams[i] == context->res_ctx.pipe_ctx[k].stream) {
1340 				current_pipe_context = &context->res_ctx.pipe_ctx[k];
1341 				break;
1342 			}
1343 		}
1344 		disp_cfg_stream_location = map_stream_to_dml_display_cfg(dml2, context->streams[i], dml_dispcfg);
1345 		stream_mall_type = dc_state_get_stream_subvp_type(context, context->streams[i]);
1346 
1347 		if (disp_cfg_stream_location < 0)
1348 			disp_cfg_stream_location = dml_dispcfg->num_timings++;
1349 
1350 		ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1351 
1352 		populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_stream_location, context->streams[i]);
1353 		populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_stream_location, context->streams[i], current_pipe_context, dml2);
1354 		/*Call site for populate_dml_writeback_cfg_from_stream_state*/
1355 		populate_dml_writeback_cfg_from_stream_state(&dml_dispcfg->writeback,
1356 			disp_cfg_stream_location, context->streams[i]);
1357 
1358 		switch (context->streams[i]->debug.force_odm_combine_segments) {
1359 		case 2:
1360 			dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_stream_location] = dml_odm_use_policy_combine_2to1;
1361 			break;
1362 		case 4:
1363 			dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_stream_location] = dml_odm_use_policy_combine_4to1;
1364 			break;
1365 		default:
1366 			break;
1367 		}
1368 
1369 		dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[disp_cfg_stream_location] = context->streams[i]->stream_id;
1370 		dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[disp_cfg_stream_location] = true;
1371 
1372 		if (context->stream_status[i].plane_count == 0) {
1373 			disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
1374 
1375 			populate_dummy_dml_surface_cfg(&dml_dispcfg->surface, disp_cfg_plane_location, context->streams[i]);
1376 			populate_dummy_dml_plane_cfg(&dml_dispcfg->plane, disp_cfg_plane_location,
1377 						     context->streams[i], &dml2->v20.dml_core_ctx.soc);
1378 
1379 			dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location;
1380 
1381 			dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;
1382 		} else {
1383 			for (j = 0; j < context->stream_status[i].plane_count; j++) {
1384 				disp_cfg_plane_location = map_plane_to_dml_display_cfg(dml2,
1385 					context->stream_status[i].plane_states[j], context, dml_dispcfg, context->streams[i]->stream_id, j);
1386 
1387 				if (disp_cfg_plane_location < 0)
1388 					disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
1389 
1390 				ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1391 
1392 				populate_dml_surface_cfg_from_plane_state(dml2->v20.dml_core_ctx.project, &dml_dispcfg->surface, disp_cfg_plane_location, context->stream_status[i].plane_states[j]);
1393 				populate_dml_plane_cfg_from_plane_state(
1394 					&dml_dispcfg->plane, disp_cfg_plane_location,
1395 					context->stream_status[i].plane_states[j], context,
1396 					&dml2->v20.dml_core_ctx.soc);
1397 
1398 				if (stream_mall_type == SUBVP_MAIN) {
1399 					dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_sub_viewport;
1400 					dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_optimize;
1401 				} else if (stream_mall_type == SUBVP_PHANTOM) {
1402 					dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_phantom_pipe;
1403 					dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_disable;
1404 					dml2->v20.dml_core_ctx.policy.ImmediateFlipRequirement[disp_cfg_plane_location] = dml_immediate_flip_not_required;
1405 				} else {
1406 					dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_disable;
1407 					dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_optimize;
1408 				}
1409 
1410 				dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location;
1411 
1412 				if (get_plane_id(dml2, context, context->stream_status[i].plane_states[j], context->streams[i]->stream_id, j,
1413 					&dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id[disp_cfg_plane_location]))
1414 					dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;
1415 
1416 				if (j >= 1) {
1417 					populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_plane_location, context->streams[i]);
1418 					populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_plane_location, context->streams[i], current_pipe_context, dml2);
1419 					switch (context->streams[i]->debug.force_odm_combine_segments) {
1420 					case 2:
1421 						dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_2to1;
1422 						break;
1423 					case 4:
1424 						dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_4to1;
1425 						break;
1426 					default:
1427 						break;
1428 					}
1429 
1430 					if (stream_mall_type == SUBVP_MAIN)
1431 						dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_sub_viewport;
1432 					else if (stream_mall_type == SUBVP_PHANTOM)
1433 						dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_phantom_pipe;
1434 
1435 					dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[disp_cfg_plane_location] = context->streams[i]->stream_id;
1436 					dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[disp_cfg_plane_location] = true;
1437 
1438 					dml_dispcfg->num_timings++;
1439 				}
1440 			}
1441 		}
1442 	}
1443 
1444 	if (!dml2->config.use_native_pstate_optimization)
1445 		apply_legacy_svp_drr_settings(dml2, context, dml_dispcfg);
1446 }
1447 
1448 void dml2_update_pipe_ctx_dchub_regs(struct _vcs_dpi_dml_display_rq_regs_st *rq_regs,
1449 	struct _vcs_dpi_dml_display_dlg_regs_st *disp_dlg_regs,
1450 	struct _vcs_dpi_dml_display_ttu_regs_st *disp_ttu_regs,
1451 	struct pipe_ctx *out)
1452 {
1453 	memset(&out->rq_regs, 0, sizeof(out->rq_regs));
1454 	out->rq_regs.rq_regs_l.chunk_size = rq_regs->rq_regs_l.chunk_size;
1455 	out->rq_regs.rq_regs_l.min_chunk_size = rq_regs->rq_regs_l.min_chunk_size;
1456 	out->rq_regs.rq_regs_l.meta_chunk_size = rq_regs->rq_regs_l.meta_chunk_size;
1457 	out->rq_regs.rq_regs_l.min_meta_chunk_size = rq_regs->rq_regs_l.min_meta_chunk_size;
1458 	out->rq_regs.rq_regs_l.dpte_group_size = rq_regs->rq_regs_l.dpte_group_size;
1459 	out->rq_regs.rq_regs_l.mpte_group_size = rq_regs->rq_regs_l.mpte_group_size;
1460 	out->rq_regs.rq_regs_l.swath_height = rq_regs->rq_regs_l.swath_height;
1461 	out->rq_regs.rq_regs_l.pte_row_height_linear = rq_regs->rq_regs_l.pte_row_height_linear;
1462 
1463 	out->rq_regs.rq_regs_c.chunk_size = rq_regs->rq_regs_c.chunk_size;
1464 	out->rq_regs.rq_regs_c.min_chunk_size = rq_regs->rq_regs_c.min_chunk_size;
1465 	out->rq_regs.rq_regs_c.meta_chunk_size = rq_regs->rq_regs_c.meta_chunk_size;
1466 	out->rq_regs.rq_regs_c.min_meta_chunk_size = rq_regs->rq_regs_c.min_meta_chunk_size;
1467 	out->rq_regs.rq_regs_c.dpte_group_size = rq_regs->rq_regs_c.dpte_group_size;
1468 	out->rq_regs.rq_regs_c.mpte_group_size = rq_regs->rq_regs_c.mpte_group_size;
1469 	out->rq_regs.rq_regs_c.swath_height = rq_regs->rq_regs_c.swath_height;
1470 	out->rq_regs.rq_regs_c.pte_row_height_linear = rq_regs->rq_regs_c.pte_row_height_linear;
1471 
1472 	out->rq_regs.drq_expansion_mode = rq_regs->drq_expansion_mode;
1473 	out->rq_regs.prq_expansion_mode = rq_regs->prq_expansion_mode;
1474 	out->rq_regs.mrq_expansion_mode = rq_regs->mrq_expansion_mode;
1475 	out->rq_regs.crq_expansion_mode = rq_regs->crq_expansion_mode;
1476 	out->rq_regs.plane1_base_address = rq_regs->plane1_base_address;
1477 
1478 	memset(&out->dlg_regs, 0, sizeof(out->dlg_regs));
1479 	out->dlg_regs.refcyc_h_blank_end = disp_dlg_regs->refcyc_h_blank_end;
1480 	out->dlg_regs.dlg_vblank_end = disp_dlg_regs->dlg_vblank_end;
1481 	out->dlg_regs.min_dst_y_next_start = disp_dlg_regs->min_dst_y_next_start;
1482 	out->dlg_regs.refcyc_per_htotal = disp_dlg_regs->refcyc_per_htotal;
1483 	out->dlg_regs.refcyc_x_after_scaler = disp_dlg_regs->refcyc_x_after_scaler;
1484 	out->dlg_regs.dst_y_after_scaler = disp_dlg_regs->dst_y_after_scaler;
1485 	out->dlg_regs.dst_y_prefetch = disp_dlg_regs->dst_y_prefetch;
1486 	out->dlg_regs.dst_y_per_vm_vblank = disp_dlg_regs->dst_y_per_vm_vblank;
1487 	out->dlg_regs.dst_y_per_row_vblank = disp_dlg_regs->dst_y_per_row_vblank;
1488 	out->dlg_regs.dst_y_per_vm_flip = disp_dlg_regs->dst_y_per_vm_flip;
1489 	out->dlg_regs.dst_y_per_row_flip = disp_dlg_regs->dst_y_per_row_flip;
1490 	out->dlg_regs.ref_freq_to_pix_freq = disp_dlg_regs->ref_freq_to_pix_freq;
1491 	out->dlg_regs.vratio_prefetch = disp_dlg_regs->vratio_prefetch;
1492 	out->dlg_regs.vratio_prefetch_c = disp_dlg_regs->vratio_prefetch_c;
1493 	out->dlg_regs.refcyc_per_pte_group_vblank_l = disp_dlg_regs->refcyc_per_pte_group_vblank_l;
1494 	out->dlg_regs.refcyc_per_pte_group_vblank_c = disp_dlg_regs->refcyc_per_pte_group_vblank_c;
1495 	out->dlg_regs.refcyc_per_meta_chunk_vblank_l = disp_dlg_regs->refcyc_per_meta_chunk_vblank_l;
1496 	out->dlg_regs.refcyc_per_meta_chunk_vblank_c = disp_dlg_regs->refcyc_per_meta_chunk_vblank_c;
1497 	out->dlg_regs.refcyc_per_pte_group_flip_l = disp_dlg_regs->refcyc_per_pte_group_flip_l;
1498 	out->dlg_regs.refcyc_per_pte_group_flip_c = disp_dlg_regs->refcyc_per_pte_group_flip_c;
1499 	out->dlg_regs.refcyc_per_meta_chunk_flip_l = disp_dlg_regs->refcyc_per_meta_chunk_flip_l;
1500 	out->dlg_regs.refcyc_per_meta_chunk_flip_c = disp_dlg_regs->refcyc_per_meta_chunk_flip_c;
1501 	out->dlg_regs.dst_y_per_pte_row_nom_l = disp_dlg_regs->dst_y_per_pte_row_nom_l;
1502 	out->dlg_regs.dst_y_per_pte_row_nom_c = disp_dlg_regs->dst_y_per_pte_row_nom_c;
1503 	out->dlg_regs.refcyc_per_pte_group_nom_l = disp_dlg_regs->refcyc_per_pte_group_nom_l;
1504 	out->dlg_regs.refcyc_per_pte_group_nom_c = disp_dlg_regs->refcyc_per_pte_group_nom_c;
1505 	out->dlg_regs.dst_y_per_meta_row_nom_l = disp_dlg_regs->dst_y_per_meta_row_nom_l;
1506 	out->dlg_regs.dst_y_per_meta_row_nom_c = disp_dlg_regs->dst_y_per_meta_row_nom_c;
1507 	out->dlg_regs.refcyc_per_meta_chunk_nom_l = disp_dlg_regs->refcyc_per_meta_chunk_nom_l;
1508 	out->dlg_regs.refcyc_per_meta_chunk_nom_c = disp_dlg_regs->refcyc_per_meta_chunk_nom_c;
1509 	out->dlg_regs.refcyc_per_line_delivery_pre_l = disp_dlg_regs->refcyc_per_line_delivery_pre_l;
1510 	out->dlg_regs.refcyc_per_line_delivery_pre_c = disp_dlg_regs->refcyc_per_line_delivery_pre_c;
1511 	out->dlg_regs.refcyc_per_line_delivery_l = disp_dlg_regs->refcyc_per_line_delivery_l;
1512 	out->dlg_regs.refcyc_per_line_delivery_c = disp_dlg_regs->refcyc_per_line_delivery_c;
1513 	out->dlg_regs.refcyc_per_vm_group_vblank = disp_dlg_regs->refcyc_per_vm_group_vblank;
1514 	out->dlg_regs.refcyc_per_vm_group_flip = disp_dlg_regs->refcyc_per_vm_group_flip;
1515 	out->dlg_regs.refcyc_per_vm_req_vblank = disp_dlg_regs->refcyc_per_vm_req_vblank;
1516 	out->dlg_regs.refcyc_per_vm_req_flip = disp_dlg_regs->refcyc_per_vm_req_flip;
1517 	out->dlg_regs.dst_y_offset_cur0 = disp_dlg_regs->dst_y_offset_cur0;
1518 	out->dlg_regs.chunk_hdl_adjust_cur0 = disp_dlg_regs->chunk_hdl_adjust_cur0;
1519 	out->dlg_regs.dst_y_offset_cur1 = disp_dlg_regs->dst_y_offset_cur1;
1520 	out->dlg_regs.chunk_hdl_adjust_cur1 = disp_dlg_regs->chunk_hdl_adjust_cur1;
1521 	out->dlg_regs.vready_after_vcount0 = disp_dlg_regs->vready_after_vcount0;
1522 	out->dlg_regs.dst_y_delta_drq_limit = disp_dlg_regs->dst_y_delta_drq_limit;
1523 	out->dlg_regs.refcyc_per_vm_dmdata = disp_dlg_regs->refcyc_per_vm_dmdata;
1524 	out->dlg_regs.dmdata_dl_delta = disp_dlg_regs->dmdata_dl_delta;
1525 
1526 	memset(&out->ttu_regs, 0, sizeof(out->ttu_regs));
1527 	out->ttu_regs.qos_level_low_wm = disp_ttu_regs->qos_level_low_wm;
1528 	out->ttu_regs.qos_level_high_wm = disp_ttu_regs->qos_level_high_wm;
1529 	out->ttu_regs.min_ttu_vblank = disp_ttu_regs->min_ttu_vblank;
1530 	out->ttu_regs.qos_level_flip = disp_ttu_regs->qos_level_flip;
1531 	out->ttu_regs.refcyc_per_req_delivery_l = disp_ttu_regs->refcyc_per_req_delivery_l;
1532 	out->ttu_regs.refcyc_per_req_delivery_c = disp_ttu_regs->refcyc_per_req_delivery_c;
1533 	out->ttu_regs.refcyc_per_req_delivery_cur0 = disp_ttu_regs->refcyc_per_req_delivery_cur0;
1534 	out->ttu_regs.refcyc_per_req_delivery_cur1 = disp_ttu_regs->refcyc_per_req_delivery_cur1;
1535 	out->ttu_regs.refcyc_per_req_delivery_pre_l = disp_ttu_regs->refcyc_per_req_delivery_pre_l;
1536 	out->ttu_regs.refcyc_per_req_delivery_pre_c = disp_ttu_regs->refcyc_per_req_delivery_pre_c;
1537 	out->ttu_regs.refcyc_per_req_delivery_pre_cur0 = disp_ttu_regs->refcyc_per_req_delivery_pre_cur0;
1538 	out->ttu_regs.refcyc_per_req_delivery_pre_cur1 = disp_ttu_regs->refcyc_per_req_delivery_pre_cur1;
1539 	out->ttu_regs.qos_level_fixed_l = disp_ttu_regs->qos_level_fixed_l;
1540 	out->ttu_regs.qos_level_fixed_c = disp_ttu_regs->qos_level_fixed_c;
1541 	out->ttu_regs.qos_level_fixed_cur0 = disp_ttu_regs->qos_level_fixed_cur0;
1542 	out->ttu_regs.qos_level_fixed_cur1 = disp_ttu_regs->qos_level_fixed_cur1;
1543 	out->ttu_regs.qos_ramp_disable_l = disp_ttu_regs->qos_ramp_disable_l;
1544 	out->ttu_regs.qos_ramp_disable_c = disp_ttu_regs->qos_ramp_disable_c;
1545 	out->ttu_regs.qos_ramp_disable_cur0 = disp_ttu_regs->qos_ramp_disable_cur0;
1546 	out->ttu_regs.qos_ramp_disable_cur1 = disp_ttu_regs->qos_ramp_disable_cur1;
1547 }
1548