<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Melissa, </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for the new update and added your changes. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards, </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jasdeep </div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Melissa Wen <mwen@igalia.com><br>
<b>Sent:</b> February 23, 2022 6:05 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; Wentland, Harry <Harry.Wentland@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>;
 Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; airlied@linux.ie <airlied@linux.ie>; daniel@ffwll.ch <daniel@ffwll.ch><br>
<b>Cc:</b> Laktyushkin, Dmytro <Dmytro.Laktyushkin@amd.com>; Dhillon, Jasdeep <Jasdeep.Dhillon@amd.com>; Zhuo, Qingqing (Lillian) <Qingqing.Zhuo@amd.com>; Melissa Wen <mwen@igalia.com>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org><br>
<b>Subject:</b> [PATCH v2] drm/amd/display: move FPU-related code from dcn20 to dml folder</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Move parts of dcn20 code that uses FPU to dml folder. It aims to isolate<br>
FPU operations as described by series:<br>
<br>
drm/amd/display: Introduce FPU directory inside DC<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.freedesktop.org%2Fseries%2F93042%2F&amp;data=04%7C01%7CJasdeep.Dhillon%40amd.com%7Cdf9863db496249b48b6f08d9f7210654%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637812543530752899%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=Mcy8dEkii67NyQoxaP0%2F8AjFYDhCZgqlm%2BGxAPo1OQ4%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.freedesktop.org%2Fseries%2F93042%2F&amp;data=04%7C01%7CJasdeep.Dhillon%40amd.com%7Cdf9863db496249b48b6f08d9f7210654%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637812543530752899%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=Mcy8dEkii67NyQoxaP0%2F8AjFYDhCZgqlm%2BGxAPo1OQ4%3D&amp;reserved=0</a><br>
<br>
This patch moves the following functions from dcn20_resource to<br>
dml/dcn20_fpu and calls of public functions in dcn20_resource are<br>
wrapped by DC_FP_START/END():<br>
<br>
- void dcn20_populate_dml_writeback_from_context<br>
- static bool is_dtbclk_required()<br>
- static enum dcn_zstate_support_state()<br>
- void dcn20_calculate_dlg_params()<br>
- static void swizzle_to_dml_params()<br>
- int dcn20_populate_dml_pipes_from_context()<br>
- void dcn20_calculate_wm()<br>
- void dcn20_cap_soc_clocks()<br>
- void dcn20_update_bounding_box()<br>
- void dcn20_patch_bounding_box()<br>
- bool dcn20_validate_bandwidth_fp()<br>
<br>
This movement also affects dcn21/30/31, as dcn20_calculate_dlg_params()<br>
is used by them. For this reason, I included dcn20_fpu headers in<br>
dcn20_resource headers to make dcn20_calculate_dlg_params() visible to<br>
dcn21/30/31.<br>
<br>
Three new functions are created to isolate well-delimited FPU<br>
operations:<br>
<br>
- void dcn20_fpu_set_wb_arb_params(): set cli_watermark,<br>
  pstate_watermark and time_per_pixel from wb_arb_params (struct<br>
mcif_arb_params), since those uses FPU operations on double types:<br>
WritebackUrgentWatermark, WritebackDRAMClockChangeWatermark, '16.0'.<br>
- void dcn20_fpu_set_wm_ranges(): set min_fill_clk_mhz and<br>
  max_fill_clk_mhz involves FPU calcs on dram_speed_mts (double type);<br>
- void dcn20_fpu_adjust_dppclk(): adjust operation on RequiredDPPCLK<br>
  that is a double.<br>
<br>
--<br>
<br>
v2:<br>
 - besides dcn20_resource, dcn20_calculate_dlg_params() is used in<br>
   dcn[21/30/31]_resource and therefore it needs to be wrapped by<br>
   DC_FP_START/END wherever it is called, as verified by<br>
   dc_assert_fp_enabled.<br>
<br>
Signed-off-by: Melissa Wen <mwen@igalia.com><br>
---<br>
 drivers/gpu/drm/amd/display/dc/dcn20/Makefile |   25 -<br>
 .../drm/amd/display/dc/dcn20/dcn20_resource.c | 1370 +---------------<br>
 .../drm/amd/display/dc/dcn20/dcn20_resource.h |   30 +-<br>
 .../drm/amd/display/dc/dcn21/dcn21_resource.c |    2 +<br>
 .../drm/amd/display/dc/dcn30/dcn30_resource.c |    2 +<br>
 .../drm/amd/display/dc/dcn31/dcn31_resource.c |    2 +<br>
 .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.c  | 1385 +++++++++++++++++<br>
 .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.h  |   42 +-<br>
 8 files changed, 1457 insertions(+), 1401 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile<br>
index 5fcaf78334ff..abaed2121feb 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile<br>
@@ -9,31 +9,6 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d<br>
 <br>
 DCN20 += dcn20_dsc.o<br>
 <br>
-ifdef CONFIG_X86<br>
-CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse<br>
-endif<br>
-<br>
-ifdef CONFIG_PPC64<br>
-CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -maltivec<br>
-endif<br>
-<br>
-ifdef CONFIG_CC_IS_GCC<br>
-ifeq ($(call cc-ifversion, -lt, 0701, y), y)<br>
-IS_OLD_GCC = 1<br>
-endif<br>
-endif<br>
-<br>
-ifdef CONFIG_X86<br>
-ifdef IS_OLD_GCC<br>
-# Stack alignment mismatch, proceed with caution.<br>
-# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3<br>
-# (8B stack alignment).<br>
-CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4<br>
-else<br>
-CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2<br>
-endif<br>
-endif<br>
-<br>
 AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20))<br>
 <br>
 AMD_DISPLAY_FILES += $(AMD_DAL_DCN20)<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c<br>
index dfe2e1c25a26..63c50bee0144 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c<br>
@@ -63,7 +63,6 @@<br>
 #include "dcn20_dccg.h"<br>
 #include "dcn20_vmid.h"<br>
 #include "dc_link_ddc.h"<br>
-#include "dc_link_dp.h"<br>
 #include "dce/dce_panel_cntl.h"<br>
 <br>
 #include "navi10_ip_offset.h"<br>
@@ -93,367 +92,6 @@<br>
 <br>
 #define DC_LOGGER_INIT(logger)<br>
 <br>
-struct _vcs_dpi_ip_params_st dcn2_0_ip = {<br>
-       .odm_capable = 1,<br>
-       .gpuvm_enable = 0,<br>
-       .hostvm_enable = 0,<br>
-       .gpuvm_max_page_table_levels = 4,<br>
-       .hostvm_max_page_table_levels = 4,<br>
-       .hostvm_cached_page_table_levels = 0,<br>
-       .pte_group_size_bytes = 2048,<br>
-       .num_dsc = 6,<br>
-       .rob_buffer_size_kbytes = 168,<br>
-       .det_buffer_size_kbytes = 164,<br>
-       .dpte_buffer_size_in_pte_reqs_luma = 84,<br>
-       .pde_proc_buffer_size_64k_reqs = 48,<br>
-       .dpp_output_buffer_pixels = 2560,<br>
-       .opp_output_buffer_lines = 1,<br>
-       .pixel_chunk_size_kbytes = 8,<br>
-       .pte_chunk_size_kbytes = 2,<br>
-       .meta_chunk_size_kbytes = 2,<br>
-       .writeback_chunk_size_kbytes = 2,<br>
-       .line_buffer_size_bits = 789504,<br>
-       .is_line_buffer_bpp_fixed = 0,<br>
-       .line_buffer_fixed_bpp = 0,<br>
-       .dcc_supported = true,<br>
-       .max_line_buffer_lines = 12,<br>
-       .writeback_luma_buffer_size_kbytes = 12,<br>
-       .writeback_chroma_buffer_size_kbytes = 8,<br>
-       .writeback_chroma_line_buffer_width_pixels = 4,<br>
-       .writeback_max_hscl_ratio = 1,<br>
-       .writeback_max_vscl_ratio = 1,<br>
-       .writeback_min_hscl_ratio = 1,<br>
-       .writeback_min_vscl_ratio = 1,<br>
-       .writeback_max_hscl_taps = 12,<br>
-       .writeback_max_vscl_taps = 12,<br>
-       .writeback_line_buffer_luma_buffer_size = 0,<br>
-       .writeback_line_buffer_chroma_buffer_size = 14643,<br>
-       .cursor_buffer_size = 8,<br>
-       .cursor_chunk_size = 2,<br>
-       .max_num_otg = 6,<br>
-       .max_num_dpp = 6,<br>
-       .max_num_wb = 1,<br>
-       .max_dchub_pscl_bw_pix_per_clk = 4,<br>
-       .max_pscl_lb_bw_pix_per_clk = 2,<br>
-       .max_lb_vscl_bw_pix_per_clk = 4,<br>
-       .max_vscl_hscl_bw_pix_per_clk = 4,<br>
-       .max_hscl_ratio = 8,<br>
-       .max_vscl_ratio = 8,<br>
-       .hscl_mults = 4,<br>
-       .vscl_mults = 4,<br>
-       .max_hscl_taps = 8,<br>
-       .max_vscl_taps = 8,<br>
-       .dispclk_ramp_margin_percent = 1,<br>
-       .underscan_factor = 1.10,<br>
-       .min_vblank_lines = 32, //<br>
-       .dppclk_delay_subtotal = 77, //<br>
-       .dppclk_delay_scl_lb_only = 16,<br>
-       .dppclk_delay_scl = 50,<br>
-       .dppclk_delay_cnvc_formatter = 8,<br>
-       .dppclk_delay_cnvc_cursor = 6,<br>
-       .dispclk_delay_subtotal = 87, //<br>
-       .dcfclk_cstate_latency = 10, // SRExitTime<br>
-       .max_inter_dcn_tile_repeaters = 8,<br>
-       .xfc_supported = true,<br>
-       .xfc_fill_bw_overhead_percent = 10.0,<br>
-       .xfc_fill_constant_bytes = 0,<br>
-       .number_of_cursors = 1,<br>
-};<br>
-<br>
-static struct _vcs_dpi_ip_params_st dcn2_0_nv14_ip = {<br>
-       .odm_capable = 1,<br>
-       .gpuvm_enable = 0,<br>
-       .hostvm_enable = 0,<br>
-       .gpuvm_max_page_table_levels = 4,<br>
-       .hostvm_max_page_table_levels = 4,<br>
-       .hostvm_cached_page_table_levels = 0,<br>
-       .num_dsc = 5,<br>
-       .rob_buffer_size_kbytes = 168,<br>
-       .det_buffer_size_kbytes = 164,<br>
-       .dpte_buffer_size_in_pte_reqs_luma = 84,<br>
-       .dpte_buffer_size_in_pte_reqs_chroma = 42,//todo<br>
-       .dpp_output_buffer_pixels = 2560,<br>
-       .opp_output_buffer_lines = 1,<br>
-       .pixel_chunk_size_kbytes = 8,<br>
-       .pte_enable = 1,<br>
-       .max_page_table_levels = 4,<br>
-       .pte_chunk_size_kbytes = 2,<br>
-       .meta_chunk_size_kbytes = 2,<br>
-       .writeback_chunk_size_kbytes = 2,<br>
-       .line_buffer_size_bits = 789504,<br>
-       .is_line_buffer_bpp_fixed = 0,<br>
-       .line_buffer_fixed_bpp = 0,<br>
-       .dcc_supported = true,<br>
-       .max_line_buffer_lines = 12,<br>
-       .writeback_luma_buffer_size_kbytes = 12,<br>
-       .writeback_chroma_buffer_size_kbytes = 8,<br>
-       .writeback_chroma_line_buffer_width_pixels = 4,<br>
-       .writeback_max_hscl_ratio = 1,<br>
-       .writeback_max_vscl_ratio = 1,<br>
-       .writeback_min_hscl_ratio = 1,<br>
-       .writeback_min_vscl_ratio = 1,<br>
-       .writeback_max_hscl_taps = 12,<br>
-       .writeback_max_vscl_taps = 12,<br>
-       .writeback_line_buffer_luma_buffer_size = 0,<br>
-       .writeback_line_buffer_chroma_buffer_size = 14643,<br>
-       .cursor_buffer_size = 8,<br>
-       .cursor_chunk_size = 2,<br>
-       .max_num_otg = 5,<br>
-       .max_num_dpp = 5,<br>
-       .max_num_wb = 1,<br>
-       .max_dchub_pscl_bw_pix_per_clk = 4,<br>
-       .max_pscl_lb_bw_pix_per_clk = 2,<br>
-       .max_lb_vscl_bw_pix_per_clk = 4,<br>
-       .max_vscl_hscl_bw_pix_per_clk = 4,<br>
-       .max_hscl_ratio = 8,<br>
-       .max_vscl_ratio = 8,<br>
-       .hscl_mults = 4,<br>
-       .vscl_mults = 4,<br>
-       .max_hscl_taps = 8,<br>
-       .max_vscl_taps = 8,<br>
-       .dispclk_ramp_margin_percent = 1,<br>
-       .underscan_factor = 1.10,<br>
-       .min_vblank_lines = 32, //<br>
-       .dppclk_delay_subtotal = 77, //<br>
-       .dppclk_delay_scl_lb_only = 16,<br>
-       .dppclk_delay_scl = 50,<br>
-       .dppclk_delay_cnvc_formatter = 8,<br>
-       .dppclk_delay_cnvc_cursor = 6,<br>
-       .dispclk_delay_subtotal = 87, //<br>
-       .dcfclk_cstate_latency = 10, // SRExitTime<br>
-       .max_inter_dcn_tile_repeaters = 8,<br>
-       .xfc_supported = true,<br>
-       .xfc_fill_bw_overhead_percent = 10.0,<br>
-       .xfc_fill_constant_bytes = 0,<br>
-       .ptoi_supported = 0,<br>
-       .number_of_cursors = 1,<br>
-};<br>
-<br>
-static struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = {<br>
-       /* Defaults that get patched on driver load from firmware. */<br>
-       .clock_limits = {<br>
-                       {<br>
-                               .state = 0,<br>
-                               .dcfclk_mhz = 560.0,<br>
-                               .fabricclk_mhz = 560.0,<br>
-                               .dispclk_mhz = 513.0,<br>
-                               .dppclk_mhz = 513.0,<br>
-                               .phyclk_mhz = 540.0,<br>
-                               .socclk_mhz = 560.0,<br>
-                               .dscclk_mhz = 171.0,<br>
-                               .dram_speed_mts = 8960.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 1,<br>
-                               .dcfclk_mhz = 694.0,<br>
-                               .fabricclk_mhz = 694.0,<br>
-                               .dispclk_mhz = 642.0,<br>
-                               .dppclk_mhz = 642.0,<br>
-                               .phyclk_mhz = 600.0,<br>
-                               .socclk_mhz = 694.0,<br>
-                               .dscclk_mhz = 214.0,<br>
-                               .dram_speed_mts = 11104.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 2,<br>
-                               .dcfclk_mhz = 875.0,<br>
-                               .fabricclk_mhz = 875.0,<br>
-                               .dispclk_mhz = 734.0,<br>
-                               .dppclk_mhz = 734.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 875.0,<br>
-                               .dscclk_mhz = 245.0,<br>
-                               .dram_speed_mts = 14000.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 3,<br>
-                               .dcfclk_mhz = 1000.0,<br>
-                               .fabricclk_mhz = 1000.0,<br>
-                               .dispclk_mhz = 1100.0,<br>
-                               .dppclk_mhz = 1100.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 1000.0,<br>
-                               .dscclk_mhz = 367.0,<br>
-                               .dram_speed_mts = 16000.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 4,<br>
-                               .dcfclk_mhz = 1200.0,<br>
-                               .fabricclk_mhz = 1200.0,<br>
-                               .dispclk_mhz = 1284.0,<br>
-                               .dppclk_mhz = 1284.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 1200.0,<br>
-                               .dscclk_mhz = 428.0,<br>
-                               .dram_speed_mts = 16000.0,<br>
-                       },<br>
-                       /*Extra state, no dispclk ramping*/<br>
-                       {<br>
-                               .state = 5,<br>
-                               .dcfclk_mhz = 1200.0,<br>
-                               .fabricclk_mhz = 1200.0,<br>
-                               .dispclk_mhz = 1284.0,<br>
-                               .dppclk_mhz = 1284.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 1200.0,<br>
-                               .dscclk_mhz = 428.0,<br>
-                               .dram_speed_mts = 16000.0,<br>
-                       },<br>
-               },<br>
-       .num_states = 5,<br>
-       .sr_exit_time_us = 8.6,<br>
-       .sr_enter_plus_exit_time_us = 10.9,<br>
-       .urgent_latency_us = 4.0,<br>
-       .urgent_latency_pixel_data_only_us = 4.0,<br>
-       .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,<br>
-       .urgent_latency_vm_data_only_us = 4.0,<br>
-       .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,<br>
-       .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,<br>
-       .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,<br>
-       .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0,<br>
-       .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0,<br>
-       .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0,<br>
-       .max_avg_sdp_bw_use_normal_percent = 40.0,<br>
-       .max_avg_dram_bw_use_normal_percent = 40.0,<br>
-       .writeback_latency_us = 12.0,<br>
-       .ideal_dram_bw_after_urgent_percent = 40.0,<br>
-       .max_request_size_bytes = 256,<br>
-       .dram_channel_width_bytes = 2,<br>
-       .fabric_datapath_to_dcn_data_return_bytes = 64,<br>
-       .dcn_downspread_percent = 0.5,<br>
-       .downspread_percent = 0.38,<br>
-       .dram_page_open_time_ns = 50.0,<br>
-       .dram_rw_turnaround_time_ns = 17.5,<br>
-       .dram_return_buffer_per_channel_bytes = 8192,<br>
-       .round_trip_ping_latency_dcfclk_cycles = 131,<br>
-       .urgent_out_of_order_return_per_channel_bytes = 256,<br>
-       .channel_interleave_bytes = 256,<br>
-       .num_banks = 8,<br>
-       .num_chans = 16,<br>
-       .vmm_page_size_bytes = 4096,<br>
-       .dram_clock_change_latency_us = 404.0,<br>
-       .dummy_pstate_latency_us = 5.0,<br>
-       .writeback_dram_clock_change_latency_us = 23.0,<br>
-       .return_bus_width_bytes = 64,<br>
-       .dispclk_dppclk_vco_speed_mhz = 3850,<br>
-       .xfc_bus_transport_time_us = 20,<br>
-       .xfc_xbuf_latency_tolerance_us = 4,<br>
-       .use_urgent_burst_bw = 0<br>
-};<br>
-<br>
-static struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = {<br>
-       .clock_limits = {<br>
-                       {<br>
-                               .state = 0,<br>
-                               .dcfclk_mhz = 560.0,<br>
-                               .fabricclk_mhz = 560.0,<br>
-                               .dispclk_mhz = 513.0,<br>
-                               .dppclk_mhz = 513.0,<br>
-                               .phyclk_mhz = 540.0,<br>
-                               .socclk_mhz = 560.0,<br>
-                               .dscclk_mhz = 171.0,<br>
-                               .dram_speed_mts = 8960.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 1,<br>
-                               .dcfclk_mhz = 694.0,<br>
-                               .fabricclk_mhz = 694.0,<br>
-                               .dispclk_mhz = 642.0,<br>
-                               .dppclk_mhz = 642.0,<br>
-                               .phyclk_mhz = 600.0,<br>
-                               .socclk_mhz = 694.0,<br>
-                               .dscclk_mhz = 214.0,<br>
-                               .dram_speed_mts = 11104.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 2,<br>
-                               .dcfclk_mhz = 875.0,<br>
-                               .fabricclk_mhz = 875.0,<br>
-                               .dispclk_mhz = 734.0,<br>
-                               .dppclk_mhz = 734.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 875.0,<br>
-                               .dscclk_mhz = 245.0,<br>
-                               .dram_speed_mts = 14000.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 3,<br>
-                               .dcfclk_mhz = 1000.0,<br>
-                               .fabricclk_mhz = 1000.0,<br>
-                               .dispclk_mhz = 1100.0,<br>
-                               .dppclk_mhz = 1100.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 1000.0,<br>
-                               .dscclk_mhz = 367.0,<br>
-                               .dram_speed_mts = 16000.0,<br>
-                       },<br>
-                       {<br>
-                               .state = 4,<br>
-                               .dcfclk_mhz = 1200.0,<br>
-                               .fabricclk_mhz = 1200.0,<br>
-                               .dispclk_mhz = 1284.0,<br>
-                               .dppclk_mhz = 1284.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 1200.0,<br>
-                               .dscclk_mhz = 428.0,<br>
-                               .dram_speed_mts = 16000.0,<br>
-                       },<br>
-                       /*Extra state, no dispclk ramping*/<br>
-                       {<br>
-                               .state = 5,<br>
-                               .dcfclk_mhz = 1200.0,<br>
-                               .fabricclk_mhz = 1200.0,<br>
-                               .dispclk_mhz = 1284.0,<br>
-                               .dppclk_mhz = 1284.0,<br>
-                               .phyclk_mhz = 810.0,<br>
-                               .socclk_mhz = 1200.0,<br>
-                               .dscclk_mhz = 428.0,<br>
-                               .dram_speed_mts = 16000.0,<br>
-                       },<br>
-               },<br>
-       .num_states = 5,<br>
-       .sr_exit_time_us = 11.6,<br>
-       .sr_enter_plus_exit_time_us = 13.9,<br>
-       .urgent_latency_us = 4.0,<br>
-       .urgent_latency_pixel_data_only_us = 4.0,<br>
-       .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,<br>
-       .urgent_latency_vm_data_only_us = 4.0,<br>
-       .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,<br>
-       .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,<br>
-       .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,<br>
-       .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0,<br>
-       .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0,<br>
-       .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0,<br>
-       .max_avg_sdp_bw_use_normal_percent = 40.0,<br>
-       .max_avg_dram_bw_use_normal_percent = 40.0,<br>
-       .writeback_latency_us = 12.0,<br>
-       .ideal_dram_bw_after_urgent_percent = 40.0,<br>
-       .max_request_size_bytes = 256,<br>
-       .dram_channel_width_bytes = 2,<br>
-       .fabric_datapath_to_dcn_data_return_bytes = 64,<br>
-       .dcn_downspread_percent = 0.5,<br>
-       .downspread_percent = 0.38,<br>
-       .dram_page_open_time_ns = 50.0,<br>
-       .dram_rw_turnaround_time_ns = 17.5,<br>
-       .dram_return_buffer_per_channel_bytes = 8192,<br>
-       .round_trip_ping_latency_dcfclk_cycles = 131,<br>
-       .urgent_out_of_order_return_per_channel_bytes = 256,<br>
-       .channel_interleave_bytes = 256,<br>
-       .num_banks = 8,<br>
-       .num_chans = 8,<br>
-       .vmm_page_size_bytes = 4096,<br>
-       .dram_clock_change_latency_us = 404.0,<br>
-       .dummy_pstate_latency_us = 5.0,<br>
-       .writeback_dram_clock_change_latency_us = 23.0,<br>
-       .return_bus_width_bytes = 64,<br>
-       .dispclk_dppclk_vco_speed_mhz = 3850,<br>
-       .xfc_bus_transport_time_us = 20,<br>
-       .xfc_xbuf_latency_tolerance_us = 4,<br>
-       .use_urgent_burst_bw = 0<br>
-};<br>
-<br>
-static struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = { 0 };<br>
-<br>
 #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL<br>
         #define mmDP0_DP_DPHY_INTERNAL_CTRL             0x210f<br>
         #define mmDP0_DP_DPHY_INTERNAL_CTRL_BASE_IDX    2<br>
