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
dml2_init_ip_params(struct dml2_context * dml2,const struct dc * in_dc,struct ip_params_st * out)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
dml2_init_socbb_params(struct dml2_context * dml2,const struct dc * in_dc,struct soc_bounding_box_st * out)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
dml2_init_soc_states(struct dml2_context * dml2,const struct dc * in_dc,const struct soc_bounding_box_st * in_bbox,struct soc_states_st * out)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].dscclk_mhz = max_dispclk_mhz / 3.0;
594 p->out_states->state_array[i].phyclk_mhz = max_phyclk_mhz;
595 p->out_states->state_array[i].dtbclk_mhz = max_dtbclk_mhz;
596
597 /* Dependent states. */
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
dml2_translate_ip_params(const struct dc * in,struct ip_params_st * out)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
dml2_translate_socbb_params(const struct dc * in,struct soc_bounding_box_st * out)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
dml2_translate_soc_states(const struct dc * dc,struct soc_states_st * out,int num_states)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
populate_dml_timing_cfg_from_stream_state(struct dml_timing_cfg_st * out,unsigned int location,const struct dc_stream_state * in)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
populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st * out,unsigned int location,const struct dc_stream_state * in,const struct pipe_ctx * pipe,struct dml2_context * dml2)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
populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st * out,unsigned int location,const struct dc_stream_state * in)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] = 1;
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
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)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_ABGR16161616:
957 case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F:
958 case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
959 out->SourcePixelFormat[location] = dml_444_64;
960 break;
961 case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
962 case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
963 out->SourcePixelFormat[location] = dml_444_16;
964 break;
965 case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS:
966 out->SourcePixelFormat[location] = dml_444_8;
967 break;
968 case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA:
969 out->SourcePixelFormat[location] = dml_rgbe_alpha;
970 break;
971 default:
972 out->SourcePixelFormat[location] = dml_444_32;
973 break;
974 }
975 }
976
get_scaler_data_for_plane(const struct dc_plane_state * in,struct dc_state * context)977 static struct scaler_data *get_scaler_data_for_plane(
978 const struct dc_plane_state *in,
979 struct dc_state *context)
980 {
981 int i;
982 struct pipe_ctx *temp_pipe = &context->res_ctx.temp_pipe;
983
984 memset(temp_pipe, 0, sizeof(struct pipe_ctx));
985
986 for (i = 0; i < MAX_PIPES; i++) {
987 const struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
988
989 if (pipe->plane_state == in && !pipe->prev_odm_pipe) {
990 temp_pipe->stream = pipe->stream;
991 temp_pipe->plane_state = pipe->plane_state;
992 temp_pipe->plane_res.scl_data.taps = pipe->plane_res.scl_data.taps;
993 temp_pipe->stream_res = pipe->stream_res;
994 resource_build_scaling_params(temp_pipe);
995 break;
996 }
997 }
998
999 ASSERT(i < MAX_PIPES);
1000 return &temp_pipe->plane_res.scl_data;
1001 }
1002
populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st * out,unsigned int location,const struct dc_stream_state * in,const struct soc_bounding_box_st * soc)1003 static void populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st *out, unsigned int location,
1004 const struct dc_stream_state *in,
1005 const struct soc_bounding_box_st *soc)
1006 {
1007 dml_uint_t width, height;
1008
1009 if (in->timing.h_addressable > 3840)
1010 width = 3840;
1011 else
1012 width = in->timing.h_addressable; // 4K max
1013
1014 if (in->timing.v_addressable > 2160)
1015 height = 2160;
1016 else
1017 height = in->timing.v_addressable; // 4K max
1018
1019 out->CursorBPP[location] = dml_cur_32bit;
1020 out->CursorWidth[location] = 256;
1021
1022 out->GPUVMMinPageSizeKBytes[location] = soc->gpuvm_min_page_size_kbytes;
1023
1024 out->ViewportWidth[location] = width;
1025 out->ViewportHeight[location] = height;
1026 out->ViewportStationary[location] = false;
1027 out->ViewportWidthChroma[location] = 0;
1028 out->ViewportHeightChroma[location] = 0;
1029 out->ViewportXStart[location] = 0;
1030 out->ViewportXStartC[location] = 0;
1031 out->ViewportYStart[location] = 0;
1032 out->ViewportYStartC[location] = 0;
1033
1034 out->ScalerEnabled[location] = false;
1035 out->HRatio[location] = 1.0;
1036 out->VRatio[location] = 1.0;
1037 out->HRatioChroma[location] = 0;
1038 out->VRatioChroma[location] = 0;
1039 out->HTaps[location] = 1;
1040 out->VTaps[location] = 1;
1041 out->HTapsChroma[location] = 0;
1042 out->VTapsChroma[location] = 0;
1043 out->SourceScan[location] = dml_rotation_0;
1044 out->ScalerRecoutWidth[location] = width;
1045
1046 out->LBBitPerPixel[location] = 57;
1047
1048 out->DynamicMetadataEnable[location] = false;
1049
1050 out->NumberOfCursors[location] = 1;
1051 out->UseMALLForStaticScreen[location] = dml_use_mall_static_screen_disable;
1052 out->UseMALLForPStateChange[location] = dml_use_mall_pstate_change_disable;
1053
1054 out->DETSizeOverride[location] = 256;
1055
1056 out->ScalerEnabled[location] = false;
1057 }
1058
populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st * out,unsigned int location,const struct dc_plane_state * in,struct dc_state * context,const struct soc_bounding_box_st * soc)1059 static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out, unsigned int location,
1060 const struct dc_plane_state *in, struct dc_state *context,
1061 const struct soc_bounding_box_st *soc)
1062 {
1063 struct scaler_data *scaler_data = get_scaler_data_for_plane(in, context);
1064
1065 out->CursorBPP[location] = dml_cur_32bit;
1066 out->CursorWidth[location] = 256;
1067
1068 out->GPUVMMinPageSizeKBytes[location] = soc->gpuvm_min_page_size_kbytes;
1069
1070 out->ViewportWidth[location] = scaler_data->viewport.width;
1071 out->ViewportHeight[location] = scaler_data->viewport.height;
1072 out->ViewportWidthChroma[location] = scaler_data->viewport_c.width;
1073 out->ViewportHeightChroma[location] = scaler_data->viewport_c.height;
1074 out->ViewportXStart[location] = scaler_data->viewport.x;
1075 out->ViewportYStart[location] = scaler_data->viewport.y;
1076 out->ViewportXStartC[location] = scaler_data->viewport_c.x;
1077 out->ViewportYStartC[location] = scaler_data->viewport_c.y;
1078 out->ViewportStationary[location] = false;
1079
1080 out->ScalerEnabled[location] = scaler_data->ratios.horz.value != dc_fixpt_one.value ||
1081 scaler_data->ratios.horz_c.value != dc_fixpt_one.value ||
1082 scaler_data->ratios.vert.value != dc_fixpt_one.value ||
1083 scaler_data->ratios.vert_c.value != dc_fixpt_one.value;
1084
1085 /* Current driver code base uses LBBitPerPixel as 57. There is a discrepancy
1086 * from the HW/DML teams about this value. Initialize LBBitPerPixel with the
1087 * value current used in Navi3x .
1088 */
1089
1090 out->LBBitPerPixel[location] = 57;
1091
1092 if (out->ScalerEnabled[location] == false) {
1093 out->HRatio[location] = 1;
1094 out->HRatioChroma[location] = 1;
1095 out->VRatio[location] = 1;
1096 out->VRatioChroma[location] = 1;
1097 } else {
1098 /* Follow the original dml_wrapper.c code direction to fix scaling issues */
1099 out->HRatio[location] = (dml_float_t)scaler_data->ratios.horz.value / (1ULL << 32);
1100 out->HRatioChroma[location] = (dml_float_t)scaler_data->ratios.horz_c.value / (1ULL << 32);
1101 out->VRatio[location] = (dml_float_t)scaler_data->ratios.vert.value / (1ULL << 32);
1102 out->VRatioChroma[location] = (dml_float_t)scaler_data->ratios.vert_c.value / (1ULL << 32);
1103 }
1104
1105 if (!scaler_data->taps.h_taps) {
1106 out->HTaps[location] = 1;
1107 out->HTapsChroma[location] = 1;
1108 } else {
1109 out->HTaps[location] = scaler_data->taps.h_taps;
1110 out->HTapsChroma[location] = scaler_data->taps.h_taps_c;
1111 }
1112 if (!scaler_data->taps.v_taps) {
1113 out->VTaps[location] = 1;
1114 out->VTapsChroma[location] = 1;
1115 } else {
1116 out->VTaps[location] = scaler_data->taps.v_taps;
1117 out->VTapsChroma[location] = scaler_data->taps.v_taps_c;
1118 }
1119
1120 out->SourceScan[location] = (enum dml_rotation_angle)in->rotation;
1121 out->ScalerRecoutWidth[location] = in->dst_rect.width;
1122
1123 out->DynamicMetadataEnable[location] = false;
1124 out->DynamicMetadataLinesBeforeActiveRequired[location] = 0;
1125 out->DynamicMetadataTransmittedBytes[location] = 0;
1126
1127 out->NumberOfCursors[location] = 1;
1128 }
1129
map_stream_to_dml_display_cfg(const struct dml2_context * dml2,const struct dc_stream_state * stream,const struct dml_display_cfg_st * dml_dispcfg)1130 static unsigned int map_stream_to_dml_display_cfg(const struct dml2_context *dml2,
1131 const struct dc_stream_state *stream, const struct dml_display_cfg_st *dml_dispcfg)
1132 {
1133 int i = 0;
1134 int location = -1;
1135
1136 for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1137 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) {
1138 location = i;
1139 break;
1140 }
1141 }
1142
1143 return location;
1144 }
1145
get_plane_id(struct dml2_context * dml2,const struct dc_state * context,const struct dc_plane_state * plane,unsigned int stream_id,unsigned int plane_index,unsigned int * plane_id)1146 static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *context, const struct dc_plane_state *plane,
1147 unsigned int stream_id, unsigned int plane_index, unsigned int *plane_id)
1148 {
1149 int i, j;
1150 bool is_plane_duplicate = dml2->v20.scratch.plane_duplicate_exists;
1151
1152 if (!plane_id)
1153 return false;
1154
1155 for (i = 0; i < context->stream_count; i++) {
1156 if (context->streams[i]->stream_id == stream_id) {
1157 for (j = 0; j < context->stream_status[i].plane_count; j++) {
1158 if (context->stream_status[i].plane_states[j] == plane &&
1159 (!is_plane_duplicate || (j == plane_index))) {
1160 *plane_id = (i << 16) | j;
1161 return true;
1162 }
1163 }
1164 }
1165 }
1166
1167 return false;
1168 }
1169
map_plane_to_dml_display_cfg(const struct dml2_context * dml2,const struct dc_plane_state * plane,const struct dc_state * context,const struct dml_display_cfg_st * dml_dispcfg,unsigned int stream_id,int plane_index)1170 static unsigned int map_plane_to_dml_display_cfg(const struct dml2_context *dml2, const struct dc_plane_state *plane,
1171 const struct dc_state *context, const struct dml_display_cfg_st *dml_dispcfg, unsigned int stream_id, int plane_index)
1172 {
1173 unsigned int plane_id;
1174 int i = 0;
1175 int location = -1;
1176
1177 if (!get_plane_id(context->bw_ctx.dml2, context, plane, stream_id, plane_index, &plane_id)) {
1178 ASSERT(false);
1179 return -1;
1180 }
1181
1182 for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1183 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) {
1184 location = i;
1185 break;
1186 }
1187 }
1188
1189 return location;
1190 }
1191
apply_legacy_svp_drr_settings(struct dml2_context * dml2,const struct dc_state * state,struct dml_display_cfg_st * dml_dispcfg)1192 static void apply_legacy_svp_drr_settings(struct dml2_context *dml2, const struct dc_state *state, struct dml_display_cfg_st *dml_dispcfg)
1193 {
1194 int i;
1195
1196 if (state->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
1197 ASSERT(state->stream_count == 1);
1198 dml_dispcfg->timing.DRRDisplay[0] = true;
1199 } else if (state->bw_ctx.bw.dcn.legacy_svp_drr_stream_index_valid) {
1200
1201 for (i = 0; i < dml_dispcfg->num_timings; i++) {
1202 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)
1203 dml_dispcfg->timing.DRRDisplay[i] = true;
1204 }
1205 }
1206 }
1207
dml2_populate_pipe_to_plane_index_mapping(struct dml2_context * dml2,struct dc_state * state)1208 static void dml2_populate_pipe_to_plane_index_mapping(struct dml2_context *dml2, struct dc_state *state)
1209 {
1210 unsigned int i;
1211 unsigned int pipe_index = 0;
1212 unsigned int plane_index = 0;
1213 struct dml2_dml_to_dc_pipe_mapping *dml_to_dc_pipe_mapping = &dml2->v20.scratch.dml_to_dc_pipe_mapping;
1214
1215 for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1216 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[i] = false;
1217 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index[i] = 0;
1218 }
1219
1220 for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1221 struct pipe_ctx *pipe = &state->res_ctx.pipe_ctx[i];
1222
1223 if (!pipe || !pipe->stream || !pipe->plane_state)
1224 continue;
1225
1226 while (pipe) {
1227 pipe_index = pipe->pipe_idx;
1228
1229 if (pipe->stream && dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[pipe_index] == false) {
1230 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index[pipe_index] = plane_index;
1231 plane_index++;
1232 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[pipe_index] = true;
1233 }
1234
1235 pipe = pipe->bottom_pipe;
1236 }
1237
1238 plane_index = 0;
1239 }
1240 }
1241
populate_dml_writeback_cfg_from_stream_state(struct dml_writeback_cfg_st * out,unsigned int location,const struct dc_stream_state * in)1242 static void populate_dml_writeback_cfg_from_stream_state(struct dml_writeback_cfg_st *out,
1243 unsigned int location, const struct dc_stream_state *in)
1244 {
1245 if (in->num_wb_info > 0) {
1246 for (int i = 0; i < __DML_NUM_DMB__; i++) {
1247 const struct dc_writeback_info *wb_info = &in->writeback_info[i];
1248 /*current dml support 1 dwb per stream, limitation*/
1249 if (wb_info->wb_enabled) {
1250 out->WritebackEnable[location] = wb_info->wb_enabled;
1251 out->ActiveWritebacksPerSurface[location] = wb_info->dwb_params.cnv_params.src_width;
1252 out->WritebackDestinationWidth[location] = wb_info->dwb_params.dest_width;
1253 out->WritebackDestinationHeight[location] = wb_info->dwb_params.dest_height;
1254
1255 out->WritebackSourceWidth[location] = wb_info->dwb_params.cnv_params.crop_en ?
1256 wb_info->dwb_params.cnv_params.crop_width :
1257 wb_info->dwb_params.cnv_params.src_width;
1258
1259 out->WritebackSourceHeight[location] = wb_info->dwb_params.cnv_params.crop_en ?
1260 wb_info->dwb_params.cnv_params.crop_height :
1261 wb_info->dwb_params.cnv_params.src_height;
1262 /*current design does not have chroma scaling, need to follow up*/
1263 out->WritebackHTaps[location] = wb_info->dwb_params.scaler_taps.h_taps > 0 ?
1264 wb_info->dwb_params.scaler_taps.h_taps : 1;
1265 out->WritebackVTaps[location] = wb_info->dwb_params.scaler_taps.v_taps > 0 ?
1266 wb_info->dwb_params.scaler_taps.v_taps : 1;
1267
1268 out->WritebackHRatio[location] = wb_info->dwb_params.cnv_params.crop_en ?
1269 (double)wb_info->dwb_params.cnv_params.crop_width /
1270 (double)wb_info->dwb_params.dest_width :
1271 (double)wb_info->dwb_params.cnv_params.src_width /
1272 (double)wb_info->dwb_params.dest_width;
1273 out->WritebackVRatio[location] = wb_info->dwb_params.cnv_params.crop_en ?
1274 (double)wb_info->dwb_params.cnv_params.crop_height /
1275 (double)wb_info->dwb_params.dest_height :
1276 (double)wb_info->dwb_params.cnv_params.src_height /
1277 (double)wb_info->dwb_params.dest_height;
1278 }
1279 }
1280 }
1281 }
1282
dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(struct dml2_context * dml2,struct dc_state * context)1283 static void dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(struct dml2_context *dml2, struct dc_state *context)
1284 {
1285 int i;
1286 struct pipe_ctx *current_pipe_context;
1287
1288 /* Scratch gets reset to zero in dml, but link encoder instance can be zero, so reset to -1 */
1289 for (i = 0; i < MAX_HPO_DP2_ENCODERS; i++) {
1290 dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[i] = -1;
1291 }
1292
1293 /* If an HPO stream encoder is allocated to a pipe, get the instance of it's allocated HPO Link encoder */
1294 for (i = 0; i < MAX_PIPES; i++) {
1295 current_pipe_context = &context->res_ctx.pipe_ctx[i];
1296 if (current_pipe_context->stream &&
1297 current_pipe_context->stream_res.hpo_dp_stream_enc &&
1298 current_pipe_context->link_res.hpo_dp_link_enc &&
1299 dc_is_dp_signal(current_pipe_context->stream->signal)) {
1300 dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[current_pipe_context->stream_res.hpo_dp_stream_enc->inst] =
1301 current_pipe_context->link_res.hpo_dp_link_enc->inst;
1302 }
1303 }
1304 }
1305
map_dc_state_into_dml_display_cfg(struct dml2_context * dml2,struct dc_state * context,struct dml_display_cfg_st * dml_dispcfg)1306 void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_state *context, struct dml_display_cfg_st *dml_dispcfg)
1307 {
1308 int i = 0, j = 0, k = 0;
1309 int disp_cfg_stream_location, disp_cfg_plane_location;
1310 enum mall_stream_type stream_mall_type;
1311 struct pipe_ctx *current_pipe_context;
1312
1313 for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1314 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[i] = false;
1315 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[i] = false;
1316 dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id_valid[i] = false;
1317 dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id_valid[i] = false;
1318 }
1319
1320 //Generally these are set by referencing our latest BB/IP params in dcn32_resource.c file
1321 dml_dispcfg->plane.GPUVMEnable = dml2->v20.dml_core_ctx.ip.gpuvm_enable;
1322 dml_dispcfg->plane.GPUVMMaxPageTableLevels = dml2->v20.dml_core_ctx.ip.gpuvm_max_page_table_levels;
1323 dml_dispcfg->plane.HostVMEnable = dml2->v20.dml_core_ctx.ip.hostvm_enable;
1324 dml_dispcfg->plane.HostVMMaxPageTableLevels = dml2->v20.dml_core_ctx.ip.hostvm_max_page_table_levels;
1325 if (dml2->v20.dml_core_ctx.ip.hostvm_enable)
1326 dml2->v20.dml_core_ctx.policy.AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter;
1327
1328 dml2_populate_pipe_to_plane_index_mapping(dml2, context);
1329 dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(dml2, context);
1330
1331 for (i = 0; i < context->stream_count; i++) {
1332 current_pipe_context = NULL;
1333 for (k = 0; k < MAX_PIPES; k++) {
1334 /* find one pipe allocated to this stream for the purpose of getting
1335 info about the link later */
1336 if (context->streams[i] == context->res_ctx.pipe_ctx[k].stream) {
1337 current_pipe_context = &context->res_ctx.pipe_ctx[k];
1338 break;
1339 }
1340 }
1341 disp_cfg_stream_location = map_stream_to_dml_display_cfg(dml2, context->streams[i], dml_dispcfg);
1342 stream_mall_type = dc_state_get_stream_subvp_type(context, context->streams[i]);
1343
1344 if (disp_cfg_stream_location < 0)
1345 disp_cfg_stream_location = dml_dispcfg->num_timings++;
1346
1347 ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1348
1349 populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_stream_location, context->streams[i]);
1350 populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_stream_location, context->streams[i], current_pipe_context, dml2);
1351 /*Call site for populate_dml_writeback_cfg_from_stream_state*/
1352 populate_dml_writeback_cfg_from_stream_state(&dml_dispcfg->writeback,
1353 disp_cfg_stream_location, context->streams[i]);
1354
1355 switch (context->streams[i]->debug.force_odm_combine_segments) {
1356 case 2:
1357 dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_stream_location] = dml_odm_use_policy_combine_2to1;
1358 break;
1359 case 4:
1360 dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_stream_location] = dml_odm_use_policy_combine_4to1;
1361 break;
1362 default:
1363 break;
1364 }
1365
1366 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[disp_cfg_stream_location] = context->streams[i]->stream_id;
1367 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[disp_cfg_stream_location] = true;
1368
1369 if (context->stream_status[i].plane_count == 0) {
1370 disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
1371
1372 populate_dummy_dml_surface_cfg(&dml_dispcfg->surface, disp_cfg_plane_location, context->streams[i]);
1373 populate_dummy_dml_plane_cfg(&dml_dispcfg->plane, disp_cfg_plane_location,
1374 context->streams[i], &dml2->v20.dml_core_ctx.soc);
1375
1376 dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location;
1377
1378 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;
1379 } else {
1380 for (j = 0; j < context->stream_status[i].plane_count; j++) {
1381 disp_cfg_plane_location = map_plane_to_dml_display_cfg(dml2,
1382 context->stream_status[i].plane_states[j], context, dml_dispcfg, context->streams[i]->stream_id, j);
1383
1384 if (disp_cfg_plane_location < 0)
1385 disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
1386
1387 ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1388
1389 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]);
1390 populate_dml_plane_cfg_from_plane_state(
1391 &dml_dispcfg->plane, disp_cfg_plane_location,
1392 context->stream_status[i].plane_states[j], context,
1393 &dml2->v20.dml_core_ctx.soc);
1394
1395 if (stream_mall_type == SUBVP_MAIN) {
1396 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_sub_viewport;
1397 dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_optimize;
1398 } else if (stream_mall_type == SUBVP_PHANTOM) {
1399 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_phantom_pipe;
1400 dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_disable;
1401 dml2->v20.dml_core_ctx.policy.ImmediateFlipRequirement[disp_cfg_plane_location] = dml_immediate_flip_not_required;
1402 } else {
1403 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_disable;
1404 dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_optimize;
1405 }
1406
1407 dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location;
1408
1409 if (get_plane_id(dml2, context, context->stream_status[i].plane_states[j], context->streams[i]->stream_id, j,
1410 &dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id[disp_cfg_plane_location]))
1411 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;
1412
1413 if (j >= 1) {
1414 populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_plane_location, context->streams[i]);
1415 populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_plane_location, context->streams[i], current_pipe_context, dml2);
1416 switch (context->streams[i]->debug.force_odm_combine_segments) {
1417 case 2:
1418 dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_2to1;
1419 break;
1420 case 4:
1421 dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_4to1;
1422 break;
1423 default:
1424 break;
1425 }
1426
1427 if (stream_mall_type == SUBVP_MAIN)
1428 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_sub_viewport;
1429 else if (stream_mall_type == SUBVP_PHANTOM)
1430 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_phantom_pipe;
1431
1432 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[disp_cfg_plane_location] = context->streams[i]->stream_id;
1433 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[disp_cfg_plane_location] = true;
1434
1435 dml_dispcfg->num_timings++;
1436 }
1437 }
1438 }
1439 }
1440
1441 if (!dml2->config.use_native_pstate_optimization)
1442 apply_legacy_svp_drr_settings(dml2, context, dml_dispcfg);
1443 }
1444
dml2_update_pipe_ctx_dchub_regs(struct _vcs_dpi_dml_display_rq_regs_st * rq_regs,struct _vcs_dpi_dml_display_dlg_regs_st * disp_dlg_regs,struct _vcs_dpi_dml_display_ttu_regs_st * disp_ttu_regs,struct pipe_ctx * out)1445 void dml2_update_pipe_ctx_dchub_regs(struct _vcs_dpi_dml_display_rq_regs_st *rq_regs,
1446 struct _vcs_dpi_dml_display_dlg_regs_st *disp_dlg_regs,
1447 struct _vcs_dpi_dml_display_ttu_regs_st *disp_ttu_regs,
1448 struct pipe_ctx *out)
1449 {
1450 memset(&out->rq_regs, 0, sizeof(out->rq_regs));
1451 out->rq_regs.rq_regs_l.chunk_size = rq_regs->rq_regs_l.chunk_size;
1452 out->rq_regs.rq_regs_l.min_chunk_size = rq_regs->rq_regs_l.min_chunk_size;
1453 out->rq_regs.rq_regs_l.meta_chunk_size = rq_regs->rq_regs_l.meta_chunk_size;
1454 out->rq_regs.rq_regs_l.min_meta_chunk_size = rq_regs->rq_regs_l.min_meta_chunk_size;
1455 out->rq_regs.rq_regs_l.dpte_group_size = rq_regs->rq_regs_l.dpte_group_size;
1456 out->rq_regs.rq_regs_l.mpte_group_size = rq_regs->rq_regs_l.mpte_group_size;
1457 out->rq_regs.rq_regs_l.swath_height = rq_regs->rq_regs_l.swath_height;
1458 out->rq_regs.rq_regs_l.pte_row_height_linear = rq_regs->rq_regs_l.pte_row_height_linear;
1459
1460 out->rq_regs.rq_regs_c.chunk_size = rq_regs->rq_regs_c.chunk_size;
1461 out->rq_regs.rq_regs_c.min_chunk_size = rq_regs->rq_regs_c.min_chunk_size;
1462 out->rq_regs.rq_regs_c.meta_chunk_size = rq_regs->rq_regs_c.meta_chunk_size;
1463 out->rq_regs.rq_regs_c.min_meta_chunk_size = rq_regs->rq_regs_c.min_meta_chunk_size;
1464 out->rq_regs.rq_regs_c.dpte_group_size = rq_regs->rq_regs_c.dpte_group_size;
1465 out->rq_regs.rq_regs_c.mpte_group_size = rq_regs->rq_regs_c.mpte_group_size;
1466 out->rq_regs.rq_regs_c.swath_height = rq_regs->rq_regs_c.swath_height;
1467 out->rq_regs.rq_regs_c.pte_row_height_linear = rq_regs->rq_regs_c.pte_row_height_linear;
1468
1469 out->rq_regs.drq_expansion_mode = rq_regs->drq_expansion_mode;
1470 out->rq_regs.prq_expansion_mode = rq_regs->prq_expansion_mode;
1471 out->rq_regs.mrq_expansion_mode = rq_regs->mrq_expansion_mode;
1472 out->rq_regs.crq_expansion_mode = rq_regs->crq_expansion_mode;
1473 out->rq_regs.plane1_base_address = rq_regs->plane1_base_address;
1474
1475 memset(&out->dlg_regs, 0, sizeof(out->dlg_regs));
1476 out->dlg_regs.refcyc_h_blank_end = disp_dlg_regs->refcyc_h_blank_end;
1477 out->dlg_regs.dlg_vblank_end = disp_dlg_regs->dlg_vblank_end;
1478 out->dlg_regs.min_dst_y_next_start = disp_dlg_regs->min_dst_y_next_start;
1479 out->dlg_regs.refcyc_per_htotal = disp_dlg_regs->refcyc_per_htotal;
1480 out->dlg_regs.refcyc_x_after_scaler = disp_dlg_regs->refcyc_x_after_scaler;
1481 out->dlg_regs.dst_y_after_scaler = disp_dlg_regs->dst_y_after_scaler;
1482 out->dlg_regs.dst_y_prefetch = disp_dlg_regs->dst_y_prefetch;
1483 out->dlg_regs.dst_y_per_vm_vblank = disp_dlg_regs->dst_y_per_vm_vblank;
1484 out->dlg_regs.dst_y_per_row_vblank = disp_dlg_regs->dst_y_per_row_vblank;
1485 out->dlg_regs.dst_y_per_vm_flip = disp_dlg_regs->dst_y_per_vm_flip;
1486 out->dlg_regs.dst_y_per_row_flip = disp_dlg_regs->dst_y_per_row_flip;
1487 out->dlg_regs.ref_freq_to_pix_freq = disp_dlg_regs->ref_freq_to_pix_freq;
1488 out->dlg_regs.vratio_prefetch = disp_dlg_regs->vratio_prefetch;
1489 out->dlg_regs.vratio_prefetch_c = disp_dlg_regs->vratio_prefetch_c;
1490 out->dlg_regs.refcyc_per_pte_group_vblank_l = disp_dlg_regs->refcyc_per_pte_group_vblank_l;
1491 out->dlg_regs.refcyc_per_pte_group_vblank_c = disp_dlg_regs->refcyc_per_pte_group_vblank_c;
1492 out->dlg_regs.refcyc_per_meta_chunk_vblank_l = disp_dlg_regs->refcyc_per_meta_chunk_vblank_l;
1493 out->dlg_regs.refcyc_per_meta_chunk_vblank_c = disp_dlg_regs->refcyc_per_meta_chunk_vblank_c;
1494 out->dlg_regs.refcyc_per_pte_group_flip_l = disp_dlg_regs->refcyc_per_pte_group_flip_l;
1495 out->dlg_regs.refcyc_per_pte_group_flip_c = disp_dlg_regs->refcyc_per_pte_group_flip_c;
1496 out->dlg_regs.refcyc_per_meta_chunk_flip_l = disp_dlg_regs->refcyc_per_meta_chunk_flip_l;
1497 out->dlg_regs.refcyc_per_meta_chunk_flip_c = disp_dlg_regs->refcyc_per_meta_chunk_flip_c;
1498 out->dlg_regs.dst_y_per_pte_row_nom_l = disp_dlg_regs->dst_y_per_pte_row_nom_l;
1499 out->dlg_regs.dst_y_per_pte_row_nom_c = disp_dlg_regs->dst_y_per_pte_row_nom_c;
1500 out->dlg_regs.refcyc_per_pte_group_nom_l = disp_dlg_regs->refcyc_per_pte_group_nom_l;
1501 out->dlg_regs.refcyc_per_pte_group_nom_c = disp_dlg_regs->refcyc_per_pte_group_nom_c;
1502 out->dlg_regs.dst_y_per_meta_row_nom_l = disp_dlg_regs->dst_y_per_meta_row_nom_l;
1503 out->dlg_regs.dst_y_per_meta_row_nom_c = disp_dlg_regs->dst_y_per_meta_row_nom_c;
1504 out->dlg_regs.refcyc_per_meta_chunk_nom_l = disp_dlg_regs->refcyc_per_meta_chunk_nom_l;
1505 out->dlg_regs.refcyc_per_meta_chunk_nom_c = disp_dlg_regs->refcyc_per_meta_chunk_nom_c;
1506 out->dlg_regs.refcyc_per_line_delivery_pre_l = disp_dlg_regs->refcyc_per_line_delivery_pre_l;
1507 out->dlg_regs.refcyc_per_line_delivery_pre_c = disp_dlg_regs->refcyc_per_line_delivery_pre_c;
1508 out->dlg_regs.refcyc_per_line_delivery_l = disp_dlg_regs->refcyc_per_line_delivery_l;
1509 out->dlg_regs.refcyc_per_line_delivery_c = disp_dlg_regs->refcyc_per_line_delivery_c;
1510 out->dlg_regs.refcyc_per_vm_group_vblank = disp_dlg_regs->refcyc_per_vm_group_vblank;
1511 out->dlg_regs.refcyc_per_vm_group_flip = disp_dlg_regs->refcyc_per_vm_group_flip;
1512 out->dlg_regs.refcyc_per_vm_req_vblank = disp_dlg_regs->refcyc_per_vm_req_vblank;
1513 out->dlg_regs.refcyc_per_vm_req_flip = disp_dlg_regs->refcyc_per_vm_req_flip;
1514 out->dlg_regs.dst_y_offset_cur0 = disp_dlg_regs->dst_y_offset_cur0;
1515 out->dlg_regs.chunk_hdl_adjust_cur0 = disp_dlg_regs->chunk_hdl_adjust_cur0;
1516 out->dlg_regs.dst_y_offset_cur1 = disp_dlg_regs->dst_y_offset_cur1;
1517 out->dlg_regs.chunk_hdl_adjust_cur1 = disp_dlg_regs->chunk_hdl_adjust_cur1;
1518 out->dlg_regs.vready_after_vcount0 = disp_dlg_regs->vready_after_vcount0;
1519 out->dlg_regs.dst_y_delta_drq_limit = disp_dlg_regs->dst_y_delta_drq_limit;
1520 out->dlg_regs.refcyc_per_vm_dmdata = disp_dlg_regs->refcyc_per_vm_dmdata;
1521 out->dlg_regs.dmdata_dl_delta = disp_dlg_regs->dmdata_dl_delta;
1522
1523 memset(&out->ttu_regs, 0, sizeof(out->ttu_regs));
1524 out->ttu_regs.qos_level_low_wm = disp_ttu_regs->qos_level_low_wm;
1525 out->ttu_regs.qos_level_high_wm = disp_ttu_regs->qos_level_high_wm;
1526 out->ttu_regs.min_ttu_vblank = disp_ttu_regs->min_ttu_vblank;
1527 out->ttu_regs.qos_level_flip = disp_ttu_regs->qos_level_flip;
1528 out->ttu_regs.refcyc_per_req_delivery_l = disp_ttu_regs->refcyc_per_req_delivery_l;
1529 out->ttu_regs.refcyc_per_req_delivery_c = disp_ttu_regs->refcyc_per_req_delivery_c;
1530 out->ttu_regs.refcyc_per_req_delivery_cur0 = disp_ttu_regs->refcyc_per_req_delivery_cur0;
1531 out->ttu_regs.refcyc_per_req_delivery_cur1 = disp_ttu_regs->refcyc_per_req_delivery_cur1;
1532 out->ttu_regs.refcyc_per_req_delivery_pre_l = disp_ttu_regs->refcyc_per_req_delivery_pre_l;
1533 out->ttu_regs.refcyc_per_req_delivery_pre_c = disp_ttu_regs->refcyc_per_req_delivery_pre_c;
1534 out->ttu_regs.refcyc_per_req_delivery_pre_cur0 = disp_ttu_regs->refcyc_per_req_delivery_pre_cur0;
1535 out->ttu_regs.refcyc_per_req_delivery_pre_cur1 = disp_ttu_regs->refcyc_per_req_delivery_pre_cur1;
1536 out->ttu_regs.qos_level_fixed_l = disp_ttu_regs->qos_level_fixed_l;
1537 out->ttu_regs.qos_level_fixed_c = disp_ttu_regs->qos_level_fixed_c;
1538 out->ttu_regs.qos_level_fixed_cur0 = disp_ttu_regs->qos_level_fixed_cur0;
1539 out->ttu_regs.qos_level_fixed_cur1 = disp_ttu_regs->qos_level_fixed_cur1;
1540 out->ttu_regs.qos_ramp_disable_l = disp_ttu_regs->qos_ramp_disable_l;
1541 out->ttu_regs.qos_ramp_disable_c = disp_ttu_regs->qos_ramp_disable_c;
1542 out->ttu_regs.qos_ramp_disable_cur0 = disp_ttu_regs->qos_ramp_disable_cur0;
1543 out->ttu_regs.qos_ramp_disable_cur1 = disp_ttu_regs->qos_ramp_disable_cur1;
1544 }
1545