bandwidth_calcs.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. /*
  2. * Copyright 2015 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. /**
  26. * Bandwidth and Watermark calculations interface.
  27. * (Refer to "DCEx_mode_support.xlsm" from Perforce.)
  28. */
  29. #ifndef __BANDWIDTH_CALCS_H__
  30. #define __BANDWIDTH_CALCS_H__
  31. #include "bw_fixed.h"
  32. struct pipe_ctx;
  33. enum bw_calcs_version {
  34. BW_CALCS_VERSION_INVALID,
  35. BW_CALCS_VERSION_CARRIZO,
  36. BW_CALCS_VERSION_POLARIS10,
  37. BW_CALCS_VERSION_POLARIS11,
  38. BW_CALCS_VERSION_STONEY,
  39. };
  40. /*******************************************************************************
  41. * There are three types of input into Calculations:
  42. * 1. per-DCE static values - these are "hardcoded" properties of the DCEIP
  43. * 2. board-level values - these are generally coming from VBIOS parser
  44. * 3. mode/configuration values - depending Mode, Scaling number of Displays etc.
  45. ******************************************************************************/
  46. enum bw_defines {
  47. //Common
  48. bw_def_no = 0,
  49. bw_def_none = 0,
  50. bw_def_yes = 1,
  51. bw_def_ok = 1,
  52. bw_def_high = 2,
  53. bw_def_mid = 1,
  54. bw_def_low = 0,
  55. //Internal
  56. bw_defs_start = 255,
  57. bw_def_underlay422,
  58. bw_def_underlay420_luma,
  59. bw_def_underlay420_chroma,
  60. bw_def_underlay444,
  61. bw_def_graphics,
  62. bw_def_display_write_back420_luma,
  63. bw_def_display_write_back420_chroma,
  64. bw_def_portrait,
  65. bw_def_hsr_mtn_4,
  66. bw_def_hsr_mtn_h_taps,
  67. bw_def_ceiling__h_taps_div_4___meq_hsr,
  68. bw_def_invalid_linear_or_stereo_mode,
  69. bw_def_invalid_rotation_or_bpp_or_stereo,
  70. bw_def_vsr_mtn_v_taps,
  71. bw_def_vsr_mtn_4,
  72. bw_def_auto,
  73. bw_def_manual,
  74. bw_def_exceeded_allowed_maximum_sclk,
  75. bw_def_exceeded_allowed_page_close_open,
  76. bw_def_exceeded_allowed_outstanding_pte_req_queue_size,
  77. bw_def_exceeded_allowed_maximum_bw,
  78. bw_def_landscape,
  79. //Panning and bezel
  80. bw_def_any_lines,
  81. //Underlay mode
  82. bw_def_underlay_only,
  83. bw_def_blended,
  84. bw_def_blend,
  85. //Stereo mode
  86. bw_def_mono,
  87. bw_def_side_by_side,
  88. bw_def_top_bottom,
  89. //Underlay surface type
  90. bw_def_420,
  91. bw_def_422,
  92. bw_def_444,
  93. //Tiling mode
  94. bw_def_linear,
  95. bw_def_tiled,
  96. bw_def_array_linear_general,
  97. bw_def_array_linear_aligned,
  98. bw_def_rotated_micro_tiling,
  99. bw_def_display_micro_tiling,
  100. //Memory type
  101. bw_def_gddr5,
  102. bw_def_hbm,
  103. //Voltage
  104. bw_def_high_no_nbp_state_change,
  105. bw_def_0_72,
  106. bw_def_0_8,
  107. bw_def_0_9,
  108. bw_def_notok = -1,
  109. bw_def_na = -1
  110. };
  111. struct bw_calcs_dceip {
  112. enum bw_calcs_version version;
  113. bool large_cursor;
  114. uint32_t cursor_max_outstanding_group_num;
  115. bool dmif_pipe_en_fbc_chunk_tracker;
  116. struct bw_fixed dmif_request_buffer_size;
  117. uint32_t lines_interleaved_into_lb;
  118. uint32_t low_power_tiling_mode;
  119. uint32_t chunk_width;
  120. uint32_t number_of_graphics_pipes;
  121. uint32_t number_of_underlay_pipes;
  122. bool display_write_back_supported;
  123. bool argb_compression_support;
  124. struct bw_fixed underlay_vscaler_efficiency6_bit_per_component;
  125. struct bw_fixed underlay_vscaler_efficiency8_bit_per_component;
  126. struct bw_fixed underlay_vscaler_efficiency10_bit_per_component;
  127. struct bw_fixed underlay_vscaler_efficiency12_bit_per_component;
  128. struct bw_fixed graphics_vscaler_efficiency6_bit_per_component;
  129. struct bw_fixed graphics_vscaler_efficiency8_bit_per_component;
  130. struct bw_fixed graphics_vscaler_efficiency10_bit_per_component;
  131. struct bw_fixed graphics_vscaler_efficiency12_bit_per_component;
  132. struct bw_fixed alpha_vscaler_efficiency;
  133. uint32_t max_dmif_buffer_allocated;
  134. uint32_t graphics_dmif_size;
  135. uint32_t underlay_luma_dmif_size;
  136. uint32_t underlay_chroma_dmif_size;
  137. bool pre_downscaler_enabled;
  138. bool underlay_downscale_prefetch_enabled;
  139. struct bw_fixed lb_write_pixels_per_dispclk;
  140. struct bw_fixed lb_size_per_component444;
  141. bool graphics_lb_nodownscaling_multi_line_prefetching;
  142. struct bw_fixed stutter_and_dram_clock_state_change_gated_before_cursor;
  143. struct bw_fixed underlay420_luma_lb_size_per_component;
  144. struct bw_fixed underlay420_chroma_lb_size_per_component;
  145. struct bw_fixed underlay422_lb_size_per_component;
  146. struct bw_fixed cursor_chunk_width;
  147. struct bw_fixed cursor_dcp_buffer_lines;
  148. struct bw_fixed underlay_maximum_width_efficient_for_tiling;
  149. struct bw_fixed underlay_maximum_height_efficient_for_tiling;
  150. struct bw_fixed peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display;
  151. struct bw_fixed peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation;
  152. struct bw_fixed minimum_outstanding_pte_request_limit;
  153. struct bw_fixed maximum_total_outstanding_pte_requests_allowed_by_saw;
  154. bool limit_excessive_outstanding_dmif_requests;
  155. struct bw_fixed linear_mode_line_request_alternation_slice;
  156. uint32_t scatter_gather_lines_of_pte_prefetching_in_linear_mode;
  157. uint32_t display_write_back420_luma_mcifwr_buffer_size;
  158. uint32_t display_write_back420_chroma_mcifwr_buffer_size;
  159. struct bw_fixed request_efficiency;
  160. struct bw_fixed dispclk_per_request;
  161. struct bw_fixed dispclk_ramping_factor;
  162. struct bw_fixed display_pipe_throughput_factor;
  163. uint32_t scatter_gather_pte_request_rows_in_tiling_mode;
  164. struct bw_fixed mcifwr_all_surfaces_burst_time;
  165. };
  166. struct bw_calcs_vbios {
  167. enum bw_defines memory_type;
  168. uint32_t dram_channel_width_in_bits;
  169. uint32_t number_of_dram_channels;
  170. uint32_t number_of_dram_banks;
  171. struct bw_fixed low_yclk; /*m_hz*/
  172. struct bw_fixed mid_yclk; /*m_hz*/
  173. struct bw_fixed high_yclk; /*m_hz*/
  174. struct bw_fixed low_sclk; /*m_hz*/
  175. struct bw_fixed mid1_sclk; /*m_hz*/
  176. struct bw_fixed mid2_sclk; /*m_hz*/
  177. struct bw_fixed mid3_sclk; /*m_hz*/
  178. struct bw_fixed mid4_sclk; /*m_hz*/
  179. struct bw_fixed mid5_sclk; /*m_hz*/
  180. struct bw_fixed mid6_sclk; /*m_hz*/
  181. struct bw_fixed high_sclk; /*m_hz*/
  182. struct bw_fixed low_voltage_max_dispclk; /*m_hz*/
  183. struct bw_fixed mid_voltage_max_dispclk; /*m_hz*/
  184. struct bw_fixed high_voltage_max_dispclk; /*m_hz*/
  185. struct bw_fixed low_voltage_max_phyclk;
  186. struct bw_fixed mid_voltage_max_phyclk;
  187. struct bw_fixed high_voltage_max_phyclk;
  188. struct bw_fixed data_return_bus_width;
  189. struct bw_fixed trc;
  190. struct bw_fixed dmifmc_urgent_latency;
  191. struct bw_fixed stutter_self_refresh_exit_latency;
  192. struct bw_fixed stutter_self_refresh_entry_latency;
  193. struct bw_fixed nbp_state_change_latency;
  194. struct bw_fixed mcifwrmc_urgent_latency;
  195. bool scatter_gather_enable;
  196. struct bw_fixed down_spread_percentage;
  197. uint32_t cursor_width;
  198. uint32_t average_compression_rate;
  199. uint32_t number_of_request_slots_gmc_reserves_for_dmif_per_channel;
  200. struct bw_fixed blackout_duration;
  201. struct bw_fixed maximum_blackout_recovery_time;
  202. };
  203. /*******************************************************************************
  204. * Temporary data structure(s).
  205. ******************************************************************************/
  206. #define maximum_number_of_surfaces 12
  207. /*Units : MHz, us */
  208. struct bw_calcs_data {
  209. /* data for all displays */
  210. uint32_t number_of_displays;
  211. enum bw_defines underlay_surface_type;
  212. enum bw_defines panning_and_bezel_adjustment;
  213. enum bw_defines graphics_tiling_mode;
  214. uint32_t graphics_lb_bpc;
  215. uint32_t underlay_lb_bpc;
  216. enum bw_defines underlay_tiling_mode;
  217. enum bw_defines d0_underlay_mode;
  218. bool d1_display_write_back_dwb_enable;
  219. enum bw_defines d1_underlay_mode;
  220. bool cpup_state_change_enable;
  221. bool cpuc_state_change_enable;
  222. bool nbp_state_change_enable;
  223. bool stutter_mode_enable;
  224. uint32_t y_clk_level;
  225. uint32_t sclk_level;
  226. uint32_t number_of_underlay_surfaces;
  227. uint32_t number_of_dram_wrchannels;
  228. uint32_t chunk_request_delay;
  229. uint32_t number_of_dram_channels;
  230. enum bw_defines underlay_micro_tile_mode;
  231. enum bw_defines graphics_micro_tile_mode;
  232. struct bw_fixed max_phyclk;
  233. struct bw_fixed dram_efficiency;
  234. struct bw_fixed src_width_after_surface_type;
  235. struct bw_fixed src_height_after_surface_type;
  236. struct bw_fixed hsr_after_surface_type;
  237. struct bw_fixed vsr_after_surface_type;
  238. struct bw_fixed src_width_after_rotation;
  239. struct bw_fixed src_height_after_rotation;
  240. struct bw_fixed hsr_after_rotation;
  241. struct bw_fixed vsr_after_rotation;
  242. struct bw_fixed source_height_pixels;
  243. struct bw_fixed hsr_after_stereo;
  244. struct bw_fixed vsr_after_stereo;
  245. struct bw_fixed source_width_in_lb;
  246. struct bw_fixed lb_line_pitch;
  247. struct bw_fixed underlay_maximum_source_efficient_for_tiling;
  248. struct bw_fixed num_lines_at_frame_start;
  249. struct bw_fixed min_dmif_size_in_time;
  250. struct bw_fixed min_mcifwr_size_in_time;
  251. struct bw_fixed total_requests_for_dmif_size;
  252. struct bw_fixed peak_pte_request_to_eviction_ratio_limiting;
  253. struct bw_fixed useful_pte_per_pte_request;
  254. struct bw_fixed scatter_gather_pte_request_rows;
  255. struct bw_fixed scatter_gather_row_height;
  256. struct bw_fixed scatter_gather_pte_requests_in_vblank;
  257. struct bw_fixed inefficient_linear_pitch_in_bytes;
  258. struct bw_fixed cursor_total_data;
  259. struct bw_fixed cursor_total_request_groups;
  260. struct bw_fixed scatter_gather_total_pte_requests;
  261. struct bw_fixed scatter_gather_total_pte_request_groups;
  262. struct bw_fixed tile_width_in_pixels;
  263. struct bw_fixed dmif_total_number_of_data_request_page_close_open;
  264. struct bw_fixed mcifwr_total_number_of_data_request_page_close_open;
  265. struct bw_fixed bytes_per_page_close_open;
  266. struct bw_fixed mcifwr_total_page_close_open_time;
  267. struct bw_fixed total_requests_for_adjusted_dmif_size;
  268. struct bw_fixed total_dmifmc_urgent_trips;
  269. struct bw_fixed total_dmifmc_urgent_latency;
  270. struct bw_fixed total_display_reads_required_data;
  271. struct bw_fixed total_display_reads_required_dram_access_data;
  272. struct bw_fixed total_display_writes_required_data;
  273. struct bw_fixed total_display_writes_required_dram_access_data;
  274. struct bw_fixed display_reads_required_data;
  275. struct bw_fixed display_reads_required_dram_access_data;
  276. struct bw_fixed dmif_total_page_close_open_time;
  277. struct bw_fixed min_cursor_memory_interface_buffer_size_in_time;
  278. struct bw_fixed min_read_buffer_size_in_time;
  279. struct bw_fixed display_reads_time_for_data_transfer;
  280. struct bw_fixed display_writes_time_for_data_transfer;
  281. struct bw_fixed dmif_required_dram_bandwidth;
  282. struct bw_fixed mcifwr_required_dram_bandwidth;
  283. struct bw_fixed required_dmifmc_urgent_latency_for_page_close_open;
  284. struct bw_fixed required_mcifmcwr_urgent_latency;
  285. struct bw_fixed required_dram_bandwidth_gbyte_per_second;
  286. struct bw_fixed dram_bandwidth;
  287. struct bw_fixed dmif_required_sclk;
  288. struct bw_fixed mcifwr_required_sclk;
  289. struct bw_fixed required_sclk;
  290. struct bw_fixed downspread_factor;
  291. struct bw_fixed v_scaler_efficiency;
  292. struct bw_fixed scaler_limits_factor;
  293. struct bw_fixed display_pipe_pixel_throughput;
  294. struct bw_fixed total_dispclk_required_with_ramping;
  295. struct bw_fixed total_dispclk_required_without_ramping;
  296. struct bw_fixed total_read_request_bandwidth;
  297. struct bw_fixed total_write_request_bandwidth;
  298. struct bw_fixed dispclk_required_for_total_read_request_bandwidth;
  299. struct bw_fixed total_dispclk_required_with_ramping_with_request_bandwidth;
  300. struct bw_fixed total_dispclk_required_without_ramping_with_request_bandwidth;
  301. struct bw_fixed dispclk;
  302. struct bw_fixed blackout_recovery_time;
  303. struct bw_fixed min_pixels_per_data_fifo_entry;
  304. struct bw_fixed sclk_deep_sleep;
  305. struct bw_fixed chunk_request_time;
  306. struct bw_fixed cursor_request_time;
  307. struct bw_fixed line_source_pixels_transfer_time;
  308. struct bw_fixed dmifdram_access_efficiency;
  309. struct bw_fixed mcifwrdram_access_efficiency;
  310. struct bw_fixed total_average_bandwidth_no_compression;
  311. struct bw_fixed total_average_bandwidth;
  312. struct bw_fixed total_stutter_cycle_duration;
  313. struct bw_fixed stutter_burst_time;
  314. struct bw_fixed time_in_self_refresh;
  315. struct bw_fixed stutter_efficiency;
  316. struct bw_fixed worst_number_of_trips_to_memory;
  317. struct bw_fixed immediate_flip_time;
  318. struct bw_fixed latency_for_non_dmif_clients;
  319. struct bw_fixed latency_for_non_mcifwr_clients;
  320. struct bw_fixed dmifmc_urgent_latency_supported_in_high_sclk_and_yclk;
  321. struct bw_fixed nbp_state_dram_speed_change_margin;
  322. struct bw_fixed display_reads_time_for_data_transfer_and_urgent_latency;
  323. struct bw_fixed dram_speed_change_margin;
  324. struct bw_fixed min_vblank_dram_speed_change_margin;
  325. struct bw_fixed min_stutter_refresh_duration;
  326. uint32_t total_stutter_dmif_buffer_size;
  327. uint32_t total_bytes_requested;
  328. uint32_t min_stutter_dmif_buffer_size;
  329. uint32_t num_stutter_bursts;
  330. struct bw_fixed v_blank_nbp_state_dram_speed_change_latency_supported;
  331. struct bw_fixed nbp_state_dram_speed_change_latency_supported;
  332. bool fbc_en[maximum_number_of_surfaces];
  333. bool lpt_en[maximum_number_of_surfaces];
  334. bool displays_match_flag[maximum_number_of_surfaces];
  335. bool use_alpha[maximum_number_of_surfaces];
  336. bool orthogonal_rotation[maximum_number_of_surfaces];
  337. bool enable[maximum_number_of_surfaces];
  338. bool access_one_channel_only[maximum_number_of_surfaces];
  339. bool scatter_gather_enable_for_pipe[maximum_number_of_surfaces];
  340. bool interlace_mode[maximum_number_of_surfaces];
  341. bool display_pstate_change_enable[maximum_number_of_surfaces];
  342. bool line_buffer_prefetch[maximum_number_of_surfaces];
  343. uint32_t bytes_per_pixel[maximum_number_of_surfaces];
  344. uint32_t max_chunks_non_fbc_mode[maximum_number_of_surfaces];
  345. uint32_t lb_bpc[maximum_number_of_surfaces];
  346. uint32_t output_bpphdmi[maximum_number_of_surfaces];
  347. uint32_t output_bppdp4_lane_hbr[maximum_number_of_surfaces];
  348. uint32_t output_bppdp4_lane_hbr2[maximum_number_of_surfaces];
  349. uint32_t output_bppdp4_lane_hbr3[maximum_number_of_surfaces];
  350. enum bw_defines stereo_mode[maximum_number_of_surfaces];
  351. struct bw_fixed dmif_buffer_transfer_time[maximum_number_of_surfaces];
  352. struct bw_fixed displays_with_same_mode[maximum_number_of_surfaces];
  353. struct bw_fixed stutter_dmif_buffer_size[maximum_number_of_surfaces];
  354. struct bw_fixed stutter_refresh_duration[maximum_number_of_surfaces];
  355. struct bw_fixed stutter_exit_watermark[maximum_number_of_surfaces];
  356. struct bw_fixed stutter_entry_watermark[maximum_number_of_surfaces];
  357. struct bw_fixed h_total[maximum_number_of_surfaces];
  358. struct bw_fixed v_total[maximum_number_of_surfaces];
  359. struct bw_fixed pixel_rate[maximum_number_of_surfaces];
  360. struct bw_fixed src_width[maximum_number_of_surfaces];
  361. struct bw_fixed pitch_in_pixels[maximum_number_of_surfaces];
  362. struct bw_fixed pitch_in_pixels_after_surface_type[maximum_number_of_surfaces];
  363. struct bw_fixed src_height[maximum_number_of_surfaces];
  364. struct bw_fixed scale_ratio[maximum_number_of_surfaces];
  365. struct bw_fixed h_taps[maximum_number_of_surfaces];
  366. struct bw_fixed v_taps[maximum_number_of_surfaces];
  367. struct bw_fixed h_scale_ratio[maximum_number_of_surfaces];
  368. struct bw_fixed v_scale_ratio[maximum_number_of_surfaces];
  369. struct bw_fixed rotation_angle[maximum_number_of_surfaces];
  370. struct bw_fixed compression_rate[maximum_number_of_surfaces];
  371. struct bw_fixed hsr[maximum_number_of_surfaces];
  372. struct bw_fixed vsr[maximum_number_of_surfaces];
  373. struct bw_fixed source_width_rounded_up_to_chunks[maximum_number_of_surfaces];
  374. struct bw_fixed source_width_pixels[maximum_number_of_surfaces];
  375. struct bw_fixed source_height_rounded_up_to_chunks[maximum_number_of_surfaces];
  376. struct bw_fixed display_bandwidth[maximum_number_of_surfaces];
  377. struct bw_fixed request_bandwidth[maximum_number_of_surfaces];
  378. struct bw_fixed bytes_per_request[maximum_number_of_surfaces];
  379. struct bw_fixed useful_bytes_per_request[maximum_number_of_surfaces];
  380. struct bw_fixed lines_interleaved_in_mem_access[maximum_number_of_surfaces];
  381. struct bw_fixed latency_hiding_lines[maximum_number_of_surfaces];
  382. struct bw_fixed lb_partitions[maximum_number_of_surfaces];
  383. struct bw_fixed lb_partitions_max[maximum_number_of_surfaces];
  384. struct bw_fixed dispclk_required_with_ramping[maximum_number_of_surfaces];
  385. struct bw_fixed dispclk_required_without_ramping[maximum_number_of_surfaces];
  386. struct bw_fixed data_buffer_size[maximum_number_of_surfaces];
  387. struct bw_fixed outstanding_chunk_request_limit[maximum_number_of_surfaces];
  388. struct bw_fixed urgent_watermark[maximum_number_of_surfaces];
  389. struct bw_fixed nbp_state_change_watermark[maximum_number_of_surfaces];
  390. struct bw_fixed v_filter_init[maximum_number_of_surfaces];
  391. struct bw_fixed stutter_cycle_duration[maximum_number_of_surfaces];
  392. struct bw_fixed average_bandwidth[maximum_number_of_surfaces];
  393. struct bw_fixed average_bandwidth_no_compression[maximum_number_of_surfaces];
  394. struct bw_fixed scatter_gather_pte_request_limit[maximum_number_of_surfaces];
  395. struct bw_fixed lb_size_per_component[maximum_number_of_surfaces];
  396. struct bw_fixed memory_chunk_size_in_bytes[maximum_number_of_surfaces];
  397. struct bw_fixed pipe_chunk_size_in_bytes[maximum_number_of_surfaces];
  398. struct bw_fixed number_of_trips_to_memory_for_getting_apte_row[maximum_number_of_surfaces];
  399. struct bw_fixed adjusted_data_buffer_size[maximum_number_of_surfaces];
  400. struct bw_fixed adjusted_data_buffer_size_in_memory[maximum_number_of_surfaces];
  401. struct bw_fixed pixels_per_data_fifo_entry[maximum_number_of_surfaces];
  402. struct bw_fixed scatter_gather_pte_requests_in_row[maximum_number_of_surfaces];
  403. struct bw_fixed pte_request_per_chunk[maximum_number_of_surfaces];
  404. struct bw_fixed scatter_gather_page_width[maximum_number_of_surfaces];
  405. struct bw_fixed scatter_gather_page_height[maximum_number_of_surfaces];
  406. struct bw_fixed lb_lines_in_per_line_out_in_beginning_of_frame[maximum_number_of_surfaces];
  407. struct bw_fixed lb_lines_in_per_line_out_in_middle_of_frame[maximum_number_of_surfaces];
  408. struct bw_fixed cursor_width_pixels[maximum_number_of_surfaces];
  409. struct bw_fixed minimum_latency_hiding[maximum_number_of_surfaces];
  410. struct bw_fixed maximum_latency_hiding[maximum_number_of_surfaces];
  411. struct bw_fixed minimum_latency_hiding_with_cursor[maximum_number_of_surfaces];
  412. struct bw_fixed maximum_latency_hiding_with_cursor[maximum_number_of_surfaces];
  413. struct bw_fixed src_pixels_for_first_output_pixel[maximum_number_of_surfaces];
  414. struct bw_fixed src_pixels_for_last_output_pixel[maximum_number_of_surfaces];
  415. struct bw_fixed src_data_for_first_output_pixel[maximum_number_of_surfaces];
  416. struct bw_fixed src_data_for_last_output_pixel[maximum_number_of_surfaces];
  417. struct bw_fixed active_time[maximum_number_of_surfaces];
  418. struct bw_fixed horizontal_blank_and_chunk_granularity_factor[maximum_number_of_surfaces];
  419. struct bw_fixed cursor_latency_hiding[maximum_number_of_surfaces];
  420. struct bw_fixed v_blank_dram_speed_change_margin[maximum_number_of_surfaces];
  421. uint32_t num_displays_with_margin[3][8];
  422. struct bw_fixed dmif_burst_time[3][8];
  423. struct bw_fixed mcifwr_burst_time[3][8];
  424. struct bw_fixed line_source_transfer_time[maximum_number_of_surfaces][3][8];
  425. struct bw_fixed dram_speed_change_line_source_transfer_time[maximum_number_of_surfaces][3][8];
  426. struct bw_fixed min_dram_speed_change_margin[3][8];
  427. struct bw_fixed dispclk_required_for_dram_speed_change[3][8];
  428. struct bw_fixed blackout_duration_margin[3][8];
  429. struct bw_fixed dispclk_required_for_blackout_duration[3][8];
  430. struct bw_fixed dispclk_required_for_blackout_recovery[3][8];
  431. struct bw_fixed dmif_required_sclk_for_urgent_latency[6];
  432. };
  433. /*******************************************************************************
  434. * Output data structures.
  435. ******************************************************************************/
  436. struct bw_watermarks {
  437. uint32_t a_mark;
  438. uint32_t b_mark;
  439. uint32_t c_mark;
  440. uint32_t d_mark;
  441. };
  442. struct bw_calcs_output {
  443. bool cpuc_state_change_enable;
  444. bool cpup_state_change_enable;
  445. bool stutter_mode_enable;
  446. bool nbp_state_change_enable;
  447. bool all_displays_in_sync;
  448. struct bw_watermarks urgent_wm_ns[6];
  449. struct bw_watermarks stutter_exit_wm_ns[6];
  450. struct bw_watermarks nbp_state_change_wm_ns[6];
  451. uint32_t required_sclk;
  452. uint32_t required_sclk_deep_sleep;
  453. uint32_t required_yclk;
  454. uint32_t dispclk_khz;
  455. int blackout_recovery_time_us;
  456. };
  457. /**
  458. * Initialize structures with data which will NOT change at runtime.
  459. */
  460. void bw_calcs_init(
  461. struct bw_calcs_dceip *bw_dceip,
  462. struct bw_calcs_vbios *bw_vbios,
  463. enum bw_calcs_version version);
  464. /**
  465. * Return:
  466. * true - Display(s) configuration supported.
  467. * In this case 'calcs_output' contains data for HW programming
  468. * false - Display(s) configuration not supported (not enough bandwidth).
  469. */
  470. bool bw_calcs(
  471. struct dc_context *ctx,
  472. const struct bw_calcs_dceip *dceip,
  473. const struct bw_calcs_vbios *vbios,
  474. const struct pipe_ctx *pipe,
  475. int pipe_count,
  476. struct bw_calcs_output *calcs_output);
  477. #endif /* __BANDWIDTH_CALCS_H__ */