@@ -1810,69 +1448,6 @@ enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_<br>
         return result;<br>
 }<br>
 <br>
-<br>
-static void swizzle_to_dml_params(<br>
-               enum swizzle_mode_values swizzle,<br>
-               unsigned int *sw_mode)<br>
-{<br>
-       switch (swizzle) {<br>
-       case DC_SW_LINEAR:<br>
-               *sw_mode = dm_sw_linear;<br>
-               break;<br>
-       case DC_SW_4KB_S:<br>
-               *sw_mode = dm_sw_4kb_s;<br>
-               break;<br>
-       case DC_SW_4KB_S_X:<br>
-               *sw_mode = dm_sw_4kb_s_x;<br>
-               break;<br>
-       case DC_SW_4KB_D:<br>
-               *sw_mode = dm_sw_4kb_d;<br>
-               break;<br>
-       case DC_SW_4KB_D_X:<br>
-               *sw_mode = dm_sw_4kb_d_x;<br>
-               break;<br>
-       case DC_SW_64KB_S:<br>
-               *sw_mode = dm_sw_64kb_s;<br>
-               break;<br>
-       case DC_SW_64KB_S_X:<br>
-               *sw_mode = dm_sw_64kb_s_x;<br>
-               break;<br>
-       case DC_SW_64KB_S_T:<br>
-               *sw_mode = dm_sw_64kb_s_t;<br>
-               break;<br>
-       case DC_SW_64KB_D:<br>
-               *sw_mode = dm_sw_64kb_d;<br>
-               break;<br>
-       case DC_SW_64KB_D_X:<br>
-               *sw_mode = dm_sw_64kb_d_x;<br>
-               break;<br>
-       case DC_SW_64KB_D_T:<br>
-               *sw_mode = dm_sw_64kb_d_t;<br>
-               break;<br>
-       case DC_SW_64KB_R_X:<br>
-               *sw_mode = dm_sw_64kb_r_x;<br>
-               break;<br>
-       case DC_SW_VAR_S:<br>
-               *sw_mode = dm_sw_var_s;<br>
-               break;<br>
-       case DC_SW_VAR_S_X:<br>
-               *sw_mode = dm_sw_var_s_x;<br>
-               break;<br>
-       case DC_SW_VAR_D:<br>
-               *sw_mode = dm_sw_var_d;<br>
-               break;<br>
-       case DC_SW_VAR_D_X:<br>
-               *sw_mode = dm_sw_var_d_x;<br>
-               break;<br>
-       case DC_SW_VAR_R_X:<br>
-               *sw_mode = dm_sw_var_r_x;<br>
-               break;<br>
-       default:<br>
-               ASSERT(0); /* Not supported */<br>
-               break;<br>
-       }<br>
-}<br>
-<br>
 bool dcn20_split_stream_for_odm(<br>
                 const struct dc *dc,<br>
                 struct resource_context *res_ctx,<br>
@@ -1988,394 +1563,6 @@ void dcn20_split_stream_for_mpc(<br>
         ASSERT(primary_pipe->plane_state);<br>
 }<br>
 <br>
-int dcn20_populate_dml_pipes_from_context(<br>
-               struct dc *dc,<br>
-               struct dc_state *context,<br>
-               display_e2e_pipe_params_st *pipes,<br>
-               bool fast_validate)<br>
-{<br>
-       int pipe_cnt, i;<br>
-       bool synchronized_vblank = true;<br>
-       struct resource_context *res_ctx = &context->res_ctx;<br>
-<br>
-       for (i = 0, pipe_cnt = -1; i < dc->res_pool->pipe_count; i++) {<br>
-               if (!res_ctx->pipe_ctx[i].stream)<br>
-                       continue;<br>
-<br>
-               if (pipe_cnt < 0) {<br>
-                       pipe_cnt = i;<br>
-                       continue;<br>
-               }<br>
-<br>
-               if (res_ctx->pipe_ctx[pipe_cnt].stream == res_ctx->pipe_ctx[i].stream)<br>
-                       continue;<br>
-<br>
-               if (dc->debug.disable_timing_sync ||<br>
-                       (!resource_are_streams_timing_synchronizable(<br>
-                               res_ctx->pipe_ctx[pipe_cnt].stream,<br>
-                               res_ctx->pipe_ctx[i].stream) &&<br>
-                       !resource_are_vblanks_synchronizable(<br>
-                               res_ctx->pipe_ctx[pipe_cnt].stream,<br>
-                               res_ctx->pipe_ctx[i].stream))) {<br>
-                       synchronized_vblank = false;<br>
-                       break;<br>
-               }<br>
-       }<br>
-<br>
-       for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {<br>
-               struct dc_crtc_timing *timing = &res_ctx->pipe_ctx[i].stream->timing;<br>
-               unsigned int v_total;<br>
-               unsigned int front_porch;<br>
-               int output_bpc;<br>
-               struct audio_check aud_check = {0};<br>
-<br>
-               if (!res_ctx->pipe_ctx[i].stream)<br>
-                       continue;<br>
-<br>
-               v_total = timing->v_total;<br>
-               front_porch = timing->v_front_porch;<br>
-<br>
-               /* todo:<br>
-               pipes[pipe_cnt].pipe.src.dynamic_metadata_enable = 0;<br>
-               pipes[pipe_cnt].pipe.src.dcc = 0;<br>
-               pipes[pipe_cnt].pipe.src.vm = 0;*/<br>
-<br>
-               pipes[pipe_cnt].clks_cfg.refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000.0;<br>
-<br>
-               pipes[pipe_cnt].dout.dsc_enable = res_ctx->pipe_ctx[i].stream->timing.flags.DSC;<br>
-               /* todo: rotation?*/<br>
-               pipes[pipe_cnt].dout.dsc_slices = res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.num_slices_h;<br>
-               if (res_ctx->pipe_ctx[i].stream->use_dynamic_meta) {<br>
-                       pipes[pipe_cnt].pipe.src.dynamic_metadata_enable = true;<br>
-                       /* 1/2 vblank */<br>
-                       pipes[pipe_cnt].pipe.src.dynamic_metadata_lines_before_active =<br>
-                               (v_total - timing->v_addressable<br>
-                                       - timing->v_border_top - timing->v_border_bottom) / 2;<br>
-                       /* 36 bytes dp, 32 hdmi */<br>
-                       pipes[pipe_cnt].pipe.src.dynamic_metadata_xmit_bytes =<br>
-                               dc_is_dp_signal(res_ctx->pipe_ctx[i].stream->signal) ? 36 : 32;<br>
-               }<br>
-               pipes[pipe_cnt].pipe.src.dcc = false;<br>
-               pipes[pipe_cnt].pipe.src.dcc_rate = 1;<br>
-               pipes[pipe_cnt].pipe.dest.synchronized_vblank_all_planes = synchronized_vblank;<br>
-               pipes[pipe_cnt].pipe.dest.hblank_start = timing->h_total - timing->h_front_porch;<br>
-               pipes[pipe_cnt].pipe.dest.hblank_end = pipes[pipe_cnt].pipe.dest.hblank_start<br>
-                               - timing->h_addressable<br>
-                               - timing->h_border_left<br>
-                               - timing->h_border_right;<br>
-               pipes[pipe_cnt].pipe.dest.vblank_start = v_total - front_porch;<br>
-               pipes[pipe_cnt].pipe.dest.vblank_end = pipes[pipe_cnt].pipe.dest.vblank_start<br>
-                               - timing->v_addressable<br>
-                               - timing->v_border_top<br>
-                               - timing->v_border_bottom;<br>
-               pipes[pipe_cnt].pipe.dest.htotal = timing->h_total;<br>
-               pipes[pipe_cnt].pipe.dest.vtotal = v_total;<br>
-               pipes[pipe_cnt].pipe.dest.hactive =<br>
-                       timing->h_addressable + timing->h_border_left + timing->h_border_right;<br>
-               pipes[pipe_cnt].pipe.dest.vactive =<br>
-                       timing->v_addressable + timing->v_border_top + timing->v_border_bottom;<br>
-               pipes[pipe_cnt].pipe.dest.interlaced = timing->flags.INTERLACE;<br>
-               pipes[pipe_cnt].pipe.dest.pixel_rate_mhz = timing->pix_clk_100hz/10000.0;<br>
-               if (timing->timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING)<br>
-                       pipes[pipe_cnt].pipe.dest.pixel_rate_mhz *= 2;<br>
-               pipes[pipe_cnt].pipe.dest.otg_inst = res_ctx->pipe_ctx[i].stream_res.tg->inst;<br>
-               pipes[pipe_cnt].dout.dp_lanes = 4;<br>
-               pipes[pipe_cnt].dout.is_virtual = 0;<br>
-               pipes[pipe_cnt].pipe.dest.vtotal_min = res_ctx->pipe_ctx[i].stream->adjust.v_total_min;<br>
-               pipes[pipe_cnt].pipe.dest.vtotal_max = res_ctx->pipe_ctx[i].stream->adjust.v_total_max;<br>
-               switch (get_num_odm_splits(&res_ctx->pipe_ctx[i])) {<br>
-               case 1:<br>
-                       pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_2to1;<br>
-                       break;<br>
-               case 3:<br>
-                       pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_4to1;<br>
-                       break;<br>
-               default:<br>
-                       pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_disabled;<br>
-               }<br>
-               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].pipe_idx;<br>
-               if (res_ctx->pipe_ctx[i].top_pipe && res_ctx->pipe_ctx[i].top_pipe->plane_state<br>
-                               == res_ctx->pipe_ctx[i].plane_state) {<br>
-                       struct pipe_ctx *first_pipe = res_ctx->pipe_ctx[i].top_pipe;<br>
-                       int split_idx = 0;<br>
-<br>
-                       while (first_pipe->top_pipe && first_pipe->top_pipe->plane_state<br>
-                                       == res_ctx->pipe_ctx[i].plane_state) {<br>
-                               first_pipe = first_pipe->top_pipe;<br>
-                               split_idx++;<br>
-                       }<br>
-                       /* Treat 4to1 mpc combine as an mpo of 2 2-to-1 combines */<br>
-                       if (split_idx == 0)<br>
-                               pipes[pipe_cnt].pipe.src.hsplit_grp = first_pipe->pipe_idx;<br>
-                       else if (split_idx == 1)<br>
-                               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].pipe_idx;<br>
-                       else if (split_idx == 2)<br>
-                               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].top_pipe->pipe_idx;<br>
-               } else if (res_ctx->pipe_ctx[i].prev_odm_pipe) {<br>
-                       struct pipe_ctx *first_pipe = res_ctx->pipe_ctx[i].prev_odm_pipe;<br>
-<br>
-                       while (first_pipe->prev_odm_pipe)<br>
-                               first_pipe = first_pipe->prev_odm_pipe;<br>
-                       pipes[pipe_cnt].pipe.src.hsplit_grp = first_pipe->pipe_idx;<br>
-               }<br>
-<br>
-               switch (res_ctx->pipe_ctx[i].stream->signal) {<br>
-               case SIGNAL_TYPE_DISPLAY_PORT_MST:<br>
-               case SIGNAL_TYPE_DISPLAY_PORT:<br>
-                       pipes[pipe_cnt].dout.output_type = dm_dp;<br>
-                       break;<br>
-               case SIGNAL_TYPE_EDP:<br>
-                       pipes[pipe_cnt].dout.output_type = dm_edp;<br>
-                       break;<br>
-               case SIGNAL_TYPE_HDMI_TYPE_A:<br>
-               case SIGNAL_TYPE_DVI_SINGLE_LINK:<br>
-               case SIGNAL_TYPE_DVI_DUAL_LINK:<br>
-                       pipes[pipe_cnt].dout.output_type = dm_hdmi;<br>
-                       break;<br>
-               default:<br>
-                       /* In case there is no signal, set dp with 4 lanes to allow max config */<br>
-                       pipes[pipe_cnt].dout.is_virtual = 1;<br>
-                       pipes[pipe_cnt].dout.output_type = dm_dp;<br>
-                       pipes[pipe_cnt].dout.dp_lanes = 4;<br>
-               }<br>
-<br>
-               switch (res_ctx->pipe_ctx[i].stream->timing.display_color_depth) {<br>
-               case COLOR_DEPTH_666:<br>
-                       output_bpc = 6;<br>
-                       break;<br>
-               case COLOR_DEPTH_888:<br>
-                       output_bpc = 8;<br>
-                       break;<br>
-               case COLOR_DEPTH_101010:<br>
-                       output_bpc = 10;<br>
-                       break;<br>
-               case COLOR_DEPTH_121212:<br>
-                       output_bpc = 12;<br>
-                       break;<br>
-               case COLOR_DEPTH_141414:<br>
-                       output_bpc = 14;<br>
-                       break;<br>
-               case COLOR_DEPTH_161616:<br>
-                       output_bpc = 16;<br>
-                       break;<br>
-               case COLOR_DEPTH_999:<br>
-                       output_bpc = 9;<br>
-                       break;<br>
-               case COLOR_DEPTH_111111:<br>
-                       output_bpc = 11;<br>
-                       break;<br>
-               default:<br>
-                       output_bpc = 8;<br>
-                       break;<br>
-               }<br>
-<br>
-               switch (res_ctx->pipe_ctx[i].stream->timing.pixel_encoding) {<br>
-               case PIXEL_ENCODING_RGB:<br>
-               case PIXEL_ENCODING_YCBCR444:<br>
-                       pipes[pipe_cnt].dout.output_format = dm_444;<br>
-                       pipes[pipe_cnt].dout.output_bpp = output_bpc * 3;<br>
-                       break;<br>
-               case PIXEL_ENCODING_YCBCR420:<br>
-                       pipes[pipe_cnt].dout.output_format = dm_420;<br>
-                       pipes[pipe_cnt].dout.output_bpp = (output_bpc * 3.0) / 2;<br>
-                       break;<br>
-               case PIXEL_ENCODING_YCBCR422:<br>
-                       if (res_ctx->pipe_ctx[i].stream->timing.flags.DSC &&<br>
-                           !res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.ycbcr422_simple)<br>
-                               pipes[pipe_cnt].dout.output_format = dm_n422;<br>
-                       else<br>
-                               pipes[pipe_cnt].dout.output_format = dm_s422;<br>
-                       pipes[pipe_cnt].dout.output_bpp = output_bpc * 2;<br>
-                       break;<br>
-               default:<br>
-                       pipes[pipe_cnt].dout.output_format = dm_444;<br>
-                       pipes[pipe_cnt].dout.output_bpp = output_bpc * 3;<br>
-               }<br>
-<br>
-               if (res_ctx->pipe_ctx[i].stream->timing.flags.DSC)<br>
-                       pipes[pipe_cnt].dout.output_bpp = res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.bits_per_pixel / 16.0;<br>
-<br>
-               /* todo: default max for now, until there is logic reflecting this in dc*/<br>
-               pipes[pipe_cnt].dout.dsc_input_bpc = 12;<br>
-               /*fill up the audio sample rate (unit in kHz)*/<br>
-               get_audio_check(&res_ctx->pipe_ctx[i].stream->audio_info, &aud_check);<br>
-               pipes[pipe_cnt].dout.max_audio_sample_rate = aud_check.max_audiosample_rate / 1000;<br>
-               /*<br>
-                * For graphic plane, cursor number is 1, nv12 is 0<br>
-                * bw calculations due to cursor on/off<br>
-                */<br>
-               if (res_ctx->pipe_ctx[i].plane_state &&<br>
-                               res_ctx->pipe_ctx[i].plane_state->address.type == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)<br>
-                       pipes[pipe_cnt].pipe.src.num_cursors = 0;<br>
-               else<br>
-                       pipes[pipe_cnt].pipe.src.num_cursors = dc->dml.ip.number_of_cursors;<br>
-<br>
-               pipes[pipe_cnt].pipe.src.cur0_src_width = 256;<br>
-               pipes[pipe_cnt].pipe.src.cur0_bpp = dm_cur_32bit;<br>
-<br>
-               if (!res_ctx->pipe_ctx[i].plane_state) {<br>
-                       pipes[pipe_cnt].pipe.src.is_hsplit = pipes[pipe_cnt].pipe.dest.odm_combine != dm_odm_combine_mode_disabled;<br>
-                       pipes[pipe_cnt].pipe.src.source_scan = dm_horz;<br>
-                       pipes[pipe_cnt].pipe.src.sw_mode = dm_sw_4kb_s;<br>
-                       pipes[pipe_cnt].pipe.src.macro_tile_size = dm_64k_tile;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_width = timing->h_addressable;<br>
-                       if (pipes[pipe_cnt].pipe.src.viewport_width > 1920)<br>
-                               pipes[pipe_cnt].pipe.src.viewport_width = 1920;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_height = timing->v_addressable;<br>
-                       if (pipes[pipe_cnt].pipe.src.viewport_height > 1080)<br>
-                               pipes[pipe_cnt].pipe.src.viewport_height = 1080;<br>
-                       pipes[pipe_cnt].pipe.src.surface_height_y = pipes[pipe_cnt].pipe.src.viewport_height;<br>
-                       pipes[pipe_cnt].pipe.src.surface_width_y = pipes[pipe_cnt].pipe.src.viewport_width;<br>
-                       pipes[pipe_cnt].pipe.src.surface_height_c = pipes[pipe_cnt].pipe.src.viewport_height;<br>
-                       pipes[pipe_cnt].pipe.src.surface_width_c = pipes[pipe_cnt].pipe.src.viewport_width;<br>
-                       pipes[pipe_cnt].pipe.src.data_pitch = ((pipes[pipe_cnt].pipe.src.viewport_width + 255) / 256) * 256;<br>
-                       pipes[pipe_cnt].pipe.src.source_format = dm_444_32;<br>
-                       pipes[pipe_cnt].pipe.dest.recout_width = pipes[pipe_cnt].pipe.src.viewport_width; /*vp_width/hratio*/<br>
-                       pipes[pipe_cnt].pipe.dest.recout_height = pipes[pipe_cnt].pipe.src.viewport_height; /*vp_height/vratio*/<br>
-                       pipes[pipe_cnt].pipe.dest.full_recout_width = pipes[pipe_cnt].pipe.dest.recout_width;  /*when is_hsplit != 1*/<br>
-                       pipes[pipe_cnt].pipe.dest.full_recout_height = pipes[pipe_cnt].pipe.dest.recout_height; /*when is_hsplit != 1*/<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.lb_depth = dm_lb_16;<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.hscl_ratio = 1.0;<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.vscl_ratio = 1.0;<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.scl_enable = 0; /*Lb only or Full scl*/<br>
-                       pipes[pipe_cnt].pipe.scale_taps.htaps = 1;<br>
-                       pipes[pipe_cnt].pipe.scale_taps.vtaps = 1;<br>
-                       pipes[pipe_cnt].pipe.dest.vtotal_min = v_total;<br>
-                       pipes[pipe_cnt].pipe.dest.vtotal_max = v_total;<br>
-<br>
-                       if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_2to1) {<br>
-                               pipes[pipe_cnt].pipe.src.viewport_width /= 2;<br>
-                               pipes[pipe_cnt].pipe.dest.recout_width /= 2;<br>
-                       } else if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_4to1) {<br>
-                               pipes[pipe_cnt].pipe.src.viewport_width /= 4;<br>
-                               pipes[pipe_cnt].pipe.dest.recout_width /= 4;<br>
-                       }<br>
-               } else {<br>
-                       struct dc_plane_state *pln = res_ctx->pipe_ctx[i].plane_state;<br>
-                       struct scaler_data *scl = &res_ctx->pipe_ctx[i].plane_res.scl_data;<br>
-<br>
-                       pipes[pipe_cnt].pipe.src.immediate_flip = pln->flip_immediate;<br>
-                       pipes[pipe_cnt].pipe.src.is_hsplit = (res_ctx->pipe_ctx[i].bottom_pipe && res_ctx->pipe_ctx[i].bottom_pipe->plane_state == pln)<br>
-                                       || (res_ctx->pipe_ctx[i].top_pipe && res_ctx->pipe_ctx[i].top_pipe->plane_state == pln)<br>
-                                       || pipes[pipe_cnt].pipe.dest.odm_combine != dm_odm_combine_mode_disabled;<br>
-<br>
-                       /* stereo is not split */<br>
-                       if (pln->stereo_format == PLANE_STEREO_FORMAT_SIDE_BY_SIDE ||<br>
-                           pln->stereo_format == PLANE_STEREO_FORMAT_TOP_AND_BOTTOM) {<br>
-                               pipes[pipe_cnt].pipe.src.is_hsplit = false;<br>
-                               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].pipe_idx;<br>
-                       }<br>
-<br>
-                       pipes[pipe_cnt].pipe.src.source_scan = pln->rotation == ROTATION_ANGLE_90<br>
-                                       || pln->rotation == ROTATION_ANGLE_270 ? dm_vert : dm_horz;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_y_y = scl->viewport.y;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_y_c = scl->viewport_c.y;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_width = scl->viewport.width;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_width_c = scl->viewport_c.width;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_height = scl->viewport.height;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_height_c = scl->viewport_c.height;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_width_max = pln->src_rect.width;<br>
-                       pipes[pipe_cnt].pipe.src.viewport_height_max = pln->src_rect.height;<br>
-                       pipes[pipe_cnt].pipe.src.surface_width_y = pln->plane_size.surface_size.width;<br>
-                       pipes[pipe_cnt].pipe.src.surface_height_y = pln->plane_size.surface_size.height;<br>
-                       pipes[pipe_cnt].pipe.src.surface_width_c = pln->plane_size.chroma_size.width;<br>
-                       pipes[pipe_cnt].pipe.src.surface_height_c = pln->plane_size.chroma_size.height;<br>
-                       if (pln->format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA<br>
-                                       || pln->format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) {<br>
-                               pipes[pipe_cnt].pipe.src.data_pitch = pln->plane_size.surface_pitch;<br>
-                               pipes[pipe_cnt].pipe.src.data_pitch_c = pln->plane_size.chroma_pitch;<br>
-                               pipes[pipe_cnt].pipe.src.meta_pitch = pln->dcc.meta_pitch;<br>
-                               pipes[pipe_cnt].pipe.src.meta_pitch_c = pln->dcc.meta_pitch_c;<br>
-                       } else {<br>
-                               pipes[pipe_cnt].pipe.src.data_pitch = pln->plane_size.surface_pitch;<br>
-                               pipes[pipe_cnt].pipe.src.meta_pitch = pln->dcc.meta_pitch;<br>
-                       }<br>
-                       pipes[pipe_cnt].pipe.src.dcc = pln->dcc.enable;<br>
-                       pipes[pipe_cnt].pipe.dest.recout_width = scl->recout.width;<br>
-                       pipes[pipe_cnt].pipe.dest.recout_height = scl->recout.height;<br>
-                       pipes[pipe_cnt].pipe.dest.full_recout_height = scl->recout.height;<br>
-                       pipes[pipe_cnt].pipe.dest.full_recout_width = scl->recout.width;<br>
-                       if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_2to1)<br>
-                               pipes[pipe_cnt].pipe.dest.full_recout_width *= 2;<br>
-                       else if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_4to1)<br>
-                               pipes[pipe_cnt].pipe.dest.full_recout_width *= 4;<br>
-                       else {<br>
-                               struct pipe_ctx *split_pipe = res_ctx->pipe_ctx[i].bottom_pipe;<br>
-<br>
-                               while (split_pipe && split_pipe->plane_state == pln) {<br>
-                                       pipes[pipe_cnt].pipe.dest.full_recout_width += split_pipe->plane_res.scl_data.recout.width;<br>
-                                       split_pipe = split_pipe->bottom_pipe;<br>
-                               }<br>
-                               split_pipe = res_ctx->pipe_ctx[i].top_pipe;<br>
-                               while (split_pipe && split_pipe->plane_state == pln) {<br>
-                                       pipes[pipe_cnt].pipe.dest.full_recout_width += split_pipe->plane_res.scl_data.recout.width;<br>
-                                       split_pipe = split_pipe->top_pipe;<br>
-                               }<br>
-                       }<br>
-<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.lb_depth = dm_lb_16;<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.hscl_ratio = (double) scl->ratios.horz.value / (1ULL<<32);<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.hscl_ratio_c = (double) scl->ratios.horz_c.value / (1ULL<<32);<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.vscl_ratio = (double) scl->ratios.vert.value / (1ULL<<32);<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.vscl_ratio_c = (double) scl->ratios.vert_c.value / (1ULL<<32);<br>
-                       pipes[pipe_cnt].pipe.scale_ratio_depth.scl_enable =<br>
-                                       scl->ratios.vert.value != dc_fixpt_one.value<br>
-                                       || scl->ratios.horz.value != dc_fixpt_one.value<br>
-                                       || scl->ratios.vert_c.value != dc_fixpt_one.value<br>
-                                       || scl->ratios.horz_c.value != dc_fixpt_one.value /*Lb only or Full scl*/<br>
-                                       || dc->debug.always_scale; /*support always scale*/<br>
-                       pipes[pipe_cnt].pipe.scale_taps.htaps = scl->taps.h_taps;<br>
-                       pipes[pipe_cnt].pipe.scale_taps.htaps_c = scl->taps.h_taps_c;<br>
-                       pipes[pipe_cnt].pipe.scale_taps.vtaps = scl->taps.v_taps;<br>
-                       pipes[pipe_cnt].pipe.scale_taps.vtaps_c = scl->taps.v_taps_c;<br>
-<br>
-                       pipes[pipe_cnt].pipe.src.macro_tile_size =<br>
-                                       swizzle_mode_to_macro_tile_size(pln->tiling_info.gfx9.swizzle);<br>
-                       swizzle_to_dml_params(pln->tiling_info.gfx9.swizzle,<br>
-                                       &pipes[pipe_cnt].pipe.src.sw_mode);<br>
-<br>
-                       switch (pln->format) {<br>
-                       case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:<br>
-                       case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_420_8;<br>
-                               break;<br>
-                       case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:<br>
-                       case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_420_10;<br>
-                               break;<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616:<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F:<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_444_64;<br>
-                               break;<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_RGB565:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_444_16;<br>
-                               break;<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_444_8;<br>
-                               break;<br>
-                       case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_rgbe_alpha;<br>
-                               break;<br>
-                       default:<br>
-                               pipes[pipe_cnt].pipe.src.source_format = dm_444_32;<br>
-                               break;<br>
-                       }<br>
-               }<br>
-<br>
-               pipe_cnt++;<br>
-       }<br>
-<br>
-       /* populate writeback information */<br>
-       DC_FP_START();<br>
-       dc->res_pool->funcs->populate_dml_writeback_from_context(dc, res_ctx, pipes);<br>
-       DC_FP_END();<br>
-<br>
-       return pipe_cnt;<br>
-}<br>
-<br>
 unsigned int dcn20_calc_max_scaled_time(<br>
                 unsigned int time_per_pixel,<br>
                 enum mmhubbub_wbif_mode mode,<br>
@@ -2413,7 +1600,7 @@ void dcn20_set_mcif_arb_params(<br>
 {<br>
         enum mmhubbub_wbif_mode wbif_mode;<br>
         struct mcif_arb_params *wb_arb_params;<br>
-       int i, j, k, dwb_pipe;<br>
+       int i, j, dwb_pipe;<br>
 <br>
         /* Writeback MCIF_WB arbitration parameters */<br>
         dwb_pipe = 0;<br>
@@ -2437,11 +1624,10 @@ void dcn20_set_mcif_arb_params(<br>
                         } else<br>
                                 wbif_mode = PACKED_444;<br>
 <br>
-                       for (k = 0; k < sizeof(wb_arb_params->cli_watermark)/sizeof(wb_arb_params->cli_watermark[0]); k++) {<br>
-                               wb_arb_params->cli_watermark[k] = get_wm_writeback_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-                               wb_arb_params->pstate_watermark[k] = get_wm_writeback_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-                       }<br>
-                       wb_arb_params->time_per_pixel = 16.0 * 1000 / (context->res_ctx.pipe_ctx[i].stream->phy_pix_clk / 1000); /* 4 bit fraction, ms */<br>
+                       DC_FP_START();<br>
+                       dcn20_fpu_set_wb_arb_params(wb_arb_params, context, pipes, pipe_cnt, i);<br>
+                       DC_FP_END();<br>
+<br>
                         wb_arb_params->slice_lines = 32;<br>
                         wb_arb_params->arbitration_slice = 2;<br>
                         wb_arb_params->max_scaled_time = dcn20_calc_max_scaled_time(wb_arb_params->time_per_pixel,<br>
@@ -2808,8 +1994,11 @@ int dcn20_validate_apply_pipe_split_flags(<br>
                 }<br>
 <br>
                 /* Adjust dppclk when split is forced, do not bother with dispclk */<br>
-               if (split[i] != 0 && v->NoOfDPP[vlevel][max_mpc_comb][pipe_idx] == 1)<br>
-                       v->RequiredDPPCLK[vlevel][max_mpc_comb][pipe_idx] /= 2;<br>
+               if (split[i] != 0 && v->NoOfDPP[vlevel][max_mpc_comb][pipe_idx] == 1) {<br>
+                       DC_FP_START();<br>
+                       dcn20_fpu_adjust_dppclk(v, vlevel, max_mpc_comb, pipe_idx, false);<br>
+                       DC_FP_END();<br>
+               }<br>
                 pipe_idx++;<br>
         }<br>
 <br>
@@ -2835,7 +2024,9 @@ bool dcn20_fast_validate_bw(<br>
 <br>
         dcn20_merge_pipes_for_validate(dc, context);<br>
 <br>
+       DC_FP_START();<br>
         pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate);<br>
+       DC_FP_END();<br>
 <br>
         *pipe_cnt_out = pipe_cnt;<br>
 <br>
@@ -2892,7 +2083,9 @@ bool dcn20_fast_validate_bw(<br>
                                 hsplit_pipe = dcn20_find_secondary_pipe(dc, &context->res_ctx, dc->res_pool, pipe);<br>
                                 ASSERT(hsplit_pipe);<br>
                                 if (!hsplit_pipe) {<br>
-                                       context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] *= 2;<br>
+                                       DC_FP_START();<br>
+                                       dcn20_fpu_adjust_dppclk(&context->bw_ctx.dml.vba, vlevel, context->bw_ctx.dml.vba.maxMpcComb, pipe_idx, true);<br>
+                                       DC_FP_END();<br>
                                         continue;<br>
                                 }<br>
                                 if (context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_idx]) {<br>
@@ -2934,369 +2127,6 @@ bool dcn20_fast_validate_bw(<br>
         return out;<br>
 }<br>
 <br>
-static void dcn20_calculate_wm(<br>
-               struct dc *dc, struct dc_state *context,<br>
-               display_e2e_pipe_params_st *pipes,<br>
-               int *out_pipe_cnt,<br>
-               int *pipe_split_from,<br>
-               int vlevel,<br>
-               bool fast_validate)<br>
-{<br>
-       int pipe_cnt, i, pipe_idx;<br>
-<br>
-       for (i = 0, pipe_idx = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {<br>
-               if (!context->res_ctx.pipe_ctx[i].stream)<br>
-                       continue;<br>
-<br>
-               pipes[pipe_cnt].clks_cfg.refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000.0;<br>
-               pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.vba.RequiredDISPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb];<br>
-<br>
-               if (pipe_split_from[i] < 0) {<br>
-                       pipes[pipe_cnt].clks_cfg.dppclk_mhz =<br>
-                                       context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx];<br>
-                       if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_idx] == pipe_idx)<br>
-                               pipes[pipe_cnt].pipe.dest.odm_combine =<br>
-                                               context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_idx];<br>
-                       else<br>
-                               pipes[pipe_cnt].pipe.dest.odm_combine = 0;<br>
-                       pipe_idx++;<br>
-               } else {<br>
-                       pipes[pipe_cnt].clks_cfg.dppclk_mhz =<br>
-                                       context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_split_from[i]];<br>
-                       if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_split_from[i]] == pipe_split_from[i])<br>
-                               pipes[pipe_cnt].pipe.dest.odm_combine =<br>
-                                               context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_split_from[i]];<br>
-                       else<br>
-                               pipes[pipe_cnt].pipe.dest.odm_combine = 0;<br>
-               }<br>
-<br>
-               if (dc->config.forced_clocks) {<br>
-                       pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dispclk_mhz;<br>
-                       pipes[pipe_cnt].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dppclk_mhz;<br>
-               }<br>
-               if (dc->debug.min_disp_clk_khz > pipes[pipe_cnt].clks_cfg.dispclk_mhz * 1000)<br>
-                       pipes[pipe_cnt].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz / 1000.0;<br>
-               if (dc->debug.min_dpp_clk_khz > pipes[pipe_cnt].clks_cfg.dppclk_mhz * 1000)<br>
-                       pipes[pipe_cnt].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz / 1000.0;<br>
-<br>
-               pipe_cnt++;<br>
-       }<br>
-<br>
-       if (pipe_cnt != pipe_idx) {<br>
-               if (dc->res_pool->funcs->populate_dml_pipes)<br>
-                       pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc,<br>
-                               context, pipes, fast_validate);<br>
-               else<br>
-                       pipe_cnt = dcn20_populate_dml_pipes_from_context(dc,<br>
-                               context, pipes, fast_validate);<br>
-       }<br>
-<br>
-       *out_pipe_cnt = pipe_cnt;<br>
-<br>
-       pipes[0].clks_cfg.voltage = vlevel;<br>
-       pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz;<br>
-       pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz;<br>
-<br>
-       /* only pipe 0 is read for voltage and dcf/soc clocks */<br>
-       if (vlevel < 1) {<br>
-               pipes[0].clks_cfg.voltage = 1;<br>
-               pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[1].dcfclk_mhz;<br>
-               pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[1].socclk_mhz;<br>
-       }<br>
-       context->bw_ctx.bw.dcn.watermarks.b.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.b.urgent_latency_ns = get_urgent_latency(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-<br>
-       if (vlevel < 2) {<br>
-               pipes[0].clks_cfg.voltage = 2;<br>
-               pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].dcfclk_mhz;<br>
-               pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].socclk_mhz;<br>
-       }<br>
-       context->bw_ctx.bw.dcn.watermarks.c.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.c.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.c.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.c.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-<br>
-       if (vlevel < 3) {<br>
-               pipes[0].clks_cfg.voltage = 3;<br>
-               pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].dcfclk_mhz;<br>
-               pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].socclk_mhz;<br>
-       }<br>
-       context->bw_ctx.bw.dcn.watermarks.d.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.d.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.d.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.d.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-<br>
-       pipes[0].clks_cfg.voltage = vlevel;<br>
-       pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz;<br>
-       pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-       context->bw_ctx.bw.dcn.watermarks.a.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
-}<br>
-<br>
-static bool is_dtbclk_required(struct dc *dc, struct dc_state *context)<br>
-{<br>
-       int i;<br>
-       for (i = 0; i < dc->res_pool->pipe_count; i++) {<br>
-               if (!context->res_ctx.pipe_ctx[i].stream)<br>
-                       continue;<br>
-               if (is_dp_128b_132b_signal(&context->res_ctx.pipe_ctx[i]))<br>
-                       return true;<br>
-       }<br>
-       return false;<br>
-}<br>
-<br>
-static enum dcn_zstate_support_state  decide_zstate_support(struct dc *dc, struct dc_state *context)<br>
-{<br>
-       int plane_count;<br>
-       int i;<br>
-<br>
-       plane_count = 0;<br>
-       for (i = 0; i < dc->res_pool->pipe_count; i++) {<br>
-               if (context->res_ctx.pipe_ctx[i].plane_state)<br>
-                       plane_count++;<br>
-       }<br>
-<br>
-       /*<br>
-        * Zstate is allowed in following scenarios:<br>
-        *        1. Single eDP with PSR enabled<br>
-        *        2. 0 planes (No memory requests)<br>
-        *        3. Single eDP without PSR but > 5ms stutter period<br>
-        */<br>
-       if (plane_count == 0)<br>
-               return DCN_ZSTATE_SUPPORT_ALLOW;<br>
-       else if (context->stream_count == 1 &&  context->streams[0]->signal == SIGNAL_TYPE_EDP) {<br>
-               struct dc_link *link = context->streams[0]->sink->link;<br>
-<br>
-               /* zstate only supported on PWRSEQ0 */<br>
-               if (link->link_index != 0)<br>
-                       return DCN_ZSTATE_SUPPORT_DISALLOW;<br>
-<br>
-               if (context->bw_ctx.dml.vba.StutterPeriod > 5000.0)<br>
-                       return DCN_ZSTATE_SUPPORT_ALLOW;<br>
-               else if (link->psr_settings.psr_version == DC_PSR_VERSION_1 && !dc->debug.disable_psr)<br>
-                       return DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY;<br>
-               else<br>
-                       return DCN_ZSTATE_SUPPORT_DISALLOW;<br>
-       } else<br>
-               return DCN_ZSTATE_SUPPORT_DISALLOW;<br>
-}<br>
-<br>
-void dcn20_calculate_dlg_params(<br>
-               struct dc *dc, struct dc_state *context,<br>
-               display_e2e_pipe_params_st *pipes,<br>
-               int pipe_cnt,<br>
-               int vlevel)<br>
-{<br>
-       int i, pipe_idx;<br>
-<br>
-       /* Writeback MCIF_WB arbitration parameters */<br>
-       dc->res_pool->funcs->set_mcif_arb_params(dc, context, pipes, pipe_cnt);<br>
-<br>
-       context->bw_ctx.bw.dcn.clk.dispclk_khz = context->bw_ctx.dml.vba.DISPCLK * 1000;<br>
-       context->bw_ctx.bw.dcn.clk.dcfclk_khz = context->bw_ctx.dml.vba.DCFCLK * 1000;<br>
-       context->bw_ctx.bw.dcn.clk.socclk_khz = context->bw_ctx.dml.vba.SOCCLK * 1000;<br>
-       context->bw_ctx.bw.dcn.clk.dramclk_khz = context->bw_ctx.dml.vba.DRAMSpeed * 1000 / 16;<br>
-<br>
-       if (dc->debug.min_dram_clk_khz > context->bw_ctx.bw.dcn.clk.dramclk_khz)<br>
-               context->bw_ctx.bw.dcn.clk.dramclk_khz = dc->debug.min_dram_clk_khz;<br>
-<br>
-       context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = context->bw_ctx.dml.vba.DCFCLKDeepSleep * 1000;<br>
-       context->bw_ctx.bw.dcn.clk.fclk_khz = context->bw_ctx.dml.vba.FabricClock * 1000;<br>
-       context->bw_ctx.bw.dcn.clk.p_state_change_support =<br>
-               context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][context->bw_ctx.dml.vba.maxMpcComb]<br>
-                                                       != dm_dram_clock_change_unsupported;<br>
-       context->bw_ctx.bw.dcn.clk.dppclk_khz = 0;<br>
-<br>
-       context->bw_ctx.bw.dcn.clk.zstate_support = decide_zstate_support(dc, context);<br>
-<br>
-       context->bw_ctx.bw.dcn.clk.dtbclk_en = is_dtbclk_required(dc, context);<br>
-<br>
-       if (context->bw_ctx.bw.dcn.clk.dispclk_khz < dc->debug.min_disp_clk_khz)<br>
-               context->bw_ctx.bw.dcn.clk.dispclk_khz = dc->debug.min_disp_clk_khz;<br>
-<br>
-       for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {<br>
-               if (!context->res_ctx.pipe_ctx[i].stream)<br>
-                       continue;<br>
-               pipes[pipe_idx].pipe.dest.vstartup_start = get_vstartup(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
-               pipes[pipe_idx].pipe.dest.vupdate_offset = get_vupdate_offset(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
-               pipes[pipe_idx].pipe.dest.vupdate_width = get_vupdate_width(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
-               pipes[pipe_idx].pipe.dest.vready_offset = get_vready_offset(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
-               context->res_ctx.pipe_ctx[i].det_buffer_size_kb = context->bw_ctx.dml.ip.det_buffer_size_kbytes;<br>
-               context->res_ctx.pipe_ctx[i].unbounded_req = pipes[pipe_idx].pipe.src.unbounded_req_mode;<br>
-<br>
-               if (context->bw_ctx.bw.dcn.clk.dppclk_khz < pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000)<br>
-                       context->bw_ctx.bw.dcn.clk.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;<br>
-               context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz =<br>
-                                               pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;<br>
-               context->res_ctx.pipe_ctx[i].pipe_dlg_param = pipes[pipe_idx].pipe.dest;<br>
-               pipe_idx++;<br>
-       }<br>
-       /*save a original dppclock copy*/<br>
-       context->bw_ctx.bw.dcn.clk.bw_dppclk_khz = context->bw_ctx.bw.dcn.clk.dppclk_khz;<br>
-       context->bw_ctx.bw.dcn.clk.bw_dispclk_khz = context->bw_ctx.bw.dcn.clk.dispclk_khz;<br>
-       context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dppclk_mhz * 1000;<br>
-       context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dispclk_mhz * 1000;<br>
-<br>
-       context->bw_ctx.bw.dcn.compbuf_size_kb = context->bw_ctx.dml.ip.config_return_buffer_size_in_kbytes<br>
-                                               - context->bw_ctx.dml.ip.det_buffer_size_kbytes * pipe_idx;<br>
-<br>
-       for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {<br>
-               bool cstate_en = context->bw_ctx.dml.vba.PrefetchMode[vlevel][context->bw_ctx.dml.vba.maxMpcComb] != 2;<br>
-<br>
-               if (!context->res_ctx.pipe_ctx[i].stream)<br>
-                       continue;<br>
-<br>
-               if (dc->ctx->dce_version == DCN_VERSION_2_01)<br>
-                       cstate_en = false;<br>
-<br>
-               context->bw_ctx.dml.funcs.rq_dlg_get_dlg_reg(&context->bw_ctx.dml,<br>
-                               &context->res_ctx.pipe_ctx[i].dlg_regs,<br>
-                               &context->res_ctx.pipe_ctx[i].ttu_regs,<br>
-                               pipes,<br>
-                               pipe_cnt,<br>
-                               pipe_idx,<br>
-                               cstate_en,<br>
-                               context->bw_ctx.bw.dcn.clk.p_state_change_support,<br>
-                               false, false, true);<br>
-<br>
-               context->bw_ctx.dml.funcs.rq_dlg_get_rq_reg(&context->bw_ctx.dml,<br>
-                               &context->res_ctx.pipe_ctx[i].rq_regs,<br>
-                               &pipes[pipe_idx].pipe);<br>
-               pipe_idx++;<br>
-       }<br>
-}<br>
-<br>
-static bool dcn20_validate_bandwidth_internal(struct dc *dc, struct dc_state *context,<br>
-               bool fast_validate)<br>
-{<br>
-       bool out = false;<br>
-<br>
-       BW_VAL_TRACE_SETUP();<br>
-<br>
-       int vlevel = 0;<br>
-       int pipe_split_from[MAX_PIPES];<br>
-       int pipe_cnt = 0;<br>
-       display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);<br>
-       DC_LOGGER_INIT(dc->ctx->logger);<br>
-<br>
-       BW_VAL_TRACE_COUNT();<br>
-<br>
-       out = dcn20_fast_validate_bw(dc, context, pipes, &pipe_cnt, pipe_split_from, &vlevel, fast_validate);<br>
-<br>
-       if (pipe_cnt == 0)<br>
-               goto validate_out;<br>
-<br>
-       if (!out)<br>
-               goto validate_fail;<br>
-<br>
-       BW_VAL_TRACE_END_VOLTAGE_LEVEL();<br>
-<br>
-       if (fast_validate) {<br>
-               BW_VAL_TRACE_SKIP(fast);<br>
-               goto validate_out;<br>
-       }<br>
-<br>
-       dcn20_calculate_wm(dc, context, pipes, &pipe_cnt, pipe_split_from, vlevel, fast_validate);<br>
-       dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);<br>
-<br>
-       BW_VAL_TRACE_END_WATERMARKS();<br>
-<br>
-       goto validate_out;<br>
-<br>
-validate_fail:<br>
-       DC_LOG_WARNING("Mode Validation Warning: %s failed validation.\n",<br>
-               dml_get_status_message(context->bw_ctx.dml.vba.ValidationStatus[context->bw_ctx.dml.vba.soc.num_states]));<br>
-<br>
-       BW_VAL_TRACE_SKIP(fail);<br>
-       out = false;<br>
-<br>
-validate_out:<br>
-       kfree(pipes);<br>
-<br>
-       BW_VAL_TRACE_FINISH();<br>
-<br>
-       return out;<br>
-}<br>
-<br>
-/*<br>
- * This must be noinline to ensure anything that deals with FP registers<br>
- * is contained within this call; previously our compiling with hard-float<br>
- * would result in fp instructions being emitted outside of the boundaries<br>
- * of the DC_FP_START/END macros, which makes sense as the compiler has no<br>
- * idea about what is wrapped and what is not<br>
- *<br>
- * This is largely just a workaround to avoid breakage introduced with 5.6,<br>
- * ideally all fp-using code should be moved into its own file, only that<br>
- * should be compiled with hard-float, and all code exported from there<br>
- * should be strictly wrapped with DC_FP_START/END<br>
- */<br>
-static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc,<br>
-               struct dc_state *context, bool fast_validate)<br>
-{<br>
-       bool voltage_supported = false;<br>
-       bool full_pstate_supported = false;<br>
-       bool dummy_pstate_supported = false;<br>
-       double p_state_latency_us;<br>
-<br>
-       p_state_latency_us = context->bw_ctx.dml.soc.dram_clock_change_latency_us;<br>
-       context->bw_ctx.dml.soc.disable_dram_clock_change_vactive_support =<br>
-               dc->debug.disable_dram_clock_change_vactive_support;<br>
-       context->bw_ctx.dml.soc.allow_dram_clock_one_display_vactive =<br>
-               dc->debug.enable_dram_clock_change_one_display_vactive;<br>
-<br>
-       /*Unsafe due to current pipe merge and split logic*/<br>
-       ASSERT(context != dc->current_state);<br>
-<br>
-       if (fast_validate) {<br>
-               return dcn20_validate_bandwidth_internal(dc, context, true);<br>
-       }<br>
-<br>
-       // Best case, we support full UCLK switch latency<br>
-       voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);<br>
-       full_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;<br>
-<br>
-       if (context->bw_ctx.dml.soc.dummy_pstate_latency_us == 0 ||<br>
-               (voltage_supported && full_pstate_supported)) {<br>
-               context->bw_ctx.bw.dcn.clk.p_state_change_support = full_pstate_supported;<br>
-               goto restore_dml_state;<br>
-       }<br>
-<br>
-       // Fallback: Try to only support G6 temperature read latency<br>
-       context->bw_ctx.dml.soc.dram_clock_change_latency_us = context->bw_ctx.dml.soc.dummy_pstate_latency_us;<br>
-<br>
-       voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);<br>
-       dummy_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;<br>
-<br>
-       if (voltage_supported && (dummy_pstate_supported || !(context->stream_count))) {<br>
-               context->bw_ctx.bw.dcn.clk.p_state_change_support = false;<br>
-               goto restore_dml_state;<br>
-       }<br>
-<br>
-       // ERROR: fallback is supposed to always work.<br>
-       ASSERT(false);<br>
-<br>
-restore_dml_state:<br>
-       context->bw_ctx.dml.soc.dram_clock_change_latency_us = p_state_latency_us;<br>
-       return voltage_supported;<br>
-}<br>
-<br>
 bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context,<br>
                 bool fast_validate)<br>
 {<br>
@@ -3464,170 +2294,6 @@ static void dcn20_pp_smu_destroy(struct pp_smu_funcs **pp_smu)<br>
         }<br>
 }<br>
 <br>
