]> Git Repo - linux.git/blob - drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
Merge tag 'pinctrl-v6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux.git] / drivers / gpu / drm / amd / display / dc / dml2 / dml2_translation_helper.c
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
33 void dml2_init_ip_params(struct dml2_context *dml2, const struct dc *in_dc, struct ip_params_st *out)
34 {
35         switch (dml2->v20.dml_core_ctx.project) {
36
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         }
179 }
180
181 void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, struct soc_bounding_box_st *out)
182 {
183         out->dprefclk_mhz = dml2->config.bbox_overrides.dprefclk_mhz;
184         out->xtalclk_mhz = dml2->config.bbox_overrides.xtalclk_mhz;
185         out->pcierefclk_mhz = 100;
186         out->refclk_mhz = dml2->config.bbox_overrides.dchub_refclk_mhz;
187
188         out->max_outstanding_reqs = 512;
189         out->pct_ideal_sdp_bw_after_urgent = 100;
190         out->pct_ideal_fabric_bw_after_urgent = 67;
191         out->pct_ideal_dram_bw_after_urgent_pixel_only = 20;
192         out->pct_ideal_dram_bw_after_urgent_pixel_and_vm = 60;
193         out->pct_ideal_dram_bw_after_urgent_vm_only = 30;
194         out->pct_ideal_dram_bw_after_urgent_strobe = 67;
195         out->max_avg_sdp_bw_use_normal_percent = 80;
196         out->max_avg_fabric_bw_use_normal_percent = 60;
197         out->max_avg_dram_bw_use_normal_percent = 15;
198         out->max_avg_dram_bw_use_normal_strobe_percent = 50;
199
200         out->urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096;
201         out->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096;
202         out->urgent_out_of_order_return_per_channel_vm_only_bytes = 4096;
203         out->return_bus_width_bytes = 64;
204         out->dram_channel_width_bytes = 2;
205         out->fabric_datapath_to_dcn_data_return_bytes = 64;
206         out->hostvm_min_page_size_kbytes = 0;
207         out->gpuvm_min_page_size_kbytes = 256;
208         out->phy_downspread_percent = 0.38;
209         out->dcn_downspread_percent = 0.5;
210         out->dispclk_dppclk_vco_speed_mhz = dml2->config.bbox_overrides.disp_pll_vco_speed_mhz;
211         out->mall_allocated_for_dcn_mbytes = dml2->config.mall_cfg.max_cab_allocation_bytes / 1048576; // 64 or 32 MB;
212
213         out->do_urgent_latency_adjustment = true;
214
215         switch (dml2->v20.dml_core_ctx.project) {
216
217         case dml_project_dcn32:
218         default:
219                 out->num_chans = 24;
220                 out->round_trip_ping_latency_dcfclk_cycles = 263;
221                 out->smn_latency_us = 2;
222                 break;
223
224         case dml_project_dcn321:
225                 out->num_chans = 8;
226                 out->round_trip_ping_latency_dcfclk_cycles = 207;
227                 out->smn_latency_us = 0;
228                 break;
229
230         case dml_project_dcn35:
231                 out->num_chans = 4;
232                 out->round_trip_ping_latency_dcfclk_cycles = 106;
233                 out->smn_latency_us = 2;
234                 out->dispclk_dppclk_vco_speed_mhz = 3600;
235                 break;
236
237         case dml_project_dcn351:
238                 out->num_chans = 16;
239                 out->round_trip_ping_latency_dcfclk_cycles = 1100;
240                 out->smn_latency_us = 2;
241                 break;
242         }
243         /* ---Overrides if available--- */
244         if (dml2->config.bbox_overrides.dram_num_chan)
245                 out->num_chans = dml2->config.bbox_overrides.dram_num_chan;
246
247         if (dml2->config.bbox_overrides.dram_chanel_width_bytes)
248                 out->dram_channel_width_bytes = dml2->config.bbox_overrides.dram_chanel_width_bytes;
249 }
250
251 void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
252         const struct soc_bounding_box_st *in_bbox, struct soc_states_st *out)
253 {
254         struct dml2_policy_build_synthetic_soc_states_scratch *s = &dml2->v20.scratch.create_scratch.build_synthetic_socbb_scratch;
255         struct dml2_policy_build_synthetic_soc_states_params *p = &dml2->v20.scratch.build_synthetic_socbb_params;
256         unsigned int dcfclk_stas_mhz[NUM_DCFCLK_STAS];
257         unsigned int i = 0;
258         unsigned int transactions_per_mem_clock = 16; // project specific, depends on used Memory type
259
260         p->dcfclk_stas_mhz = dcfclk_stas_mhz;
261         p->num_dcfclk_stas = NUM_DCFCLK_STAS;
262         p->in_bbox = in_bbox;
263         p->out_states = out;
264         p->in_states = &dml2->v20.scratch.create_scratch.in_states;
265
266
267         /* Initial hardcoded values */
268         switch (dml2->v20.dml_core_ctx.project) {
269
270         case dml_project_dcn32:
271         default:
272                 p->in_states->num_states = 2;
273                 transactions_per_mem_clock = 16;
274                 p->in_states->state_array[0].socclk_mhz = 620.0;
275                 p->in_states->state_array[0].dscclk_mhz = 716.667;
276                 p->in_states->state_array[0].phyclk_mhz = 810;
277                 p->in_states->state_array[0].phyclk_d18_mhz = 667;
278                 p->in_states->state_array[0].phyclk_d32_mhz = 625;
279                 p->in_states->state_array[0].dtbclk_mhz = 1564.0;
280                 p->in_states->state_array[0].fabricclk_mhz = 450.0;
281                 p->in_states->state_array[0].dcfclk_mhz = 300.0;
282                 p->in_states->state_array[0].dispclk_mhz = 2150.0;
283                 p->in_states->state_array[0].dppclk_mhz = 2150.0;
284                 p->in_states->state_array[0].dram_speed_mts = 100 * transactions_per_mem_clock;
285
286                 p->in_states->state_array[0].urgent_latency_pixel_data_only_us = 4;
287                 p->in_states->state_array[0].urgent_latency_pixel_mixed_with_vm_data_us = 0;
288                 p->in_states->state_array[0].urgent_latency_vm_data_only_us = 0;
289                 p->in_states->state_array[0].writeback_latency_us = 12;
290                 p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_component_us = 1;
291                 p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_reference_mhz = 3000;
292                 p->in_states->state_array[0].sr_exit_z8_time_us = 0;
293                 p->in_states->state_array[0].sr_enter_plus_exit_z8_time_us = 0;
294                 p->in_states->state_array[0].dram_clock_change_latency_us = 400;
295                 p->in_states->state_array[0].use_ideal_dram_bw_strobe = true;
296                 p->in_states->state_array[0].sr_exit_time_us = 42.97;
297                 p->in_states->state_array[0].sr_enter_plus_exit_time_us = 49.94;
298                 p->in_states->state_array[0].fclk_change_latency_us = 20;
299                 p->in_states->state_array[0].usr_retraining_latency_us = 2;
300
301                 p->in_states->state_array[1].socclk_mhz = 1200.0;
302                 p->in_states->state_array[1].fabricclk_mhz = 2500.0;
303                 p->in_states->state_array[1].dcfclk_mhz = 1564.0;
304                 p->in_states->state_array[1].dram_speed_mts = 1125 * transactions_per_mem_clock;
305                 break;
306
307         case dml_project_dcn321:
308                 p->in_states->num_states = 2;
309                 transactions_per_mem_clock = 16;
310                 p->in_states->state_array[0].socclk_mhz = 582.0;
311                 p->in_states->state_array[0].dscclk_mhz = 573.333;
312                 p->in_states->state_array[0].phyclk_mhz = 810;
313                 p->in_states->state_array[0].phyclk_d18_mhz = 667;
314                 p->in_states->state_array[0].phyclk_d32_mhz = 313;
315                 p->in_states->state_array[0].dtbclk_mhz = 1564.0;
316                 p->in_states->state_array[0].fabricclk_mhz = 450.0;
317                 p->in_states->state_array[0].dcfclk_mhz = 300.0;
318                 p->in_states->state_array[0].dispclk_mhz = 1720.0;
319                 p->in_states->state_array[0].dppclk_mhz = 1720.0;
320                 p->in_states->state_array[0].dram_speed_mts = 100 * transactions_per_mem_clock;
321
322                 p->in_states->state_array[0].urgent_latency_pixel_data_only_us = 4;
323                 p->in_states->state_array[0].urgent_latency_pixel_mixed_with_vm_data_us = 0;
324                 p->in_states->state_array[0].urgent_latency_vm_data_only_us = 0;
325                 p->in_states->state_array[0].writeback_latency_us = 12;
326                 p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_component_us = 1;
327                 p->in_states->state_array[0].urgent_latency_adjustment_fabric_clock_reference_mhz = 3000;
328                 p->in_states->state_array[0].sr_exit_z8_time_us = 0;
329                 p->in_states->state_array[0].sr_enter_plus_exit_z8_time_us = 0;
330                 p->in_states->state_array[0].dram_clock_change_latency_us = 400;
331                 p->in_states->state_array[0].use_ideal_dram_bw_strobe = true;
332                 p->in_states->state_array[0].sr_exit_time_us = 19.95;
333                 p->in_states->state_array[0].sr_enter_plus_exit_time_us = 24.36;
334                 p->in_states->state_array[0].fclk_change_latency_us = 7;
335                 p->in_states->state_array[0].usr_retraining_latency_us = 0;
336
337                 p->in_states->state_array[1].socclk_mhz = 1200.0;
338                 p->in_states->state_array[1].fabricclk_mhz = 2250.0;
339                 p->in_states->state_array[1].dcfclk_mhz = 1434.0;
340                 p->in_states->state_array[1].dram_speed_mts = 1000 * transactions_per_mem_clock;
341                 break;
342         }
343
344         if (dml2->config.bbox_overrides.clks_table.num_states)
345                         p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;
346
347         /* Override from passed values, if available */
348         for (i = 0; i < p->in_states->num_states; i++) {
349                 if (dml2->config.bbox_overrides.sr_exit_latency_us) {
350                         p->in_states->state_array[i].sr_exit_time_us =
351                                 dml2->config.bbox_overrides.sr_exit_latency_us;
352                 }
353
354                 if (dml2->config.bbox_overrides.sr_enter_plus_exit_latency_us) {
355                         p->in_states->state_array[i].sr_enter_plus_exit_time_us =
356                                 dml2->config.bbox_overrides.sr_enter_plus_exit_latency_us;
357                 }
358
359                 if (dml2->config.bbox_overrides.sr_exit_z8_time_us) {
360                         p->in_states->state_array[i].sr_exit_z8_time_us =
361                                 dml2->config.bbox_overrides.sr_exit_z8_time_us;
362                 }
363
364                 if (dml2->config.bbox_overrides.sr_enter_plus_exit_z8_time_us) {
365                         p->in_states->state_array[i].sr_enter_plus_exit_z8_time_us =
366                                 dml2->config.bbox_overrides.sr_enter_plus_exit_z8_time_us;
367                 }
368
369                 if (dml2->config.bbox_overrides.urgent_latency_us) {
370                         p->in_states->state_array[i].urgent_latency_pixel_data_only_us =
371                                 dml2->config.bbox_overrides.urgent_latency_us;
372                 }
373
374                 if (dml2->config.bbox_overrides.dram_clock_change_latency_us) {
375                         p->in_states->state_array[i].dram_clock_change_latency_us =
376                                 dml2->config.bbox_overrides.dram_clock_change_latency_us;
377                 }
378
379                 if (dml2->config.bbox_overrides.fclk_change_latency_us) {
380                         p->in_states->state_array[i].fclk_change_latency_us =
381                                 dml2->config.bbox_overrides.fclk_change_latency_us;
382                 }
383         }
384
385         /* DCFCLK stas values are project specific */
386         if ((dml2->v20.dml_core_ctx.project == dml_project_dcn32) ||
387                 (dml2->v20.dml_core_ctx.project == dml_project_dcn321)) {
388                 p->dcfclk_stas_mhz[0] = p->in_states->state_array[0].dcfclk_mhz;
389                 p->dcfclk_stas_mhz[1] = 615;
390                 p->dcfclk_stas_mhz[2] = 906;
391                 p->dcfclk_stas_mhz[3] = 1324;
392                 p->dcfclk_stas_mhz[4] = p->in_states->state_array[1].dcfclk_mhz;
393         } else if (dml2->v20.dml_core_ctx.project != dml_project_dcn35 &&
394                         dml2->v20.dml_core_ctx.project != dml_project_dcn351) {
395                 p->dcfclk_stas_mhz[0] = 300;
396                 p->dcfclk_stas_mhz[1] = 615;
397                 p->dcfclk_stas_mhz[2] = 906;
398                 p->dcfclk_stas_mhz[3] = 1324;
399                 p->dcfclk_stas_mhz[4] = 1500;
400         }
401         /* Copy clocks tables entries, if available */
402         if (dml2->config.bbox_overrides.clks_table.num_states) {
403
404                 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) {
405                         p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz;
406                 }
407
408                 p->dcfclk_stas_mhz[0] = dml2->config.bbox_overrides.clks_table.clk_entries[0].dcfclk_mhz;
409                 if (i > 1)
410                         p->dcfclk_stas_mhz[4] = dml2->config.bbox_overrides.clks_table.clk_entries[i-1].dcfclk_mhz;
411
412                 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels; i++) {
413                         p->in_states->state_array[i].fabricclk_mhz =
414                                 dml2->config.bbox_overrides.clks_table.clk_entries[i].fclk_mhz;
415                 }
416
417                 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels; i++) {
418                         p->in_states->state_array[i].dram_speed_mts =
419                                 dml2->config.bbox_overrides.clks_table.clk_entries[i].memclk_mhz * transactions_per_mem_clock;
420                 }
421
422                 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_socclk_levels; i++) {
423                         p->in_states->state_array[i].socclk_mhz =
424                                 dml2->config.bbox_overrides.clks_table.clk_entries[i].socclk_mhz;
425                 }
426
427                 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels; i++) {
428                         if (dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz > 0)
429                                 p->in_states->state_array[i].dtbclk_mhz =
430                                         dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz;
431                 }
432
433                 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dispclk_levels; i++) {
434                         p->in_states->state_array[i].dispclk_mhz =
435                                 dml2->config.bbox_overrides.clks_table.clk_entries[i].dispclk_mhz;
436                         p->in_states->state_array[i].dppclk_mhz =
437                                 dml2->config.bbox_overrides.clks_table.clk_entries[i].dppclk_mhz;
438                 }
439         }
440
441         dml2_policy_build_synthetic_soc_states(s, p);
442 }
443
444 void dml2_translate_ip_params(const struct dc *in, struct ip_params_st *out)
445 {
446         const struct _vcs_dpi_ip_params_st *in_ip_params = &in->dml.ip;
447         /* Copy over the IP params tp dml2_ctx */
448         out->compressed_buffer_segment_size_in_kbytes = in_ip_params->compressed_buffer_segment_size_in_kbytes;
449         out->config_return_buffer_size_in_kbytes = in_ip_params->config_return_buffer_size_in_kbytes;
450         out->cursor_buffer_size = in_ip_params->cursor_buffer_size;
451         out->cursor_chunk_size = in_ip_params->cursor_chunk_size;
452         out->dcc_meta_buffer_size_bytes = in_ip_params->dcc_meta_buffer_size_bytes;
453         out->dcc_supported = in_ip_params->dcc_supported;
454         out->dispclk_delay_subtotal = in_ip_params->dispclk_delay_subtotal;
455         out->dispclk_ramp_margin_percent = in_ip_params->dispclk_ramp_margin_percent;
456         out->dppclk_delay_cnvc_cursor = in_ip_params->dppclk_delay_cnvc_cursor;
457         out->dppclk_delay_cnvc_formatter = in_ip_params->dppclk_delay_cnvc_formatter;
458         out->dppclk_delay_scl = in_ip_params->dppclk_delay_scl;
459         out->dppclk_delay_scl_lb_only = in_ip_params->dppclk_delay_scl_lb_only;
460         out->dppclk_delay_subtotal = in_ip_params->dppclk_delay_subtotal;
461         out->dpte_buffer_size_in_pte_reqs_chroma = in_ip_params->dpte_buffer_size_in_pte_reqs_chroma;
462         out->dpte_buffer_size_in_pte_reqs_luma = in_ip_params->dpte_buffer_size_in_pte_reqs_luma;
463         out->dsc422_native_support = in_ip_params->dsc422_native_support;
464         out->dynamic_metadata_vm_enabled = in_ip_params->dynamic_metadata_vm_enabled;
465         out->gpuvm_enable = in_ip_params->gpuvm_enable;
466         out->gpuvm_max_page_table_levels = in_ip_params->gpuvm_max_page_table_levels;
467         out->hostvm_enable = in_ip_params->hostvm_enable;
468         out->hostvm_max_page_table_levels = in_ip_params->hostvm_max_page_table_levels;
469         out->line_buffer_size_bits = in_ip_params->line_buffer_size_bits;
470         out->maximum_dsc_bits_per_component = in_ip_params->maximum_dsc_bits_per_component;
471         out->maximum_pixels_per_line_per_dsc_unit = in_ip_params->maximum_pixels_per_line_per_dsc_unit;
472         out->max_dchub_pscl_bw_pix_per_clk = in_ip_params->max_dchub_pscl_bw_pix_per_clk;
473         out->max_hscl_ratio = in_ip_params->max_hscl_ratio;
474         out->max_hscl_taps = in_ip_params->max_hscl_taps;
475         out->max_inter_dcn_tile_repeaters = in_ip_params->max_inter_dcn_tile_repeaters;
476         out->max_lb_vscl_bw_pix_per_clk = in_ip_params->max_lb_vscl_bw_pix_per_clk;
477         out->max_line_buffer_lines = in_ip_params->max_line_buffer_lines;
478         out->max_num_dp2p0_outputs = in_ip_params->max_num_dp2p0_outputs;
479         out->max_num_dp2p0_streams = in_ip_params->max_num_dp2p0_streams;
480         out->max_num_dpp = in_ip_params->max_num_dpp;
481         out->max_num_hdmi_frl_outputs = in_ip_params->max_num_hdmi_frl_outputs;
482         out->max_num_otg = in_ip_params->max_num_otg;
483         out->max_num_wb = in_ip_params->max_num_wb;
484         out->max_pscl_lb_bw_pix_per_clk = in_ip_params->max_pscl_lb_bw_pix_per_clk;
485         out->max_vscl_hscl_bw_pix_per_clk = in_ip_params->max_vscl_hscl_bw_pix_per_clk;
486         out->max_vscl_ratio = in_ip_params->max_vscl_ratio;
487         out->max_vscl_taps = in_ip_params->max_vscl_taps;
488         out->meta_chunk_size_kbytes = in_ip_params->meta_chunk_size_kbytes;
489         out->meta_fifo_size_in_kentries = in_ip_params->meta_fifo_size_in_kentries;
490         out->min_meta_chunk_size_bytes = in_ip_params->min_meta_chunk_size_bytes;
491         out->min_pixel_chunk_size_bytes = in_ip_params->min_pixel_chunk_size_bytes;
492         out->num_dsc = in_ip_params->num_dsc;
493         out->pixel_chunk_size_kbytes = in_ip_params->pixel_chunk_size_kbytes;
494         out->ptoi_supported = in_ip_params->ptoi_supported;
495         out->rob_buffer_size_kbytes = in_ip_params->rob_buffer_size_kbytes;
496         out->writeback_chunk_size_kbytes = in_ip_params->writeback_chunk_size_kbytes;
497         out->writeback_interface_buffer_size_kbytes = in_ip_params->writeback_interface_buffer_size_kbytes;
498         out->writeback_line_buffer_buffer_size = in_ip_params->writeback_line_buffer_buffer_size;
499         out->writeback_max_hscl_ratio = in_ip_params->writeback_max_hscl_ratio;
500         out->writeback_max_hscl_taps = in_ip_params->writeback_max_hscl_taps;
501         out->writeback_max_vscl_ratio = in_ip_params->writeback_max_vscl_ratio;
502         out->writeback_max_vscl_taps = in_ip_params->writeback_max_vscl_taps;
503         out->writeback_min_hscl_ratio = in_ip_params->writeback_min_hscl_ratio;
504         out->writeback_min_vscl_ratio = in_ip_params->writeback_min_vscl_ratio;
505         out->zero_size_buffer_entries = in_ip_params->zero_size_buffer_entries;
506
507         /* As per hardcoded reference / discussions */
508         out->config_return_buffer_segment_size_in_kbytes = 64;
509         //out->vblank_nom_default_us = 600;
510         out->vblank_nom_default_us = in_ip_params->VBlankNomDefaultUS;
511 }
512
513 void dml2_translate_socbb_params(const struct dc *in, struct soc_bounding_box_st *out)
514 {
515         const struct _vcs_dpi_soc_bounding_box_st *in_soc_params = &in->dml.soc;
516         /* Copy over the SOCBB params to dml2_ctx */
517         out->dispclk_dppclk_vco_speed_mhz = in_soc_params->dispclk_dppclk_vco_speed_mhz;
518         out->do_urgent_latency_adjustment = in_soc_params->do_urgent_latency_adjustment;
519         out->dram_channel_width_bytes = (dml_uint_t)in_soc_params->dram_channel_width_bytes;
520         out->fabric_datapath_to_dcn_data_return_bytes = (dml_uint_t)in_soc_params->fabric_datapath_to_dcn_data_return_bytes;
521         out->gpuvm_min_page_size_kbytes = in_soc_params->gpuvm_min_page_size_bytes / 1024;
522         out->hostvm_min_page_size_kbytes = in_soc_params->hostvm_min_page_size_bytes / 1024;
523         out->mall_allocated_for_dcn_mbytes = (dml_uint_t)in_soc_params->mall_allocated_for_dcn_mbytes;
524         out->max_avg_dram_bw_use_normal_percent = in_soc_params->max_avg_dram_bw_use_normal_percent;
525         out->max_avg_fabric_bw_use_normal_percent = in_soc_params->max_avg_fabric_bw_use_normal_percent;
526         out->max_avg_dram_bw_use_normal_strobe_percent = in_soc_params->max_avg_dram_bw_use_normal_strobe_percent;
527         out->max_avg_sdp_bw_use_normal_percent = in_soc_params->max_avg_sdp_bw_use_normal_percent;
528         out->max_outstanding_reqs = in_soc_params->max_request_size_bytes;
529         out->num_chans = in_soc_params->num_chans;
530         out->pct_ideal_dram_bw_after_urgent_strobe = in_soc_params->pct_ideal_dram_bw_after_urgent_strobe;
531         out->pct_ideal_dram_bw_after_urgent_vm_only = in_soc_params->pct_ideal_dram_sdp_bw_after_urgent_vm_only;
532         out->pct_ideal_fabric_bw_after_urgent = in_soc_params->pct_ideal_fabric_bw_after_urgent;
533         out->pct_ideal_sdp_bw_after_urgent = in_soc_params->pct_ideal_sdp_bw_after_urgent;
534         out->phy_downspread_percent = in_soc_params->downspread_percent;
535         out->refclk_mhz = 50; // As per hardcoded reference.
536         out->return_bus_width_bytes = in_soc_params->return_bus_width_bytes;
537         out->round_trip_ping_latency_dcfclk_cycles = in_soc_params->round_trip_ping_latency_dcfclk_cycles;
538         out->smn_latency_us = in_soc_params->smn_latency_us;
539         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;
540         out->urgent_out_of_order_return_per_channel_pixel_only_bytes = in_soc_params->urgent_out_of_order_return_per_channel_pixel_only_bytes;
541         out->urgent_out_of_order_return_per_channel_vm_only_bytes = in_soc_params->urgent_out_of_order_return_per_channel_vm_only_bytes;
542         out->pct_ideal_dram_bw_after_urgent_pixel_and_vm = in_soc_params->pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm;
543         out->pct_ideal_dram_bw_after_urgent_pixel_only = in_soc_params->pct_ideal_dram_sdp_bw_after_urgent_pixel_only;
544         out->dcn_downspread_percent = in_soc_params->dcn_downspread_percent;
545 }
546
547 void dml2_translate_soc_states(const struct dc *dc, struct soc_states_st *out, int num_states)
548 {
549         unsigned int i = 0;
550         out->num_states = num_states;
551
552         for (i = 0; i < out->num_states; i++) {
553                 out->state_array[i].dcfclk_mhz = dc->dml.soc.clock_limits[i].dcfclk_mhz;
554                 out->state_array[i].dispclk_mhz = dc->dml.soc.clock_limits[i].dispclk_mhz;
555                 out->state_array[i].dppclk_mhz = dc->dml.soc.clock_limits[i].dppclk_mhz;
556                 out->state_array[i].dram_speed_mts = dc->dml.soc.clock_limits[i].dram_speed_mts;
557                 out->state_array[i].dtbclk_mhz = dc->dml.soc.clock_limits[i].dtbclk_mhz;
558                 out->state_array[i].socclk_mhz = dc->dml.soc.clock_limits[i].socclk_mhz;
559                 out->state_array[i].fabricclk_mhz = dc->dml.soc.clock_limits[i].fabricclk_mhz;
560                 out->state_array[i].dscclk_mhz = dc->dml.soc.clock_limits[i].dscclk_mhz;
561                 out->state_array[i].phyclk_d18_mhz = dc->dml.soc.clock_limits[i].phyclk_d18_mhz;
562                 out->state_array[i].phyclk_d32_mhz = dc->dml.soc.clock_limits[i].phyclk_d32_mhz;
563                 out->state_array[i].phyclk_mhz = dc->dml.soc.clock_limits[i].phyclk_mhz;
564                 out->state_array[i].sr_enter_plus_exit_time_us = dc->dml.soc.sr_enter_plus_exit_time_us;
565                 out->state_array[i].sr_exit_time_us = dc->dml.soc.sr_exit_time_us;
566                 out->state_array[i].fclk_change_latency_us = dc->dml.soc.fclk_change_latency_us;
567                 out->state_array[i].dram_clock_change_latency_us = dc->dml.soc.dram_clock_change_latency_us;
568                 out->state_array[i].usr_retraining_latency_us = dc->dml.soc.usr_retraining_latency_us;
569                 out->state_array[i].writeback_latency_us = dc->dml.soc.writeback_latency_us;
570                 /* Driver initialized values for these are different than the spreadsheet. Use the
571                  * spreadsheet ones for now. We need to decided which ones to use.
572                  */
573                 out->state_array[i].sr_exit_z8_time_us = dc->dml.soc.sr_exit_z8_time_us;
574                 out->state_array[i].sr_enter_plus_exit_z8_time_us = dc->dml.soc.sr_enter_plus_exit_z8_time_us;
575                 //out->state_array[i].sr_exit_z8_time_us = 5.20;
576                 //out->state_array[i].sr_enter_plus_exit_z8_time_us = 9.60;
577                 out->state_array[i].use_ideal_dram_bw_strobe = true;
578                 out->state_array[i].urgent_latency_pixel_data_only_us = dc->dml.soc.urgent_latency_pixel_data_only_us;
579                 out->state_array[i].urgent_latency_pixel_mixed_with_vm_data_us = dc->dml.soc.urgent_latency_pixel_mixed_with_vm_data_us;
580                 out->state_array[i].urgent_latency_vm_data_only_us = dc->dml.soc.urgent_latency_vm_data_only_us;
581                 out->state_array[i].urgent_latency_adjustment_fabric_clock_component_us = dc->dml.soc.urgent_latency_adjustment_fabric_clock_component_us;
582                 out->state_array[i].urgent_latency_adjustment_fabric_clock_reference_mhz = dc->dml.soc.urgent_latency_adjustment_fabric_clock_reference_mhz;
583         }
584 }
585
586 static void populate_dml_timing_cfg_from_stream_state(struct dml_timing_cfg_st *out, unsigned int location, const struct dc_stream_state *in)
587 {
588         dml_uint_t hblank_start, vblank_start;
589
590         out->HActive[location] = in->timing.h_addressable + in->timing.h_border_left + in->timing.h_border_right;
591         out->VActive[location] = in->timing.v_addressable + in->timing.v_border_bottom + in->timing.v_border_top;
592         out->RefreshRate[location] = ((in->timing.pix_clk_100hz * 100) / in->timing.h_total) / in->timing.v_total;
593         out->VFrontPorch[location] = in->timing.v_front_porch;
594         out->PixelClock[location] = in->timing.pix_clk_100hz / 10000.00;
595         if (in->timing.timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING)
596                 out->PixelClock[location] *= 2;
597         out->HTotal[location] = in->timing.h_total;
598         out->VTotal[location] = in->timing.v_total;
599         out->Interlace[location] = in->timing.flags.INTERLACE;
600         hblank_start = in->timing.h_total - in->timing.h_front_porch;
601         out->HBlankEnd[location] = hblank_start
602                                         - in->timing.h_addressable
603                                         - in->timing.h_border_left
604                                         - in->timing.h_border_right;
605         vblank_start = in->timing.v_total - in->timing.v_front_porch;
606         out->VBlankEnd[location] = vblank_start
607                                         - in->timing.v_addressable
608                                         - in->timing.v_border_top
609                                         - in->timing.v_border_bottom;
610         out->DRRDisplay[location] = false;
611 }
612
613 static void populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st *out, unsigned int location,
614                                 const struct dc_stream_state *in, const struct pipe_ctx *pipe)
615 {
616         unsigned int output_bpc;
617
618         out->DSCEnable[location] = (enum dml_dsc_enable)in->timing.flags.DSC;
619         out->OutputLinkDPLanes[location] = 4; // As per code in dcn20_resource.c
620         out->DSCInputBitPerComponent[location] = 12; // As per code in dcn20_resource.c
621
622         switch (in->signal) {
623         case SIGNAL_TYPE_DISPLAY_PORT_MST:
624         case SIGNAL_TYPE_DISPLAY_PORT:
625                 out->OutputEncoder[location] = dml_dp;
626                 if (is_dp2p0_output_encoder(pipe))
627                         out->OutputEncoder[location] = dml_dp2p0;
628                 break;
629                 out->OutputEncoder[location] = dml_edp;
630         case SIGNAL_TYPE_EDP:
631                 break;
632         case SIGNAL_TYPE_HDMI_TYPE_A:
633         case SIGNAL_TYPE_DVI_SINGLE_LINK:
634         case SIGNAL_TYPE_DVI_DUAL_LINK:
635                 out->OutputEncoder[location] = dml_hdmi;
636                 break;
637         default:
638                 out->OutputEncoder[location] = dml_dp;
639         }
640
641         switch (in->timing.display_color_depth) {
642         case COLOR_DEPTH_666:
643                 output_bpc = 6;
644                 break;
645         case COLOR_DEPTH_888:
646                 output_bpc = 8;
647                 break;
648         case COLOR_DEPTH_101010:
649                 output_bpc = 10;
650                 break;
651         case COLOR_DEPTH_121212:
652                 output_bpc = 12;
653                 break;
654         case COLOR_DEPTH_141414:
655                 output_bpc = 14;
656                 break;
657         case COLOR_DEPTH_161616:
658                 output_bpc = 16;
659                 break;
660         case COLOR_DEPTH_999:
661                 output_bpc = 9;
662                 break;
663         case COLOR_DEPTH_111111:
664                 output_bpc = 11;
665                 break;
666         default:
667                 output_bpc = 8;
668                 break;
669         }
670
671         switch (in->timing.pixel_encoding) {
672         case PIXEL_ENCODING_RGB:
673         case PIXEL_ENCODING_YCBCR444:
674                 out->OutputFormat[location] = dml_444;
675                 out->OutputBpp[location] = (dml_float_t)output_bpc * 3;
676                 break;
677         case PIXEL_ENCODING_YCBCR420:
678                 out->OutputFormat[location] = dml_420;
679                 out->OutputBpp[location] = (output_bpc * 3.0) / 2;
680                 break;
681         case PIXEL_ENCODING_YCBCR422:
682                 if (in->timing.flags.DSC && !in->timing.dsc_cfg.ycbcr422_simple)
683                         out->OutputFormat[location] = dml_n422;
684                 else
685                         out->OutputFormat[location] = dml_s422;
686                 out->OutputBpp[location] = (dml_float_t)output_bpc * 2;
687                 break;
688         default:
689                 out->OutputFormat[location] = dml_444;
690                 out->OutputBpp[location] = (dml_float_t)output_bpc * 3;
691                 break;
692         }
693
694         if (in->timing.flags.DSC) {
695                 out->OutputBpp[location] = in->timing.dsc_cfg.bits_per_pixel / 16.0;
696         }
697
698         // This has been false throughout DCN32x development. If needed we can change this later on.
699         out->OutputMultistreamEn[location] = false;
700
701         switch (in->signal) {
702         case SIGNAL_TYPE_NONE:
703         case SIGNAL_TYPE_DVI_SINGLE_LINK:
704         case SIGNAL_TYPE_DVI_DUAL_LINK:
705         case SIGNAL_TYPE_HDMI_TYPE_A:
706         case SIGNAL_TYPE_LVDS:
707         case SIGNAL_TYPE_RGB:
708         case SIGNAL_TYPE_DISPLAY_PORT:
709         case SIGNAL_TYPE_DISPLAY_PORT_MST:
710         case SIGNAL_TYPE_EDP:
711         case SIGNAL_TYPE_VIRTUAL:
712         default:
713                 out->OutputLinkDPRate[location] = dml_dp_rate_na;
714                 break;
715         }
716
717         out->PixelClockBackEnd[location] = in->timing.pix_clk_100hz / 10000.00;
718
719         out->AudioSampleLayout[location] = in->audio_info.modes->sample_size;
720         out->AudioSampleRate[location] = in->audio_info.modes->max_bit_rate;
721
722         out->OutputDisabled[location] = true;
723 }
724
725 static void populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st *out, unsigned int location, const struct dc_stream_state *in)
726 {
727         out->SurfaceWidthY[location] = in->timing.h_addressable;
728         out->SurfaceHeightY[location] = in->timing.v_addressable;
729         out->SurfaceWidthC[location] = in->timing.h_addressable;
730         out->SurfaceHeightC[location] = in->timing.v_addressable;
731         out->PitchY[location] = ((out->SurfaceWidthY[location] + 127) / 128) * 128;
732         out->PitchC[location] = 0;
733         out->DCCEnable[location] = false;
734         out->DCCMetaPitchY[location] = 0;
735         out->DCCMetaPitchC[location] = 0;
736         out->DCCRateLuma[location] = 1.0;
737         out->DCCRateChroma[location] = 1.0;
738         out->DCCFractionOfZeroSizeRequestsLuma[location] = 0;
739         out->DCCFractionOfZeroSizeRequestsChroma[location] = 0;
740         out->SurfaceTiling[location] = dml_sw_64kb_r_x;
741         out->SourcePixelFormat[location] = dml_444_32;
742 }
743
744 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)
745 {
746         out->PitchY[location] = in->plane_size.surface_pitch;
747         out->SurfaceHeightY[location] = in->plane_size.surface_size.height;
748         out->SurfaceWidthY[location] = in->plane_size.surface_size.width;
749         out->SurfaceHeightC[location] = in->plane_size.chroma_size.height;
750         out->SurfaceWidthC[location] = in->plane_size.chroma_size.width;
751         out->PitchC[location] = in->plane_size.chroma_pitch;
752         out->DCCEnable[location] = in->dcc.enable;
753         out->DCCMetaPitchY[location] = in->dcc.meta_pitch;
754         out->DCCMetaPitchC[location] = in->dcc.meta_pitch_c;
755         out->DCCRateLuma[location] = 1.0;
756         out->DCCRateChroma[location] = 1.0;
757         out->DCCFractionOfZeroSizeRequestsLuma[location] = in->dcc.independent_64b_blks;
758         out->DCCFractionOfZeroSizeRequestsChroma[location] = in->dcc.independent_64b_blks_c;
759
760         switch (dml2_project) {
761         default:
762                 out->SurfaceTiling[location] = (enum dml_swizzle_mode)in->tiling_info.gfx9.swizzle;
763                 break;
764         }
765
766         switch (in->format) {
767         case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
768         case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
769                 out->SourcePixelFormat[location] = dml_420_8;
770                 break;
771         case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:
772         case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:
773                 out->SourcePixelFormat[location] = dml_420_10;
774                 break;
775         case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
776         case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F:
777         case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
778                 out->SourcePixelFormat[location] = dml_444_64;
779                 break;
780         case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
781         case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
782                 out->SourcePixelFormat[location] = dml_444_16;
783                 break;
784         case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS:
785                 out->SourcePixelFormat[location] = dml_444_8;
786                 break;
787         case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA:
788                 out->SourcePixelFormat[location] = dml_rgbe_alpha;
789                 break;
790         default:
791                 out->SourcePixelFormat[location] = dml_444_32;
792                 break;
793         }
794 }
795
796 /*TODO no support for mpc combine, need rework - should calculate scaling params based on plane+stream*/
797 static struct scaler_data get_scaler_data_for_plane(const struct dc_plane_state *in, const struct dc_state *context)
798 {
799         int i;
800         struct scaler_data data = { 0 };
801
802         for (i = 0; i < MAX_PIPES; i++) {
803                 const struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
804
805                 if (pipe->plane_state == in && !pipe->prev_odm_pipe) {
806                         const struct pipe_ctx *next_pipe = pipe->next_odm_pipe;
807
808                         data = context->res_ctx.pipe_ctx[i].plane_res.scl_data;
809                         while (next_pipe) {
810                                 data.h_active += next_pipe->plane_res.scl_data.h_active;
811                                 data.recout.width += next_pipe->plane_res.scl_data.recout.width;
812                                 if (in->rotation == ROTATION_ANGLE_0 || in->rotation == ROTATION_ANGLE_180) {
813                                         data.viewport.width += next_pipe->plane_res.scl_data.viewport.width;
814                                 } else {
815                                         data.viewport.height += next_pipe->plane_res.scl_data.viewport.height;
816                                 }
817                                 next_pipe = next_pipe->next_odm_pipe;
818                         }
819                         break;
820                 }
821         }
822
823         ASSERT(i < MAX_PIPES);
824         return data;
825 }
826
827 static void populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st *out, unsigned int location, const struct dc_stream_state *in)
828 {
829         out->CursorBPP[location] = dml_cur_32bit;
830         out->CursorWidth[location] = 256;
831
832         out->GPUVMMinPageSizeKBytes[location] = 256;
833
834         out->ViewportWidth[location] = in->timing.h_addressable;
835         out->ViewportHeight[location] = in->timing.v_addressable;
836         out->ViewportStationary[location] = false;
837         out->ViewportWidthChroma[location] = 0;
838         out->ViewportHeightChroma[location] = 0;
839         out->ViewportXStart[location] = 0;
840         out->ViewportXStartC[location] = 0;
841         out->ViewportYStart[location] = 0;
842         out->ViewportYStartC[location] = 0;
843
844         out->ScalerEnabled[location] = false;
845         out->HRatio[location] = 1.0;
846         out->VRatio[location] = 1.0;
847         out->HRatioChroma[location] = 0;
848         out->VRatioChroma[location] = 0;
849         out->HTaps[location] = 1;
850         out->VTaps[location] = 1;
851         out->HTapsChroma[location] = 0;
852         out->VTapsChroma[location] = 0;
853         out->SourceScan[location] = dml_rotation_0;
854         out->ScalerRecoutWidth[location] = in->timing.h_addressable;
855
856         out->LBBitPerPixel[location] = 57;
857
858         out->DynamicMetadataEnable[location] = false;
859
860         out->NumberOfCursors[location] = 1;
861         out->UseMALLForStaticScreen[location] = dml_use_mall_static_screen_disable;
862         out->UseMALLForPStateChange[location] = dml_use_mall_pstate_change_disable;
863
864         out->DETSizeOverride[location] = 256;
865
866         out->ScalerEnabled[location] = false;
867 }
868
869 static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out, unsigned int location, const struct dc_plane_state *in, const struct dc_state *context)
870 {
871         const struct scaler_data scaler_data = get_scaler_data_for_plane(in, context);
872
873         out->CursorBPP[location] = dml_cur_32bit;
874         out->CursorWidth[location] = 256;
875
876         out->GPUVMMinPageSizeKBytes[location] = 256;
877
878         out->ViewportWidth[location] = scaler_data.viewport.width;
879         out->ViewportHeight[location] = scaler_data.viewport.height;
880         out->ViewportWidthChroma[location] = scaler_data.viewport_c.width;
881         out->ViewportHeightChroma[location] = scaler_data.viewport_c.height;
882         out->ViewportXStart[location] = scaler_data.viewport.x;
883         out->ViewportYStart[location] = scaler_data.viewport.y;
884         out->ViewportXStartC[location] = scaler_data.viewport_c.x;
885         out->ViewportYStartC[location] = scaler_data.viewport_c.y;
886         out->ViewportStationary[location] = false;
887
888         out->ScalerEnabled[location] = scaler_data.ratios.horz.value != dc_fixpt_one.value ||
889                                 scaler_data.ratios.horz_c.value != dc_fixpt_one.value ||
890                                 scaler_data.ratios.vert.value != dc_fixpt_one.value ||
891                                 scaler_data.ratios.vert_c.value != dc_fixpt_one.value;
892
893         /* Current driver code base uses LBBitPerPixel as 57. There is a discrepancy
894          * from the HW/DML teams about this value. Initialize LBBitPerPixel with the
895          * value current used in Navi3x .
896          */
897
898         out->LBBitPerPixel[location] = 57;
899
900         if (out->ScalerEnabled[location] == false) {
901                 out->HRatio[location] = 1;
902                 out->HRatioChroma[location] = 1;
903                 out->VRatio[location] = 1;
904                 out->VRatioChroma[location] = 1;
905         } else {
906                 /* Follow the original dml_wrapper.c code direction to fix scaling issues */
907                 out->HRatio[location] = (dml_float_t)scaler_data.ratios.horz.value / (1ULL << 32);
908                 out->HRatioChroma[location] = (dml_float_t)scaler_data.ratios.horz_c.value / (1ULL << 32);
909                 out->VRatio[location] = (dml_float_t)scaler_data.ratios.vert.value / (1ULL << 32);
910                 out->VRatioChroma[location] = (dml_float_t)scaler_data.ratios.vert_c.value / (1ULL << 32);
911         }
912
913         if (!scaler_data.taps.h_taps) {
914                 out->HTaps[location] = 1;
915                 out->HTapsChroma[location] = 1;
916         } else {
917                 out->HTaps[location] = scaler_data.taps.h_taps;
918                 out->HTapsChroma[location] = scaler_data.taps.h_taps_c;
919         }
920         if (!scaler_data.taps.v_taps) {
921                 out->VTaps[location] = 1;
922                 out->VTapsChroma[location] = 1;
923         } else {
924                 out->VTaps[location] = scaler_data.taps.v_taps;
925                 out->VTapsChroma[location] = scaler_data.taps.v_taps_c;
926         }
927
928         out->SourceScan[location] = (enum dml_rotation_angle)in->rotation;
929         out->ScalerRecoutWidth[location] = in->dst_rect.width;
930
931         out->DynamicMetadataEnable[location] = false;
932         out->DynamicMetadataLinesBeforeActiveRequired[location] = 0;
933         out->DynamicMetadataTransmittedBytes[location] = 0;
934
935         out->NumberOfCursors[location] = 1;
936 }
937
938 static unsigned int map_stream_to_dml_display_cfg(const struct dml2_context *dml2,
939                 const struct dc_stream_state *stream, const struct dml_display_cfg_st *dml_dispcfg)
940 {
941         int i = 0;
942         int location = -1;
943
944         for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
945                 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) {
946                         location = i;
947                         break;
948                 }
949         }
950
951         return location;
952 }
953
954 static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *context, const struct dc_plane_state *plane,
955                 unsigned int stream_id, unsigned int plane_index, unsigned int *plane_id)
956 {
957         int i, j;
958         bool is_plane_duplicate = dml2->v20.scratch.plane_duplicate_exists;
959
960         if (!plane_id)
961                 return false;
962
963         for (i = 0; i < context->stream_count; i++) {
964                 if (context->streams[i]->stream_id == stream_id) {
965                         for (j = 0; j < context->stream_status[i].plane_count; j++) {
966                                 if (context->stream_status[i].plane_states[j] == plane &&
967                                         (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) {
968                                         *plane_id = (i << 16) | j;
969                                         return true;
970                                 }
971                         }
972                 }
973         }
974
975         return false;
976 }
977
978 static unsigned int map_plane_to_dml_display_cfg(const struct dml2_context *dml2, const struct dc_plane_state *plane,
979                 const struct dc_state *context, const struct dml_display_cfg_st *dml_dispcfg, unsigned int stream_id, int plane_index)
980 {
981         unsigned int plane_id;
982         int i = 0;
983         int location = -1;
984
985         if (!get_plane_id(context->bw_ctx.dml2, context, plane, stream_id, plane_index, &plane_id)) {
986                 ASSERT(false);
987                 return -1;
988         }
989
990         for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
991                 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) {
992                         location = i;
993                         break;
994                 }
995         }
996
997         return location;
998 }
999
1000 static void apply_legacy_svp_drr_settings(struct dml2_context *dml2, const struct dc_state *state, struct dml_display_cfg_st *dml_dispcfg)
1001 {
1002         int i;
1003
1004         if (state->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
1005                 ASSERT(state->stream_count == 1);
1006                 dml_dispcfg->timing.DRRDisplay[0] = true;
1007         } else if (state->bw_ctx.bw.dcn.legacy_svp_drr_stream_index_valid) {
1008
1009                 for (i = 0; i < dml_dispcfg->num_timings; i++) {
1010                         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)
1011                                 dml_dispcfg->timing.DRRDisplay[i] = true;
1012                 }
1013         }
1014 }
1015
1016 static void dml2_populate_pipe_to_plane_index_mapping(struct dml2_context *dml2, struct dc_state *state)
1017 {
1018         unsigned int i;
1019         unsigned int pipe_index = 0;
1020         unsigned int plane_index = 0;
1021         struct dml2_dml_to_dc_pipe_mapping *dml_to_dc_pipe_mapping = &dml2->v20.scratch.dml_to_dc_pipe_mapping;
1022
1023         for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1024                 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[i] = false;
1025                 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index[i] = 0;
1026         }
1027
1028         for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1029                 struct pipe_ctx *pipe = &state->res_ctx.pipe_ctx[i];
1030
1031                 if (!pipe || !pipe->stream || !pipe->plane_state)
1032                         continue;
1033
1034                 while (pipe) {
1035                         pipe_index = pipe->pipe_idx;
1036
1037                         if (pipe->stream && dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[pipe_index] == false) {
1038                                 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index[pipe_index] = plane_index;
1039                                 plane_index++;
1040                                 dml_to_dc_pipe_mapping->dml_pipe_idx_to_plane_index_valid[pipe_index] = true;
1041                         }
1042
1043                         pipe = pipe->bottom_pipe;
1044                 }
1045
1046                 plane_index = 0;
1047         }
1048 }
1049
1050 void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_state *context, struct dml_display_cfg_st *dml_dispcfg)
1051 {
1052         int i = 0, j = 0, k = 0;
1053         int disp_cfg_stream_location, disp_cfg_plane_location;
1054         enum mall_stream_type stream_mall_type;
1055         struct pipe_ctx *current_pipe_context;
1056
1057         for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
1058                 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[i] = false;
1059                 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[i] = false;
1060                 dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id_valid[i] = false;
1061                 dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id_valid[i] = false;
1062         }
1063
1064         //Generally these are set by referencing our latest BB/IP params in dcn32_resource.c file
1065         dml_dispcfg->plane.GPUVMEnable = dml2->v20.dml_core_ctx.ip.gpuvm_enable;
1066         dml_dispcfg->plane.GPUVMMaxPageTableLevels = dml2->v20.dml_core_ctx.ip.gpuvm_max_page_table_levels;
1067         dml_dispcfg->plane.HostVMEnable = dml2->v20.dml_core_ctx.ip.hostvm_enable;
1068         dml_dispcfg->plane.HostVMMaxPageTableLevels = dml2->v20.dml_core_ctx.ip.hostvm_max_page_table_levels;
1069         if (dml2->v20.dml_core_ctx.ip.hostvm_enable)
1070                 dml2->v20.dml_core_ctx.policy.AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter;
1071
1072         dml2_populate_pipe_to_plane_index_mapping(dml2, context);
1073
1074         for (i = 0; i < context->stream_count; i++) {
1075                 current_pipe_context = NULL;
1076                 for (k = 0; k < MAX_PIPES; k++) {
1077                         /* find one pipe allocated to this stream for the purpose of getting
1078                         info about the link later */
1079                         if (context->streams[i] == context->res_ctx.pipe_ctx[k].stream) {
1080                                 current_pipe_context = &context->res_ctx.pipe_ctx[k];
1081                                 break;
1082                         }
1083                 }
1084                 disp_cfg_stream_location = map_stream_to_dml_display_cfg(dml2, context->streams[i], dml_dispcfg);
1085                 stream_mall_type = dc_state_get_stream_subvp_type(context, context->streams[i]);
1086
1087                 if (disp_cfg_stream_location < 0)
1088                         disp_cfg_stream_location = dml_dispcfg->num_timings++;
1089
1090                 ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1091
1092                 populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_stream_location, context->streams[i]);
1093                 populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_stream_location, context->streams[i], current_pipe_context);
1094                 switch (context->streams[i]->debug.force_odm_combine_segments) {
1095                 case 2:
1096                         dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_stream_location] = dml_odm_use_policy_combine_2to1;
1097                         break;
1098                 case 4:
1099                         dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_stream_location] = dml_odm_use_policy_combine_4to1;
1100                         break;
1101                 default:
1102                         break;
1103                 }
1104
1105                 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[disp_cfg_stream_location] = context->streams[i]->stream_id;
1106                 dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[disp_cfg_stream_location] = true;
1107
1108                 if (context->stream_status[i].plane_count == 0) {
1109                         disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
1110
1111                         populate_dummy_dml_surface_cfg(&dml_dispcfg->surface, disp_cfg_plane_location, context->streams[i]);
1112                         populate_dummy_dml_plane_cfg(&dml_dispcfg->plane, disp_cfg_plane_location, context->streams[i]);
1113
1114                         dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location;
1115
1116                         dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;
1117                 } else {
1118                         for (j = 0; j < context->stream_status[i].plane_count; j++) {
1119                                 disp_cfg_plane_location = map_plane_to_dml_display_cfg(dml2,
1120                                         context->stream_status[i].plane_states[j], context, dml_dispcfg, context->streams[i]->stream_id, j);
1121
1122                                 if (disp_cfg_plane_location < 0)
1123                                         disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
1124
1125                                 ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1126
1127                                 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]);
1128                                 populate_dml_plane_cfg_from_plane_state(&dml_dispcfg->plane, disp_cfg_plane_location, context->stream_status[i].plane_states[j], context);
1129
1130                                 if (stream_mall_type == SUBVP_MAIN) {
1131                                         dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_sub_viewport;
1132                                         dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_optimize;
1133                                 } else if (stream_mall_type == SUBVP_PHANTOM) {
1134                                         dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_phantom_pipe;
1135                                         dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_disable;
1136                                         dml2->v20.dml_core_ctx.policy.ImmediateFlipRequirement[disp_cfg_plane_location] = dml_immediate_flip_not_required;
1137                                 } else {
1138                                         dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_disable;
1139                                         dml_dispcfg->plane.UseMALLForStaticScreen[disp_cfg_plane_location] = dml_use_mall_static_screen_optimize;
1140                                 }
1141
1142                                 dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location;
1143
1144                                 if (get_plane_id(dml2, context, context->stream_status[i].plane_states[j], context->streams[i]->stream_id, j,
1145                                         &dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id[disp_cfg_plane_location]))
1146                                         dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;
1147
1148                                 if (j >= 1) {
1149                                         populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_plane_location, context->streams[i]);
1150                                         populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_plane_location, context->streams[i], current_pipe_context);
1151                                         switch (context->streams[i]->debug.force_odm_combine_segments) {
1152                                         case 2:
1153                                                 dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_2to1;
1154                                                 break;
1155                                         case 4:
1156                                                 dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_4to1;
1157                                                 break;
1158                                         default:
1159                                                 break;
1160                                         }
1161
1162                                         if (stream_mall_type == SUBVP_MAIN)
1163                                                 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_sub_viewport;
1164                                         else if (stream_mall_type == SUBVP_PHANTOM)
1165                                                 dml_dispcfg->plane.UseMALLForPStateChange[disp_cfg_plane_location] = dml_use_mall_pstate_change_phantom_pipe;
1166
1167                                         dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[disp_cfg_plane_location] = context->streams[i]->stream_id;
1168                                         dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id_valid[disp_cfg_plane_location] = true;
1169
1170                                         dml_dispcfg->num_timings++;
1171                                 }
1172                         }
1173                 }
1174         }
1175
1176         if (!dml2->config.use_native_pstate_optimization)
1177                 apply_legacy_svp_drr_settings(dml2, context, dml_dispcfg);
1178 }
1179
1180 void dml2_update_pipe_ctx_dchub_regs(struct _vcs_dpi_dml_display_rq_regs_st *rq_regs,
1181         struct _vcs_dpi_dml_display_dlg_regs_st *disp_dlg_regs,
1182         struct _vcs_dpi_dml_display_ttu_regs_st *disp_ttu_regs,
1183         struct pipe_ctx *out)
1184 {
1185         memset(&out->rq_regs, 0, sizeof(out->rq_regs));
1186         out->rq_regs.rq_regs_l.chunk_size = rq_regs->rq_regs_l.chunk_size;
1187         out->rq_regs.rq_regs_l.min_chunk_size = rq_regs->rq_regs_l.min_chunk_size;
1188         out->rq_regs.rq_regs_l.meta_chunk_size = rq_regs->rq_regs_l.meta_chunk_size;
1189         out->rq_regs.rq_regs_l.min_meta_chunk_size = rq_regs->rq_regs_l.min_meta_chunk_size;
1190         out->rq_regs.rq_regs_l.dpte_group_size = rq_regs->rq_regs_l.dpte_group_size;
1191         out->rq_regs.rq_regs_l.mpte_group_size = rq_regs->rq_regs_l.mpte_group_size;
1192         out->rq_regs.rq_regs_l.swath_height = rq_regs->rq_regs_l.swath_height;
1193         out->rq_regs.rq_regs_l.pte_row_height_linear = rq_regs->rq_regs_l.pte_row_height_linear;
1194
1195         out->rq_regs.rq_regs_c.chunk_size = rq_regs->rq_regs_c.chunk_size;
1196         out->rq_regs.rq_regs_c.min_chunk_size = rq_regs->rq_regs_c.min_chunk_size;
1197         out->rq_regs.rq_regs_c.meta_chunk_size = rq_regs->rq_regs_c.meta_chunk_size;
1198         out->rq_regs.rq_regs_c.min_meta_chunk_size = rq_regs->rq_regs_c.min_meta_chunk_size;
1199         out->rq_regs.rq_regs_c.dpte_group_size = rq_regs->rq_regs_c.dpte_group_size;
1200         out->rq_regs.rq_regs_c.mpte_group_size = rq_regs->rq_regs_c.mpte_group_size;
1201         out->rq_regs.rq_regs_c.swath_height = rq_regs->rq_regs_c.swath_height;
1202         out->rq_regs.rq_regs_c.pte_row_height_linear = rq_regs->rq_regs_c.pte_row_height_linear;
1203
1204         out->rq_regs.drq_expansion_mode = rq_regs->drq_expansion_mode;
1205         out->rq_regs.prq_expansion_mode = rq_regs->prq_expansion_mode;
1206         out->rq_regs.mrq_expansion_mode = rq_regs->mrq_expansion_mode;
1207         out->rq_regs.crq_expansion_mode = rq_regs->crq_expansion_mode;
1208         out->rq_regs.plane1_base_address = rq_regs->plane1_base_address;
1209
1210         memset(&out->dlg_regs, 0, sizeof(out->dlg_regs));
1211         out->dlg_regs.refcyc_h_blank_end = disp_dlg_regs->refcyc_h_blank_end;
1212         out->dlg_regs.dlg_vblank_end = disp_dlg_regs->dlg_vblank_end;
1213         out->dlg_regs.min_dst_y_next_start = disp_dlg_regs->min_dst_y_next_start;
1214         out->dlg_regs.refcyc_per_htotal = disp_dlg_regs->refcyc_per_htotal;
1215         out->dlg_regs.refcyc_x_after_scaler = disp_dlg_regs->refcyc_x_after_scaler;
1216         out->dlg_regs.dst_y_after_scaler = disp_dlg_regs->dst_y_after_scaler;
1217         out->dlg_regs.dst_y_prefetch = disp_dlg_regs->dst_y_prefetch;
1218         out->dlg_regs.dst_y_per_vm_vblank = disp_dlg_regs->dst_y_per_vm_vblank;
1219         out->dlg_regs.dst_y_per_row_vblank = disp_dlg_regs->dst_y_per_row_vblank;
1220         out->dlg_regs.dst_y_per_vm_flip = disp_dlg_regs->dst_y_per_vm_flip;
1221         out->dlg_regs.dst_y_per_row_flip = disp_dlg_regs->dst_y_per_row_flip;
1222         out->dlg_regs.ref_freq_to_pix_freq = disp_dlg_regs->ref_freq_to_pix_freq;
1223         out->dlg_regs.vratio_prefetch = disp_dlg_regs->vratio_prefetch;
1224         out->dlg_regs.vratio_prefetch_c = disp_dlg_regs->vratio_prefetch_c;
1225         out->dlg_regs.refcyc_per_pte_group_vblank_l = disp_dlg_regs->refcyc_per_pte_group_vblank_l;
1226         out->dlg_regs.refcyc_per_pte_group_vblank_c = disp_dlg_regs->refcyc_per_pte_group_vblank_c;
1227         out->dlg_regs.refcyc_per_meta_chunk_vblank_l = disp_dlg_regs->refcyc_per_meta_chunk_vblank_l;
1228         out->dlg_regs.refcyc_per_meta_chunk_vblank_c = disp_dlg_regs->refcyc_per_meta_chunk_vblank_c;
1229         out->dlg_regs.refcyc_per_pte_group_flip_l = disp_dlg_regs->refcyc_per_pte_group_flip_l;
1230         out->dlg_regs.refcyc_per_pte_group_flip_c = disp_dlg_regs->refcyc_per_pte_group_flip_c;
1231         out->dlg_regs.refcyc_per_meta_chunk_flip_l = disp_dlg_regs->refcyc_per_meta_chunk_flip_l;
1232         out->dlg_regs.refcyc_per_meta_chunk_flip_c = disp_dlg_regs->refcyc_per_meta_chunk_flip_c;
1233         out->dlg_regs.dst_y_per_pte_row_nom_l = disp_dlg_regs->dst_y_per_pte_row_nom_l;
1234         out->dlg_regs.dst_y_per_pte_row_nom_c = disp_dlg_regs->dst_y_per_pte_row_nom_c;
1235         out->dlg_regs.refcyc_per_pte_group_nom_l = disp_dlg_regs->refcyc_per_pte_group_nom_l;
1236         out->dlg_regs.refcyc_per_pte_group_nom_c = disp_dlg_regs->refcyc_per_pte_group_nom_c;
1237         out->dlg_regs.dst_y_per_meta_row_nom_l = disp_dlg_regs->dst_y_per_meta_row_nom_l;
1238         out->dlg_regs.dst_y_per_meta_row_nom_c = disp_dlg_regs->dst_y_per_meta_row_nom_c;
1239         out->dlg_regs.refcyc_per_meta_chunk_nom_l = disp_dlg_regs->refcyc_per_meta_chunk_nom_l;
1240         out->dlg_regs.refcyc_per_meta_chunk_nom_c = disp_dlg_regs->refcyc_per_meta_chunk_nom_c;
1241         out->dlg_regs.refcyc_per_line_delivery_pre_l = disp_dlg_regs->refcyc_per_line_delivery_pre_l;
1242         out->dlg_regs.refcyc_per_line_delivery_pre_c = disp_dlg_regs->refcyc_per_line_delivery_pre_c;
1243         out->dlg_regs.refcyc_per_line_delivery_l = disp_dlg_regs->refcyc_per_line_delivery_l;
1244         out->dlg_regs.refcyc_per_line_delivery_c = disp_dlg_regs->refcyc_per_line_delivery_c;
1245         out->dlg_regs.refcyc_per_vm_group_vblank = disp_dlg_regs->refcyc_per_vm_group_vblank;
1246         out->dlg_regs.refcyc_per_vm_group_flip = disp_dlg_regs->refcyc_per_vm_group_flip;
1247         out->dlg_regs.refcyc_per_vm_req_vblank = disp_dlg_regs->refcyc_per_vm_req_vblank;
1248         out->dlg_regs.refcyc_per_vm_req_flip = disp_dlg_regs->refcyc_per_vm_req_flip;
1249         out->dlg_regs.dst_y_offset_cur0 = disp_dlg_regs->dst_y_offset_cur0;
1250         out->dlg_regs.chunk_hdl_adjust_cur0 = disp_dlg_regs->chunk_hdl_adjust_cur0;
1251         out->dlg_regs.dst_y_offset_cur1 = disp_dlg_regs->dst_y_offset_cur1;
1252         out->dlg_regs.chunk_hdl_adjust_cur1 = disp_dlg_regs->chunk_hdl_adjust_cur1;
1253         out->dlg_regs.vready_after_vcount0 = disp_dlg_regs->vready_after_vcount0;
1254         out->dlg_regs.dst_y_delta_drq_limit = disp_dlg_regs->dst_y_delta_drq_limit;
1255         out->dlg_regs.refcyc_per_vm_dmdata = disp_dlg_regs->refcyc_per_vm_dmdata;
1256         out->dlg_regs.dmdata_dl_delta = disp_dlg_regs->dmdata_dl_delta;
1257
1258         memset(&out->ttu_regs, 0, sizeof(out->ttu_regs));
1259         out->ttu_regs.qos_level_low_wm = disp_ttu_regs->qos_level_low_wm;
1260         out->ttu_regs.qos_level_high_wm = disp_ttu_regs->qos_level_high_wm;
1261         out->ttu_regs.min_ttu_vblank = disp_ttu_regs->min_ttu_vblank;
1262         out->ttu_regs.qos_level_flip = disp_ttu_regs->qos_level_flip;
1263         out->ttu_regs.refcyc_per_req_delivery_l = disp_ttu_regs->refcyc_per_req_delivery_l;
1264         out->ttu_regs.refcyc_per_req_delivery_c = disp_ttu_regs->refcyc_per_req_delivery_c;
1265         out->ttu_regs.refcyc_per_req_delivery_cur0 = disp_ttu_regs->refcyc_per_req_delivery_cur0;
1266         out->ttu_regs.refcyc_per_req_delivery_cur1 = disp_ttu_regs->refcyc_per_req_delivery_cur1;
1267         out->ttu_regs.refcyc_per_req_delivery_pre_l = disp_ttu_regs->refcyc_per_req_delivery_pre_l;
1268         out->ttu_regs.refcyc_per_req_delivery_pre_c = disp_ttu_regs->refcyc_per_req_delivery_pre_c;
1269         out->ttu_regs.refcyc_per_req_delivery_pre_cur0 = disp_ttu_regs->refcyc_per_req_delivery_pre_cur0;
1270         out->ttu_regs.refcyc_per_req_delivery_pre_cur1 = disp_ttu_regs->refcyc_per_req_delivery_pre_cur1;
1271         out->ttu_regs.qos_level_fixed_l = disp_ttu_regs->qos_level_fixed_l;
1272         out->ttu_regs.qos_level_fixed_c = disp_ttu_regs->qos_level_fixed_c;
1273         out->ttu_regs.qos_level_fixed_cur0 = disp_ttu_regs->qos_level_fixed_cur0;
1274         out->ttu_regs.qos_level_fixed_cur1 = disp_ttu_regs->qos_level_fixed_cur1;
1275         out->ttu_regs.qos_ramp_disable_l = disp_ttu_regs->qos_ramp_disable_l;
1276         out->ttu_regs.qos_ramp_disable_c = disp_ttu_regs->qos_ramp_disable_c;
1277         out->ttu_regs.qos_ramp_disable_cur0 = disp_ttu_regs->qos_ramp_disable_cur0;
1278         out->ttu_regs.qos_ramp_disable_cur1 = disp_ttu_regs->qos_ramp_disable_cur1;
1279 }
This page took 0.122297 seconds and 4 git commands to generate.