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