-void dcn20_cap_soc_clocks(<br>
-               struct _vcs_dpi_soc_bounding_box_st *bb,<br>
-               struct pp_smu_nv_clock_table max_clocks)<br>
-{<br>
-       int i;<br>
-<br>
-       // First pass - cap all clocks higher than the reported max<br>
-       for (i = 0; i < bb->num_states; i++) {<br>
-               if ((bb->clock_limits[i].dcfclk_mhz > (max_clocks.dcfClockInKhz / 1000))<br>
-                               && max_clocks.dcfClockInKhz != 0)<br>
-                       bb->clock_limits[i].dcfclk_mhz = (max_clocks.dcfClockInKhz / 1000);<br>
-<br>
-               if ((bb->clock_limits[i].dram_speed_mts > (max_clocks.uClockInKhz / 1000) * 16)<br>
-                                               && max_clocks.uClockInKhz != 0)<br>
-                       bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz / 1000) * 16;<br>
-<br>
-               if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz / 1000))<br>
-                                               && max_clocks.fabricClockInKhz != 0)<br>
-                       bb->clock_limits[i].fabricclk_mhz = (max_clocks.fabricClockInKhz / 1000);<br>
-<br>
-               if ((bb->clock_limits[i].dispclk_mhz > (max_clocks.displayClockInKhz / 1000))<br>
-                                               && max_clocks.displayClockInKhz != 0)<br>
-                       bb->clock_limits[i].dispclk_mhz = (max_clocks.displayClockInKhz / 1000);<br>
-<br>
-               if ((bb->clock_limits[i].dppclk_mhz > (max_clocks.dppClockInKhz / 1000))<br>
-                                               && max_clocks.dppClockInKhz != 0)<br>
-                       bb->clock_limits[i].dppclk_mhz = (max_clocks.dppClockInKhz / 1000);<br>
-<br>
-               if ((bb->clock_limits[i].phyclk_mhz > (max_clocks.phyClockInKhz / 1000))<br>
-                                               && max_clocks.phyClockInKhz != 0)<br>
-                       bb->clock_limits[i].phyclk_mhz = (max_clocks.phyClockInKhz / 1000);<br>
-<br>
-               if ((bb->clock_limits[i].socclk_mhz > (max_clocks.socClockInKhz / 1000))<br>
-                                               && max_clocks.socClockInKhz != 0)<br>
-                       bb->clock_limits[i].socclk_mhz = (max_clocks.socClockInKhz / 1000);<br>
-<br>
-               if ((bb->clock_limits[i].dscclk_mhz > (max_clocks.dscClockInKhz / 1000))<br>
-                                               && max_clocks.dscClockInKhz != 0)<br>
-                       bb->clock_limits[i].dscclk_mhz = (max_clocks.dscClockInKhz / 1000);<br>
-       }<br>
-<br>
-       // Second pass - remove all duplicate clock states<br>
-       for (i = bb->num_states - 1; i > 1; i--) {<br>
-               bool duplicate = true;<br>
-<br>
-               if (bb->clock_limits[i-1].dcfclk_mhz != bb->clock_limits[i].dcfclk_mhz)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].dispclk_mhz != bb->clock_limits[i].dispclk_mhz)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].dppclk_mhz != bb->clock_limits[i].dppclk_mhz)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].dram_speed_mts != bb->clock_limits[i].dram_speed_mts)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].dscclk_mhz != bb->clock_limits[i].dscclk_mhz)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].fabricclk_mhz != bb->clock_limits[i].fabricclk_mhz)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].phyclk_mhz != bb->clock_limits[i].phyclk_mhz)<br>
-                       duplicate = false;<br>
-               if (bb->clock_limits[i-1].socclk_mhz != bb->clock_limits[i].socclk_mhz)<br>
-                       duplicate = false;<br>
-<br>
-               if (duplicate)<br>
-                       bb->num_states--;<br>
-       }<br>
-}<br>
-<br>
-void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb,<br>
-               struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states)<br>
-{<br>
-       struct _vcs_dpi_voltage_scaling_st calculated_states[DC__VOLTAGE_STATES];<br>
-       int i;<br>
-       int num_calculated_states = 0;<br>
-       int min_dcfclk = 0;<br>
-<br>
-       if (num_states == 0)<br>
-               return;<br>
-<br>
-       memset(calculated_states, 0, sizeof(calculated_states));<br>
-<br>
-       if (dc->bb_overrides.min_dcfclk_mhz > 0)<br>
-               min_dcfclk = dc->bb_overrides.min_dcfclk_mhz;<br>
-       else {<br>
-               if (ASICREV_IS_NAVI12_P(dc->ctx->asic_id.hw_internal_rev))<br>
-                       min_dcfclk = 310;<br>
-               else<br>
-                       // Accounting for SOC/DCF relationship, we can go as high as<br>
-                       // 506Mhz in Vmin.<br>
-                       min_dcfclk = 506;<br>
-       }<br>
-<br>
-       for (i = 0; i < num_states; i++) {<br>
-               int min_fclk_required_by_uclk;<br>
-               calculated_states[i].state = i;<br>
-               calculated_states[i].dram_speed_mts = uclk_states[i] * 16 / 1000;<br>
-<br>
-               // FCLK:UCLK ratio is 1.08<br>
-               min_fclk_required_by_uclk = div_u64(((unsigned long long)uclk_states[i]) * 1080,<br>
-                       1000000);<br>
-<br>
-               calculated_states[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?<br>
-                               min_dcfclk : min_fclk_required_by_uclk;<br>
-<br>
-               calculated_states[i].socclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?<br>
-                               max_clocks->socClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;<br>
-<br>
-               calculated_states[i].dcfclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?<br>
-                               max_clocks->dcfClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;<br>
-<br>
-               calculated_states[i].dispclk_mhz = max_clocks->displayClockInKhz / 1000;<br>
-               calculated_states[i].dppclk_mhz = max_clocks->displayClockInKhz / 1000;<br>
-               calculated_states[i].dscclk_mhz = max_clocks->displayClockInKhz / (1000 * 3);<br>
-<br>
-               calculated_states[i].phyclk_mhz = max_clocks->phyClockInKhz / 1000;<br>
-<br>
-               num_calculated_states++;<br>
-       }<br>
-<br>
-       calculated_states[num_calculated_states - 1].socclk_mhz = max_clocks->socClockInKhz / 1000;<br>
-       calculated_states[num_calculated_states - 1].fabricclk_mhz = max_clocks->socClockInKhz / 1000;<br>
-       calculated_states[num_calculated_states - 1].dcfclk_mhz = max_clocks->dcfClockInKhz / 1000;<br>
-<br>
-       memcpy(bb->clock_limits, calculated_states, sizeof(bb->clock_limits));<br>
-       bb->num_states = num_calculated_states;<br>
-<br>
-       // Duplicate the last state, DML always an extra state identical to max state to work<br>
-       memcpy(&bb->clock_limits[num_calculated_states], &bb->clock_limits[num_calculated_states - 1], sizeof(struct _vcs_dpi_voltage_scaling_st));<br>
-       bb->clock_limits[num_calculated_states].state = bb->num_states;<br>
-}<br>
-<br>
-void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb)<br>
-{<br>
-       if ((int)(bb->sr_exit_time_us * 1000) != dc->bb_overrides.sr_exit_time_ns<br>
-                       && dc->bb_overrides.sr_exit_time_ns) {<br>
-               bb->sr_exit_time_us = dc->bb_overrides.sr_exit_time_ns / 1000.0;<br>
-       }<br>
-<br>
-       if ((int)(bb->sr_enter_plus_exit_time_us * 1000)<br>
-                               != dc->bb_overrides.sr_enter_plus_exit_time_ns<br>
-                       && dc->bb_overrides.sr_enter_plus_exit_time_ns) {<br>
-               bb->sr_enter_plus_exit_time_us =<br>
-                               dc->bb_overrides.sr_enter_plus_exit_time_ns / 1000.0;<br>
-       }<br>
-<br>
-       if ((int)(bb->urgent_latency_us * 1000) != dc->bb_overrides.urgent_latency_ns<br>
-                       && dc->bb_overrides.urgent_latency_ns) {<br>
-               bb->urgent_latency_us = dc->bb_overrides.urgent_latency_ns / 1000.0;<br>
-       }<br>
-<br>
-       if ((int)(bb->dram_clock_change_latency_us * 1000)<br>
-                               != dc->bb_overrides.dram_clock_change_latency_ns<br>
-                       && dc->bb_overrides.dram_clock_change_latency_ns) {<br>
-               bb->dram_clock_change_latency_us =<br>
-                               dc->bb_overrides.dram_clock_change_latency_ns / 1000.0;<br>
-       }<br>
-<br>
-       if ((int)(bb->dummy_pstate_latency_us * 1000)<br>
-                               != dc->bb_overrides.dummy_clock_change_latency_ns<br>
-                       && dc->bb_overrides.dummy_clock_change_latency_ns) {<br>
-               bb->dummy_pstate_latency_us =<br>
-                               dc->bb_overrides.dummy_clock_change_latency_ns / 1000.0;<br>
-       }<br>
-}<br>
-<br>
 static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb(<br>
         uint32_t hw_internal_rev)<br>
 {<br>
@@ -3910,9 +2576,9 @@ static bool dcn20_resource_construct(<br>
                                 ranges.reader_wm_sets[i].wm_inst = i;<br>
                                 ranges.reader_wm_sets[i].min_drain_clk_mhz = PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MIN;<br>
                                 ranges.reader_wm_sets[i].max_drain_clk_mhz = PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MAX;<br>
-                               ranges.reader_wm_sets[i].min_fill_clk_mhz = (i > 0) ? (loaded_bb->clock_limits[i - 1].dram_speed_mts / 16) + 1 : 0;<br>
-                               ranges.reader_wm_sets[i].max_fill_clk_mhz = loaded_bb->clock_limits[i].dram_speed_mts / 16;<br>
-<br>
+                               DC_FP_START();<br>
+                               dcn20_fpu_set_wm_ranges(i, &ranges, loaded_bb);<br>
+                               DC_FP_END();<br>
                                 ranges.num_reader_wm_sets = i + 1;<br>
                         }<br>
 <br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h<br>
index 6ec8ff45f0f7..961923c56ea0 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h<br>
@@ -27,6 +27,7 @@<br>
 #define __DC_RESOURCE_DCN20_H__<br>
 <br>
 #include "core_types.h"<br>
+#include "dml/dcn20/dcn20_fpu.h"<br>
 <br>
 #define TO_DCN20_RES_POOL(pool)\<br>
         container_of(pool, struct dcn20_resource_pool, base)<br>
@@ -35,6 +36,12 @@ struct dc;<br>
 struct resource_pool;<br>
 struct _vcs_dpi_display_pipe_params_st;<br>
 <br>
+extern struct _vcs_dpi_ip_params_st dcn2_0_ip;<br>
+extern struct _vcs_dpi_ip_params_st dcn2_0_nv14_ip;<br>
+extern struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc;<br>
+extern struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc;<br>
+extern struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc;<br>
+<br>
 struct dcn20_resource_pool {<br>
         struct resource_pool base;<br>
 };<br>
@@ -49,11 +56,6 @@ unsigned int dcn20_calc_max_scaled_time(<br>
                 unsigned int time_per_pixel,<br>
                 enum mmhubbub_wbif_mode mode,<br>
                 unsigned int urgent_watermark);<br>
-int dcn20_populate_dml_pipes_from_context(<br>
-               struct dc *dc,<br>
-               struct dc_state *context,<br>
-               display_e2e_pipe_params_st *pipes,<br>
-               bool fast_validate);<br>
 struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer(<br>
                 struct dc_state *state,<br>
                 const struct resource_pool *pool,<br>
@@ -79,7 +81,6 @@ struct dpp *dcn20_dpp_create(<br>
 struct input_pixel_processor *dcn20_ipp_create(<br>
         struct dc_context *ctx, uint32_t inst);<br>
 <br>
-<br>
 struct output_pixel_processor *dcn20_opp_create(<br>
         struct dc_context *ctx, uint32_t inst);<br>
 <br>
@@ -96,11 +97,6 @@ struct display_stream_compressor *dcn20_dsc_create(<br>
         struct dc_context *ctx, uint32_t inst);<br>
 void dcn20_dsc_destroy(struct display_stream_compressor **dsc);<br>
 <br>
-void dcn20_cap_soc_clocks(<br>
-               struct _vcs_dpi_soc_bounding_box_st *bb,<br>
-               struct pp_smu_nv_clock_table max_clocks);<br>
-void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb,<br>
-               struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states);<br>
 struct hubp *dcn20_hubp_create(<br>
         struct dc_context *ctx,<br>
         uint32_t inst);<br>
@@ -158,11 +154,6 @@ bool dcn20_fast_validate_bw(<br>
                 int *pipe_split_from,<br>
                 int *vlevel_out,<br>
                 bool fast_validate);<br>
-void dcn20_calculate_dlg_params(<br>
-               struct dc *dc, struct dc_state *context,<br>
-               display_e2e_pipe_params_st *pipes,<br>
-               int pipe_cnt,<br>
-               int vlevel);<br>
 <br>
 enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream);<br>
 enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream);<br>
@@ -170,12 +161,5 @@ enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct dc_state *<br>
 enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream);<br>
 enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_state);<br>
 <br>
-void dcn20_patch_bounding_box(<br>
-               struct dc *dc,<br>
-               struct _vcs_dpi_soc_bounding_box_st *bb);<br>
-void dcn20_cap_soc_clocks(<br>
-               struct _vcs_dpi_soc_bounding_box_st *bb,<br>
-               struct pp_smu_nv_clock_table max_clocks);<br>
-<br>
 #endif /* __DC_RESOURCE_DCN20_H__ */<br>
 <br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c<br>
index e5cc6bf45743..c1cd1a8ff1d7 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c<br>
@@ -1363,7 +1363,9 @@ static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc,<br>
         }<br>
 <br>
         dcn21_calculate_wm(dc, context, pipes, &pipe_cnt, pipe_split_from, vlevel, fast_validate);<br>
+       DC_FP_START();<br>
         dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);<br>
+       DC_FP_END();<br>
 <br>
         BW_VAL_TRACE_END_WATERMARKS();<br>
 <br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c<br>
index f10f7a0ca02a..8fa08f026c89 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c<br>
@@ -2261,7 +2261,9 @@ static noinline void dcn30_calculate_wm_and_dlg_fp(<br>
                 pipe_idx++;<br>
         }<br>
 <br>
+       DC_FP_START();<br>
         dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);<br>
+       DC_FP_END();<br>
 <br>
         if (!pstate_en)<br>
                 /* Restore full p-state latency */<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c<br>
index 660e96a7fe7f..4a9c80482636 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c<br>
@@ -1998,7 +1998,9 @@ static void dcn31_calculate_wm_and_dlg_fp(<br>
                 pipe_idx++;<br>
         }<br>
 <br>
+       DC_FP_START();<br>
         dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);<br>
+       DC_FP_END();<br>
 }<br>
 <br>
 void dcn31_calculate_wm_and_dlg(<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c<br>
index d590dc917363..b7adc9b6a543 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c<br>
@@ -25,6 +25,9 @@<br>
  */<br>
 <br>
 #include "resource.h"<br>
+#include "clk_mgr.h"<br>
+#include "dc_link_dp.h"<br>
+#include "dcn20/dcn20_resource.h"<br>
 <br>
 #include "dcn20_fpu.h"<br>
 <br>
@@ -61,6 +64,370 @@<br>
  * warning.<br>
  */<br>
 <br>
+struct _vcs_dpi_ip_params_st dcn2_0_ip = {<br>
+       .odm_capable = 1,<br>
+       .gpuvm_enable = 0,<br>
+       .hostvm_enable = 0,<br>
+       .gpuvm_max_page_table_levels = 4,<br>
+       .hostvm_max_page_table_levels = 4,<br>
+       .hostvm_cached_page_table_levels = 0,<br>
+       .pte_group_size_bytes = 2048,<br>
+       .num_dsc = 6,<br>
+       .rob_buffer_size_kbytes = 168,<br>
+       .det_buffer_size_kbytes = 164,<br>
+       .dpte_buffer_size_in_pte_reqs_luma = 84,<br>
+       .pde_proc_buffer_size_64k_reqs = 48,<br>
+       .dpp_output_buffer_pixels = 2560,<br>
+       .opp_output_buffer_lines = 1,<br>
+       .pixel_chunk_size_kbytes = 8,<br>
+       .pte_chunk_size_kbytes = 2,<br>
+       .meta_chunk_size_kbytes = 2,<br>
+       .writeback_chunk_size_kbytes = 2,<br>
+       .line_buffer_size_bits = 789504,<br>
+       .is_line_buffer_bpp_fixed = 0,<br>
+       .line_buffer_fixed_bpp = 0,<br>
+       .dcc_supported = true,<br>
+       .max_line_buffer_lines = 12,<br>
+       .writeback_luma_buffer_size_kbytes = 12,<br>
+       .writeback_chroma_buffer_size_kbytes = 8,<br>
+       .writeback_chroma_line_buffer_width_pixels = 4,<br>
+       .writeback_max_hscl_ratio = 1,<br>
+       .writeback_max_vscl_ratio = 1,<br>
+       .writeback_min_hscl_ratio = 1,<br>
+       .writeback_min_vscl_ratio = 1,<br>
+       .writeback_max_hscl_taps = 12,<br>
+       .writeback_max_vscl_taps = 12,<br>
+       .writeback_line_buffer_luma_buffer_size = 0,<br>
+       .writeback_line_buffer_chroma_buffer_size = 14643,<br>
+       .cursor_buffer_size = 8,<br>
+       .cursor_chunk_size = 2,<br>
+       .max_num_otg = 6,<br>
+       .max_num_dpp = 6,<br>
+       .max_num_wb = 1,<br>
+       .max_dchub_pscl_bw_pix_per_clk = 4,<br>
+       .max_pscl_lb_bw_pix_per_clk = 2,<br>
+       .max_lb_vscl_bw_pix_per_clk = 4,<br>
+       .max_vscl_hscl_bw_pix_per_clk = 4,<br>
+       .max_hscl_ratio = 8,<br>
+       .max_vscl_ratio = 8,<br>
+       .hscl_mults = 4,<br>
+       .vscl_mults = 4,<br>
+       .max_hscl_taps = 8,<br>
+       .max_vscl_taps = 8,<br>
+       .dispclk_ramp_margin_percent = 1,<br>
+       .underscan_factor = 1.10,<br>
+       .min_vblank_lines = 32, //<br>
+       .dppclk_delay_subtotal = 77, //<br>
+       .dppclk_delay_scl_lb_only = 16,<br>
+       .dppclk_delay_scl = 50,<br>
+       .dppclk_delay_cnvc_formatter = 8,<br>
+       .dppclk_delay_cnvc_cursor = 6,<br>
+       .dispclk_delay_subtotal = 87, //<br>
+       .dcfclk_cstate_latency = 10, // SRExitTime<br>
+       .max_inter_dcn_tile_repeaters = 8,<br>
+       .xfc_supported = true,<br>
+       .xfc_fill_bw_overhead_percent = 10.0,<br>
+       .xfc_fill_constant_bytes = 0,<br>
+       .number_of_cursors = 1,<br>
+};<br>
+<br>
+struct _vcs_dpi_ip_params_st dcn2_0_nv14_ip = {<br>
+       .odm_capable = 1,<br>
+       .gpuvm_enable = 0,<br>
+       .hostvm_enable = 0,<br>
+       .gpuvm_max_page_table_levels = 4,<br>
+       .hostvm_max_page_table_levels = 4,<br>
+       .hostvm_cached_page_table_levels = 0,<br>
+       .num_dsc = 5,<br>
+       .rob_buffer_size_kbytes = 168,<br>
+       .det_buffer_size_kbytes = 164,<br>
+       .dpte_buffer_size_in_pte_reqs_luma = 84,<br>
+       .dpte_buffer_size_in_pte_reqs_chroma = 42,//todo<br>
+       .dpp_output_buffer_pixels = 2560,<br>
+       .opp_output_buffer_lines = 1,<br>
+       .pixel_chunk_size_kbytes = 8,<br>
+       .pte_enable = 1,<br>
+       .max_page_table_levels = 4,<br>
+       .pte_chunk_size_kbytes = 2,<br>
+       .meta_chunk_size_kbytes = 2,<br>
+       .writeback_chunk_size_kbytes = 2,<br>
+       .line_buffer_size_bits = 789504,<br>
+       .is_line_buffer_bpp_fixed = 0,<br>
+       .line_buffer_fixed_bpp = 0,<br>
+       .dcc_supported = true,<br>
+       .max_line_buffer_lines = 12,<br>
+       .writeback_luma_buffer_size_kbytes = 12,<br>
+       .writeback_chroma_buffer_size_kbytes = 8,<br>
+       .writeback_chroma_line_buffer_width_pixels = 4,<br>
+       .writeback_max_hscl_ratio = 1,<br>
+       .writeback_max_vscl_ratio = 1,<br>
+       .writeback_min_hscl_ratio = 1,<br>
+       .writeback_min_vscl_ratio = 1,<br>
+       .writeback_max_hscl_taps = 12,<br>
+       .writeback_max_vscl_taps = 12,<br>
+       .writeback_line_buffer_luma_buffer_size = 0,<br>
+       .writeback_line_buffer_chroma_buffer_size = 14643,<br>
+       .cursor_buffer_size = 8,<br>
+       .cursor_chunk_size = 2,<br>
+       .max_num_otg = 5,<br>
+       .max_num_dpp = 5,<br>
+       .max_num_wb = 1,<br>
+       .max_dchub_pscl_bw_pix_per_clk = 4,<br>
+       .max_pscl_lb_bw_pix_per_clk = 2,<br>
+       .max_lb_vscl_bw_pix_per_clk = 4,<br>
+       .max_vscl_hscl_bw_pix_per_clk = 4,<br>
+       .max_hscl_ratio = 8,<br>
+       .max_vscl_ratio = 8,<br>
+       .hscl_mults = 4,<br>
+       .vscl_mults = 4,<br>
+       .max_hscl_taps = 8,<br>
+       .max_vscl_taps = 8,<br>
+       .dispclk_ramp_margin_percent = 1,<br>
+       .underscan_factor = 1.10,<br>
+       .min_vblank_lines = 32, //<br>
+       .dppclk_delay_subtotal = 77, //<br>
+       .dppclk_delay_scl_lb_only = 16,<br>
+       .dppclk_delay_scl = 50,<br>
+       .dppclk_delay_cnvc_formatter = 8,<br>
+       .dppclk_delay_cnvc_cursor = 6,<br>
+       .dispclk_delay_subtotal = 87, //<br>
+       .dcfclk_cstate_latency = 10, // SRExitTime<br>
+       .max_inter_dcn_tile_repeaters = 8,<br>
+       .xfc_supported = true,<br>
+       .xfc_fill_bw_overhead_percent = 10.0,<br>
+       .xfc_fill_constant_bytes = 0,<br>
+       .ptoi_supported = 0,<br>
+       .number_of_cursors = 1,<br>
+};<br>
+<br>
+<br>
+struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = {<br>
+       /* Defaults that get patched on driver load from firmware. */<br>
+       .clock_limits = {<br>
+                       {<br>
+                               .state = 0,<br>
+                               .dcfclk_mhz = 560.0,<br>
+                               .fabricclk_mhz = 560.0,<br>
+                               .dispclk_mhz = 513.0,<br>
+                               .dppclk_mhz = 513.0,<br>
+                               .phyclk_mhz = 540.0,<br>
+                               .socclk_mhz = 560.0,<br>
+                               .dscclk_mhz = 171.0,<br>
+                               .dram_speed_mts = 8960.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 1,<br>
+                               .dcfclk_mhz = 694.0,<br>
+                               .fabricclk_mhz = 694.0,<br>
+                               .dispclk_mhz = 642.0,<br>
+                               .dppclk_mhz = 642.0,<br>
+                               .phyclk_mhz = 600.0,<br>
+                               .socclk_mhz = 694.0,<br>
+                               .dscclk_mhz = 214.0,<br>
+                               .dram_speed_mts = 11104.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 2,<br>
+                               .dcfclk_mhz = 875.0,<br>
+                               .fabricclk_mhz = 875.0,<br>
+                               .dispclk_mhz = 734.0,<br>
+                               .dppclk_mhz = 734.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 875.0,<br>
+                               .dscclk_mhz = 245.0,<br>
+                               .dram_speed_mts = 14000.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 3,<br>
+                               .dcfclk_mhz = 1000.0,<br>
+                               .fabricclk_mhz = 1000.0,<br>
+                               .dispclk_mhz = 1100.0,<br>
+                               .dppclk_mhz = 1100.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 1000.0,<br>
+                               .dscclk_mhz = 367.0,<br>
+                               .dram_speed_mts = 16000.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 4,<br>
+                               .dcfclk_mhz = 1200.0,<br>
+                               .fabricclk_mhz = 1200.0,<br>
+                               .dispclk_mhz = 1284.0,<br>
+                               .dppclk_mhz = 1284.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 1200.0,<br>
+                               .dscclk_mhz = 428.0,<br>
+                               .dram_speed_mts = 16000.0,<br>
+                       },<br>
+                       /*Extra state, no dispclk ramping*/<br>
+                       {<br>
+                               .state = 5,<br>
+                               .dcfclk_mhz = 1200.0,<br>
+                               .fabricclk_mhz = 1200.0,<br>
+                               .dispclk_mhz = 1284.0,<br>
+                               .dppclk_mhz = 1284.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 1200.0,<br>
+                               .dscclk_mhz = 428.0,<br>
+                               .dram_speed_mts = 16000.0,<br>
+                       },<br>
+               },<br>
+       .num_states = 5,<br>
+       .sr_exit_time_us = 8.6,<br>
+       .sr_enter_plus_exit_time_us = 10.9,<br>
+       .urgent_latency_us = 4.0,<br>
+       .urgent_latency_pixel_data_only_us = 4.0,<br>
+       .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,<br>
+       .urgent_latency_vm_data_only_us = 4.0,<br>
+       .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,<br>
+       .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,<br>
+       .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,<br>
+       .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0,<br>
+       .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0,<br>
+       .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0,<br>
+       .max_avg_sdp_bw_use_normal_percent = 40.0,<br>
+       .max_avg_dram_bw_use_normal_percent = 40.0,<br>
+       .writeback_latency_us = 12.0,<br>
+       .ideal_dram_bw_after_urgent_percent = 40.0,<br>
+       .max_request_size_bytes = 256,<br>
+       .dram_channel_width_bytes = 2,<br>
+       .fabric_datapath_to_dcn_data_return_bytes = 64,<br>
+       .dcn_downspread_percent = 0.5,<br>
+       .downspread_percent = 0.38,<br>
+       .dram_page_open_time_ns = 50.0,<br>
+       .dram_rw_turnaround_time_ns = 17.5,<br>
+       .dram_return_buffer_per_channel_bytes = 8192,<br>
+       .round_trip_ping_latency_dcfclk_cycles = 131,<br>
+       .urgent_out_of_order_return_per_channel_bytes = 256,<br>
+       .channel_interleave_bytes = 256,<br>
+       .num_banks = 8,<br>
+       .num_chans = 16,<br>
+       .vmm_page_size_bytes = 4096,<br>
+       .dram_clock_change_latency_us = 404.0,<br>
+       .dummy_pstate_latency_us = 5.0,<br>
+       .writeback_dram_clock_change_latency_us = 23.0,<br>
+       .return_bus_width_bytes = 64,<br>
+       .dispclk_dppclk_vco_speed_mhz = 3850,<br>
+       .xfc_bus_transport_time_us = 20,<br>
+       .xfc_xbuf_latency_tolerance_us = 4,<br>
+       .use_urgent_burst_bw = 0<br>
+};<br>
+<br>
+struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = {<br>
+       .clock_limits = {<br>
+                       {<br>
+                               .state = 0,<br>
+                               .dcfclk_mhz = 560.0,<br>
+                               .fabricclk_mhz = 560.0,<br>
+                               .dispclk_mhz = 513.0,<br>
+                               .dppclk_mhz = 513.0,<br>
+                               .phyclk_mhz = 540.0,<br>
+                               .socclk_mhz = 560.0,<br>
+                               .dscclk_mhz = 171.0,<br>
+                               .dram_speed_mts = 8960.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 1,<br>
+                               .dcfclk_mhz = 694.0,<br>
+                               .fabricclk_mhz = 694.0,<br>
+                               .dispclk_mhz = 642.0,<br>
+                               .dppclk_mhz = 642.0,<br>
+                               .phyclk_mhz = 600.0,<br>
+                               .socclk_mhz = 694.0,<br>
+                               .dscclk_mhz = 214.0,<br>
+                               .dram_speed_mts = 11104.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 2,<br>
+                               .dcfclk_mhz = 875.0,<br>
+                               .fabricclk_mhz = 875.0,<br>
+                               .dispclk_mhz = 734.0,<br>
+                               .dppclk_mhz = 734.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 875.0,<br>
+                               .dscclk_mhz = 245.0,<br>
+                               .dram_speed_mts = 14000.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 3,<br>
+                               .dcfclk_mhz = 1000.0,<br>
+                               .fabricclk_mhz = 1000.0,<br>
+                               .dispclk_mhz = 1100.0,<br>
+                               .dppclk_mhz = 1100.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 1000.0,<br>
+                               .dscclk_mhz = 367.0,<br>
+                               .dram_speed_mts = 16000.0,<br>
+                       },<br>
+                       {<br>
+                               .state = 4,<br>
+                               .dcfclk_mhz = 1200.0,<br>
+                               .fabricclk_mhz = 1200.0,<br>
+                               .dispclk_mhz = 1284.0,<br>
+                               .dppclk_mhz = 1284.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 1200.0,<br>
+                               .dscclk_mhz = 428.0,<br>
+                               .dram_speed_mts = 16000.0,<br>
+                       },<br>
+                       /*Extra state, no dispclk ramping*/<br>
+                       {<br>
+                               .state = 5,<br>
+                               .dcfclk_mhz = 1200.0,<br>
+                               .fabricclk_mhz = 1200.0,<br>
+                               .dispclk_mhz = 1284.0,<br>
+                               .dppclk_mhz = 1284.0,<br>
+                               .phyclk_mhz = 810.0,<br>
+                               .socclk_mhz = 1200.0,<br>
+                               .dscclk_mhz = 428.0,<br>
+                               .dram_speed_mts = 16000.0,<br>
+                       },<br>
+               },<br>
+       .num_states = 5,<br>
+       .sr_exit_time_us = 11.6,<br>
+       .sr_enter_plus_exit_time_us = 13.9,<br>
+       .urgent_latency_us = 4.0,<br>
+       .urgent_latency_pixel_data_only_us = 4.0,<br>
+       .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,<br>
+       .urgent_latency_vm_data_only_us = 4.0,<br>
+       .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,<br>
+       .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,<br>
+       .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,<br>
+       .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0,<br>
+       .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0,<br>
+       .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0,<br>
+       .max_avg_sdp_bw_use_normal_percent = 40.0,<br>
+       .max_avg_dram_bw_use_normal_percent = 40.0,<br>
+       .writeback_latency_us = 12.0,<br>
+       .ideal_dram_bw_after_urgent_percent = 40.0,<br>
+       .max_request_size_bytes = 256,<br>
+       .dram_channel_width_bytes = 2,<br>
+       .fabric_datapath_to_dcn_data_return_bytes = 64,<br>
+       .dcn_downspread_percent = 0.5,<br>
+       .downspread_percent = 0.38,<br>
+       .dram_page_open_time_ns = 50.0,<br>
+       .dram_rw_turnaround_time_ns = 17.5,<br>
+       .dram_return_buffer_per_channel_bytes = 8192,<br>
+       .round_trip_ping_latency_dcfclk_cycles = 131,<br>
+       .urgent_out_of_order_return_per_channel_bytes = 256,<br>
+       .channel_interleave_bytes = 256,<br>
+       .num_banks = 8,<br>
+       .num_chans = 8,<br>
+       .vmm_page_size_bytes = 4096,<br>
+       .dram_clock_change_latency_us = 404.0,<br>
+       .dummy_pstate_latency_us = 5.0,<br>
+       .writeback_dram_clock_change_latency_us = 23.0,<br>
+       .return_bus_width_bytes = 64,<br>
+       .dispclk_dppclk_vco_speed_mhz = 3850,<br>
+       .xfc_bus_transport_time_us = 20,<br>
+       .xfc_xbuf_latency_tolerance_us = 4,<br>
+       .use_urgent_burst_bw = 0<br>
+};<br>
+<br>
+struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = { 0 };<br>
+<br>
+#define DC_LOGGER_INIT(logger)<br>
+<br>
 void dcn20_populate_dml_writeback_from_context(struct dc *dc,<br>
                                                struct resource_context *res_ctx,<br>
                                                display_e2e_pipe_params_st *pipes)<br>
@@ -100,3 +467,1021 @@ void dcn20_populate_dml_writeback_from_context(struct dc *dc,<br>
                 pipe_cnt++;<br>
         }<br>
 }<br>
+<br>
+void dcn20_fpu_set_wb_arb_params(struct mcif_arb_params *wb_arb_params,<br>
+                                struct dc_state *context,<br>
+                                display_e2e_pipe_params_st *pipes,<br>
+                                int pipe_cnt, int i)<br>
+{<br>
+       int k;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       for (k = 0; k < sizeof(wb_arb_params->cli_watermark)/sizeof(wb_arb_params->cli_watermark[0]); k++) {<br>
+               wb_arb_params->cli_watermark[k] = get_wm_writeback_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+               wb_arb_params->pstate_watermark[k] = get_wm_writeback_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       }<br>
+       wb_arb_params->time_per_pixel = 16.0 * 1000 / (context->res_ctx.pipe_ctx[i].stream->phy_pix_clk / 1000); /* 4 bit fraction, ms */<br>
+}<br>
+<br>
+static bool is_dtbclk_required(struct dc *dc, struct dc_state *context)<br>
+{<br>
+       int i;<br>
+<br>
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {<br>
+               if (!context->res_ctx.pipe_ctx[i].stream)<br>
+                       continue;<br>
+               if (is_dp_128b_132b_signal(&context->res_ctx.pipe_ctx[i]))<br>
+                       return true;<br>
+       }<br>
+       return false;<br>
+}<br>
+<br>
+static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc,struct dc_state *context)<br>
+{<br>
+       int plane_count;<br>
+       int i;<br>
+<br>
+       plane_count = 0;<br>
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {<br>
+               if (context->res_ctx.pipe_ctx[i].plane_state)<br>
+                       plane_count++;<br>
+       }<br>
+<br>
+       /*<br>
+        * Zstate is allowed in following scenarios:<br>
+        *        1. Single eDP with PSR enabled<br>
+        *        2. 0 planes (No memory requests)<br>
+        *        3. Single eDP without PSR but > 5ms stutter period<br>
+        */<br>
+       if (plane_count == 0)<br>
+               return DCN_ZSTATE_SUPPORT_ALLOW;<br>
+       else if (context->stream_count == 1 &&  context->streams[0]->signal == SIGNAL_TYPE_EDP) {<br>
+               struct dc_link *link = context->streams[0]->sink->link;<br>
+<br>
+               /* zstate only supported on PWRSEQ0 */<br>
+               if (link->link_index != 0)<br>
+                       return DCN_ZSTATE_SUPPORT_DISALLOW;<br>
+<br>
+               if (context->bw_ctx.dml.vba.StutterPeriod > 5000.0)<br>
+                       return DCN_ZSTATE_SUPPORT_ALLOW;<br>
+               else if (link->psr_settings.psr_version == DC_PSR_VERSION_1 && !dc->debug.disable_psr)<br>
+                       return DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY;<br>
+               else<br>
+                       return DCN_ZSTATE_SUPPORT_DISALLOW;<br>
+       } else<br>
+               return DCN_ZSTATE_SUPPORT_DISALLOW;<br>
+}<br>
+<br>
+void dcn20_calculate_dlg_params(struct dc *dc,<br>
+                               struct dc_state *context,<br>
+                               display_e2e_pipe_params_st *pipes,<br>
+                               int pipe_cnt,<br>
+                               int vlevel)<br>
+{<br>
+       int i, pipe_idx;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       /* Writeback MCIF_WB arbitration parameters */<br>
+       dc->res_pool->funcs->set_mcif_arb_params(dc, context, pipes, pipe_cnt);<br>
+<br>
+       context->bw_ctx.bw.dcn.clk.dispclk_khz = context->bw_ctx.dml.vba.DISPCLK * 1000;<br>
+       context->bw_ctx.bw.dcn.clk.dcfclk_khz = context->bw_ctx.dml.vba.DCFCLK * 1000;<br>
+       context->bw_ctx.bw.dcn.clk.socclk_khz = context->bw_ctx.dml.vba.SOCCLK * 1000;<br>
+       context->bw_ctx.bw.dcn.clk.dramclk_khz = context->bw_ctx.dml.vba.DRAMSpeed * 1000 / 16;<br>
+<br>
+       if (dc->debug.min_dram_clk_khz > context->bw_ctx.bw.dcn.clk.dramclk_khz)<br>
+               context->bw_ctx.bw.dcn.clk.dramclk_khz = dc->debug.min_dram_clk_khz;<br>
+<br>
+       context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = context->bw_ctx.dml.vba.DCFCLKDeepSleep * 1000;<br>
+       context->bw_ctx.bw.dcn.clk.fclk_khz = context->bw_ctx.dml.vba.FabricClock * 1000;<br>
+       context->bw_ctx.bw.dcn.clk.p_state_change_support =<br>
+               context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][context->bw_ctx.dml.vba.maxMpcComb]<br>
+                                                       != dm_dram_clock_change_unsupported;<br>
+       context->bw_ctx.bw.dcn.clk.dppclk_khz = 0;<br>
+<br>
+       context->bw_ctx.bw.dcn.clk.zstate_support = decide_zstate_support(dc, context);<br>
+<br>
+       context->bw_ctx.bw.dcn.clk.dtbclk_en = is_dtbclk_required(dc, context);<br>
+<br>
+       if (context->bw_ctx.bw.dcn.clk.dispclk_khz < dc->debug.min_disp_clk_khz)<br>
+               context->bw_ctx.bw.dcn.clk.dispclk_khz = dc->debug.min_disp_clk_khz;<br>
+<br>
+       for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {<br>
+               if (!context->res_ctx.pipe_ctx[i].stream)<br>
+                       continue;<br>
+               pipes[pipe_idx].pipe.dest.vstartup_start = get_vstartup(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
+               pipes[pipe_idx].pipe.dest.vupdate_offset = get_vupdate_offset(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
+               pipes[pipe_idx].pipe.dest.vupdate_width = get_vupdate_width(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
+               pipes[pipe_idx].pipe.dest.vready_offset = get_vready_offset(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);<br>
+               context->res_ctx.pipe_ctx[i].det_buffer_size_kb = context->bw_ctx.dml.ip.det_buffer_size_kbytes;<br>
+               context->res_ctx.pipe_ctx[i].unbounded_req = pipes[pipe_idx].pipe.src.unbounded_req_mode;<br>
+<br>
+               if (context->bw_ctx.bw.dcn.clk.dppclk_khz < pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000)<br>
+                       context->bw_ctx.bw.dcn.clk.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;<br>
+               context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz =<br>
+                                               pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;<br>
+               context->res_ctx.pipe_ctx[i].pipe_dlg_param = pipes[pipe_idx].pipe.dest;<br>
+               pipe_idx++;<br>
+       }<br>
+       /*save a original dppclock copy*/<br>
+       context->bw_ctx.bw.dcn.clk.bw_dppclk_khz = context->bw_ctx.bw.dcn.clk.dppclk_khz;<br>
+       context->bw_ctx.bw.dcn.clk.bw_dispclk_khz = context->bw_ctx.bw.dcn.clk.dispclk_khz;<br>
+       context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dppclk_mhz * 1000;<br>
+       context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dispclk_mhz * 1000;<br>
+<br>
+       context->bw_ctx.bw.dcn.compbuf_size_kb = context->bw_ctx.dml.ip.config_return_buffer_size_in_kbytes<br>
+                                               - context->bw_ctx.dml.ip.det_buffer_size_kbytes * pipe_idx;<br>
+<br>
+       for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {<br>
+               bool cstate_en = context->bw_ctx.dml.vba.PrefetchMode[vlevel][context->bw_ctx.dml.vba.maxMpcComb] != 2;<br>
+<br>
+               if (!context->res_ctx.pipe_ctx[i].stream)<br>
+                       continue;<br>
+<br>
+               if (dc->ctx->dce_version == DCN_VERSION_2_01)<br>
+                       cstate_en = false;<br>
+<br>
+               context->bw_ctx.dml.funcs.rq_dlg_get_dlg_reg(&context->bw_ctx.dml,<br>
+                               &context->res_ctx.pipe_ctx[i].dlg_regs,<br>
+                               &context->res_ctx.pipe_ctx[i].ttu_regs,<br>
+                               pipes,<br>
+                               pipe_cnt,<br>
+                               pipe_idx,<br>
+                               cstate_en,<br>
+                               context->bw_ctx.bw.dcn.clk.p_state_change_support,<br>
+                               false, false, true);<br>
+<br>
+               context->bw_ctx.dml.funcs.rq_dlg_get_rq_reg(&context->bw_ctx.dml,<br>
+                               &context->res_ctx.pipe_ctx[i].rq_regs,<br>
+                               &pipes[pipe_idx].pipe);<br>
+               pipe_idx++;<br>
+       }<br>
+}<br>
+<br>
+static void swizzle_to_dml_params(enum swizzle_mode_values swizzle,<br>
+                                 unsigned int *sw_mode)<br>
+{<br>
+       switch (swizzle) {<br>
+       case DC_SW_LINEAR:<br>
+               *sw_mode = dm_sw_linear;<br>
+               break;<br>
+       case DC_SW_4KB_S:<br>
+               *sw_mode = dm_sw_4kb_s;<br>
+               break;<br>
+       case DC_SW_4KB_S_X:<br>
+               *sw_mode = dm_sw_4kb_s_x;<br>
+               break;<br>
+       case DC_SW_4KB_D:<br>
+               *sw_mode = dm_sw_4kb_d;<br>
+               break;<br>
+       case DC_SW_4KB_D_X:<br>
+               *sw_mode = dm_sw_4kb_d_x;<br>
+               break;<br>
+       case DC_SW_64KB_S:<br>
+               *sw_mode = dm_sw_64kb_s;<br>
+               break;<br>
+       case DC_SW_64KB_S_X:<br>
+               *sw_mode = dm_sw_64kb_s_x;<br>
+               break;<br>
+       case DC_SW_64KB_S_T:<br>
+               *sw_mode = dm_sw_64kb_s_t;<br>
+               break;<br>
+       case DC_SW_64KB_D:<br>
+               *sw_mode = dm_sw_64kb_d;<br>
+               break;<br>
+       case DC_SW_64KB_D_X:<br>
+               *sw_mode = dm_sw_64kb_d_x;<br>
+               break;<br>
+       case DC_SW_64KB_D_T:<br>
+               *sw_mode = dm_sw_64kb_d_t;<br>
+               break;<br>
+       case DC_SW_64KB_R_X:<br>
+               *sw_mode = dm_sw_64kb_r_x;<br>
+               break;<br>
+       case DC_SW_VAR_S:<br>
+               *sw_mode = dm_sw_var_s;<br>
+               break;<br>
+       case DC_SW_VAR_S_X:<br>
+               *sw_mode = dm_sw_var_s_x;<br>
+               break;<br>
+       case DC_SW_VAR_D:<br>
+               *sw_mode = dm_sw_var_d;<br>
+               break;<br>
+       case DC_SW_VAR_D_X:<br>
+               *sw_mode = dm_sw_var_d_x;<br>
+               break;<br>
+       case DC_SW_VAR_R_X:<br>
+               *sw_mode = dm_sw_var_r_x;<br>
+               break;<br>
+       default:<br>
+               ASSERT(0); /* Not supported */<br>
+               break;<br>
+       }<br>
+}<br>
+<br>
+int dcn20_populate_dml_pipes_from_context(struct dc *dc,<br>
+                                         struct dc_state *context,<br>
+                                         display_e2e_pipe_params_st *pipes,<br>
+                                         bool fast_validate)<br>
+{<br>
+       int pipe_cnt, i;<br>
+       bool synchronized_vblank = true;<br>
+       struct resource_context *res_ctx = &context->res_ctx;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       for (i = 0, pipe_cnt = -1; i < dc->res_pool->pipe_count; i++) {<br>
+               if (!res_ctx->pipe_ctx[i].stream)<br>
+                       continue;<br>
+<br>
+               if (pipe_cnt < 0) {<br>
+                       pipe_cnt = i;<br>
+                       continue;<br>
+               }<br>
+<br>
+               if (res_ctx->pipe_ctx[pipe_cnt].stream == res_ctx->pipe_ctx[i].stream)<br>
+                       continue;<br>
+<br>
+               if (dc->debug.disable_timing_sync ||<br>
+                       (!resource_are_streams_timing_synchronizable(<br>
+                               res_ctx->pipe_ctx[pipe_cnt].stream,<br>
+                               res_ctx->pipe_ctx[i].stream) &&<br>
+                       !resource_are_vblanks_synchronizable(<br>
+                               res_ctx->pipe_ctx[pipe_cnt].stream,<br>
+                               res_ctx->pipe_ctx[i].stream))) {<br>
+                       synchronized_vblank = false;<br>
+                       break;<br>
+               }<br>
+       }<br>
+<br>
+       for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {<br>
+               struct dc_crtc_timing *timing = &res_ctx->pipe_ctx[i].stream->timing;<br>
+               unsigned int v_total;<br>
+               unsigned int front_porch;<br>
+               int output_bpc;<br>
+               struct audio_check aud_check = {0};<br>
+<br>
+               if (!res_ctx->pipe_ctx[i].stream)<br>
+                       continue;<br>
+<br>
+               v_total = timing->v_total;<br>
+               front_porch = timing->v_front_porch;<br>
+<br>
+               /* todo:<br>
+               pipes[pipe_cnt].pipe.src.dynamic_metadata_enable = 0;<br>
+               pipes[pipe_cnt].pipe.src.dcc = 0;<br>
+               pipes[pipe_cnt].pipe.src.vm = 0;*/<br>
+<br>
+               pipes[pipe_cnt].clks_cfg.refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000.0;<br>
+<br>
+               pipes[pipe_cnt].dout.dsc_enable = res_ctx->pipe_ctx[i].stream->timing.flags.DSC;<br>
+               /* todo: rotation?*/<br>
+               pipes[pipe_cnt].dout.dsc_slices = res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.num_slices_h;<br>
+               if (res_ctx->pipe_ctx[i].stream->use_dynamic_meta) {<br>
+                       pipes[pipe_cnt].pipe.src.dynamic_metadata_enable = true;<br>
+                       /* 1/2 vblank */<br>
+                       pipes[pipe_cnt].pipe.src.dynamic_metadata_lines_before_active =<br>
+                               (v_total - timing->v_addressable<br>
+                                       - timing->v_border_top - timing->v_border_bottom) / 2;<br>
+                       /* 36 bytes dp, 32 hdmi */<br>
+                       pipes[pipe_cnt].pipe.src.dynamic_metadata_xmit_bytes =<br>
+                               dc_is_dp_signal(res_ctx->pipe_ctx[i].stream->signal) ? 36 : 32;<br>
+               }<br>
+               pipes[pipe_cnt].pipe.src.dcc = false;<br>
+               pipes[pipe_cnt].pipe.src.dcc_rate = 1;<br>
+               pipes[pipe_cnt].pipe.dest.synchronized_vblank_all_planes = synchronized_vblank;<br>
+               pipes[pipe_cnt].pipe.dest.hblank_start = timing->h_total - timing->h_front_porch;<br>
+               pipes[pipe_cnt].pipe.dest.hblank_end = pipes[pipe_cnt].pipe.dest.hblank_start<br>
+                               - timing->h_addressable<br>
+                               - timing->h_border_left<br>
+                               - timing->h_border_right;<br>
+               pipes[pipe_cnt].pipe.dest.vblank_start = v_total - front_porch;<br>
+               pipes[pipe_cnt].pipe.dest.vblank_end = pipes[pipe_cnt].pipe.dest.vblank_start<br>
+                               - timing->v_addressable<br>
+                               - timing->v_border_top<br>
+                               - timing->v_border_bottom;<br>
+               pipes[pipe_cnt].pipe.dest.htotal = timing->h_total;<br>
+               pipes[pipe_cnt].pipe.dest.vtotal = v_total;<br>
+               pipes[pipe_cnt].pipe.dest.hactive =<br>
+                       timing->h_addressable + timing->h_border_left + timing->h_border_right;<br>
+               pipes[pipe_cnt].pipe.dest.vactive =<br>
+                       timing->v_addressable + timing->v_border_top + timing->v_border_bottom;<br>
+               pipes[pipe_cnt].pipe.dest.interlaced = timing->flags.INTERLACE;<br>
+               pipes[pipe_cnt].pipe.dest.pixel_rate_mhz = timing->pix_clk_100hz/10000.0;<br>
+               if (timing->timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING)<br>
+                       pipes[pipe_cnt].pipe.dest.pixel_rate_mhz *= 2;<br>
+               pipes[pipe_cnt].pipe.dest.otg_inst = res_ctx->pipe_ctx[i].stream_res.tg->inst;<br>
+               pipes[pipe_cnt].dout.dp_lanes = 4;<br>
+               pipes[pipe_cnt].dout.is_virtual = 0;<br>
+               pipes[pipe_cnt].pipe.dest.vtotal_min = res_ctx->pipe_ctx[i].stream->adjust.v_total_min;<br>
+               pipes[pipe_cnt].pipe.dest.vtotal_max = res_ctx->pipe_ctx[i].stream->adjust.v_total_max;<br>
+               switch (get_num_odm_splits(&res_ctx->pipe_ctx[i])) {<br>
+               case 1:<br>
+                       pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_2to1;<br>
+                       break;<br>
+               case 3:<br>
+                       pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_4to1;<br>
+                       break;<br>
+               default:<br>
+                       pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_disabled;<br>
+               }<br>
+               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].pipe_idx;<br>
+               if (res_ctx->pipe_ctx[i].top_pipe && res_ctx->pipe_ctx[i].top_pipe->plane_state<br>
+                               == res_ctx->pipe_ctx[i].plane_state) {<br>
+                       struct pipe_ctx *first_pipe = res_ctx->pipe_ctx[i].top_pipe;<br>
+                       int split_idx = 0;<br>
+<br>
+                       while (first_pipe->top_pipe && first_pipe->top_pipe->plane_state<br>
+                                       == res_ctx->pipe_ctx[i].plane_state) {<br>
+                               first_pipe = first_pipe->top_pipe;<br>
+                               split_idx++;<br>
+                       }<br>
+                       /* Treat 4to1 mpc combine as an mpo of 2 2-to-1 combines */<br>
+                       if (split_idx == 0)<br>
+                               pipes[pipe_cnt].pipe.src.hsplit_grp = first_pipe->pipe_idx;<br>
+                       else if (split_idx == 1)<br>
+                               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].pipe_idx;<br>
+                       else if (split_idx == 2)<br>
+                               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].top_pipe->pipe_idx;<br>
+               } else if (res_ctx->pipe_ctx[i].prev_odm_pipe) {<br>
+                       struct pipe_ctx *first_pipe = res_ctx->pipe_ctx[i].prev_odm_pipe;<br>
+<br>
+                       while (first_pipe->prev_odm_pipe)<br>
+                               first_pipe = first_pipe->prev_odm_pipe;<br>
+                       pipes[pipe_cnt].pipe.src.hsplit_grp = first_pipe->pipe_idx;<br>
+               }<br>
+<br>
+               switch (res_ctx->pipe_ctx[i].stream->signal) {<br>
+               case SIGNAL_TYPE_DISPLAY_PORT_MST:<br>
+               case SIGNAL_TYPE_DISPLAY_PORT:<br>
+                       pipes[pipe_cnt].dout.output_type = dm_dp;<br>
+                       break;<br>
+               case SIGNAL_TYPE_EDP:<br>
+                       pipes[pipe_cnt].dout.output_type = dm_edp;<br>
+                       break;<br>
+               case SIGNAL_TYPE_HDMI_TYPE_A:<br>
+               case SIGNAL_TYPE_DVI_SINGLE_LINK:<br>
+               case SIGNAL_TYPE_DVI_DUAL_LINK:<br>
+                       pipes[pipe_cnt].dout.output_type = dm_hdmi;<br>
+                       break;<br>
+               default:<br>
+                       /* In case there is no signal, set dp with 4 lanes to allow max config */<br>
+                       pipes[pipe_cnt].dout.is_virtual = 1;<br>
+                       pipes[pipe_cnt].dout.output_type = dm_dp;<br>
+                       pipes[pipe_cnt].dout.dp_lanes = 4;<br>
+               }<br>
+<br>
+               switch (res_ctx->pipe_ctx[i].stream->timing.display_color_depth) {<br>
+               case COLOR_DEPTH_666:<br>
+                       output_bpc = 6;<br>
+                       break;<br>
+               case COLOR_DEPTH_888:<br>
+                       output_bpc = 8;<br>
+                       break;<br>
+               case COLOR_DEPTH_101010:<br>
+                       output_bpc = 10;<br>
+                       break;<br>
+               case COLOR_DEPTH_121212:<br>
+                       output_bpc = 12;<br>
+                       break;<br>
+               case COLOR_DEPTH_141414:<br>
+                       output_bpc = 14;<br>
+                       break;<br>
+               case COLOR_DEPTH_161616:<br>
+                       output_bpc = 16;<br>
+                       break;<br>
+               case COLOR_DEPTH_999:<br>
+                       output_bpc = 9;<br>
+                       break;<br>
+               case COLOR_DEPTH_111111:<br>
+                       output_bpc = 11;<br>
+                       break;<br>
+               default:<br>
+                       output_bpc = 8;<br>
+                       break;<br>
+               }<br>
+<br>
+               switch (res_ctx->pipe_ctx[i].stream->timing.pixel_encoding) {<br>
+               case PIXEL_ENCODING_RGB:<br>
+               case PIXEL_ENCODING_YCBCR444:<br>
+                       pipes[pipe_cnt].dout.output_format = dm_444;<br>
+                       pipes[pipe_cnt].dout.output_bpp = output_bpc * 3;<br>
+                       break;<br>
+               case PIXEL_ENCODING_YCBCR420:<br>
+                       pipes[pipe_cnt].dout.output_format = dm_420;<br>
+                       pipes[pipe_cnt].dout.output_bpp = (output_bpc * 3.0) / 2;<br>
+                       break;<br>
+               case PIXEL_ENCODING_YCBCR422:<br>
+                       if (res_ctx->pipe_ctx[i].stream->timing.flags.DSC &&<br>
+                           !res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.ycbcr422_simple)<br>
+                               pipes[pipe_cnt].dout.output_format = dm_n422;<br>
+                       else<br>
+                               pipes[pipe_cnt].dout.output_format = dm_s422;<br>
+                       pipes[pipe_cnt].dout.output_bpp = output_bpc * 2;<br>
+                       break;<br>
+               default:<br>
+                       pipes[pipe_cnt].dout.output_format = dm_444;<br>
+                       pipes[pipe_cnt].dout.output_bpp = output_bpc * 3;<br>
+               }<br>
+<br>
+               if (res_ctx->pipe_ctx[i].stream->timing.flags.DSC)<br>
+                       pipes[pipe_cnt].dout.output_bpp = res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.bits_per_pixel / 16.0;<br>
+<br>
+               /* todo: default max for now, until there is logic reflecting this in dc*/<br>
+               pipes[pipe_cnt].dout.dsc_input_bpc = 12;<br>
+               /*fill up the audio sample rate (unit in kHz)*/<br>
+               get_audio_check(&res_ctx->pipe_ctx[i].stream->audio_info, &aud_check);<br>
+               pipes[pipe_cnt].dout.max_audio_sample_rate = aud_check.max_audiosample_rate / 1000;<br>
+               /*<br>
+                * For graphic plane, cursor number is 1, nv12 is 0<br>
+                * bw calculations due to cursor on/off<br>
+                */<br>
+               if (res_ctx->pipe_ctx[i].plane_state &&<br>
+                               res_ctx->pipe_ctx[i].plane_state->address.type == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)<br>
+                       pipes[pipe_cnt].pipe.src.num_cursors = 0;<br>
+               else<br>
+                       pipes[pipe_cnt].pipe.src.num_cursors = dc->dml.ip.number_of_cursors;<br>
+<br>
+               pipes[pipe_cnt].pipe.src.cur0_src_width = 256;<br>
+               pipes[pipe_cnt].pipe.src.cur0_bpp = dm_cur_32bit;<br>
+<br>
+               if (!res_ctx->pipe_ctx[i].plane_state) {<br>
+                       pipes[pipe_cnt].pipe.src.is_hsplit = pipes[pipe_cnt].pipe.dest.odm_combine != dm_odm_combine_mode_disabled;<br>
+                       pipes[pipe_cnt].pipe.src.source_scan = dm_horz;<br>
+                       pipes[pipe_cnt].pipe.src.sw_mode = dm_sw_4kb_s;<br>
+                       pipes[pipe_cnt].pipe.src.macro_tile_size = dm_64k_tile;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_width = timing->h_addressable;<br>
+                       if (pipes[pipe_cnt].pipe.src.viewport_width > 1920)<br>
+                               pipes[pipe_cnt].pipe.src.viewport_width = 1920;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_height = timing->v_addressable;<br>
+                       if (pipes[pipe_cnt].pipe.src.viewport_height > 1080)<br>
+                               pipes[pipe_cnt].pipe.src.viewport_height = 1080;<br>
+                       pipes[pipe_cnt].pipe.src.surface_height_y = pipes[pipe_cnt].pipe.src.viewport_height;<br>
+                       pipes[pipe_cnt].pipe.src.surface_width_y = pipes[pipe_cnt].pipe.src.viewport_width;<br>
+                       pipes[pipe_cnt].pipe.src.surface_height_c = pipes[pipe_cnt].pipe.src.viewport_height;<br>
+                       pipes[pipe_cnt].pipe.src.surface_width_c = pipes[pipe_cnt].pipe.src.viewport_width;<br>
+                       pipes[pipe_cnt].pipe.src.data_pitch = ((pipes[pipe_cnt].pipe.src.viewport_width + 255) / 256) * 256;<br>
+                       pipes[pipe_cnt].pipe.src.source_format = dm_444_32;<br>
+                       pipes[pipe_cnt].pipe.dest.recout_width = pipes[pipe_cnt].pipe.src.viewport_width; /*vp_width/hratio*/<br>
+                       pipes[pipe_cnt].pipe.dest.recout_height = pipes[pipe_cnt].pipe.src.viewport_height; /*vp_height/vratio*/<br>
+                       pipes[pipe_cnt].pipe.dest.full_recout_width = pipes[pipe_cnt].pipe.dest.recout_width;  /*when is_hsplit != 1*/<br>
+                       pipes[pipe_cnt].pipe.dest.full_recout_height = pipes[pipe_cnt].pipe.dest.recout_height; /*when is_hsplit != 1*/<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.lb_depth = dm_lb_16;<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.hscl_ratio = 1.0;<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.vscl_ratio = 1.0;<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.scl_enable = 0; /*Lb only or Full scl*/<br>
+                       pipes[pipe_cnt].pipe.scale_taps.htaps = 1;<br>
+                       pipes[pipe_cnt].pipe.scale_taps.vtaps = 1;<br>
+                       pipes[pipe_cnt].pipe.dest.vtotal_min = v_total;<br>
+                       pipes[pipe_cnt].pipe.dest.vtotal_max = v_total;<br>
+<br>
+                       if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_2to1) {<br>
+                               pipes[pipe_cnt].pipe.src.viewport_width /= 2;<br>
+                               pipes[pipe_cnt].pipe.dest.recout_width /= 2;<br>
+                       } else if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_4to1) {<br>
+                               pipes[pipe_cnt].pipe.src.viewport_width /= 4;<br>
+                               pipes[pipe_cnt].pipe.dest.recout_width /= 4;<br>
+                       }<br>
+               } else {<br>
+                       struct dc_plane_state *pln = res_ctx->pipe_ctx[i].plane_state;<br>
+                       struct scaler_data *scl = &res_ctx->pipe_ctx[i].plane_res.scl_data;<br>
+<br>
+                       pipes[pipe_cnt].pipe.src.immediate_flip = pln->flip_immediate;<br>
+                       pipes[pipe_cnt].pipe.src.is_hsplit = (res_ctx->pipe_ctx[i].bottom_pipe && res_ctx->pipe_ctx[i].bottom_pipe->plane_state == pln)<br>
+                                       || (res_ctx->pipe_ctx[i].top_pipe && res_ctx->pipe_ctx[i].top_pipe->plane_state == pln)<br>
+                                       || pipes[pipe_cnt].pipe.dest.odm_combine != dm_odm_combine_mode_disabled;<br>
+<br>
+                       /* stereo is not split */<br>
+                       if (pln->stereo_format == PLANE_STEREO_FORMAT_SIDE_BY_SIDE ||<br>
+                           pln->stereo_format == PLANE_STEREO_FORMAT_TOP_AND_BOTTOM) {<br>
+                               pipes[pipe_cnt].pipe.src.is_hsplit = false;<br>
+                               pipes[pipe_cnt].pipe.src.hsplit_grp = res_ctx->pipe_ctx[i].pipe_idx;<br>
+                       }<br>
+<br>
+                       pipes[pipe_cnt].pipe.src.source_scan = pln->rotation == ROTATION_ANGLE_90<br>
+                                       || pln->rotation == ROTATION_ANGLE_270 ? dm_vert : dm_horz;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_y_y = scl->viewport.y;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_y_c = scl->viewport_c.y;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_width = scl->viewport.width;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_width_c = scl->viewport_c.width;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_height = scl->viewport.height;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_height_c = scl->viewport_c.height;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_width_max = pln->src_rect.width;<br>
+                       pipes[pipe_cnt].pipe.src.viewport_height_max = pln->src_rect.height;<br>
+                       pipes[pipe_cnt].pipe.src.surface_width_y = pln->plane_size.surface_size.width;<br>
+                       pipes[pipe_cnt].pipe.src.surface_height_y = pln->plane_size.surface_size.height;<br>
+                       pipes[pipe_cnt].pipe.src.surface_width_c = pln->plane_size.chroma_size.width;<br>
+                       pipes[pipe_cnt].pipe.src.surface_height_c = pln->plane_size.chroma_size.height;<br>
+                       if (pln->format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA<br>
+                                       || pln->format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) {<br>
+                               pipes[pipe_cnt].pipe.src.data_pitch = pln->plane_size.surface_pitch;<br>
+                               pipes[pipe_cnt].pipe.src.data_pitch_c = pln->plane_size.chroma_pitch;<br>
+                               pipes[pipe_cnt].pipe.src.meta_pitch = pln->dcc.meta_pitch;<br>
+                               pipes[pipe_cnt].pipe.src.meta_pitch_c = pln->dcc.meta_pitch_c;<br>
+                       } else {<br>
+                               pipes[pipe_cnt].pipe.src.data_pitch = pln->plane_size.surface_pitch;<br>
+                               pipes[pipe_cnt].pipe.src.meta_pitch = pln->dcc.meta_pitch;<br>
+                       }<br>
+                       pipes[pipe_cnt].pipe.src.dcc = pln->dcc.enable;<br>
+                       pipes[pipe_cnt].pipe.dest.recout_width = scl->recout.width;<br>
+                       pipes[pipe_cnt].pipe.dest.recout_height = scl->recout.height;<br>
+                       pipes[pipe_cnt].pipe.dest.full_recout_height = scl->recout.height;<br>
+                       pipes[pipe_cnt].pipe.dest.full_recout_width = scl->recout.width;<br>
+                       if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_2to1)<br>
+                               pipes[pipe_cnt].pipe.dest.full_recout_width *= 2;<br>
+                       else if (pipes[pipe_cnt].pipe.dest.odm_combine == dm_odm_combine_mode_4to1)<br>
+                               pipes[pipe_cnt].pipe.dest.full_recout_width *= 4;<br>
+                       else {<br>
+                               struct pipe_ctx *split_pipe = res_ctx->pipe_ctx[i].bottom_pipe;<br>
+<br>
+                               while (split_pipe && split_pipe->plane_state == pln) {<br>
+                                       pipes[pipe_cnt].pipe.dest.full_recout_width += split_pipe->plane_res.scl_data.recout.width;<br>
+                                       split_pipe = split_pipe->bottom_pipe;<br>
+                               }<br>
+                               split_pipe = res_ctx->pipe_ctx[i].top_pipe;<br>
+                               while (split_pipe && split_pipe->plane_state == pln) {<br>
+                                       pipes[pipe_cnt].pipe.dest.full_recout_width += split_pipe->plane_res.scl_data.recout.width;<br>
+                                       split_pipe = split_pipe->top_pipe;<br>
+                               }<br>
+                       }<br>
+<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.lb_depth = dm_lb_16;<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.hscl_ratio = (double) scl->ratios.horz.value / (1ULL<<32);<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.hscl_ratio_c = (double) scl->ratios.horz_c.value / (1ULL<<32);<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.vscl_ratio = (double) scl->ratios.vert.value / (1ULL<<32);<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.vscl_ratio_c = (double) scl->ratios.vert_c.value / (1ULL<<32);<br>
+                       pipes[pipe_cnt].pipe.scale_ratio_depth.scl_enable =<br>
+                                       scl->ratios.vert.value != dc_fixpt_one.value<br>
+                                       || scl->ratios.horz.value != dc_fixpt_one.value<br>
+                                       || scl->ratios.vert_c.value != dc_fixpt_one.value<br>
+                                       || scl->ratios.horz_c.value != dc_fixpt_one.value /*Lb only or Full scl*/<br>
+                                       || dc->debug.always_scale; /*support always scale*/<br>
+                       pipes[pipe_cnt].pipe.scale_taps.htaps = scl->taps.h_taps;<br>
+                       pipes[pipe_cnt].pipe.scale_taps.htaps_c = scl->taps.h_taps_c;<br>
+                       pipes[pipe_cnt].pipe.scale_taps.vtaps = scl->taps.v_taps;<br>
+                       pipes[pipe_cnt].pipe.scale_taps.vtaps_c = scl->taps.v_taps_c;<br>
+<br>
+                       pipes[pipe_cnt].pipe.src.macro_tile_size =<br>
+                                       swizzle_mode_to_macro_tile_size(pln->tiling_info.gfx9.swizzle);<br>
+                       swizzle_to_dml_params(pln->tiling_info.gfx9.swizzle,<br>
+                                       &pipes[pipe_cnt].pipe.src.sw_mode);<br>
+<br>
+                       switch (pln->format) {<br>
+                       case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:<br>
+                       case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_420_8;<br>
+                               break;<br>
+                       case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:<br>
+                       case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_420_10;<br>
+                               break;<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616:<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F:<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_444_64;<br>
+                               break;<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_RGB565:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_444_16;<br>
+                               break;<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_444_8;<br>
+                               break;<br>
+                       case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_rgbe_alpha;<br>
+                               break;<br>
+                       default:<br>
+                               pipes[pipe_cnt].pipe.src.source_format = dm_444_32;<br>
+                               break;<br>
+                       }<br>
+               }<br>
+<br>
+               pipe_cnt++;<br>
+       }<br>
+<br>
+       /* populate writeback information */<br>
+       dc->res_pool->funcs->populate_dml_writeback_from_context(dc, res_ctx, pipes);<br>
+<br>
+       return pipe_cnt;<br>
+}<br>
+<br>
+void dcn20_calculate_wm(struct dc *dc, struct dc_state *context,<br>
+                       display_e2e_pipe_params_st *pipes,<br>
+                       int *out_pipe_cnt,<br>
+                       int *pipe_split_from,<br>
+                       int vlevel,<br>
+                       bool fast_validate)<br>
+{<br>
+       int pipe_cnt, i, pipe_idx;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       for (i = 0, pipe_idx = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {<br>
+               if (!context->res_ctx.pipe_ctx[i].stream)<br>
+                       continue;<br>
+<br>
+               pipes[pipe_cnt].clks_cfg.refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000.0;<br>
+               pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.vba.RequiredDISPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb];<br>
+<br>
+               if (pipe_split_from[i] < 0) {<br>
+                       pipes[pipe_cnt].clks_cfg.dppclk_mhz =<br>
+                                       context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx];<br>
+                       if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_idx] == pipe_idx)<br>
+                               pipes[pipe_cnt].pipe.dest.odm_combine =<br>
+                                               context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_idx];<br>
+                       else<br>
+                               pipes[pipe_cnt].pipe.dest.odm_combine = 0;<br>
+                       pipe_idx++;<br>
+               } else {<br>
+                       pipes[pipe_cnt].clks_cfg.dppclk_mhz =<br>
+                                       context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_split_from[i]];<br>
+                       if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_split_from[i]] == pipe_split_from[i])<br>
+                               pipes[pipe_cnt].pipe.dest.odm_combine =<br>
+                                               context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_split_from[i]];<br>
+                       else<br>
+                               pipes[pipe_cnt].pipe.dest.odm_combine = 0;<br>
+               }<br>
+<br>
+               if (dc->config.forced_clocks) {<br>
+                       pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dispclk_mhz;<br>
+                       pipes[pipe_cnt].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dppclk_mhz;<br>
+               }<br>
+               if (dc->debug.min_disp_clk_khz > pipes[pipe_cnt].clks_cfg.dispclk_mhz * 1000)<br>
+                       pipes[pipe_cnt].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz / 1000.0;<br>
+               if (dc->debug.min_dpp_clk_khz > pipes[pipe_cnt].clks_cfg.dppclk_mhz * 1000)<br>
+                       pipes[pipe_cnt].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz / 1000.0;<br>
+<br>
+               pipe_cnt++;<br>
+       }<br>
+<br>
+       if (pipe_cnt != pipe_idx) {<br>
+               if (dc->res_pool->funcs->populate_dml_pipes)<br>
+                       pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc,<br>
+                               context, pipes, fast_validate);<br>
+               else<br>
+                       pipe_cnt = dcn20_populate_dml_pipes_from_context(dc,<br>
+                               context, pipes, fast_validate);<br>
+       }<br>
+<br>
+       *out_pipe_cnt = pipe_cnt;<br>
+<br>
+       pipes[0].clks_cfg.voltage = vlevel;<br>
+       pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz;<br>
+       pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz;<br>
+<br>
+       /* only pipe 0 is read for voltage and dcf/soc clocks */<br>
+       if (vlevel < 1) {<br>
+               pipes[0].clks_cfg.voltage = 1;<br>
+               pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[1].dcfclk_mhz;<br>
+               pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[1].socclk_mhz;<br>
+       }<br>
+       context->bw_ctx.bw.dcn.watermarks.b.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.b.urgent_latency_ns = get_urgent_latency(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+<br>
+       if (vlevel < 2) {<br>
+               pipes[0].clks_cfg.voltage = 2;<br>
+               pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].dcfclk_mhz;<br>
+               pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].socclk_mhz;<br>
+       }<br>
+       context->bw_ctx.bw.dcn.watermarks.c.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.c.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.c.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.c.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+<br>
+       if (vlevel < 3) {<br>
+               pipes[0].clks_cfg.voltage = 3;<br>
+               pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].dcfclk_mhz;<br>
+               pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2].socclk_mhz;<br>
+       }<br>
+       context->bw_ctx.bw.dcn.watermarks.d.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.d.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.d.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.d.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+<br>
+       pipes[0].clks_cfg.voltage = vlevel;<br>
+       pipes[0].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz;<br>
+       pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.pte_meta_urgent_ns = get_wm_memory_trip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+       context->bw_ctx.bw.dcn.watermarks.a.frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000;<br>
+}<br>
+<br>
+void dcn20_update_bounding_box(struct dc *dc,<br>
+                              struct _vcs_dpi_soc_bounding_box_st *bb,<br>
+                              struct pp_smu_nv_clock_table *max_clocks,<br>
+                              unsigned int *uclk_states,<br>
+                              unsigned int num_states)<br>
+{<br>
+       struct _vcs_dpi_voltage_scaling_st calculated_states[DC__VOLTAGE_STATES];<br>
+       int i;<br>
+       int num_calculated_states = 0;<br>
+       int min_dcfclk = 0;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       if (num_states == 0)<br>
+               return;<br>
+<br>
+       memset(calculated_states, 0, sizeof(calculated_states));<br>
+<br>
+       if (dc->bb_overrides.min_dcfclk_mhz > 0)<br>
+               min_dcfclk = dc->bb_overrides.min_dcfclk_mhz;<br>
+       else {<br>
+               if (ASICREV_IS_NAVI12_P(dc->ctx->asic_id.hw_internal_rev))<br>
+                       min_dcfclk = 310;<br>
+               else<br>
+                       // Accounting for SOC/DCF relationship, we can go as high as<br>
+                       // 506Mhz in Vmin.<br>
+                       min_dcfclk = 506;<br>
+       }<br>
+<br>
+       for (i = 0; i < num_states; i++) {<br>
+               int min_fclk_required_by_uclk;<br>
+               calculated_states[i].state = i;<br>
+               calculated_states[i].dram_speed_mts = uclk_states[i] * 16 / 1000;<br>
+<br>
+               // FCLK:UCLK ratio is 1.08<br>
+               min_fclk_required_by_uclk = div_u64(((unsigned long long)uclk_states[i]) * 1080,<br>
+                       1000000);<br>
+<br>
+               calculated_states[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?<br>
+                               min_dcfclk : min_fclk_required_by_uclk;<br>
+<br>
+               calculated_states[i].socclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?<br>
+                               max_clocks->socClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;<br>
+<br>
+               calculated_states[i].dcfclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?<br>
+                               max_clocks->dcfClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;<br>
+<br>
+               calculated_states[i].dispclk_mhz = max_clocks->displayClockInKhz / 1000;<br>
+               calculated_states[i].dppclk_mhz = max_clocks->displayClockInKhz / 1000;<br>
+               calculated_states[i].dscclk_mhz = max_clocks->displayClockInKhz / (1000 * 3);<br>
+<br>
+               calculated_states[i].phyclk_mhz = max_clocks->phyClockInKhz / 1000;<br>
+<br>
+               num_calculated_states++;<br>
+       }<br>
+<br>
+       calculated_states[num_calculated_states - 1].socclk_mhz = max_clocks->socClockInKhz / 1000;<br>
+       calculated_states[num_calculated_states - 1].fabricclk_mhz = max_clocks->socClockInKhz / 1000;<br>
+       calculated_states[num_calculated_states - 1].dcfclk_mhz = max_clocks->dcfClockInKhz / 1000;<br>
+<br>
+       memcpy(bb->clock_limits, calculated_states, sizeof(bb->clock_limits));<br>
+       bb->num_states = num_calculated_states;<br>
+<br>
+       // Duplicate the last state, DML always an extra state identical to max state to work<br>
+       memcpy(&bb->clock_limits[num_calculated_states], &bb->clock_limits[num_calculated_states - 1], sizeof(struct _vcs_dpi_voltage_scaling_st));<br>
+       bb->clock_limits[num_calculated_states].state = bb->num_states;<br>
+}<br>
+<br>
+void dcn20_cap_soc_clocks(struct _vcs_dpi_soc_bounding_box_st *bb,<br>
+                         struct pp_smu_nv_clock_table max_clocks)<br>
+{<br>
+       int i;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       // First pass - cap all clocks higher than the reported max<br>
+       for (i = 0; i < bb->num_states; i++) {<br>
+               if ((bb->clock_limits[i].dcfclk_mhz > (max_clocks.dcfClockInKhz / 1000))<br>
+                               && max_clocks.dcfClockInKhz != 0)<br>
+                       bb->clock_limits[i].dcfclk_mhz = (max_clocks.dcfClockInKhz / 1000);<br>
+<br>
+               if ((bb->clock_limits[i].dram_speed_mts > (max_clocks.uClockInKhz / 1000) * 16)<br>
+                                               && max_clocks.uClockInKhz != 0)<br>
+                       bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz / 1000) * 16;<br>
+<br>
+               if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz / 1000))<br>
+                                               && max_clocks.fabricClockInKhz != 0)<br>
+                       bb->clock_limits[i].fabricclk_mhz = (max_clocks.fabricClockInKhz / 1000);<br>
+<br>
+               if ((bb->clock_limits[i].dispclk_mhz > (max_clocks.displayClockInKhz / 1000))<br>
+                                               && max_clocks.displayClockInKhz != 0)<br>
+                       bb->clock_limits[i].dispclk_mhz = (max_clocks.displayClockInKhz / 1000);<br>
+<br>
+               if ((bb->clock_limits[i].dppclk_mhz > (max_clocks.dppClockInKhz / 1000))<br>
+                                               && max_clocks.dppClockInKhz != 0)<br>
+                       bb->clock_limits[i].dppclk_mhz = (max_clocks.dppClockInKhz / 1000);<br>
+<br>
+               if ((bb->clock_limits[i].phyclk_mhz > (max_clocks.phyClockInKhz / 1000))<br>
+                                               && max_clocks.phyClockInKhz != 0)<br>
+                       bb->clock_limits[i].phyclk_mhz = (max_clocks.phyClockInKhz / 1000);<br>
+<br>
+               if ((bb->clock_limits[i].socclk_mhz > (max_clocks.socClockInKhz / 1000))<br>
+                                               && max_clocks.socClockInKhz != 0)<br>
+                       bb->clock_limits[i].socclk_mhz = (max_clocks.socClockInKhz / 1000);<br>
+<br>
+               if ((bb->clock_limits[i].dscclk_mhz > (max_clocks.dscClockInKhz / 1000))<br>
+                                               && max_clocks.dscClockInKhz != 0)<br>
+                       bb->clock_limits[i].dscclk_mhz = (max_clocks.dscClockInKhz / 1000);<br>
+       }<br>
+<br>
+       // Second pass - remove all duplicate clock states<br>
+       for (i = bb->num_states - 1; i > 1; i--) {<br>
+               bool duplicate = true;<br>
+<br>
+               if (bb->clock_limits[i-1].dcfclk_mhz != bb->clock_limits[i].dcfclk_mhz)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].dispclk_mhz != bb->clock_limits[i].dispclk_mhz)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].dppclk_mhz != bb->clock_limits[i].dppclk_mhz)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].dram_speed_mts != bb->clock_limits[i].dram_speed_mts)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].dscclk_mhz != bb->clock_limits[i].dscclk_mhz)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].fabricclk_mhz != bb->clock_limits[i].fabricclk_mhz)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].phyclk_mhz != bb->clock_limits[i].phyclk_mhz)<br>
+                       duplicate = false;<br>
+               if (bb->clock_limits[i-1].socclk_mhz != bb->clock_limits[i].socclk_mhz)<br>
+                       duplicate = false;<br>
+<br>
+               if (duplicate)<br>
+                       bb->num_states--;<br>
+       }<br>
+}<br>
+<br>
+void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb)<br>
+{<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       if ((int)(bb->sr_exit_time_us * 1000) != dc->bb_overrides.sr_exit_time_ns<br>
+                       && dc->bb_overrides.sr_exit_time_ns) {<br>
+               bb->sr_exit_time_us = dc->bb_overrides.sr_exit_time_ns / 1000.0;<br>
+       }<br>
+<br>
+       if ((int)(bb->sr_enter_plus_exit_time_us * 1000)<br>
+                               != dc->bb_overrides.sr_enter_plus_exit_time_ns<br>
+                       && dc->bb_overrides.sr_enter_plus_exit_time_ns) {<br>
+               bb->sr_enter_plus_exit_time_us =<br>
+                               dc->bb_overrides.sr_enter_plus_exit_time_ns / 1000.0;<br>
+       }<br>
+<br>
+       if ((int)(bb->urgent_latency_us * 1000) != dc->bb_overrides.urgent_latency_ns<br>
+                       && dc->bb_overrides.urgent_latency_ns) {<br>
+               bb->urgent_latency_us = dc->bb_overrides.urgent_latency_ns / 1000.0;<br>
+       }<br>
+<br>
+       if ((int)(bb->dram_clock_change_latency_us * 1000)<br>
+                               != dc->bb_overrides.dram_clock_change_latency_ns<br>
+                       && dc->bb_overrides.dram_clock_change_latency_ns) {<br>
+               bb->dram_clock_change_latency_us =<br>
+                               dc->bb_overrides.dram_clock_change_latency_ns / 1000.0;<br>
+       }<br>
+<br>
+       if ((int)(bb->dummy_pstate_latency_us * 1000)<br>
+                               != dc->bb_overrides.dummy_clock_change_latency_ns<br>
+                       && dc->bb_overrides.dummy_clock_change_latency_ns) {<br>
+               bb->dummy_pstate_latency_us =<br>
+                               dc->bb_overrides.dummy_clock_change_latency_ns / 1000.0;<br>
+       }<br>
+}<br>
+<br>
+static bool dcn20_validate_bandwidth_internal(struct dc *dc, struct dc_state *context,<br>
+               bool fast_validate)<br>
+{<br>
+       bool out = false;<br>
+<br>
+       BW_VAL_TRACE_SETUP();<br>
+<br>
+       int vlevel = 0;<br>
+       int pipe_split_from[MAX_PIPES];<br>
+       int pipe_cnt = 0;<br>
+       display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);<br>
+       DC_LOGGER_INIT(dc->ctx->logger);<br>
+<br>
+       BW_VAL_TRACE_COUNT();<br>
+<br>
+       out = dcn20_fast_validate_bw(dc, context, pipes, &pipe_cnt, pipe_split_from, &vlevel, fast_validate);<br>
+<br>
+       if (pipe_cnt == 0)<br>
+               goto validate_out;<br>
+<br>
+       if (!out)<br>
+               goto validate_fail;<br>
+<br>
+       BW_VAL_TRACE_END_VOLTAGE_LEVEL();<br>
+<br>
+       if (fast_validate) {<br>
+               BW_VAL_TRACE_SKIP(fast);<br>
+               goto validate_out;<br>
+       }<br>
+<br>
+       dcn20_calculate_wm(dc, context, pipes, &pipe_cnt, pipe_split_from, vlevel, fast_validate);<br>
+       dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);<br>
+<br>
+       BW_VAL_TRACE_END_WATERMARKS();<br>
+<br>
+       goto validate_out;<br>
+<br>
+validate_fail:<br>
+       DC_LOG_WARNING("Mode Validation Warning: %s failed validation.\n",<br>
+               dml_get_status_message(context->bw_ctx.dml.vba.ValidationStatus[context->bw_ctx.dml.vba.soc.num_states]));<br>
+<br>
+       BW_VAL_TRACE_SKIP(fail);<br>
+       out = false;<br>
+<br>
+validate_out:<br>
+       kfree(pipes);<br>
+<br>
+       BW_VAL_TRACE_FINISH();<br>
+<br>
+       return out;<br>
+}<br>
+<br>
+bool dcn20_validate_bandwidth_fp(struct dc *dc,<br>
+                                struct dc_state *context,<br>
+                                bool fast_validate)<br>
+{<br>
+       bool voltage_supported = false;<br>
+       bool full_pstate_supported = false;<br>
+       bool dummy_pstate_supported = false;<br>
+       double p_state_latency_us;<br>
+<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       p_state_latency_us = context->bw_ctx.dml.soc.dram_clock_change_latency_us;<br>
+       context->bw_ctx.dml.soc.disable_dram_clock_change_vactive_support =<br>
+               dc->debug.disable_dram_clock_change_vactive_support;<br>
+       context->bw_ctx.dml.soc.allow_dram_clock_one_display_vactive =<br>
+               dc->debug.enable_dram_clock_change_one_display_vactive;<br>
+<br>
+       /*Unsafe due to current pipe merge and split logic*/<br>
+       ASSERT(context != dc->current_state);<br>
+<br>
+       if (fast_validate) {<br>
+               return dcn20_validate_bandwidth_internal(dc, context, true);<br>
+       }<br>
+<br>
+       // Best case, we support full UCLK switch latency<br>
+       voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);<br>
+       full_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;<br>
+<br>
+       if (context->bw_ctx.dml.soc.dummy_pstate_latency_us == 0 ||<br>
+               (voltage_supported && full_pstate_supported)) {<br>
+               context->bw_ctx.bw.dcn.clk.p_state_change_support = full_pstate_supported;<br>
+               goto restore_dml_state;<br>
+       }<br>
+<br>
+       // Fallback: Try to only support G6 temperature read latency<br>
+       context->bw_ctx.dml.soc.dram_clock_change_latency_us = context->bw_ctx.dml.soc.dummy_pstate_latency_us;<br>
+<br>
+       voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);<br>
+       dummy_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;<br>
+<br>
+       if (voltage_supported && (dummy_pstate_supported || !(context->stream_count))) {<br>
+               context->bw_ctx.bw.dcn.clk.p_state_change_support = false;<br>
+               goto restore_dml_state;<br>
+       }<br>
+<br>
+       // ERROR: fallback is supposed to always work.<br>
+       ASSERT(false);<br>
+<br>
+restore_dml_state:<br>
+       context->bw_ctx.dml.soc.dram_clock_change_latency_us = p_state_latency_us;<br>
+       return voltage_supported;<br>
+}<br>
+<br>
+void dcn20_fpu_set_wm_ranges(int i,<br>
+                            struct pp_smu_wm_range_sets *ranges,<br>
+                            struct _vcs_dpi_soc_bounding_box_st *loaded_bb)<br>
+{<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       ranges->reader_wm_sets[i].min_fill_clk_mhz = (i > 0) ? (loaded_bb->clock_limits[i - 1].dram_speed_mts / 16) + 1 : 0;<br>
+       ranges->reader_wm_sets[i].max_fill_clk_mhz = loaded_bb->clock_limits[i].dram_speed_mts / 16;<br>
+}<br>
+<br>
+void dcn20_fpu_adjust_dppclk(struct vba_vars_st *v,<br>
+                            int vlevel,<br>
+                            int max_mpc_comb,<br>
+                            int pipe_idx,<br>
+                            bool is_validating_bw)<br>
+{<br>
+       dc_assert_fp_enabled();<br>
+<br>
+       if (is_validating_bw)<br>
+               v->RequiredDPPCLK[vlevel][max_mpc_comb][pipe_idx] *= 2;<br>
+       else<br>
+               v->RequiredDPPCLK[vlevel][max_mpc_comb][pipe_idx] /= 2;<br>
+}<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h<br>
index 36f26126d574..6b1f4126bc88 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h<br>
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h<br>
@@ -23,6 +23,7 @@<br>
  * Authors: AMD<br>
  *<br>
  */<br>
+#include "core_types.h"<br>
 <br>
 #ifndef __DCN20_FPU_H__<br>
 #define __DCN20_FPU_H__<br>
@@ -30,5 +31,44 @@<br>
 void dcn20_populate_dml_writeback_from_context(struct dc *dc,<br>
                                                struct resource_context *res_ctx,<br>
                                                display_e2e_pipe_params_st *pipes);<br>
-<br>
+void dcn20_fpu_set_wb_arb_params(struct mcif_arb_params *wb_arb_params,<br>
+                                struct dc_state *context,<br>
+                                display_e2e_pipe_params_st *pipes,<br>
+                                int pipe_cnt, int i);<br>
+void dcn20_calculate_dlg_params(struct dc *dc,<br>
+                               struct dc_state *context,<br>
+                               display_e2e_pipe_params_st *pipes,<br>
+                               int pipe_cnt,<br>
+                               int vlevel);<br>
+int dcn20_populate_dml_pipes_from_context(struct dc *dc,<br>
+                                         struct dc_state *context,<br>
+                                         display_e2e_pipe_params_st *pipes,<br>
+                                         bool fast_validate);<br>
+void dcn20_calculate_wm(struct dc *dc,<br>
+                       struct dc_state *context,<br>
+                       display_e2e_pipe_params_st *pipes,<br>
+                       int *out_pipe_cnt,<br>
+                       int *pipe_split_from,<br>
+                       int vlevel,<br>
+                       bool fast_validate);<br>
+void dcn20_cap_soc_clocks(struct _vcs_dpi_soc_bounding_box_st *bb,<br>
+                         struct pp_smu_nv_clock_table max_clocks);<br>
+void dcn20_update_bounding_box(struct dc *dc,<br>
+                              struct _vcs_dpi_soc_bounding_box_st *bb,<br>
+                              struct pp_smu_nv_clock_table *max_clocks,<br>
+                              unsigned int *uclk_states,<br>
+                              unsigned int num_states);<br>
+void dcn20_patch_bounding_box(struct dc *dc,<br>
+                             struct _vcs_dpi_soc_bounding_box_st *bb);<br>
+bool dcn20_validate_bandwidth_fp(struct dc *dc,<br>
+                                struct dc_state *context,<br>
+                                bool fast_validate);<br>
+void dcn20_fpu_set_wm_ranges(int i,<br>
+                            struct pp_smu_wm_range_sets *ranges,<br>
+                            struct _vcs_dpi_soc_bounding_box_st *loaded_bb);<br>
+void dcn20_fpu_adjust_dppclk(struct vba_vars_st *v,<br>
+                            int vlevel,<br>
+                            int max_mpc_comb,<br>
+                            int pipe_idx,<br>
+                            bool is_validating_bw);<br>
 #endif /* __DCN20_FPU_H__ */<br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>