1 /* 2 * Copyright 2012-2026 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 #ifndef DC_INTERFACE_H_ 27 #define DC_INTERFACE_H_ 28 29 #include "dc_types.h" 30 #include "dc_state.h" 31 #include "dc_plane.h" 32 #include "grph_object_defs.h" 33 #include "logger_types.h" 34 #include "hdcp_msg_types.h" 35 #include "gpio_types.h" 36 #include "link_service_types.h" 37 #include "grph_object_ctrl_defs.h" 38 #include <inc/hw/opp.h> 39 40 #include "hwss/hw_sequencer.h" 41 #include "inc/compressor.h" 42 #include "inc/hw/dmcu.h" 43 #include "dml/display_mode_lib.h" 44 45 #include "dml2_0/dml2_wrapper.h" 46 47 #include "dmub/inc/dmub_cmd.h" 48 49 #include "dml/dml1_frl_cap_chk.h" 50 51 #include "sspl/dc_spl_types.h" 52 53 struct abm_save_restore; 54 55 /* forward declaration */ 56 struct aux_payload; 57 struct set_config_cmd_payload; 58 struct dmub_notification; 59 struct dcn_hubbub_reg_state; 60 struct dcn_hubp_reg_state; 61 struct dcn_dpp_reg_state; 62 struct dcn_mpc_reg_state; 63 struct dcn_opp_reg_state; 64 struct dcn_dsc_reg_state; 65 struct dcn_optc_reg_state; 66 struct dcn_dccg_reg_state; 67 68 #define DC_VER "3.2.384" 69 70 /** 71 * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC 72 */ 73 #define MAX_SURFACES 4 74 /** 75 * MAX_PLANES - representative of the upper bound of planes that are supported by the HW 76 */ 77 #define MAX_PLANES 6 78 #define MAX_STREAMS 6 79 #define MIN_VIEWPORT_SIZE 12 80 #define MAX_NUM_EDP 2 81 #define MAX_SUPPORTED_FORMATS 7 82 83 #define MAX_HOST_ROUTERS_NUM 3 84 #define MAX_DPIA_PER_HOST_ROUTER 3 85 #define MAX_DPIA_NUM (MAX_HOST_ROUTERS_NUM * MAX_DPIA_PER_HOST_ROUTER) 86 87 #define NUM_FAST_FLIPS_TO_STEADY_STATE 20 88 89 struct frl_cap_chk_intermediates_fixed31_32 { 90 int c_frl_sb; 91 struct fixed31_32 overhead_sb; 92 struct fixed31_32 overhead_rs; 93 struct fixed31_32 overhead_map; 94 struct fixed31_32 overhead_min; 95 struct fixed31_32 overhead_max; 96 struct fixed31_32 f_pixel_clock_max; 97 struct fixed31_32 t_line; 98 struct fixed31_32 r_bit_min; 99 struct fixed31_32 r_frl_char_min; 100 struct fixed31_32 c_frl_line; 101 struct fixed31_32 ap; 102 struct fixed31_32 r_ap; 103 struct fixed31_32 avg_audio_packets_line; 104 struct fixed31_32 margin; 105 int audio_packets_line; 106 int blank_audio_min; 107 }; 108 109 struct frl_cap_chk_params_fixed31_32 { 110 int lanes; 111 struct fixed31_32 f_pixel_clock_nominal; /* Pixel Clock rate (Hz) */ 112 struct fixed31_32 r_bit_nominal; /* FRL bitrate (bps) */ 113 int audio_packet_type; 114 struct fixed31_32 f_audio; /* Audio rate (Hz) */ 115 int h_active; /* Active pixels per line */ 116 int h_blank; /* Blanking pixels per line */ 117 int bpc; /* Bits per component */ 118 int vic; /* Video Identification Code */ 119 120 enum hdmi_frl_pixel_encoding pixel_encoding; 121 122 bool compressed; /* set to true if DSC is enabled */ 123 bool bypass_hc_target_calc; /* debug only */ 124 bool allow_all_bpp; /* dsc_all_bpp */ 125 126 /* DSC parameters */ 127 int slices; 128 int slice_width; 129 struct fixed31_32 bpp_target; 130 int layout; 131 int acat; /* not supported */ 132 133 /* outputs */ 134 struct frl_dml_borrow_params borrow_params; 135 int average_tribyte_rate; 136 }; 137 138 /* Display Core Interfaces */ 139 struct dc_versions { 140 const char *dc_ver; 141 struct dmcu_version dmcu_version; 142 }; 143 144 enum dp_protocol_version { 145 DP_VERSION_1_4 = 0, 146 DP_VERSION_2_1, 147 DP_VERSION_UNKNOWN, 148 }; 149 150 enum dc_plane_type { 151 DC_PLANE_TYPE_INVALID, 152 DC_PLANE_TYPE_DCE_RGB, 153 DC_PLANE_TYPE_DCE_UNDERLAY, 154 DC_PLANE_TYPE_DCN_UNIVERSAL, 155 }; 156 157 // Sizes defined as multiples of 64KB 158 enum det_size { 159 DET_SIZE_DEFAULT = 0, 160 DET_SIZE_192KB = 3, 161 DET_SIZE_256KB = 4, 162 DET_SIZE_320KB = 5, 163 DET_SIZE_384KB = 6 164 }; 165 166 167 struct dc_plane_cap { 168 enum dc_plane_type type; 169 uint32_t per_pixel_alpha : 1; 170 struct { 171 uint32_t argb8888 : 1; 172 uint32_t nv12 : 1; 173 uint32_t fp16 : 1; 174 uint32_t p010 : 1; 175 uint32_t ayuv : 1; 176 } pixel_format_support; 177 // max upscaling factor x1000 178 // upscaling factors are always >= 1 179 // for example, 1080p -> 8K is 4.0, or 4000 raw value 180 struct { 181 uint32_t argb8888; 182 uint32_t nv12; 183 uint32_t fp16; 184 } max_upscale_factor; 185 // max downscale factor x1000 186 // downscale factors are always <= 1 187 // for example, 8K -> 1080p is 0.25, or 250 raw value 188 struct { 189 uint32_t argb8888; 190 uint32_t nv12; 191 uint32_t fp16; 192 } max_downscale_factor; 193 // minimal width/height 194 uint32_t min_width; 195 uint32_t min_height; 196 }; 197 198 /** 199 * DOC: color-management-caps 200 * 201 * **Color management caps (DPP and MPC)** 202 * 203 * Modules/color calculates various color operations which are translated to 204 * abstracted HW. DCE 5-12 had almost no important changes, but starting with 205 * DCN1, every new generation comes with fairly major differences in color 206 * pipeline. Therefore, we abstract color pipe capabilities so modules/DM can 207 * decide mapping to HW block based on logical capabilities. 208 */ 209 210 /** 211 * struct rom_curve_caps - predefined transfer function caps for degamma and regamma 212 * @srgb: RGB color space transfer func 213 * @bt2020: BT.2020 transfer func 214 * @gamma2_2: standard gamma 215 * @pq: perceptual quantizer transfer function 216 * @hlg: hybrid log–gamma transfer function 217 */ 218 struct rom_curve_caps { 219 uint16_t srgb : 1; 220 uint16_t bt2020 : 1; 221 uint16_t gamma2_2 : 1; 222 uint16_t pq : 1; 223 uint16_t hlg : 1; 224 }; 225 226 /** 227 * struct dpp_color_caps - color pipeline capabilities for display pipe and 228 * plane blocks 229 * 230 * @dcn_arch: all DCE generations treated the same 231 * @input_lut_shared: shared with DGAM. Input LUT is different than most LUTs, 232 * just plain 256-entry lookup 233 * @icsc: input color space conversion 234 * @dgam_ram: programmable degamma LUT 235 * @post_csc: post color space conversion, before gamut remap 236 * @gamma_corr: degamma correction 237 * @hw_3d_lut: 3D LUT support. It implies a shaper LUT before. It may be shared 238 * with MPC by setting mpc:shared_3d_lut flag 239 * @ogam_ram: programmable out/blend gamma LUT 240 * @ocsc: output color space conversion 241 * @dgam_rom_for_yuv: pre-defined degamma LUT for YUV planes 242 * @dgam_rom_caps: pre-definied curve caps for degamma 1D LUT 243 * @ogam_rom_caps: pre-definied curve caps for regamma 1D LUT 244 * 245 * Note: hdr_mult and gamut remap (CTM) are always available in DPP (in that order) 246 */ 247 struct dpp_color_caps { 248 uint16_t dcn_arch : 1; 249 uint16_t input_lut_shared : 1; 250 uint16_t icsc : 1; 251 uint16_t dgam_ram : 1; 252 uint16_t post_csc : 1; 253 uint16_t gamma_corr : 1; 254 uint16_t hw_3d_lut : 1; 255 uint16_t ogam_ram : 1; 256 uint16_t ocsc : 1; 257 uint16_t dgam_rom_for_yuv : 1; 258 struct rom_curve_caps dgam_rom_caps; 259 struct rom_curve_caps ogam_rom_caps; 260 }; 261 262 /* Below structure is to describe the HW support for mem layout, extend support 263 range to match what OS could handle in the roadmap */ 264 struct lut3d_caps { 265 uint32_t dma_3d_lut : 1; /*< DMA mode support for 3D LUT */ 266 struct { 267 uint32_t swizzle_3d_rgb : 1; 268 uint32_t swizzle_3d_bgr : 1; 269 uint32_t linear_1d : 1; 270 } mem_layout_support; 271 struct { 272 uint32_t unorm_12msb : 1; 273 uint32_t unorm_12lsb : 1; 274 uint32_t float_fp1_5_10 : 1; 275 } mem_format_support; 276 struct { 277 uint32_t order_rgba : 1; 278 uint32_t order_bgra : 1; 279 } mem_pixel_order_support; 280 /*< size options are 9, 17, 33, 45, 65 */ 281 struct { 282 uint32_t dim_9 : 1; /* 3D LUT support for 9x9x9 */ 283 uint32_t dim_17 : 1; /* 3D LUT support for 17x17x17 */ 284 uint32_t dim_33 : 1; /* 3D LUT support for 33x33x33 */ 285 uint32_t dim_45 : 1; /* 3D LUT support for 45x45x45 */ 286 uint32_t dim_65 : 1; /* 3D LUT support for 65x65x65 */ 287 } lut_dim_caps; 288 }; 289 290 /** 291 * struct mpc_color_caps - color pipeline capabilities for multiple pipe and 292 * plane combined blocks 293 * 294 * @gamut_remap: color transformation matrix 295 * @ogam_ram: programmable out gamma LUT 296 * @ocsc: output color space conversion matrix 297 * @num_3dluts: MPC 3D LUT; always assumes a preceding shaper LUT 298 * @num_rmcm_3dluts: number of RMCM 3D LUTS; always assumes a preceding shaper LUT 299 * @shared_3d_lut: shared 3D LUT flag. Can be either DPP or MPC, but single 300 * instance 301 * @ogam_rom_caps: pre-definied curve caps for regamma 1D LUT 302 * @mcm_3d_lut_caps: HW support cap for MCM LUT memory 303 * @rmcm_3d_lut_caps: HW support cap for RMCM LUT memory 304 * @preblend: whether color manager supports preblend with MPC 305 */ 306 struct mpc_color_caps { 307 uint16_t gamut_remap : 1; 308 uint16_t ogam_ram : 1; 309 uint16_t ocsc : 1; 310 uint16_t num_3dluts : 3; 311 uint16_t num_rmcm_3dluts : 3; 312 uint16_t shared_3d_lut:1; 313 struct rom_curve_caps ogam_rom_caps; 314 struct lut3d_caps mcm_3d_lut_caps; 315 struct lut3d_caps rmcm_3d_lut_caps; 316 bool preblend; 317 }; 318 319 /** 320 * struct dc_color_caps - color pipes capabilities for DPP and MPC hw blocks 321 * @dpp: color pipes caps for DPP 322 * @mpc: color pipes caps for MPC 323 */ 324 struct dc_color_caps { 325 struct dpp_color_caps dpp; 326 struct mpc_color_caps mpc; 327 }; 328 329 struct dc_dmub_caps { 330 bool psr; 331 bool mclk_sw; 332 bool subvp_psr; 333 bool gecc_enable; 334 uint8_t fams_ver; 335 bool aux_backlight_support; 336 }; 337 338 struct dc_scl_caps { 339 bool sharpener_support; 340 }; 341 342 struct dc_check_config { 343 /** 344 * max video plane width that can be safely assumed to be always 345 * supported by single DPP pipe. 346 */ 347 unsigned int max_optimizable_video_width; 348 bool enable_legacy_fast_update; 349 350 bool deferred_transition_state; 351 unsigned int transition_countdown_to_steady_state; 352 }; 353 354 struct dc_caps { 355 uint32_t max_streams; 356 uint32_t max_links; 357 uint32_t max_audios; 358 uint32_t max_slave_planes; 359 uint32_t max_slave_yuv_planes; 360 uint32_t max_slave_rgb_planes; 361 uint32_t max_planes; 362 uint32_t max_downscale_ratio; 363 uint32_t i2c_speed_in_khz; 364 uint32_t i2c_speed_in_khz_hdcp; 365 uint32_t dmdata_alloc_size; 366 unsigned int max_cursor_size; 367 unsigned int max_buffered_cursor_size; 368 unsigned int max_video_width; 369 unsigned int min_horizontal_blanking_period; 370 int linear_pitch_alignment; 371 bool dcc_const_color; 372 bool dynamic_audio; 373 bool is_apu; 374 bool dual_link_dvi; 375 bool post_blend_color_processing; 376 bool force_dp_tps4_for_cp2520; 377 bool disable_dp_clk_share; 378 bool psp_setup_panel_mode; 379 bool extended_aux_timeout_support; 380 bool dmcub_support; 381 bool zstate_support; 382 bool ips_support; 383 bool ips_v2_support; 384 uint32_t num_of_internal_disp; 385 enum dp_protocol_version max_dp_protocol_version; 386 bool hdmi_hpo; 387 unsigned int mall_size_per_mem_channel; 388 unsigned int mall_size_total; 389 unsigned int cursor_cache_size; 390 struct dc_plane_cap planes[MAX_PLANES]; 391 struct dc_color_caps color; 392 struct dc_dmub_caps dmub_caps; 393 bool dp_hpo; 394 bool dp_hdmi21_pcon_support; 395 bool edp_dsc_support; 396 bool vbios_lttpr_aware; 397 bool vbios_lttpr_enable; 398 bool fused_io_supported; 399 uint32_t max_otg_num; 400 uint32_t max_cab_allocation_bytes; 401 uint32_t cache_line_size; 402 uint32_t cache_num_ways; 403 uint16_t subvp_fw_processing_delay_us; 404 uint8_t subvp_drr_max_vblank_margin_us; 405 uint16_t subvp_prefetch_end_to_mall_start_us; 406 uint8_t subvp_swath_height_margin_lines; // subvp start line must be aligned to 2 x swath height 407 uint16_t subvp_pstate_allow_width_us; 408 uint16_t subvp_vertical_int_margin_us; 409 bool seamless_odm; 410 uint32_t max_v_total; 411 bool vtotal_limited_by_fp2; 412 uint32_t max_disp_clock_khz_at_vmin; 413 uint8_t subvp_drr_vblank_start_margin_us; 414 bool cursor_not_scaled; 415 bool dcmode_power_limits_present; 416 bool sequential_ono; 417 /* Conservative limit for DCC cases which require ODM4:1 to support*/ 418 uint32_t dcc_plane_width_limit; 419 struct dc_scl_caps scl_caps; 420 uint8_t num_of_host_routers; 421 uint8_t num_of_dpias_per_host_router; 422 /* limit of the ODM only, could be limited by other factors (like pipe count)*/ 423 uint8_t max_odm_combine_factor; 424 }; 425 426 struct dc_bug_wa { 427 bool no_connect_phy_config; 428 bool dedcn20_305_wa; 429 bool skip_clock_update; 430 bool lt_early_cr_pattern; 431 struct { 432 uint8_t uclk : 1; 433 uint8_t fclk : 1; 434 uint8_t dcfclk : 1; 435 uint8_t dcfclk_ds: 1; 436 } clock_update_disable_mask; 437 bool skip_psr_ips_crtc_disable; 438 }; 439 struct dc_dcc_surface_param { 440 struct dc_size surface_size; 441 enum surface_pixel_format format; 442 unsigned int plane0_pitch; 443 struct dc_size plane1_size; 444 unsigned int plane1_pitch; 445 union { 446 enum swizzle_mode_values swizzle_mode; 447 enum swizzle_mode_addr3_values swizzle_mode_addr3; 448 }; 449 enum dc_scan_direction scan; 450 }; 451 452 struct dc_dcc_setting { 453 unsigned int max_compressed_blk_size; 454 unsigned int max_uncompressed_blk_size; 455 bool independent_64b_blks; 456 //These bitfields to be used starting with DCN 3.0 457 struct { 458 uint32_t dcc_256_64_64 : 1;//available in ASICs before DCN 3.0 (the worst compression case) 459 uint32_t dcc_128_128_uncontrained : 1; //available in ASICs before DCN 3.0 460 uint32_t dcc_256_128_128 : 1; //available starting with DCN 3.0 461 uint32_t dcc_256_256_unconstrained : 1; //available in ASICs before DCN 3.0 (the best compression case) 462 uint32_t dcc_256_256 : 1; //available in ASICs starting with DCN 4.0x (the best compression case) 463 uint32_t dcc_256_128 : 1; //available in ASICs starting with DCN 4.0x 464 uint32_t dcc_256_64 : 1; //available in ASICs starting with DCN 4.0x (the worst compression case) 465 } dcc_controls; 466 }; 467 468 struct dc_surface_dcc_cap { 469 union { 470 struct { 471 struct dc_dcc_setting rgb; 472 } grph; 473 474 struct { 475 struct dc_dcc_setting luma; 476 struct dc_dcc_setting chroma; 477 } video; 478 }; 479 480 bool capable; 481 bool const_color_support; 482 }; 483 484 struct dc_static_screen_params { 485 struct { 486 bool force_trigger; 487 bool cursor_update; 488 bool surface_update; 489 bool overlay_update; 490 } triggers; 491 unsigned int num_frames; 492 }; 493 494 495 /* Surface update type is used by dc_update_surfaces_and_stream 496 * The update type is determined at the very beginning of the function based 497 * on parameters passed in and decides how much programming (or updating) is 498 * going to be done during the call. 499 * 500 * UPDATE_TYPE_FAST is used for really fast updates that do not require much 501 * logical calculations or hardware register programming. This update MUST be 502 * ISR safe on windows. Currently fast update will only be used to flip surface 503 * address. 504 * 505 * UPDATE_TYPE_MED is used for slower updates which require significant hw 506 * re-programming however do not affect bandwidth consumption or clock 507 * requirements. At present, this is the level at which front end updates 508 * that do not require us to run bw_calcs happen. These are in/out transfer func 509 * updates, viewport offset changes, recout size changes and pixel depth changes. 510 * This update can be done at ISR, but we want to minimize how often this happens. 511 * 512 * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our 513 * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front 514 * end related. Any time viewport dimensions, recout dimensions, scaling ratios or 515 * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do 516 * a full update. This cannot be done at ISR level and should be a rare event. 517 * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting 518 * underscan we don't expect to see this call at all. 519 */ 520 521 enum surface_update_type { 522 UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */ 523 UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/ 524 UPDATE_TYPE_FULL, /* may need to shuffle resources */ 525 }; 526 527 enum dc_lock_descriptor { 528 LOCK_DESCRIPTOR_NONE = 0x0, 529 LOCK_DESCRIPTOR_STREAM = 0x1, 530 LOCK_DESCRIPTOR_LINK = 0x2, 531 LOCK_DESCRIPTOR_GLOBAL = 0x4, 532 }; 533 534 struct surface_update_descriptor { 535 enum surface_update_type update_type; 536 enum dc_lock_descriptor lock_descriptor; 537 }; 538 539 /* Forward declaration*/ 540 struct dc; 541 struct dc_plane_state; 542 struct dc_state; 543 544 struct dc_cap_funcs { 545 bool (*get_dcc_compression_cap)(const struct dc *dc, 546 const struct dc_dcc_surface_param *input, 547 struct dc_surface_dcc_cap *output); 548 bool (*get_subvp_en)(struct dc *dc, struct dc_state *context); 549 }; 550 551 struct link_training_settings; 552 553 union allow_lttpr_non_transparent_mode { 554 struct { 555 bool DP1_4A : 1; 556 bool DP2_0 : 1; 557 } bits; 558 unsigned char raw; 559 }; 560 /* Structure to hold configuration flags set by dm at dc creation. */ 561 struct dc_config { 562 bool gpu_vm_support; 563 bool disable_disp_pll_sharing; 564 bool fbc_support; 565 bool disable_fractional_pwm; 566 bool allow_seamless_boot_optimization; 567 bool seamless_boot_edp_requested; 568 bool edp_not_connected; 569 bool edp_no_power_sequencing; 570 bool force_enum_edp; 571 bool forced_clocks; 572 union allow_lttpr_non_transparent_mode allow_lttpr_non_transparent_mode; 573 bool multi_mon_pp_mclk_switch; 574 bool disable_dmcu; 575 bool allow_4to1MPC; 576 bool enable_windowed_mpo_odm; 577 bool forceHBR2CP2520; // Used for switching between test patterns TPS4 and CP2520 578 uint32_t allow_edp_hotplug_detection; 579 bool skip_riommu_prefetch_wa; 580 bool clamp_min_dcfclk; 581 uint64_t vblank_alignment_dto_params; 582 uint8_t vblank_alignment_max_frame_time_diff; 583 bool is_asymmetric_memory; 584 bool is_single_rank_dimm; 585 bool is_vmin_only_asic; 586 bool use_spl; 587 bool prefer_easf; 588 bool use_pipe_ctx_sync_logic; 589 int smart_mux_version; 590 bool ignore_dpref_ss; 591 bool enable_mipi_converter_optimization; 592 bool enable_frl; 593 bool force_hdmi21_frl_enc_enable; 594 bool skip_frl_pretraining; 595 bool use_default_clock_table; 596 bool force_bios_enable_lttpr; 597 uint8_t force_bios_fixed_vs; 598 unsigned int sdpif_request_limit_words_per_umc; 599 bool dc_mode_clk_limit_support; 600 bool EnableMinDispClkODM; 601 bool enable_auto_dpm_test_logs; 602 unsigned int disable_ips; 603 unsigned int disable_ips_rcg; 604 unsigned int disable_ips_in_vpb; 605 bool disable_ips_in_dpms_off; 606 bool usb4_bw_alloc_support; 607 bool allow_0_dtb_clk; 608 bool use_assr_psp_message; 609 bool support_edp0_on_dp1; 610 unsigned int enable_fpo_flicker_detection; 611 bool disable_hbr_audio_dp2; 612 bool consolidated_dpia_dp_lt; 613 bool set_pipe_unlock_order; 614 bool enable_dpia_pre_training; 615 bool unify_link_enc_assignment; 616 bool enable_cursor_offload; 617 bool dp_connector_no_native_i2c; 618 bool frame_update_cmd_version2; 619 struct spl_sharpness_range dcn_sharpness_range; 620 struct spl_sharpness_range dcn_override_sharpness_range; 621 bool no_native422_support; 622 }; 623 624 enum visual_confirm { 625 VISUAL_CONFIRM_DISABLE = 0, 626 VISUAL_CONFIRM_SURFACE = 1, 627 VISUAL_CONFIRM_HDR = 2, 628 VISUAL_CONFIRM_MPCTREE = 4, 629 VISUAL_CONFIRM_PSR = 5, 630 VISUAL_CONFIRM_SWAPCHAIN = 6, 631 VISUAL_CONFIRM_FAMS = 7, 632 VISUAL_CONFIRM_SWIZZLE = 9, 633 VISUAL_CONFIRM_SMARTMUX_DGPU = 10, 634 VISUAL_CONFIRM_REPLAY = 12, 635 VISUAL_CONFIRM_SUBVP = 14, 636 VISUAL_CONFIRM_MCLK_SWITCH = 16, 637 VISUAL_CONFIRM_FAMS2 = 19, 638 VISUAL_CONFIRM_HW_CURSOR = 20, 639 VISUAL_CONFIRM_VABC = 21, 640 VISUAL_CONFIRM_DCC = 22, 641 VISUAL_CONFIRM_BOOSTED_REFRESH_RATE = 23, 642 VISUAL_CONFIRM_EXPLICIT = 0x80000000, 643 }; 644 645 enum dc_psr_power_opts { 646 psr_power_opt_invalid = 0x0, 647 psr_power_opt_smu_opt_static_screen = 0x1, 648 psr_power_opt_z10_static_screen = 0x10, 649 psr_power_opt_ds_disable_allow = 0x100, 650 }; 651 652 enum dml_hostvm_override_opts { 653 DML_HOSTVM_NO_OVERRIDE = 0x0, 654 DML_HOSTVM_OVERRIDE_FALSE = 0x1, 655 DML_HOSTVM_OVERRIDE_TRUE = 0x2, 656 }; 657 658 enum dc_replay_power_opts { 659 replay_power_opt_invalid = 0x0, 660 replay_power_opt_smu_opt_static_screen = 0x1, 661 replay_power_opt_z10_static_screen = 0x10, 662 }; 663 664 enum dcc_option { 665 DCC_ENABLE = 0, 666 DCC_DISABLE = 1, 667 DCC_HALF_REQ_DISALBE = 2, 668 }; 669 670 enum in_game_fams_config { 671 INGAME_FAMS_SINGLE_DISP_ENABLE, // enable in-game fams 672 INGAME_FAMS_DISABLE, // disable in-game fams 673 INGAME_FAMS_MULTI_DISP_ENABLE, //enable in-game fams for multi-display 674 INGAME_FAMS_MULTI_DISP_CLAMPED_ONLY, //enable in-game fams for multi-display only for clamped RR strategies 675 }; 676 677 /** 678 * enum pipe_split_policy - Pipe split strategy supported by DCN 679 * 680 * This enum is used to define the pipe split policy supported by DCN. By 681 * default, DC favors MPC_SPLIT_DYNAMIC. 682 */ 683 enum pipe_split_policy { 684 /** 685 * @MPC_SPLIT_DYNAMIC: DC will automatically decide how to split the 686 * pipe in order to bring the best trade-off between performance and 687 * power consumption. This is the recommended option. 688 */ 689 MPC_SPLIT_DYNAMIC = 0, 690 691 /** 692 * @MPC_SPLIT_AVOID: Avoid pipe split, which means that DC will not 693 * try any sort of split optimization. 694 */ 695 MPC_SPLIT_AVOID = 1, 696 697 /** 698 * @MPC_SPLIT_AVOID_MULT_DISP: With this option, DC will only try to 699 * optimize the pipe utilization when using a single display; if the 700 * user connects to a second display, DC will avoid pipe split. 701 */ 702 MPC_SPLIT_AVOID_MULT_DISP = 2, 703 }; 704 705 enum wm_report_mode { 706 WM_REPORT_DEFAULT = 0, 707 WM_REPORT_OVERRIDE = 1, 708 }; 709 enum dtm_pstate{ 710 dtm_level_p0 = 0,/*highest voltage*/ 711 dtm_level_p1, 712 dtm_level_p2, 713 dtm_level_p3, 714 dtm_level_p4,/*when active_display_count = 0*/ 715 }; 716 717 enum dcn_pwr_state { 718 DCN_PWR_STATE_UNKNOWN = -1, 719 DCN_PWR_STATE_MISSION_MODE = 0, 720 DCN_PWR_STATE_LOW_POWER = 3, 721 }; 722 723 enum dcn_zstate_support_state { 724 DCN_ZSTATE_SUPPORT_UNKNOWN, 725 DCN_ZSTATE_SUPPORT_ALLOW, 726 DCN_ZSTATE_SUPPORT_ALLOW_Z8_ONLY, 727 DCN_ZSTATE_SUPPORT_ALLOW_Z8_Z10_ONLY, 728 DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY, 729 DCN_ZSTATE_SUPPORT_DISALLOW, 730 }; 731 732 /* 733 * struct dc_clocks - DC pipe clocks 734 * 735 * For any clocks that may differ per pipe only the max is stored in this 736 * structure 737 */ 738 struct dc_clocks { 739 int dispclk_khz; 740 int actual_dispclk_khz; 741 int dppclk_khz; 742 int actual_dppclk_khz; 743 int disp_dpp_voltage_level_khz; 744 int dcfclk_khz; 745 int socclk_khz; 746 int dcfclk_deep_sleep_khz; 747 int fclk_khz; 748 int phyclk_khz; 749 int dramclk_khz; 750 bool p_state_change_support; 751 enum dcn_zstate_support_state zstate_support; 752 bool dtbclk_en; 753 int ref_dtbclk_khz; 754 bool fclk_p_state_change_support; 755 enum dcn_pwr_state pwr_state; 756 /* 757 * Elements below are not compared for the purposes of 758 * optimization required 759 */ 760 bool prev_p_state_change_support; 761 bool fclk_prev_p_state_change_support; 762 int num_ways; 763 int host_router_bw_kbps[MAX_HOST_ROUTERS_NUM]; 764 765 /* 766 * @fw_based_mclk_switching 767 * 768 * DC has a mechanism that leverage the variable refresh rate to switch 769 * memory clock in cases that we have a large latency to achieve the 770 * memory clock change and a short vblank window. DC has some 771 * requirements to enable this feature, and this field describes if the 772 * system support or not such a feature. 773 */ 774 bool fw_based_mclk_switching; 775 bool fw_based_mclk_switching_shut_down; 776 int prev_num_ways; 777 enum dtm_pstate dtm_level; 778 int max_supported_dppclk_khz; 779 int max_supported_dispclk_khz; 780 int bw_dppclk_khz; /*a copy of dppclk_khz*/ 781 int bw_dispclk_khz; 782 int idle_dramclk_khz; 783 int idle_fclk_khz; 784 int subvp_prefetch_dramclk_khz; 785 int subvp_prefetch_fclk_khz; 786 787 /* Stutter efficiency is technically not clock values 788 * but stored here so the values are part of the update_clocks call similar to num_ways 789 * Efficiencies are stored as percentage (0-100) 790 */ 791 struct { 792 uint8_t base_efficiency; //LP1 793 uint8_t low_power_efficiency; //LP2 794 uint8_t z8_stutter_efficiency; 795 int z8_stutter_period; 796 } stutter_efficiency; 797 }; 798 799 struct dc_bw_validation_profile { 800 bool enable; 801 802 unsigned long long total_ticks; 803 unsigned long long voltage_level_ticks; 804 unsigned long long watermark_ticks; 805 unsigned long long rq_dlg_ticks; 806 807 unsigned long long total_count; 808 unsigned long long skip_fast_count; 809 unsigned long long skip_pass_count; 810 unsigned long long skip_fail_count; 811 }; 812 813 #define BW_VAL_TRACE_SETUP() \ 814 unsigned long long end_tick = 0; \ 815 unsigned long long voltage_level_tick = 0; \ 816 unsigned long long watermark_tick = 0; \ 817 unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \ 818 dm_get_timestamp(dc->ctx) : 0 819 820 #define BW_VAL_TRACE_COUNT() \ 821 if (dc->debug.bw_val_profile.enable) \ 822 dc->debug.bw_val_profile.total_count++ 823 824 #define BW_VAL_TRACE_SKIP(status) \ 825 if (dc->debug.bw_val_profile.enable) { \ 826 if (!voltage_level_tick) \ 827 voltage_level_tick = dm_get_timestamp(dc->ctx); \ 828 dc->debug.bw_val_profile.skip_ ## status ## _count++; \ 829 } 830 831 #define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \ 832 if (dc->debug.bw_val_profile.enable) \ 833 voltage_level_tick = dm_get_timestamp(dc->ctx) 834 835 #define BW_VAL_TRACE_END_WATERMARKS() \ 836 if (dc->debug.bw_val_profile.enable) \ 837 watermark_tick = dm_get_timestamp(dc->ctx) 838 839 #define BW_VAL_TRACE_FINISH() \ 840 if (dc->debug.bw_val_profile.enable) { \ 841 end_tick = dm_get_timestamp(dc->ctx); \ 842 dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \ 843 dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \ 844 if (watermark_tick) { \ 845 dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \ 846 dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \ 847 } \ 848 } 849 850 union mem_low_power_enable_options { 851 struct { 852 bool vga: 1; 853 bool i2c: 1; 854 bool dmcu: 1; 855 bool dscl: 1; 856 bool cm: 1; 857 bool mpc: 1; 858 bool optc: 1; 859 bool vpg: 1; 860 bool afmt: 1; 861 } bits; 862 uint32_t u32All; 863 }; 864 865 union root_clock_optimization_options { 866 struct { 867 bool dpp: 1; 868 bool dsc: 1; 869 bool hdmistream: 1; 870 bool hdmichar: 1; 871 bool dpstream: 1; 872 bool symclk32_se: 1; 873 bool symclk32_le: 1; 874 bool symclk_fe: 1; 875 bool physymclk: 1; 876 bool dpiasymclk: 1; 877 uint32_t reserved: 22; 878 } bits; 879 uint32_t u32All; 880 }; 881 882 union fine_grain_clock_gating_enable_options { 883 struct { 884 bool dccg_global_fgcg_rep : 1; /* Global fine grain clock gating of repeaters */ 885 bool dchub : 1; /* Display controller hub */ 886 bool dchubbub : 1; 887 bool dpp : 1; /* Display pipes and planes */ 888 bool opp : 1; /* Output pixel processing */ 889 bool optc : 1; /* Output pipe timing combiner */ 890 bool dio : 1; /* Display output */ 891 bool dwb : 1; /* Display writeback */ 892 bool mmhubbub : 1; /* Multimedia hub */ 893 bool dmu : 1; /* Display core management unit */ 894 bool az : 1; /* Azalia */ 895 bool dchvm : 1; 896 bool dsc : 1; /* Display stream compression */ 897 898 uint32_t reserved : 19; 899 } bits; 900 uint32_t u32All; 901 }; 902 903 enum pg_hw_pipe_resources { 904 PG_HUBP = 0, 905 PG_DPP, 906 PG_DSC, 907 PG_MPCC, 908 PG_OPP, 909 PG_OPTC, 910 PG_DPSTREAM, 911 PG_HDMISTREAM, 912 PG_PHYSYMCLK, 913 PG_HW_PIPE_RESOURCES_NUM_ELEMENT 914 }; 915 916 enum pg_hw_resources { 917 PG_DCCG = 0, 918 PG_DCIO, 919 PG_DIO, 920 PG_DCHUBBUB, 921 PG_DCHVM, 922 PG_DWB, 923 PG_HPO, 924 PG_DCOH, 925 PG_HW_RESOURCES_NUM_ELEMENT 926 }; 927 928 struct pg_block_update { 929 bool pg_pipe_res_update[PG_HW_PIPE_RESOURCES_NUM_ELEMENT][MAX_PIPES]; 930 bool pg_res_update[PG_HW_RESOURCES_NUM_ELEMENT]; 931 }; 932 933 union dpia_debug_options { 934 struct { 935 uint32_t disable_dpia:1; /* bit 0 */ 936 uint32_t force_non_lttpr:1; /* bit 1 */ 937 uint32_t extend_aux_rd_interval:1; /* bit 2 */ 938 uint32_t disable_mst_dsc_work_around:1; /* bit 3 */ 939 uint32_t enable_force_tbt3_work_around:1; /* bit 4 */ 940 uint32_t disable_usb4_pm_support:1; /* bit 5 */ 941 uint32_t enable_usb4_bw_zero_alloc_patch:1; /* bit 6 */ 942 uint32_t reserved:25; 943 } bits; 944 uint32_t raw; 945 }; 946 947 /* AUX wake work around options 948 * 0: enable/disable work around 949 * 1: use default timeout LINK_AUX_WAKE_TIMEOUT_MS 950 * 15-2: reserved 951 * 31-16: timeout in ms 952 */ 953 union aux_wake_wa_options { 954 struct { 955 uint32_t enable_wa : 1; 956 uint32_t use_default_timeout : 1; 957 uint32_t rsvd: 14; 958 uint32_t timeout_ms : 16; 959 } bits; 960 uint32_t raw; 961 }; 962 963 struct dc_debug_data { 964 uint32_t ltFailCount; 965 uint32_t i2cErrorCount; 966 uint32_t auxErrorCount; 967 struct pipe_topology_history topology_history; 968 }; 969 970 struct dc_phy_addr_space_config { 971 struct { 972 uint64_t start_addr; 973 uint64_t end_addr; 974 uint64_t fb_top; 975 uint64_t fb_offset; 976 uint64_t fb_base; 977 uint64_t agp_top; 978 uint64_t agp_bot; 979 uint64_t agp_base; 980 } system_aperture; 981 982 struct { 983 uint64_t page_table_start_addr; 984 uint64_t page_table_end_addr; 985 uint64_t page_table_base_addr; 986 bool base_addr_is_mc_addr; 987 } gart_config; 988 989 bool valid; 990 bool is_hvm_enabled; 991 uint64_t page_table_default_page_addr; 992 }; 993 994 struct dc_virtual_addr_space_config { 995 uint64_t page_table_base_addr; 996 uint64_t page_table_start_addr; 997 uint64_t page_table_end_addr; 998 uint32_t page_table_block_size_in_bytes; 999 uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid 1000 }; 1001 1002 struct dc_bounding_box_overrides { 1003 unsigned int sr_exit_time_ns; 1004 unsigned int sr_enter_plus_exit_time_ns; 1005 unsigned int sr_exit_z8_time_ns; 1006 unsigned int sr_enter_plus_exit_z8_time_ns; 1007 unsigned int urgent_latency_ns; 1008 unsigned int percent_of_ideal_drambw; 1009 unsigned int dram_clock_change_latency_ns; 1010 unsigned int dummy_clock_change_latency_ns; 1011 unsigned int fclk_clock_change_latency_ns; 1012 /* This forces a hard min on the DCFCLK we use 1013 * for DML. Unlike the debug option for forcing 1014 * DCFCLK, this override affects watermark calculations 1015 */ 1016 unsigned int min_dcfclk_mhz; 1017 }; 1018 1019 struct dc_qos_info { 1020 uint32_t actual_peak_bw_in_mbps; 1021 uint32_t qos_bandwidth_lb_in_mbps; 1022 uint32_t actual_avg_bw_in_mbps; 1023 uint32_t calculated_avg_bw_in_mbps; 1024 uint32_t actual_max_latency_in_ns; 1025 uint32_t actual_min_latency_in_ns; 1026 uint32_t qos_max_latency_ub_in_ns; 1027 uint32_t actual_avg_latency_in_ns; 1028 uint32_t qos_avg_latency_ub_in_ns; 1029 uint32_t dcn_bandwidth_ub_in_mbps; 1030 uint32_t qos_max_bw_budget_in_mbps; 1031 }; 1032 1033 struct dc_state; 1034 struct resource_pool; 1035 struct dce_hwseq; 1036 struct link_service; 1037 1038 /* 1039 * struct dc_debug_options - DC debug struct 1040 * 1041 * This struct provides a simple mechanism for developers to change some 1042 * configurations, enable/disable features, and activate extra debug options. 1043 * This can be very handy to narrow down whether some specific feature is 1044 * causing an issue or not. 1045 */ 1046 struct dc_debug_options { 1047 bool disable_dsc; 1048 enum visual_confirm visual_confirm; 1049 unsigned int visual_confirm_rect_height; 1050 1051 bool sanity_checks; 1052 bool max_disp_clk; 1053 bool surface_trace; 1054 bool clock_trace; 1055 bool validation_trace; 1056 bool bandwidth_calcs_trace; 1057 int max_downscale_src_width; 1058 1059 /* stutter efficiency related */ 1060 bool disable_stutter; 1061 bool use_max_lb; 1062 enum dcc_option disable_dcc; 1063 1064 /* 1065 * @pipe_split_policy: Define which pipe split policy is used by the 1066 * display core. 1067 */ 1068 enum pipe_split_policy pipe_split_policy; 1069 bool force_single_disp_pipe_split; 1070 bool voltage_align_fclk; 1071 bool disable_min_fclk; 1072 1073 bool hdcp_lc_force_fw_enable; 1074 bool hdcp_lc_enable_sw_fallback; 1075 1076 bool disable_dfs_bypass; 1077 bool disable_dpp_power_gate; 1078 bool disable_hubp_power_gate; 1079 bool disable_dsc_power_gate; 1080 bool disable_optc_power_gate; 1081 bool disable_hpo_power_gate; 1082 bool disable_io_clk_power_gate; 1083 bool disable_mem_power_gate; 1084 bool disable_dio_power_gate; 1085 unsigned int dsc_min_slice_height_override; 1086 unsigned int dsc_bpp_increment_div; 1087 bool disable_pplib_wm_range; 1088 enum wm_report_mode pplib_wm_report_mode; 1089 unsigned int min_disp_clk_khz; 1090 unsigned int min_dpp_clk_khz; 1091 unsigned int min_dram_clk_khz; 1092 unsigned int sr_exit_time_dpm0_ns; 1093 unsigned int sr_enter_plus_exit_time_dpm0_ns; 1094 unsigned int sr_exit_time_ns; 1095 unsigned int sr_enter_plus_exit_time_ns; 1096 unsigned int sr_exit_z8_time_ns; 1097 unsigned int sr_enter_plus_exit_z8_time_ns; 1098 unsigned int urgent_latency_ns; 1099 uint32_t underflow_assert_delay_us; 1100 unsigned int percent_of_ideal_drambw; 1101 unsigned int dram_clock_change_latency_ns; 1102 bool optimized_watermark; 1103 int always_scale; 1104 bool disable_pplib_clock_request; 1105 bool disable_clock_gate; 1106 bool disable_mem_low_power; 1107 bool pstate_enabled; 1108 bool disable_dmcu; 1109 bool force_abm_enable; 1110 bool disable_stereo_support; 1111 bool vsr_support; 1112 bool performance_trace; 1113 bool az_endpoint_mute_only; 1114 bool always_use_regamma; 1115 bool recovery_enabled; 1116 bool avoid_vbios_exec_table; 1117 bool scl_reset_length10; 1118 bool hdmi20_disable; 1119 bool skip_detection_link_training; 1120 uint32_t edid_read_retry_times; 1121 1122 uint8_t force_odm_combine; //bit vector based on otg inst 1123 uint8_t seamless_boot_odm_combine; 1124 uint8_t force_odm_combine_4to1; //bit vector based on otg inst 1125 1126 unsigned int minimum_z8_residency_time; 1127 unsigned int minimum_z10_residency_time; 1128 bool disable_z9_mpc; 1129 unsigned int force_fclk_khz; 1130 bool enable_tri_buf; 1131 bool ips_disallow_entry; 1132 bool dmub_offload_enabled; 1133 bool dmcub_emulation; 1134 bool disable_idle_power_optimizations; 1135 unsigned int mall_size_override; 1136 unsigned int mall_additional_timer_percent; 1137 bool mall_error_as_fatal; 1138 bool dmub_command_table; /* for testing only */ 1139 struct dc_bw_validation_profile bw_val_profile; 1140 bool disable_fec; 1141 bool disable_48mhz_pwrdwn; 1142 /* This forces a hard min on the DCFCLK requested to SMU/PP 1143 * watermarks are not affected. 1144 */ 1145 unsigned int force_min_dcfclk_mhz; 1146 int dwb_fi_phase; 1147 bool disable_timing_sync; 1148 bool cm_in_bypass; 1149 int force_clock_mode;/*every mode change.*/ 1150 1151 bool disable_dram_clock_change_vactive_support; 1152 bool validate_dml_output; 1153 bool enable_dmcub_surface_flip; 1154 bool usbc_combo_phy_reset_wa; 1155 bool force_vrr; 1156 bool force_fva; 1157 int max_frl_rate; 1158 unsigned int force_frl_rate; 1159 bool ignore_ffe; 1160 unsigned int select_ffe; 1161 unsigned int limit_ffe; 1162 bool force_frl_always; 1163 bool force_frl_dsc; 1164 bool force_frl_max; 1165 bool apply_vsdb_rcc_wa; 1166 bool enable_hdmi_idcc; 1167 1168 bool enable_dram_clock_change_one_display_vactive; 1169 /* TODO - remove once tested */ 1170 bool legacy_dp2_lt; 1171 bool set_mst_en_for_sst; 1172 bool disable_uhbr; 1173 bool force_dp2_lt_fallback_method; 1174 bool ignore_cable_id; 1175 union mem_low_power_enable_options enable_mem_low_power; 1176 union root_clock_optimization_options root_clock_optimization; 1177 union fine_grain_clock_gating_enable_options enable_fine_grain_clock_gating; 1178 bool hpo_optimization; 1179 bool force_vblank_alignment; 1180 1181 /* Enable dmub aux for legacy ddc */ 1182 bool enable_dmub_aux_for_legacy_ddc; 1183 bool disable_fams; 1184 enum in_game_fams_config disable_fams_gaming; 1185 /* FEC/PSR1 sequence enable delay in 100us */ 1186 uint8_t fec_enable_delay_in100us; 1187 bool enable_driver_sequence_debug; 1188 enum det_size crb_alloc_policy; 1189 unsigned int crb_alloc_policy_min_disp_count; 1190 bool disable_z10; 1191 bool enable_z9_disable_interface; 1192 bool psr_skip_crtc_disable; 1193 uint32_t ips_skip_crtc_disable_mask; 1194 union dpia_debug_options dpia_debug; 1195 bool disable_fixed_vs_aux_timeout_wa; 1196 uint32_t fixed_vs_aux_delay_config_wa; 1197 bool force_disable_subvp; 1198 bool force_subvp_mclk_switch; 1199 bool allow_sw_cursor_fallback; 1200 unsigned int force_subvp_num_ways; 1201 unsigned int force_mall_ss_num_ways; 1202 bool alloc_extra_way_for_cursor; 1203 uint32_t subvp_extra_lines; 1204 bool disable_force_pstate_allow_on_hw_release; 1205 bool force_usr_allow; 1206 /* uses value at boot and disables switch */ 1207 bool disable_dtb_ref_clk_switch; 1208 bool extended_blank_optimization; 1209 union aux_wake_wa_options aux_wake_wa; 1210 uint32_t mst_start_top_delay; 1211 uint8_t psr_power_use_phy_fsm; 1212 enum dml_hostvm_override_opts dml_hostvm_override; 1213 bool dml_disallow_alternate_prefetch_modes; 1214 bool use_legacy_soc_bb_mechanism; 1215 bool exit_idle_opt_for_cursor_updates; 1216 bool using_dml2; 1217 bool enable_single_display_2to1_odm_policy; 1218 bool enable_double_buffered_dsc_pg_support; 1219 bool enable_dp_dig_pixel_rate_div_policy; 1220 bool using_dml21; 1221 enum lttpr_mode lttpr_mode_override; 1222 unsigned int dsc_delay_factor_wa_x1000; 1223 unsigned int min_prefetch_in_strobe_ns; 1224 bool disable_unbounded_requesting; 1225 bool dig_fifo_off_in_blank; 1226 bool override_dispclk_programming; 1227 bool otg_crc_db; 1228 bool disallow_dispclk_dppclk_ds; 1229 bool disable_fpo_optimizations; 1230 bool support_eDP1_5; 1231 uint32_t fpo_vactive_margin_us; 1232 bool disable_fpo_vactive; 1233 bool disable_boot_optimizations; 1234 bool override_odm_optimization; 1235 bool minimize_dispclk_using_odm; 1236 bool disable_subvp_high_refresh; 1237 bool disable_dp_plus_plus_wa; 1238 uint32_t fpo_vactive_min_active_margin_us; 1239 uint32_t fpo_vactive_max_blank_us; 1240 bool enable_hpo_pg_support; 1241 bool disable_dc_mode_overwrite; 1242 bool replay_skip_crtc_disabled; 1243 bool ignore_pg;/*do nothing, let pmfw control it*/ 1244 bool psp_disabled_wa; 1245 unsigned int ips2_eval_delay_us; 1246 unsigned int ips2_entry_delay_us; 1247 bool optimize_ips_handshake; 1248 bool disable_dmub_reallow_idle; 1249 bool disable_timeout; 1250 bool disable_extblankadj; 1251 bool enable_idle_reg_checks; 1252 unsigned int static_screen_wait_frames; 1253 uint32_t pwm_freq; 1254 bool force_chroma_subsampling_1tap; 1255 unsigned int dcc_meta_propagation_delay_us; 1256 bool disable_422_left_edge_pixel; 1257 bool dml21_force_pstate_method; 1258 uint32_t dml21_force_pstate_method_values[MAX_PIPES]; 1259 uint32_t dml21_disable_pstate_method_mask; 1260 union fw_assisted_mclk_switch_version fams_version; 1261 union dmub_fams2_global_feature_config fams2_config; 1262 unsigned int force_cositing; 1263 unsigned int disable_spl; 1264 unsigned int force_easf; 1265 unsigned int force_sharpness; 1266 unsigned int force_sharpness_level; 1267 unsigned int force_lls; 1268 bool notify_dpia_hr_bw; 1269 bool enable_ips_visual_confirm; 1270 unsigned int sharpen_policy; 1271 unsigned int scale_to_sharpness_policy; 1272 unsigned int enable_oled_edp_power_up_opt; 1273 bool enable_hblank_borrow; 1274 bool force_subvp_df_throttle; 1275 uint32_t acpi_transition_bitmasks[MAX_PIPES]; 1276 bool enable_pg_cntl_debug_logs; 1277 unsigned int auxless_alpm_lfps_setup_ns; 1278 unsigned int auxless_alpm_lfps_period_ns; 1279 unsigned int auxless_alpm_lfps_silence_ns; 1280 unsigned int auxless_alpm_lfps_t1t2_us; 1281 short auxless_alpm_lfps_t1t2_offset_us; 1282 bool disable_stutter_for_wm_program; 1283 bool enable_block_sequence_programming; 1284 uint32_t custom_psp_footer_size; 1285 bool disable_deferred_minimal_transitions; 1286 unsigned int num_fast_flips_to_steady_state_override; 1287 bool enable_dmu_recovery; 1288 unsigned int force_vmin_threshold; 1289 bool enable_otg_frame_sync_pwa; 1290 unsigned int min_deep_sleep_dcfclk_khz; 1291 unsigned int force_odm2to1_for_edp_pixclk_mhz; 1292 bool enable_replay_esd_recovery; 1293 }; 1294 1295 1296 /* Generic structure that can be used to query properties of DC. More fields 1297 * can be added as required. 1298 */ 1299 struct dc_current_properties { 1300 unsigned int cursor_size_limit; 1301 }; 1302 1303 enum frame_buffer_mode { 1304 FRAME_BUFFER_MODE_LOCAL_ONLY = 0, 1305 FRAME_BUFFER_MODE_ZFB_ONLY, 1306 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL, 1307 } ; 1308 1309 struct dchub_init_data { 1310 int64_t zfb_phys_addr_base; 1311 int64_t zfb_mc_base_addr; 1312 uint64_t zfb_size_in_byte; 1313 enum frame_buffer_mode fb_mode; 1314 bool dchub_initialzied; 1315 bool dchub_info_valid; 1316 }; 1317 1318 struct dml2_soc_bb; 1319 1320 struct dc_init_data { 1321 struct hw_asic_id asic_id; 1322 void *driver; /* ctx */ 1323 struct cgs_device *cgs_device; 1324 struct dc_bounding_box_overrides bb_overrides; 1325 1326 int num_virtual_links; 1327 /* 1328 * If 'vbios_override' not NULL, it will be called instead 1329 * of the real VBIOS. Intended use is Diagnostics on FPGA. 1330 */ 1331 struct dc_bios *vbios_override; 1332 enum dce_environment dce_environment; 1333 1334 struct dmub_offload_funcs *dmub_if; 1335 struct dc_reg_helper_state *dmub_offload; 1336 1337 struct dc_config flags; 1338 uint64_t log_mask; 1339 1340 struct dpcd_vendor_signature vendor_signature; 1341 bool force_smu_not_present; 1342 /* 1343 * IP offset for run time initializaion of register addresses 1344 * 1345 * DCN3.5+ will fail dc_create() if these fields are null for them. They are 1346 * applicable starting with DCN32/321 and are not used for ASICs upstreamed 1347 * before them. 1348 */ 1349 uint32_t *dcn_reg_offsets; 1350 uint32_t *nbio_reg_offsets; 1351 uint32_t *clk_reg_offsets; 1352 void *bb_from_dmub; 1353 }; 1354 1355 struct dc_callback_init { 1356 struct cp_psp cp_psp; 1357 }; 1358 1359 struct dc *dc_create(const struct dc_init_data *init_params); 1360 void dc_hardware_init(struct dc *dc); 1361 1362 int dc_get_vmid_use_vector(struct dc *dc); 1363 void dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid); 1364 /* Returns the number of vmids supported */ 1365 unsigned int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config); 1366 void dc_init_callbacks(struct dc *dc, 1367 const struct dc_callback_init *init_params); 1368 void dc_deinit_callbacks(struct dc *dc); 1369 void dc_destroy(struct dc **dc); 1370 1371 /* Surface Interfaces */ 1372 1373 enum { 1374 TRANSFER_FUNC_POINTS = 1025 1375 }; 1376 1377 struct dc_hdr_static_metadata { 1378 /* display chromaticities and white point in units of 0.00001 */ 1379 unsigned int chromaticity_green_x; 1380 unsigned int chromaticity_green_y; 1381 unsigned int chromaticity_blue_x; 1382 unsigned int chromaticity_blue_y; 1383 unsigned int chromaticity_red_x; 1384 unsigned int chromaticity_red_y; 1385 unsigned int chromaticity_white_point_x; 1386 unsigned int chromaticity_white_point_y; 1387 1388 uint32_t min_luminance; 1389 uint32_t max_luminance; 1390 uint32_t maximum_content_light_level; 1391 uint32_t maximum_frame_average_light_level; 1392 }; 1393 1394 enum dc_transfer_func_type { 1395 TF_TYPE_PREDEFINED, 1396 TF_TYPE_DISTRIBUTED_POINTS, 1397 TF_TYPE_BYPASS, 1398 TF_TYPE_HWPWL 1399 }; 1400 1401 struct dc_transfer_func_distributed_points { 1402 struct fixed31_32 red[TRANSFER_FUNC_POINTS]; 1403 struct fixed31_32 green[TRANSFER_FUNC_POINTS]; 1404 struct fixed31_32 blue[TRANSFER_FUNC_POINTS]; 1405 1406 uint16_t end_exponent; 1407 uint16_t x_point_at_y1_red; 1408 uint16_t x_point_at_y1_green; 1409 uint16_t x_point_at_y1_blue; 1410 }; 1411 1412 enum dc_transfer_func_predefined { 1413 TRANSFER_FUNCTION_SRGB, 1414 TRANSFER_FUNCTION_BT709, 1415 TRANSFER_FUNCTION_PQ, 1416 TRANSFER_FUNCTION_LINEAR, 1417 TRANSFER_FUNCTION_UNITY, 1418 TRANSFER_FUNCTION_HLG, 1419 TRANSFER_FUNCTION_HLG12, 1420 TRANSFER_FUNCTION_GAMMA22, 1421 TRANSFER_FUNCTION_GAMMA24, 1422 TRANSFER_FUNCTION_GAMMA26 1423 }; 1424 1425 1426 struct dc_transfer_func { 1427 struct kref refcount; 1428 enum dc_transfer_func_type type; 1429 enum dc_transfer_func_predefined tf; 1430 /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/ 1431 uint32_t sdr_ref_white_level; 1432 union { 1433 struct pwl_params pwl; 1434 struct dc_transfer_func_distributed_points tf_pts; 1435 }; 1436 }; 1437 1438 1439 union dc_3dlut_state { 1440 struct { 1441 uint32_t initialized:1; /*if 3dlut is went through color module for initialization */ 1442 uint32_t rmu_idx_valid:1; /*if mux settings are valid*/ 1443 uint32_t rmu_mux_num:3; /*index of mux to use*/ 1444 uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/ 1445 uint32_t mpc_rmu1_mux:4; 1446 uint32_t mpc_rmu2_mux:4; 1447 uint32_t reserved:15; 1448 } bits; 1449 uint32_t raw; 1450 }; 1451 1452 1453 #define MATRIX_9C__DIM_128_ALIGNED_LEN 16 // 9+8 : 9 * 8 + 7 * 8 = 72 + 56 = 128 % 128 = 0 1454 #define MATRIX_17C__DIM_128_ALIGNED_LEN 32 //17+15: 17 * 8 + 15 * 8 = 136 + 120 = 256 % 128 = 0 1455 #define MATRIX_33C__DIM_128_ALIGNED_LEN 64 //17+47: 17 * 8 + 47 * 8 = 136 + 376 = 512 % 128 = 0 1456 1457 struct lut_rgb { 1458 uint16_t b; 1459 uint16_t g; 1460 uint16_t r; 1461 uint16_t padding; 1462 }; 1463 1464 //this structure maps directly to how the lut will read it from memory 1465 struct lut_mem_mapping { 1466 union { 1467 //NATIVE MODE 1, 2 1468 //RGB layout [b][g][r] //red is 128 byte aligned 1469 //BGR layout [r][g][b] //blue is 128 byte aligned 1470 struct lut_rgb rgb_17c[17][17][MATRIX_17C__DIM_128_ALIGNED_LEN]; 1471 struct lut_rgb rgb_33c[33][33][MATRIX_33C__DIM_128_ALIGNED_LEN]; 1472 1473 //TRANSFORMED 1474 uint16_t linear_rgb[(33*33*33*4/128+1)*128]; 1475 }; 1476 uint16_t size; 1477 }; 1478 1479 struct dc_rmcm_3dlut { 1480 bool isInUse; 1481 const struct dc_stream_state *stream; 1482 uint8_t protection_bits; 1483 }; 1484 1485 struct dc_3dlut { 1486 struct kref refcount; 1487 struct tetrahedral_params lut_3d; 1488 struct fixed31_32 hdr_multiplier; 1489 union dc_3dlut_state state; 1490 }; 1491 /* 1492 * This structure is filled in by dc_surface_get_status and contains 1493 * the last requested address and the currently active address so the called 1494 * can determine if there are any outstanding flips 1495 */ 1496 struct dc_plane_status { 1497 struct dc_plane_address requested_address; 1498 struct dc_plane_address current_address; 1499 bool is_flip_pending; 1500 bool is_right_eye; 1501 struct cm_hist cm_hist; 1502 }; 1503 1504 union surface_update_flags { 1505 1506 struct { 1507 uint32_t addr_update:1; 1508 /* Medium updates */ 1509 uint32_t dcc_change:1; 1510 uint32_t color_space_change:1; 1511 uint32_t horizontal_mirror_change:1; 1512 uint32_t per_pixel_alpha_change:1; 1513 uint32_t global_alpha_change:1; 1514 uint32_t hdr_mult:1; 1515 uint32_t rotation_change:1; 1516 uint32_t swizzle_change:1; 1517 uint32_t scaling_change:1; 1518 uint32_t position_change:1; 1519 uint32_t in_transfer_func_change:1; 1520 uint32_t input_csc_change:1; 1521 uint32_t coeff_reduction_change:1; 1522 uint32_t pixel_format_change:1; 1523 uint32_t plane_size_change:1; 1524 uint32_t gamut_remap_change:1; 1525 uint32_t cursor_csc_color_matrix_change:1; 1526 1527 /* Full updates */ 1528 uint32_t new_plane:1; 1529 uint32_t bpp_change:1; 1530 uint32_t gamma_change:1; 1531 uint32_t bandwidth_change:1; 1532 uint32_t clock_change:1; 1533 uint32_t stereo_format_change:1; 1534 uint32_t lut_3d:1; 1535 uint32_t tmz_changed:1; 1536 uint32_t mcm_transfer_function_enable_change:1; /* disable or enable MCM transfer func */ 1537 uint32_t full_update:1; 1538 uint32_t sdr_white_level_nits:1; 1539 uint32_t cm_hist_change:1; 1540 } bits; 1541 1542 uint32_t raw; 1543 }; 1544 1545 #define DC_REMOVE_PLANE_POINTERS 1 1546 1547 struct dc_plane_state { 1548 struct dc_plane_address address; 1549 struct dc_plane_flip_time time; 1550 bool triplebuffer_flips; 1551 struct scaling_taps scaling_quality; 1552 struct rect src_rect; 1553 struct rect dst_rect; 1554 struct rect clip_rect; 1555 1556 struct plane_size plane_size; 1557 struct dc_tiling_info tiling_info; 1558 1559 struct dc_plane_dcc_param dcc; 1560 1561 struct dc_gamma gamma_correction; 1562 struct dc_transfer_func in_transfer_func; 1563 struct dc_bias_and_scale bias_and_scale; 1564 struct dc_csc_transform input_csc_color_matrix; 1565 struct fixed31_32 coeff_reduction_factor; 1566 struct fixed31_32 hdr_mult; 1567 struct colorspace_transform gamut_remap_matrix; 1568 1569 // TODO: No longer used, remove 1570 struct dc_hdr_static_metadata hdr_static_ctx; 1571 1572 enum dc_color_space color_space; 1573 1574 struct dc_3dlut lut3d_func; 1575 struct dc_transfer_func in_shaper_func; 1576 struct dc_transfer_func blend_tf; 1577 1578 struct dc_transfer_func *gamcor_tf; 1579 enum surface_pixel_format format; 1580 enum dc_rotation_angle rotation; 1581 enum plane_stereo_format stereo_format; 1582 1583 bool is_tiling_rotated; 1584 bool per_pixel_alpha; 1585 bool pre_multiplied_alpha; 1586 bool global_alpha; 1587 int global_alpha_value; 1588 bool visible; 1589 bool flip_immediate; 1590 bool horizontal_mirror; 1591 unsigned int layer_index; 1592 1593 union surface_update_flags update_flags; 1594 bool flip_int_enabled; 1595 bool skip_manual_trigger; 1596 1597 /* private to DC core */ 1598 struct dc_plane_status status; 1599 struct dc_context *ctx; 1600 1601 /* HACK: Workaround for forcing full reprogramming under some conditions */ 1602 bool force_full_update; 1603 1604 bool is_phantom; // TODO: Change mall_stream_config into mall_plane_config instead 1605 1606 /* private to dc_surface.c */ 1607 enum dc_irq_source irq_source; 1608 struct kref refcount; 1609 struct tg_color visual_confirm_color; 1610 1611 bool is_statically_allocated; 1612 enum chroma_cositing cositing; 1613 enum dc_cm2_shaper_3dlut_setting mcm_shaper_3dlut_setting; 1614 bool mcm_lut1d_enable; 1615 struct dc_cm2_func_luts mcm_luts; 1616 bool lut_bank_a; 1617 enum mpcc_movable_cm_location mcm_location; 1618 struct dc_csc_transform cursor_csc_color_matrix; 1619 bool adaptive_sharpness_en; 1620 int adaptive_sharpness_policy; 1621 unsigned int sharpness_level; 1622 enum linear_light_scaling linear_light_scaling; 1623 unsigned int sdr_white_level_nits; 1624 struct cm_hist_control cm_hist_control; 1625 struct spl_sharpness_range sharpness_range; 1626 enum sharpness_range_source sharpness_source; 1627 }; 1628 1629 struct dc_plane_info { 1630 struct plane_size plane_size; 1631 struct dc_tiling_info tiling_info; 1632 struct dc_plane_dcc_param dcc; 1633 enum surface_pixel_format format; 1634 enum dc_rotation_angle rotation; 1635 enum plane_stereo_format stereo_format; 1636 enum dc_color_space color_space; 1637 bool horizontal_mirror; 1638 bool visible; 1639 bool per_pixel_alpha; 1640 bool pre_multiplied_alpha; 1641 bool global_alpha; 1642 int global_alpha_value; 1643 bool input_csc_enabled; 1644 unsigned int layer_index; 1645 enum chroma_cositing cositing; 1646 }; 1647 1648 #include "dc_stream.h" 1649 1650 struct dc_scratch_space { 1651 /* used to temporarily backup plane states of a stream during 1652 * dc update. The reason is that plane states are overwritten 1653 * with surface updates in dc update. Once they are overwritten 1654 * current state is no longer valid. We want to temporarily 1655 * store current value in plane states so we can still recover 1656 * a valid current state during dc update. 1657 */ 1658 struct dc_plane_state plane_states[MAX_SURFACES]; 1659 1660 struct dc_stream_state stream_state; 1661 }; 1662 1663 /* 1664 * A link contains one or more sinks and their connected status. 1665 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported. 1666 */ 1667 struct dc_link { 1668 struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK]; 1669 unsigned int sink_count; 1670 struct dc_sink *local_sink; 1671 unsigned int link_index; 1672 enum dc_connection_type type; 1673 enum signal_type connector_signal; 1674 enum dc_irq_source irq_source_hpd; 1675 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */ 1676 enum dc_irq_source irq_source_read_request;/* Read Request */ 1677 1678 bool is_hpd_filter_disabled; 1679 bool dp_ss_off; 1680 1681 /** 1682 * @link_state_valid: 1683 * 1684 * If there is no link and local sink, this variable should be set to 1685 * false. Otherwise, it should be set to true; usually, the function 1686 * core_link_enable_stream sets this field to true. 1687 */ 1688 bool link_state_valid; 1689 bool aux_access_disabled; 1690 bool sync_lt_in_progress; 1691 bool skip_stream_reenable; 1692 bool is_internal_display; 1693 /** @todo Rename. Flag an endpoint as having a programmable mapping to a DIG encoder. */ 1694 bool is_dig_mapping_flexible; 1695 bool hpd_status; /* HPD status of link without physical HPD pin. */ 1696 bool is_hpd_pending; /* Indicates a new received hpd */ 1697 1698 /* USB4 DPIA links skip verifying link cap, instead performing the fallback method 1699 * for every link training. This is incompatible with DP LL compliance automation, 1700 * which expects the same link settings to be used every retry on a link loss. 1701 * This flag is used to skip the fallback when link loss occurs during automation. 1702 */ 1703 bool skip_fallback_on_link_loss; 1704 1705 bool edp_sink_present; 1706 1707 struct dp_trace dp_trace; 1708 volatile bool is_link_locked; 1709 1710 /* caps is the same as reported_link_cap. link_traing use 1711 * reported_link_cap. Will clean up. TODO 1712 */ 1713 struct dc_link_settings reported_link_cap; 1714 struct dc_link_settings verified_link_cap; 1715 struct dc_link_settings cur_link_settings; 1716 struct dc_lane_settings cur_lane_setting[LANE_COUNT_DP_MAX]; 1717 struct dc_link_settings preferred_link_setting; 1718 /* preferred_training_settings are override values that 1719 * come from DM. DM is responsible for the memory 1720 * management of the override pointers. 1721 */ 1722 struct dc_link_training_overrides preferred_training_settings; 1723 struct dc_hdmi_frl_link_training_overrides preferred_hdmi_frl_settings; 1724 struct dp_audio_test_data audio_test_data; 1725 1726 /* On ASICs with dp_connector_no_native_i2c cap set and no_ddc_pin cap 1727 * set by IFWI, link aux_hw_inst is used in aux layer functions instead 1728 * of ddc_pin to know which aux instance is associated with link. 1729 */ 1730 bool no_ddc_pin; 1731 enum gpio_ddc_line aux_hw_inst; 1732 1733 enum gpio_ddc_line ddc_hw_inst; 1734 1735 uint8_t hpd_src; 1736 1737 uint8_t link_enc_hw_inst; 1738 /* DIG link encoder ID. Used as index in link encoder resource pool. 1739 * For links with fixed mapping to DIG, this is not changed after dc_link 1740 * object creation. 1741 */ 1742 enum engine_id eng_id; 1743 enum engine_id dpia_preferred_eng_id; 1744 1745 bool test_pattern_enabled; 1746 /* Pending/Current test pattern are only used to perform and track 1747 * FIXED_VS retimer test pattern/lane adjustment override state. 1748 * Pending allows link HWSS to differentiate PHY vs non-PHY pattern, 1749 * to perform specific lane adjust overrides before setting certain 1750 * PHY test patterns. In cases when lane adjust and set test pattern 1751 * calls are not performed atomically (i.e. performing link training), 1752 * pending_test_pattern will be invalid or contain a non-PHY test pattern 1753 * and current_test_pattern will contain required context for any future 1754 * set pattern/set lane adjust to transition between override state(s). 1755 * */ 1756 enum dp_test_pattern current_test_pattern; 1757 enum dp_test_pattern pending_test_pattern; 1758 1759 union compliance_test_state compliance_test_state; 1760 1761 void *priv; 1762 1763 struct ddc_service *ddc; 1764 1765 enum dp_panel_mode panel_mode; 1766 bool aux_mode; 1767 1768 /* Private to DC core */ 1769 1770 const struct dc *dc; 1771 1772 struct dc_context *ctx; 1773 1774 struct panel_cntl *panel_cntl; 1775 struct link_encoder *link_enc; 1776 struct hpo_frl_link_encoder *hpo_frl_link_enc; 1777 struct dc_hdmi_frl_link_settings frl_reported_link_cap; 1778 struct dc_hdmi_frl_link_settings frl_verified_link_cap; 1779 struct dc_hdmi_frl_link_settings frl_link_settings; 1780 struct dc_hdmi_frl_flags frl_flags; 1781 union hdmi_idcc_cable_id hdmi_cable_id; 1782 struct graphics_object_id link_id; 1783 1784 /* External encoder eg. NUTMEG or TRAVIS used on CIK APUs. */ 1785 struct graphics_object_id ext_enc_id; 1786 1787 /* Endpoint type distinguishes display endpoints which do not have entries 1788 * in the BIOS connector table from those that do. Helps when tracking link 1789 * encoder to display endpoint assignments. 1790 */ 1791 enum display_endpoint_type ep_type; 1792 union ddi_channel_mapping ddi_channel_mapping; 1793 struct connector_device_tag_info device_tag; 1794 struct dpcd_caps dpcd_caps; 1795 uint32_t dongle_max_pix_clk; 1796 unsigned short chip_caps; 1797 unsigned int dpcd_sink_count; 1798 struct hdcp_caps hdcp_caps; 1799 enum edp_revision edp_revision; 1800 union dpcd_sink_ext_caps dpcd_sink_ext_caps; 1801 1802 struct psr_settings psr_settings; 1803 struct replay_settings replay_settings; 1804 1805 /* Drive settings read from integrated info table */ 1806 struct dc_lane_settings bios_forced_drive_settings; 1807 1808 /* Vendor specific LTTPR workaround variables */ 1809 uint8_t vendor_specific_lttpr_link_rate_wa; 1810 bool apply_vendor_specific_lttpr_link_rate_wa; 1811 1812 /* MST record stream using this link */ 1813 struct link_flags { 1814 bool dp_keep_receiver_powered; 1815 bool dp_skip_DID2; 1816 bool dp_skip_reset_segment; 1817 bool dp_skip_fs_144hz; 1818 /* Some DP bridges don't work with RBR and must use HBR. */ 1819 bool dp_skip_rbr; 1820 bool dp_mot_reset_segment; 1821 /* Some USB4 docks do not handle turning off MST DSC once it has been enabled. */ 1822 bool dpia_mst_dsc_always_on; 1823 /* Forced DPIA into TBT3 compatibility mode. */ 1824 bool dpia_forced_tbt3_mode; 1825 bool dongle_mode_timing_override; 1826 bool blank_stream_on_ocs_change; 1827 bool read_dpcd204h_on_irq_hpd; 1828 bool force_dp_ffe_preset; 1829 bool skip_phy_ssc_reduction; 1830 } wa_flags; 1831 union dc_dp_ffe_preset forced_dp_ffe_preset; 1832 struct link_mst_stream_allocation_table mst_stream_alloc_table; 1833 1834 struct dc_link_status link_status; 1835 struct dprx_states dprx_states; 1836 1837 enum dc_link_fec_state fec_state; 1838 bool is_dds; 1839 bool is_display_mux_present; 1840 bool link_powered_externally; // Used to bypass hardware sequencing delays when panel is powered down forcibly 1841 1842 struct dc_panel_config panel_config; 1843 enum dc_panel_type panel_type; 1844 struct phy_state phy_state; 1845 uint32_t phy_transition_bitmask; 1846 // BW ALLOCATON USB4 ONLY 1847 struct dc_dpia_bw_alloc dpia_bw_alloc_config; 1848 bool skip_implict_edp_power_control; 1849 enum backlight_control_type backlight_control_type; 1850 }; 1851 1852 struct dc { 1853 struct dc_debug_options debug; 1854 struct dc_versions versions; 1855 struct dc_caps caps; 1856 struct dc_check_config check_config; 1857 struct dc_cap_funcs cap_funcs; 1858 struct dc_config config; 1859 struct dc_bounding_box_overrides bb_overrides; 1860 struct dc_bug_wa work_arounds; 1861 struct dc_context *ctx; 1862 struct dc_phy_addr_space_config vm_pa_config; 1863 1864 uint8_t link_count; 1865 struct dc_link *links[MAX_LINKS]; 1866 uint8_t lowest_dpia_link_index; 1867 struct link_service *link_srv; 1868 1869 struct dc_state *current_state; 1870 struct resource_pool *res_pool; 1871 1872 struct clk_mgr *clk_mgr; 1873 1874 /* Display Engine Clock levels */ 1875 struct dm_pp_clock_levels sclk_lvls; 1876 1877 /* Inputs into BW and WM calculations. */ 1878 struct bw_calcs_dceip *bw_dceip; 1879 struct bw_calcs_vbios *bw_vbios; 1880 struct dcn_soc_bounding_box *dcn_soc; 1881 struct dcn_ip_params *dcn_ip; 1882 struct display_mode_lib dml; 1883 1884 /* HW functions */ 1885 struct hw_sequencer_funcs hwss; 1886 struct dce_hwseq *hwseq; 1887 1888 /* Require to optimize clocks and bandwidth for added/removed planes */ 1889 bool optimized_required; 1890 bool idle_optimizations_allowed; 1891 bool enable_c20_dtm_b0; 1892 1893 /* Require to maintain clocks and bandwidth for UEFI enabled HW */ 1894 1895 /* For eDP to know the switching state of SmartMux */ 1896 bool is_switch_in_progress_orig; 1897 bool is_switch_in_progress_dest; 1898 1899 /* FBC compressor */ 1900 struct compressor *fbc_compressor; 1901 1902 struct dc_debug_data debug_data; 1903 struct dpcd_vendor_signature vendor_signature; 1904 1905 const char *build_id; 1906 struct vm_helper *vm_helper; 1907 1908 uint32_t *dcn_reg_offsets; 1909 uint32_t *nbio_reg_offsets; 1910 uint32_t *clk_reg_offsets; 1911 1912 /* Scratch memory */ 1913 struct { 1914 struct { 1915 /* 1916 * For matching clock_limits table in driver with table 1917 * from PMFW. 1918 */ 1919 struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES]; 1920 } update_bw_bounding_box; 1921 struct dc_scratch_space current_state; 1922 struct dc_scratch_space new_state; 1923 struct dc_stream_state temp_stream; // Used so we don't need to allocate stream on the stack 1924 struct dc_link temp_link; 1925 bool pipes_to_unlock_first[MAX_PIPES]; /* Any of the pipes indicated here should be unlocked first */ 1926 } scratch; 1927 1928 struct dml2_configuration_options dml2_options; 1929 struct dml2_configuration_options dml2_dc_power_options; 1930 enum dc_acpi_cm_power_state power_state; 1931 struct soc_and_ip_translator *soc_and_ip_translator; 1932 }; 1933 1934 struct dc_scaling_info { 1935 struct rect src_rect; 1936 struct rect dst_rect; 1937 struct rect clip_rect; 1938 struct scaling_taps scaling_quality; 1939 }; 1940 1941 struct dc_fast_update { 1942 const struct dc_flip_addrs *flip_addr; 1943 const struct dc_gamma *gamma; 1944 const struct colorspace_transform *gamut_remap_matrix; 1945 const struct dc_csc_transform *input_csc_color_matrix; 1946 const struct fixed31_32 *coeff_reduction_factor; 1947 struct dc_transfer_func *out_transfer_func; 1948 struct dc_csc_transform *output_csc_transform; 1949 const struct dc_csc_transform *cursor_csc_color_matrix; 1950 struct cm_hist_control *cm_hist_control; 1951 /* stream-level fast updates */ 1952 const struct colorspace_transform *gamut_remap; 1953 const struct dc_cursor_attributes *cursor_attributes; 1954 const struct dc_cursor_position *cursor_position; 1955 const struct periodic_interrupt_config *periodic_interrupt; 1956 const enum dc_dither_option *dither_option; 1957 struct dc_info_packet *vrr_infopacket; 1958 struct dc_info_packet *vsc_infopacket; 1959 struct dc_info_packet *vsp_infopacket; 1960 struct dc_info_packet *hfvsif_infopacket; 1961 struct dc_info_packet *vtem_infopacket; 1962 struct dc_info_packet *adaptive_sync_infopacket; 1963 struct dc_info_packet *avi_infopacket; 1964 struct dc_info_packet *hdr_static_metadata; 1965 }; 1966 1967 struct dc_surface_update { 1968 struct dc_plane_state *surface; 1969 1970 /* isr safe update parameters. null means no updates */ 1971 const struct dc_flip_addrs *flip_addr; 1972 const struct dc_plane_info *plane_info; 1973 const struct dc_scaling_info *scaling_info; 1974 struct fixed31_32 hdr_mult; 1975 /* following updates require alloc/sleep/spin that is not isr safe, 1976 * null means no updates 1977 */ 1978 const struct dc_gamma *gamma; 1979 const struct dc_transfer_func *in_transfer_func; 1980 1981 const struct dc_csc_transform *input_csc_color_matrix; 1982 const struct fixed31_32 *coeff_reduction_factor; 1983 const struct dc_transfer_func *func_shaper; 1984 const struct dc_3dlut *lut3d_func; 1985 const struct dc_transfer_func *blend_tf; 1986 const struct colorspace_transform *gamut_remap_matrix; 1987 /* 1988 * Color Transformations for pre-blend MCM (Shaper, 3DLUT, 1DLUT) 1989 * 1990 * change cm2_params.component_settings: Full update 1991 * change cm2_params.cm2_luts: Fast update 1992 */ 1993 const struct dc_cm2_parameters *cm2_params; 1994 const struct dc_plane_cm *cm; 1995 const struct dc_csc_transform *cursor_csc_color_matrix; 1996 unsigned int sdr_white_level_nits; 1997 struct dc_bias_and_scale bias_and_scale; 1998 struct cm_hist_control *cm_hist_control; 1999 }; 2000 2001 struct dc_underflow_debug_data { 2002 struct dcn_hubbub_reg_state *hubbub_reg_state; 2003 struct dcn_hubp_reg_state *hubp_reg_state[MAX_PIPES]; 2004 struct dcn_dpp_reg_state *dpp_reg_state[MAX_PIPES]; 2005 struct dcn_mpc_reg_state *mpc_reg_state[MAX_PIPES]; 2006 struct dcn_opp_reg_state *opp_reg_state[MAX_PIPES]; 2007 struct dcn_dsc_reg_state *dsc_reg_state[MAX_PIPES]; 2008 struct dcn_optc_reg_state *optc_reg_state[MAX_PIPES]; 2009 struct dcn_dccg_reg_state *dccg_reg_state[MAX_PIPES]; 2010 }; 2011 2012 struct power_features { 2013 bool ips; 2014 bool rcg; 2015 bool replay; 2016 bool dds; 2017 bool sprs; 2018 bool psr; 2019 bool fams; 2020 bool mpo; 2021 bool uclk_p_state; 2022 }; 2023 2024 /* 2025 * Create a new surface with default parameters; 2026 */ 2027 void dc_gamma_retain(struct dc_gamma *dc_gamma); 2028 void dc_gamma_release(struct dc_gamma **dc_gamma); 2029 struct dc_gamma *dc_create_gamma(void); 2030 2031 void dc_transfer_func_retain(struct dc_transfer_func *dc_tf); 2032 void dc_transfer_func_release(struct dc_transfer_func *dc_tf); 2033 struct dc_transfer_func *dc_create_transfer_func(void); 2034 2035 struct dc_3dlut *dc_create_3dlut_func(void); 2036 void dc_3dlut_func_release(struct dc_3dlut *lut); 2037 void dc_3dlut_func_retain(struct dc_3dlut *lut); 2038 2039 void dc_post_update_surfaces_to_stream( 2040 struct dc *dc); 2041 2042 /* 2043 * dc_get_default_tiling_info() - Retrieve an ASIC-appropriate default tiling 2044 * description for (typically) linear surfaces. 2045 * 2046 * This is used by OS/DM paths that need a valid, fully-initialized tiling 2047 * description without hardcoding gfx-version specifics in the caller. 2048 */ 2049 void dc_get_default_tiling_info(const struct dc *dc, struct dc_tiling_info *tiling_info); 2050 2051 /** 2052 * struct dc_validation_set - Struct to store surface/stream associations for validation 2053 */ 2054 struct dc_validation_set { 2055 /** 2056 * @stream: Stream state properties 2057 */ 2058 struct dc_stream_state *stream; 2059 2060 /** 2061 * @plane_states: Surface state 2062 */ 2063 struct dc_plane_state *plane_states[MAX_SURFACES]; 2064 2065 /** 2066 * @plane_count: Total of active planes 2067 */ 2068 uint8_t plane_count; 2069 }; 2070 2071 bool dc_validate_boot_timing(const struct dc *dc, 2072 const struct dc_sink *sink, 2073 struct dc_crtc_timing *crtc_timing); 2074 2075 enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state); 2076 2077 enum dc_status dc_validate_with_context(struct dc *dc, 2078 const struct dc_validation_set set[], 2079 unsigned int set_count, 2080 struct dc_state *context, 2081 enum dc_validate_mode validate_mode); 2082 2083 bool dc_set_generic_gpio_for_stereo(bool enable, 2084 struct gpio_service *gpio_service); 2085 2086 enum dc_status dc_validate_global_state( 2087 struct dc *dc, 2088 struct dc_state *new_ctx, 2089 enum dc_validate_mode validate_mode); 2090 2091 bool dc_acquire_release_mpc_3dlut( 2092 struct dc *dc, bool acquire, 2093 struct dc_stream_state *stream, 2094 struct dc_3dlut **lut, 2095 struct dc_transfer_func **shaper); 2096 2097 bool dc_resource_is_dsc_encoding_supported(const struct dc *dc); 2098 void get_audio_check(struct audio_info *aud_modes, 2099 struct audio_check *aud_chk); 2100 2101 bool fast_nonaddr_updates_exist(struct dc_fast_update *fast_update, int surface_count); 2102 void populate_fast_updates(struct dc_fast_update *fast_update, 2103 struct dc_surface_update *srf_updates, 2104 int surface_count, 2105 struct dc_stream_update *stream_update); 2106 /* 2107 * Set up streams and links associated to drive sinks 2108 * The streams parameter is an absolute set of all active streams. 2109 * 2110 * After this call: 2111 * Phy, Encoder, Timing Generator are programmed and enabled. 2112 * New streams are enabled with blank stream; no memory read. 2113 */ 2114 enum dc_status dc_commit_streams(struct dc *dc, struct dc_commit_streams_params *params); 2115 2116 2117 struct dc_plane_state *dc_get_surface_for_mpcc(struct dc *dc, 2118 struct dc_stream_state *stream, 2119 int mpcc_inst); 2120 2121 2122 uint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane); 2123 bool dc_set_fva_vrr_adjust(struct dc *dc, 2124 struct dc_stream_state *stream, 2125 struct fva_adj *fva_adj, 2126 struct dc_crtc_timing_adjust *vrr_adj); 2127 2128 int dc_get_hw_max_fva_factor(struct dc *dc, 2129 struct dc_stream_state *stream, 2130 unsigned int max_pixel_clock); 2131 2132 void dc_set_vstartup_start(struct dc *dc, 2133 struct dc_stream_state *stream); 2134 2135 void dc_set_disable_128b_132b_stream_overhead(bool disable); 2136 2137 /* The function returns minimum bandwidth required to drive a given timing 2138 * return - minimum required timing bandwidth in kbps. 2139 */ 2140 uint32_t dc_bandwidth_in_kbps_from_timing( 2141 const struct dc_crtc_timing *timing, 2142 const enum dc_link_encoding_format link_encoding); 2143 2144 /* Link Interfaces */ 2145 /* Return an enumerated dc_link. 2146 * dc_link order is constant and determined at 2147 * boot time. They cannot be created or destroyed. 2148 * Use dc_get_caps() to get number of links. 2149 */ 2150 struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index); 2151 2152 /* Return instance id of the edp link. Inst 0 is primary edp link. */ 2153 bool dc_get_edp_link_panel_inst(const struct dc *dc, 2154 const struct dc_link *link, 2155 unsigned int *inst_out); 2156 2157 /* Return an array of link pointers to edp links. */ 2158 void dc_get_edp_links(const struct dc *dc, 2159 struct dc_link **edp_links, 2160 unsigned int *edp_num); 2161 2162 void dc_set_edp_power(const struct dc *dc, struct dc_link *edp_link, 2163 bool powerOn); 2164 2165 /* The function initiates detection handshake over the given link. It first 2166 * determines if there are display connections over the link. If so it initiates 2167 * detection protocols supported by the connected receiver device. The function 2168 * contains protocol specific handshake sequences which are sometimes mandatory 2169 * to establish a proper connection between TX and RX. So it is always 2170 * recommended to call this function as the first link operation upon HPD event 2171 * or power up event. Upon completion, the function will update link structure 2172 * in place based on latest RX capabilities. The function may also cause dpms 2173 * to be reset to off for all currently enabled streams to the link. It is DM's 2174 * responsibility to serialize detection and DPMS updates. 2175 * 2176 * @reason - Indicate which event triggers this detection. dc may customize 2177 * detection flow depending on the triggering events. 2178 * return false - if detection is not fully completed. This could happen when 2179 * there is an unrecoverable error during detection or detection is partially 2180 * completed (detection has been delegated to dm mst manager ie. 2181 * link->connection_type == dc_connection_mst_branch when returning false). 2182 * return true - detection is completed, link has been fully updated with latest 2183 * detection result. 2184 */ 2185 bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason); 2186 2187 struct dc_sink_init_data; 2188 2189 /* When link connection type is dc_connection_mst_branch, remote sink can be 2190 * added to the link. The interface creates a remote sink and associates it with 2191 * current link. The sink will be retained by link until remove remote sink is 2192 * called. 2193 * 2194 * @dc_link - link the remote sink will be added to. 2195 * @edid - byte array of EDID raw data. 2196 * @len - size of the edid in byte 2197 * @init_data - 2198 */ 2199 struct dc_sink *dc_link_add_remote_sink( 2200 struct dc_link *dc_link, 2201 const uint8_t *edid, 2202 unsigned int len, 2203 struct dc_sink_init_data *init_data); 2204 2205 /* Remove remote sink from a link with dc_connection_mst_branch connection type. 2206 * @link - link the sink should be removed from 2207 * @sink - sink to be removed. 2208 */ 2209 void dc_link_remove_remote_sink( 2210 struct dc_link *link, 2211 struct dc_sink *sink); 2212 2213 /* Enable HPD interrupt handler for a given link */ 2214 void dc_link_enable_hpd(const struct dc_link *link); 2215 2216 /* Disable HPD interrupt handler for a given link */ 2217 void dc_link_disable_hpd(const struct dc_link *link); 2218 2219 /* determine if there is a sink connected to the link 2220 * 2221 * @type - dc_connection_single if connected, dc_connection_none otherwise. 2222 * return - false if an unexpected error occurs, true otherwise. 2223 * 2224 * NOTE: This function doesn't detect downstream sink connections i.e 2225 * dc_connection_mst_branch, dc_connection_sst_branch. In this case, it will 2226 * return dc_connection_single if the branch device is connected despite of 2227 * downstream sink's connection status. 2228 */ 2229 bool dc_link_detect_connection_type(struct dc_link *link, 2230 enum dc_connection_type *type); 2231 2232 /* query current hpd pin value 2233 * return - true HPD is asserted (HPD high), false otherwise (HPD low) 2234 * 2235 */ 2236 bool dc_link_get_hpd_state(struct dc_link *link); 2237 2238 /* Getter for cached link status from given link */ 2239 const struct dc_link_status *dc_link_get_status(const struct dc_link *link); 2240 2241 /* enable/disable hardware HPD filter. 2242 * 2243 * @link - The link the HPD pin is associated with. 2244 * @enable = true - enable hardware HPD filter. HPD event will only queued to irq 2245 * handler once after no HPD change has been detected within dc default HPD 2246 * filtering interval since last HPD event. i.e if display keeps toggling hpd 2247 * pulses within default HPD interval, no HPD event will be received until HPD 2248 * toggles have stopped. Then HPD event will be queued to irq handler once after 2249 * dc default HPD filtering interval since last HPD event. 2250 * 2251 * @enable = false - disable hardware HPD filter. HPD event will be queued 2252 * immediately to irq handler after no HPD change has been detected within 2253 * IRQ_HPD (aka HPD short pulse) interval (i.e 2ms). 2254 */ 2255 void dc_link_enable_hpd_filter(struct dc_link *link, bool enable); 2256 2257 /* submit i2c read/write payloads through ddc channel 2258 * @link_index - index to a link with ddc in i2c mode 2259 * @cmd - i2c command structure 2260 * return - true if success, false otherwise. 2261 */ 2262 bool dc_submit_i2c( 2263 struct dc *dc, 2264 uint32_t link_index, 2265 struct i2c_command *cmd); 2266 2267 /* submit i2c read/write payloads through oem channel 2268 * @link_index - index to a link with ddc in i2c mode 2269 * @cmd - i2c command structure 2270 * return - true if success, false otherwise. 2271 */ 2272 bool dc_submit_i2c_oem( 2273 struct dc *dc, 2274 struct i2c_command *cmd); 2275 2276 enum aux_return_code_type; 2277 /* Attempt to transfer the given aux payload. This function does not perform 2278 * retries or handle error states. The reply is returned in the payload->reply 2279 * and the result through operation_result. Returns the number of bytes 2280 * transferred,or -1 on a failure. 2281 */ 2282 int dc_link_aux_transfer_raw(struct ddc_service *ddc, 2283 struct aux_payload *payload, 2284 enum aux_return_code_type *operation_result); 2285 2286 struct ddc_service * 2287 dc_get_oem_i2c_device(struct dc *dc); 2288 2289 bool dc_is_oem_i2c_device_present( 2290 struct dc *dc, 2291 size_t slave_address 2292 ); 2293 2294 /* return true if the connected receiver supports the hdcp version */ 2295 bool dc_link_is_hdcp14(struct dc_link *link, enum signal_type signal); 2296 bool dc_link_is_hdcp22(struct dc_link *link, enum signal_type signal); 2297 2298 /* Notify DC about DP RX Interrupt (aka DP IRQ_HPD). 2299 * 2300 * TODO - When defer_handling is true the function will have a different purpose. 2301 * It no longer does complete hpd rx irq handling. We should create a separate 2302 * interface specifically for this case. 2303 * 2304 * Return: 2305 * true - Downstream port status changed. DM should call DC to do the 2306 * detection. 2307 * false - no change in Downstream port status. No further action required 2308 * from DM. 2309 */ 2310 bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link, 2311 union hpd_irq_data *hpd_irq_dpcd_data, bool *out_link_loss, 2312 bool defer_handling, bool *has_left_work); 2313 /* handle DP specs define test automation sequence*/ 2314 void dc_link_dp_handle_automated_test(struct dc_link *link); 2315 2316 /* handle DP Link loss sequence and try to recover RX link loss with best 2317 * effort 2318 */ 2319 void dc_link_dp_handle_link_loss(struct dc_link *link); 2320 2321 /* Determine if hpd rx irq should be handled or ignored 2322 * return true - hpd rx irq should be handled. 2323 * return false - it is safe to ignore hpd rx irq event 2324 */ 2325 bool dc_link_dp_allow_hpd_rx_irq(const struct dc_link *link); 2326 2327 /* Determine if link loss is indicated with a given hpd_irq_dpcd_data. 2328 * @link - link the hpd irq data associated with 2329 * @hpd_irq_dpcd_data - input hpd irq data 2330 * return - true if hpd irq data indicates a link lost 2331 */ 2332 bool dc_link_check_link_loss_status(struct dc_link *link, 2333 union hpd_irq_data *hpd_irq_dpcd_data); 2334 2335 /* Read hpd rx irq data from a given link 2336 * @link - link where the hpd irq data should be read from 2337 * @irq_data - output hpd irq data 2338 * return - DC_OK if hpd irq data is read successfully, otherwise hpd irq data 2339 * read has failed. 2340 */ 2341 enum dc_status dc_link_dp_read_hpd_rx_irq_data( 2342 struct dc_link *link, 2343 union hpd_irq_data *irq_data); 2344 2345 bool dc_link_frl_poll_status_flag(struct dc_link *link); 2346 bool dc_link_frl_margin_check_uncompressed_video( 2347 const struct dc_link *link, 2348 struct frl_cap_chk_params_fixed31_32 *params, 2349 struct frl_cap_chk_intermediates_fixed31_32 *inter); 2350 2351 /* The function clears recorded DP RX states in the link. DM should call this 2352 * function when it is resuming from S3 power state to previously connected links. 2353 * 2354 * TODO - in the future we should consider to expand link resume interface to 2355 * support clearing previous rx states. So we don't have to rely on dm to call 2356 * this interface explicitly. 2357 */ 2358 void dc_link_clear_dprx_states(struct dc_link *link); 2359 2360 /* Destruct the mst topology of the link and reset the allocated payload table 2361 * 2362 * NOTE: this should only be called if DM chooses not to call dc_link_detect but 2363 * still wants to reset MST topology on an unplug event */ 2364 bool dc_link_reset_cur_dp_mst_topology(struct dc_link *link); 2365 2366 /* The function calculates effective DP link bandwidth when a given link is 2367 * using the given link settings. 2368 * 2369 * return - total effective link bandwidth in kbps. 2370 */ 2371 uint32_t dc_link_bandwidth_kbps( 2372 const struct dc_link *link, 2373 const struct dc_link_settings *link_setting); 2374 2375 /* The function returns effective HDMI FRL bandwidth given link rate. 2376 * return - total effective link bandwidth in kbps. 2377 */ 2378 uint32_t dc_link_frl_bandwidth_kbps(const struct dc_link *link, 2379 enum hdmi_frl_link_rate link_rate); 2380 2381 struct dp_audio_bandwidth_params { 2382 const struct dc_crtc_timing *crtc_timing; 2383 enum dp_link_encoding link_encoding; 2384 uint32_t channel_count; 2385 uint32_t sample_rate_hz; 2386 }; 2387 2388 /* The function calculates the minimum size of hblank (in bytes) needed to 2389 * support the specified channel count and sample rate combination, given the 2390 * link encoding and timing to be used. This calculation is not supported 2391 * for 8b/10b SST. 2392 * 2393 * return - min hblank size in bytes, 0 if 8b/10b SST. 2394 */ 2395 uint32_t dc_link_required_hblank_size_bytes( 2396 const struct dc_link *link, 2397 struct dp_audio_bandwidth_params *audio_params); 2398 2399 /* The function takes a snapshot of current link resource allocation state 2400 * @dc: pointer to dc of the dm calling this 2401 * @map: a dc link resource snapshot defined internally to dc. 2402 * 2403 * DM needs to capture a snapshot of current link resource allocation mapping 2404 * and store it in its persistent storage. 2405 * 2406 * Some of the link resource is using first come first serve policy. 2407 * The allocation mapping depends on original hotplug order. This information 2408 * is lost after driver is loaded next time. The snapshot is used in order to 2409 * restore link resource to its previous state so user will get consistent 2410 * link capability allocation across reboot. 2411 * 2412 */ 2413 void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map); 2414 2415 /* This function restores link resource allocation state from a snapshot 2416 * @dc: pointer to dc of the dm calling this 2417 * @map: a dc link resource snapshot defined internally to dc. 2418 * 2419 * DM needs to call this function after initial link detection on boot and 2420 * before first commit streams to restore link resource allocation state 2421 * from previous boot session. 2422 * 2423 * Some of the link resource is using first come first serve policy. 2424 * The allocation mapping depends on original hotplug order. This information 2425 * is lost after driver is loaded next time. The snapshot is used in order to 2426 * restore link resource to its previous state so user will get consistent 2427 * link capability allocation across reboot. 2428 * 2429 */ 2430 void dc_restore_link_res_map(const struct dc *dc, uint32_t *map); 2431 2432 void dc_link_wait_for_unlocked(struct dc_link *link); 2433 2434 /* TODO: this is not meant to be exposed to DM. Should switch to stream update 2435 * interface i.e stream_update->dsc_config 2436 */ 2437 bool dc_link_update_dsc_config(struct pipe_ctx *pipe_ctx); 2438 2439 /* translate a raw link rate data to bandwidth in kbps */ 2440 uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(const struct dc *dc, uint8_t bw); 2441 2442 /* determine the optimal bandwidth given link and required bw. 2443 * @link - current detected link 2444 * @req_bw - requested bandwidth in kbps 2445 * @link_settings - returned most optimal link settings that can fit the 2446 * requested bandwidth 2447 * return - false if link can't support requested bandwidth, true if link 2448 * settings is found. 2449 */ 2450 bool dc_link_decide_edp_link_settings(struct dc_link *link, 2451 struct dc_link_settings *link_settings, 2452 uint32_t req_bw); 2453 2454 /* return the max dp link settings can be driven by the link without considering 2455 * connected RX device and its capability 2456 */ 2457 bool dc_link_dp_get_max_link_enc_cap(const struct dc_link *link, 2458 struct dc_link_settings *max_link_enc_cap); 2459 2460 /* determine when the link is driving MST mode, what DP link channel coding 2461 * format will be used. The decision will remain unchanged until next HPD event. 2462 * 2463 * @link - a link with DP RX connection 2464 * return - if stream is committed to this link with MST signal type, type of 2465 * channel coding format dc will choose. 2466 */ 2467 enum dp_link_encoding dc_link_dp_mst_decide_link_encoding_format( 2468 const struct dc_link *link); 2469 2470 /* get max dp link settings the link can enable with all things considered. (i.e 2471 * TX/RX/Cable capabilities and dp override policies. 2472 * 2473 * @link - a link with DP RX connection 2474 * return - max dp link settings the link can enable. 2475 * 2476 */ 2477 const struct dc_link_settings *dc_link_get_link_cap(const struct dc_link *link); 2478 2479 /* Get the highest encoding format that the link supports; highest meaning the 2480 * encoding format which supports the maximum bandwidth. 2481 * 2482 * @link - a link with DP RX connection 2483 * return - highest encoding format link supports. 2484 */ 2485 enum dc_link_encoding_format dc_link_get_highest_encoding_format(const struct dc_link *link); 2486 2487 /* get max frl link settings the link can enable with all things considered. 2488 * (i.e TX/RX capabilities and link verification result. 2489 * 2490 * @link - a link with FRL RX connection 2491 * return - max frl link settings the link can enable. 2492 * 2493 */ 2494 struct dc_hdmi_frl_link_settings *dc_link_get_frl_link_cap( 2495 struct dc_link *link); 2496 2497 /* Check if a RX (ex. DP sink, MST hub, passive or active dongle) is connected 2498 * to a link with dp connector signal type. 2499 * @link - a link with dp connector signal type 2500 * return - true if connected, false otherwise 2501 */ 2502 bool dc_link_is_dp_sink_present(struct dc_link *link); 2503 2504 /* Force DP lane settings update to main-link video signal and notify the change 2505 * to DP RX via DPCD. This is a debug interface used for video signal integrity 2506 * tuning purpose. The interface assumes link has already been enabled with DP 2507 * signal. 2508 * 2509 * @lt_settings - a container structure with desired hw_lane_settings 2510 */ 2511 void dc_link_set_drive_settings(struct dc *dc, 2512 struct link_training_settings *lt_settings, 2513 struct dc_link *link); 2514 2515 /* Enable a test pattern in Link or PHY layer in an active link for compliance 2516 * test or debugging purpose. The test pattern will remain until next un-plug. 2517 * 2518 * @link - active link with DP signal output enabled. 2519 * @test_pattern - desired test pattern to output. 2520 * NOTE: set to DP_TEST_PATTERN_VIDEO_MODE to disable previous test pattern. 2521 * @test_pattern_color_space - for video test pattern choose a desired color 2522 * space. 2523 * @p_link_settings - For PHY pattern choose a desired link settings 2524 * @p_custom_pattern - some test pattern will require a custom input to 2525 * customize some pattern details. Otherwise keep it to NULL. 2526 * @cust_pattern_size - size of the custom pattern input. 2527 * 2528 */ 2529 bool dc_link_dp_set_test_pattern( 2530 struct dc_link *link, 2531 enum dp_test_pattern test_pattern, 2532 enum dp_test_pattern_color_space test_pattern_color_space, 2533 const struct link_training_settings *p_link_settings, 2534 const unsigned char *p_custom_pattern, 2535 unsigned int cust_pattern_size); 2536 2537 /* Force DP link settings to always use a specific value until reboot to a 2538 * specific link. If link has already been enabled, the interface will also 2539 * switch to desired link settings immediately. This is a debug interface to 2540 * generic dp issue trouble shooting. 2541 */ 2542 void dc_link_set_preferred_link_settings(struct dc *dc, 2543 struct dc_link_settings *link_setting, 2544 struct dc_link *link); 2545 2546 /* Force FRL link settings to always use a specific value until reboot to a 2547 * specific link. If link has already been enabled, the interface will also 2548 * switch to desired link settings immediately. This is a debug interface to 2549 * generic FRL issue trouble shooting. 2550 */ 2551 void dc_link_set_preferred_frl_link_settings(struct dc *dc, 2552 struct dc_hdmi_frl_link_settings *link_setting, 2553 struct dc_hdmi_frl_link_training_overrides *lt_overrides, 2554 struct dc_link *link); 2555 2556 /* Force DP link to customize a specific link training behavior by overriding to 2557 * standard DP specs defined protocol. This is a debug interface to trouble shoot 2558 * display specific link training issues or apply some display specific 2559 * workaround in link training. 2560 * 2561 * @link_settings - if not NULL, force preferred link settings to the link. 2562 * @lt_override - a set of override pointers. If any pointer is none NULL, dc 2563 * will apply this particular override in future link training. If NULL is 2564 * passed in, dc resets previous overrides. 2565 * NOTE: DM must keep the memory from override pointers until DM resets preferred 2566 * training settings. 2567 */ 2568 void dc_link_set_preferred_training_settings(struct dc *dc, 2569 struct dc_link_settings *link_setting, 2570 struct dc_link_training_overrides *lt_overrides, 2571 struct dc_link *link, 2572 bool skip_immediate_retrain); 2573 2574 /* return - true if FEC is supported with connected DP RX, false otherwise */ 2575 bool dc_link_is_fec_supported(const struct dc_link *link); 2576 2577 /* query FEC enablement policy to determine if FEC will be enabled by dc during 2578 * link enablement. 2579 * return - true if FEC should be enabled, false otherwise. 2580 */ 2581 bool dc_link_should_enable_fec(const struct dc_link *link); 2582 2583 /* determine lttpr mode the current link should be enabled with a specific link 2584 * settings. 2585 */ 2586 enum lttpr_mode dc_link_decide_lttpr_mode(struct dc_link *link, 2587 struct dc_link_settings *link_setting); 2588 2589 /* Force DP RX to update its power state. 2590 * NOTE: this interface doesn't update dp main-link. Calling this function will 2591 * cause DP TX main-link and DP RX power states out of sync. DM has to restore 2592 * RX power state back upon finish DM specific execution requiring DP RX in a 2593 * specific power state. 2594 * @on - true to set DP RX in D0 power state, false to set DP RX in D3 power 2595 * state. 2596 */ 2597 void dc_link_dp_receiver_power_ctrl(struct dc_link *link, bool on); 2598 2599 /* Force link to read base dp receiver caps from dpcd 000h - 00Fh and overwrite 2600 * current value read from extended receiver cap from 02200h - 0220Fh. 2601 * Some DP RX has problems of providing accurate DP receiver caps from extended 2602 * field, this interface is a workaround to revert link back to use base caps. 2603 */ 2604 void dc_link_overwrite_extended_receiver_cap( 2605 struct dc_link *link); 2606 2607 void dc_link_edp_panel_backlight_power_on(struct dc_link *link, 2608 bool wait_for_hpd); 2609 2610 /* Set backlight level of an embedded panel (eDP, LVDS). 2611 * backlight_pwm_u16_16 is unsigned 32 bit with 16 bit integer 2612 * and 16 bit fractional, where 1.0 is max backlight value. 2613 */ 2614 bool dc_link_set_backlight_level(const struct dc_link *dc_link, 2615 struct set_backlight_level_params *backlight_level_params); 2616 2617 /* Set/get nits-based backlight level of an embedded panel (eDP, LVDS). */ 2618 bool dc_link_set_backlight_level_nits(struct dc_link *link, 2619 bool isHDR, 2620 uint32_t backlight_millinits, 2621 uint32_t transition_time_in_ms); 2622 2623 bool dc_link_get_backlight_level_nits(struct dc_link *link, 2624 uint32_t *backlight_millinits, 2625 uint32_t *backlight_millinits_peak); 2626 2627 int dc_link_get_backlight_level(const struct dc_link *dc_link); 2628 2629 int dc_link_get_target_backlight_pwm(const struct dc_link *link); 2630 2631 bool dc_link_set_psr_allow_active(struct dc_link *dc_link, const bool *enable, 2632 bool wait, bool force_static, const unsigned int *power_opts); 2633 2634 bool dc_link_get_psr_state(const struct dc_link *dc_link, enum dc_psr_state *state); 2635 2636 bool dc_link_setup_psr(struct dc_link *dc_link, 2637 const struct dc_stream_state *stream, struct psr_config *psr_config, 2638 struct psr_context *psr_context); 2639 2640 /* 2641 * Communicate with DMUB to allow or disallow Panel Replay on the specified link: 2642 * 2643 * @link: pointer to the dc_link struct instance 2644 * @enable: enable(active) or disable(inactive) replay 2645 * @wait: state transition need to wait the active set completed. 2646 * @force_static: force disable(inactive) the replay 2647 * @power_opts: set power optimazation parameters to DMUB. 2648 * 2649 * return: allow Replay active will return true, else will return false. 2650 */ 2651 bool dc_link_set_replay_allow_active(struct dc_link *dc_link, const bool *enable, 2652 bool wait, bool force_static, const unsigned int *power_opts); 2653 2654 bool dc_link_get_replay_state(const struct dc_link *dc_link, uint64_t *state); 2655 2656 /* 2657 * Enable or disable Panel Replay on the specified link: 2658 * 2659 * @link: pointer to the dc_link struct instance 2660 * @enable: enable or disable Panel Replay 2661 * 2662 * return: true if successful, false otherwise 2663 */ 2664 bool dc_link_set_pr_enable(struct dc_link *link, bool enable); 2665 2666 /* 2667 * Update Panel Replay state parameters: 2668 * 2669 * @link: pointer to the dc_link struct instance 2670 * @update_state_data: pointer to state update data structure 2671 * 2672 * return: true if successful, false otherwise 2673 */ 2674 bool dc_link_update_pr_state(struct dc_link *link, 2675 struct dmub_cmd_pr_update_state_data *update_state_data); 2676 2677 /* 2678 * Send general command to Panel Replay firmware: 2679 * 2680 * @link: pointer to the dc_link struct instance 2681 * @general_cmd_data: pointer to general command data structure 2682 * 2683 * return: true if successful, false otherwise 2684 */ 2685 bool dc_link_set_pr_general_cmd(struct dc_link *link, 2686 struct dmub_cmd_pr_general_cmd_data *general_cmd_data); 2687 2688 /* 2689 * Get Panel Replay state: 2690 * 2691 * @link: pointer to the dc_link struct instance 2692 * @state: pointer to store the Panel Replay state 2693 * 2694 * return: true if successful, false otherwise 2695 */ 2696 bool dc_link_get_pr_state(const struct dc_link *link, uint64_t *state); 2697 2698 /* On eDP links this function call will stall until T12 has elapsed. 2699 * If the panel is not in power off state, this function will return 2700 * immediately. 2701 */ 2702 bool dc_link_wait_for_t12(struct dc_link *link); 2703 2704 /* Determine if dp trace has been initialized to reflect upto date result * 2705 * return - true if trace is initialized and has valid data. False dp trace 2706 * doesn't have valid result. 2707 */ 2708 bool dc_dp_trace_is_initialized(struct dc_link *link); 2709 2710 /* Query a dp trace flag to indicate if the current dp trace data has been 2711 * logged before 2712 */ 2713 bool dc_dp_trace_is_logged(struct dc_link *link, 2714 bool in_detection); 2715 2716 /* Set dp trace flag to indicate whether DM has already logged the current dp 2717 * trace data. DM can set is_logged to true upon logging and check 2718 * dc_dp_trace_is_logged before logging to avoid logging the same result twice. 2719 */ 2720 void dc_dp_trace_set_is_logged_flag(struct dc_link *link, 2721 bool in_detection, 2722 bool is_logged); 2723 2724 /* Obtain driver time stamp for last dp link training end. The time stamp is 2725 * formatted based on dm_get_timestamp DM function. 2726 * @in_detection - true to get link training end time stamp of last link 2727 * training in detection sequence. false to get link training end time stamp 2728 * of last link training in commit (dpms) sequence 2729 */ 2730 unsigned long long dc_dp_trace_get_lt_end_timestamp(struct dc_link *link, 2731 bool in_detection); 2732 2733 /* Get how many link training attempts dc has done with latest sequence. 2734 * @in_detection - true to get link training count of last link 2735 * training in detection sequence. false to get link training count of last link 2736 * training in commit (dpms) sequence 2737 */ 2738 const struct dp_trace_lt_counts *dc_dp_trace_get_lt_counts(struct dc_link *link, 2739 bool in_detection); 2740 2741 /* Get how many link loss has happened since last link training attempts */ 2742 unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link); 2743 2744 /* 2745 * USB4 DPIA BW ALLOCATION PUBLIC FUNCTIONS 2746 */ 2747 /* 2748 * Send a request from DP-Tx requesting to allocate BW remotely after 2749 * allocating it locally. This will get processed by CM and a CB function 2750 * will be called. 2751 * 2752 * @link: pointer to the dc_link struct instance 2753 * @req_bw: The requested bw in Kbyte to allocated 2754 * 2755 * return: none 2756 */ 2757 void dc_link_set_usb4_req_bw_req(struct dc_link *link, int req_bw); 2758 2759 /* 2760 * Handle the USB4 BW Allocation related functionality here: 2761 * Plug => Try to allocate max bw from timing parameters supported by the sink 2762 * Unplug => de-allocate bw 2763 * 2764 * @link: pointer to the dc_link struct instance 2765 * @peak_bw: Peak bw used by the link/sink 2766 * 2767 */ 2768 void dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link( 2769 struct dc_link *link, int peak_bw); 2770 2771 /* 2772 * Calculates the DP tunneling bandwidth required for the stream timing 2773 * and aggregates the stream bandwidth for the respective DP tunneling link 2774 * 2775 * return: dc_status 2776 */ 2777 enum dc_status dc_link_validate_dp_tunneling_bandwidth(const struct dc *dc, const struct dc_state *new_ctx); 2778 2779 /* 2780 * Get if ALPM is supported by the link 2781 */ 2782 void dc_link_get_alpm_support(struct dc_link *link, bool *auxless_support, 2783 bool *auxwake_support); 2784 2785 /* Sink Interfaces - A sink corresponds to a display output device */ 2786 2787 struct dc_container_id { 2788 // 128bit GUID in binary form 2789 unsigned char guid[16]; 2790 // 8 byte port ID -> ELD.PortID 2791 unsigned int portId[2]; 2792 // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName 2793 unsigned short manufacturerName; 2794 // 2 byte product code -> ELD.ProductCode 2795 unsigned short productCode; 2796 }; 2797 2798 2799 struct dc_sink_dsc_caps { 2800 // 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology), 2801 // 'false' if they are sink's DSC caps 2802 bool is_virtual_dpcd_dsc; 2803 // 'true' if MST topology supports DSC passthrough for sink 2804 // 'false' if MST topology does not support DSC passthrough 2805 bool is_dsc_passthrough_supported; 2806 struct dsc_dec_dpcd_caps dsc_dec_caps; 2807 }; 2808 2809 struct dc_sink_hblank_expansion_caps { 2810 // 'true' if these are virtual DPCD's HBlank expansion caps (immediately upstream of sink in MST topology), 2811 // 'false' if they are sink's HBlank expansion caps 2812 bool is_virtual_dpcd_hblank_expansion; 2813 struct hblank_expansion_dpcd_caps dpcd_caps; 2814 }; 2815 2816 struct dc_sink_fec_caps { 2817 bool is_rx_fec_supported; 2818 bool is_topology_fec_supported; 2819 }; 2820 2821 struct scdc_caps { 2822 union hdmi_scdc_manufacturer_OUI_data manufacturer_OUI; 2823 union hdmi_scdc_device_id_data device_id; 2824 }; 2825 2826 /* 2827 * The sink structure contains EDID and other display device properties 2828 */ 2829 struct dc_sink { 2830 enum signal_type sink_signal; 2831 struct dc_edid dc_edid; /* raw edid */ 2832 struct dc_edid_caps edid_caps; /* parse display caps */ 2833 struct dc_container_id *dc_container_id; 2834 uint32_t dongle_max_pix_clk; 2835 void *priv; 2836 struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX]; 2837 bool converter_disable_audio; 2838 2839 struct mccs_caps mccs_caps; 2840 struct scdc_caps scdc_caps; 2841 struct dc_sink_dsc_caps dsc_caps; 2842 struct dc_sink_fec_caps fec_caps; 2843 struct dc_sink_hblank_expansion_caps hblank_expansion_caps; 2844 2845 bool is_vsc_sdp_colorimetry_supported; 2846 2847 /* private to DC core */ 2848 struct dc_link *link; 2849 struct dc_context *ctx; 2850 2851 uint32_t sink_id; 2852 2853 /* private to dc_sink.c */ 2854 // refcount must be the last member in dc_sink, since we want the 2855 // sink structure to be logically cloneable up to (but not including) 2856 // refcount 2857 struct kref refcount; 2858 }; 2859 2860 void dc_sink_retain(struct dc_sink *sink); 2861 void dc_sink_release(struct dc_sink *sink); 2862 2863 struct dc_sink_init_data { 2864 enum signal_type sink_signal; 2865 struct dc_link *link; 2866 uint32_t dongle_max_pix_clk; 2867 bool converter_disable_audio; 2868 }; 2869 2870 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params); 2871 2872 /* Newer interfaces */ 2873 struct dc_cursor { 2874 struct dc_plane_address address; 2875 struct dc_cursor_attributes attributes; 2876 }; 2877 2878 2879 /* Interrupt interfaces */ 2880 enum dc_irq_source dc_interrupt_to_irq_source( 2881 struct dc *dc, 2882 uint32_t src_id, 2883 uint32_t ext_id); 2884 bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable); 2885 void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src); 2886 bool dc_get_flip_pending_on_otg(struct dc *dc, int otg_inst); 2887 enum dc_irq_source dc_get_hpd_irq_source_at_index( 2888 struct dc *dc, uint32_t link_index); 2889 2890 void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable); 2891 2892 /* Power Interfaces */ 2893 2894 void dc_set_power_state( 2895 struct dc *dc, 2896 enum dc_acpi_cm_power_state power_state); 2897 void dc_resume(struct dc *dc); 2898 2899 void dc_power_down_on_boot(struct dc *dc); 2900 2901 /* 2902 * HDCP Interfaces 2903 */ 2904 enum hdcp_message_status dc_process_hdcp_msg( 2905 enum signal_type signal, 2906 struct dc_link *link, 2907 struct hdcp_protection_message *message_info); 2908 bool dc_is_dmcu_initialized(struct dc *dc); 2909 2910 enum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping); 2911 void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg); 2912 2913 bool dc_is_plane_eligible_for_idle_optimizations(struct dc *dc, 2914 unsigned int pitch, 2915 unsigned int height, 2916 enum surface_pixel_format format, 2917 struct dc_cursor_attributes *cursor_attr); 2918 2919 #define dc_allow_idle_optimizations(dc, allow) dc_allow_idle_optimizations_internal(dc, allow, __func__) 2920 #define dc_exit_ips_for_hw_access(dc) dc_exit_ips_for_hw_access_internal(dc, __func__) 2921 2922 void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, const char *caller_name); 2923 void dc_exit_ips_for_hw_access_internal(struct dc *dc, const char *caller_name); 2924 bool dc_dmub_is_ips_idle_state(struct dc *dc); 2925 2926 /* set min and max memory clock to lowest and highest DPM level, respectively */ 2927 void dc_unlock_memory_clock_frequency(struct dc *dc); 2928 2929 /* set min memory clock to the min required for current mode, max to maxDPM */ 2930 void dc_lock_memory_clock_frequency(struct dc *dc); 2931 2932 /* set soft max for memclk, to be used for AC/DC switching clock limitations */ 2933 void dc_enable_dcmode_clk_limit(struct dc *dc, bool enable); 2934 2935 /* cleanup on driver unload */ 2936 void dc_hardware_release(struct dc *dc); 2937 2938 /* disables fw based mclk switch */ 2939 void dc_mclk_switch_using_fw_based_vblank_stretch_shut_down(struct dc *dc); 2940 2941 bool dc_set_psr_allow_active(struct dc *dc, bool enable); 2942 2943 bool dc_set_replay_allow_active(struct dc *dc, bool active); 2944 2945 bool dc_set_ips_disable(struct dc *dc, unsigned int disable_ips); 2946 2947 void dc_z10_restore(const struct dc *dc); 2948 void dc_z10_save_init(struct dc *dc); 2949 2950 bool dc_is_dmub_outbox_supported(struct dc *dc); 2951 bool dc_enable_dmub_notifications(struct dc *dc); 2952 2953 bool dc_abm_save_restore( 2954 struct dc *dc, 2955 struct dc_stream_state *stream, 2956 struct abm_save_restore *pData); 2957 2958 void dc_enable_dmub_outbox(struct dc *dc); 2959 2960 bool dc_process_dmub_aux_transfer_async(struct dc *dc, 2961 uint32_t link_index, 2962 struct aux_payload *payload); 2963 2964 /* 2965 * smart power OLED Interfaces 2966 */ 2967 bool dc_smart_power_oled_enable(const struct dc_link *link, bool enable, uint16_t peak_nits, 2968 uint8_t debug_control, uint16_t fixed_CLL, uint32_t triggerline); 2969 bool dc_smart_power_oled_get_max_cll(const struct dc_link *link, unsigned int *pCurrent_MaxCLL); 2970 2971 /* Get dc link index from dpia port index */ 2972 uint8_t get_link_index_from_dpia_port_index(const struct dc *dc, 2973 uint8_t dpia_port_index); 2974 2975 bool dc_process_dmub_set_config_async(struct dc *dc, 2976 uint32_t link_index, 2977 struct set_config_cmd_payload *payload, 2978 struct dmub_notification *notify); 2979 2980 enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc, 2981 uint32_t link_index, 2982 uint8_t mst_alloc_slots, 2983 uint8_t *mst_slots_in_use); 2984 2985 void dc_process_dmub_dpia_set_tps_notification(const struct dc *dc, uint32_t link_index, uint8_t tps); 2986 2987 void dc_process_dmub_dpia_hpd_int_enable(const struct dc *dc, 2988 uint32_t hpd_int_enable); 2989 2990 void dc_print_dmub_diagnostic_data(const struct dc *dc); 2991 2992 void dc_query_current_properties(struct dc *dc, struct dc_current_properties *properties); 2993 2994 struct dc_power_profile { 2995 int power_level; /* Lower is better */ 2996 }; 2997 2998 struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state *context); 2999 3000 unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context); 3001 3002 bool dc_get_host_router_index(const struct dc_link *link, unsigned int *host_router_index); 3003 3004 void dc_log_preos_dmcub_info(const struct dc *dc); 3005 3006 /* DSC Interfaces */ 3007 #include "dc_dsc.h" 3008 3009 void dc_get_visual_confirm_for_stream( 3010 struct dc *dc, 3011 struct dc_stream_state *stream_state, 3012 struct tg_color *color); 3013 3014 /* Disable acc mode Interfaces */ 3015 void dc_disable_accelerated_mode(struct dc *dc); 3016 3017 bool dc_is_timing_changed(struct dc_stream_state *cur_stream, 3018 struct dc_stream_state *new_stream); 3019 3020 bool dc_is_cursor_limit_pending(struct dc *dc); 3021 bool dc_can_clear_cursor_limit(const struct dc *dc); 3022 3023 /** 3024 * dc_get_underflow_debug_data_for_otg() - Retrieve underflow debug data. 3025 * 3026 * @dc: Pointer to the display core context. 3027 * @primary_otg_inst: Instance index of the primary OTG that underflowed. 3028 * @out_data: Pointer to a dc_underflow_debug_data struct to be filled with debug information. 3029 * 3030 * This function collects and logs underflow-related HW states when underflow happens, 3031 * including OTG underflow status, current read positions, frame count, and per-HUBP debug data. 3032 * The results are stored in the provided out_data structure for further analysis or logging. 3033 */ 3034 void dc_get_underflow_debug_data_for_otg(struct dc *dc, unsigned int primary_otg_inst, struct dc_underflow_debug_data *out_data); 3035 3036 void dc_get_power_feature_status(struct dc *dc, unsigned int primary_otg_inst, struct power_features *out_data); 3037 3038 /* 3039 * Software state variables used to program register fields across the display pipeline 3040 */ 3041 struct dc_register_software_state { 3042 /* HUBP register programming variables for each pipe */ 3043 struct { 3044 bool valid_plane_state; 3045 bool valid_stream; 3046 bool min_dc_gfx_version9; 3047 uint32_t vtg_sel; /* DCHUBP_CNTL->HUBP_VTG_SEL from pipe_ctx->stream_res.tg->inst */ 3048 uint32_t hubp_clock_enable; /* HUBP_CLK_CNTL->HUBP_CLOCK_ENABLE from power management */ 3049 uint32_t surface_pixel_format; /* DCSURF_SURFACE_CONFIG->SURFACE_PIXEL_FORMAT from plane_state->format */ 3050 uint32_t rotation_angle; /* DCSURF_SURFACE_CONFIG->ROTATION_ANGLE from plane_state->rotation */ 3051 uint32_t h_mirror_en; /* DCSURF_SURFACE_CONFIG->H_MIRROR_EN from plane_state->horizontal_mirror */ 3052 uint32_t surface_dcc_en; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_DCC_EN from dcc->enable */ 3053 uint32_t surface_size_width; /* HUBP_SIZE->SURFACE_SIZE_WIDTH from plane_size.surface_size.width */ 3054 uint32_t surface_size_height; /* HUBP_SIZE->SURFACE_SIZE_HEIGHT from plane_size.surface_size.height */ 3055 uint32_t pri_viewport_width; /* DCSURF_PRI_VIEWPORT_DIMENSION->PRI_VIEWPORT_WIDTH from scaler_data.viewport.width */ 3056 uint32_t pri_viewport_height; /* DCSURF_PRI_VIEWPORT_DIMENSION->PRI_VIEWPORT_HEIGHT from scaler_data.viewport.height */ 3057 uint32_t pri_viewport_x_start; /* DCSURF_PRI_VIEWPORT_START->PRI_VIEWPORT_X_START from scaler_data.viewport.x */ 3058 uint32_t pri_viewport_y_start; /* DCSURF_PRI_VIEWPORT_START->PRI_VIEWPORT_Y_START from scaler_data.viewport.y */ 3059 uint32_t cursor_enable; /* CURSOR_CONTROL->CURSOR_ENABLE from cursor_attributes.enable */ 3060 uint32_t cursor_width; /* CURSOR_SETTINGS->CURSOR_WIDTH from cursor_position.width */ 3061 uint32_t cursor_height; /* CURSOR_SETTINGS->CURSOR_HEIGHT from cursor_position.height */ 3062 3063 /* Additional DCC configuration */ 3064 uint32_t surface_dcc_ind_64b_blk; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_DCC_IND_64B_BLK from dcc.independent_64b_blks */ 3065 uint32_t surface_dcc_ind_128b_blk; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_DCC_IND_128B_BLK from dcc.independent_128b_blks */ 3066 3067 /* Surface pitch configuration */ 3068 uint32_t surface_pitch; /* DCSURF_SURFACE_PITCH->PITCH from plane_size.surface_pitch */ 3069 uint32_t meta_pitch; /* DCSURF_SURFACE_PITCH->META_PITCH from dcc.meta_pitch */ 3070 uint32_t chroma_pitch; /* DCSURF_SURFACE_PITCH_C->PITCH_C from plane_size.chroma_pitch */ 3071 uint32_t meta_pitch_c; /* DCSURF_SURFACE_PITCH_C->META_PITCH_C from dcc.meta_pitch_c */ 3072 3073 /* Surface addresses */ 3074 uint32_t primary_surface_address_low; /* DCSURF_PRIMARY_SURFACE_ADDRESS->PRIMARY_SURFACE_ADDRESS from address.grph.addr.low_part */ 3075 uint32_t primary_surface_address_high; /* DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH->PRIMARY_SURFACE_ADDRESS_HIGH from address.grph.addr.high_part */ 3076 uint32_t primary_meta_surface_address_low; /* DCSURF_PRIMARY_META_SURFACE_ADDRESS->PRIMARY_META_SURFACE_ADDRESS from address.grph.meta_addr.low_part */ 3077 uint32_t primary_meta_surface_address_high; /* DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH->PRIMARY_META_SURFACE_ADDRESS_HIGH from address.grph.meta_addr.high_part */ 3078 3079 /* TMZ configuration */ 3080 uint32_t primary_surface_tmz; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_TMZ from address.tmz_surface */ 3081 uint32_t primary_meta_surface_tmz; /* DCSURF_SURFACE_CONTROL->PRIMARY_META_SURFACE_TMZ from address.tmz_surface */ 3082 3083 /* Tiling configuration */ 3084 uint32_t sw_mode; /* DCSURF_TILING_CONFIG->SW_MODE from tiling_info.gfx9.swizzle */ 3085 uint32_t num_pipes; /* DCSURF_ADDR_CONFIG->NUM_PIPES from tiling_info.gfx9.num_pipes */ 3086 uint32_t num_banks; /* DCSURF_ADDR_CONFIG->NUM_BANKS from tiling_info.gfx9.num_banks */ 3087 uint32_t pipe_interleave; /* DCSURF_ADDR_CONFIG->PIPE_INTERLEAVE from tiling_info.gfx9.pipe_interleave */ 3088 uint32_t num_shader_engines; /* DCSURF_ADDR_CONFIG->NUM_SE from tiling_info.gfx9.num_shader_engines */ 3089 uint32_t num_rb_per_se; /* DCSURF_ADDR_CONFIG->NUM_RB_PER_SE from tiling_info.gfx9.num_rb_per_se */ 3090 uint32_t num_pkrs; /* DCSURF_ADDR_CONFIG->NUM_PKRS from tiling_info.gfx9.num_pkrs */ 3091 3092 /* DML Request Size Configuration - Luma */ 3093 uint32_t rq_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->CHUNK_SIZE from rq_regs.rq_regs_l.chunk_size */ 3094 uint32_t rq_min_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->MIN_CHUNK_SIZE from rq_regs.rq_regs_l.min_chunk_size */ 3095 uint32_t rq_meta_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->META_CHUNK_SIZE from rq_regs.rq_regs_l.meta_chunk_size */ 3096 uint32_t rq_min_meta_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->MIN_META_CHUNK_SIZE from rq_regs.rq_regs_l.min_meta_chunk_size */ 3097 uint32_t rq_dpte_group_size; /* DCHUBP_REQ_SIZE_CONFIG->DPTE_GROUP_SIZE from rq_regs.rq_regs_l.dpte_group_size */ 3098 uint32_t rq_mpte_group_size; /* DCHUBP_REQ_SIZE_CONFIG->MPTE_GROUP_SIZE from rq_regs.rq_regs_l.mpte_group_size */ 3099 uint32_t rq_swath_height_l; /* DCHUBP_REQ_SIZE_CONFIG->SWATH_HEIGHT_L from rq_regs.rq_regs_l.swath_height */ 3100 uint32_t rq_pte_row_height_l; /* DCHUBP_REQ_SIZE_CONFIG->PTE_ROW_HEIGHT_L from rq_regs.rq_regs_l.pte_row_height */ 3101 3102 /* DML Request Size Configuration - Chroma */ 3103 uint32_t rq_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->CHUNK_SIZE_C from rq_regs.rq_regs_c.chunk_size */ 3104 uint32_t rq_min_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->MIN_CHUNK_SIZE_C from rq_regs.rq_regs_c.min_chunk_size */ 3105 uint32_t rq_meta_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->META_CHUNK_SIZE_C from rq_regs.rq_regs_c.meta_chunk_size */ 3106 uint32_t rq_min_meta_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->MIN_META_CHUNK_SIZE_C from rq_regs.rq_regs_c.min_meta_chunk_size */ 3107 uint32_t rq_dpte_group_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->DPTE_GROUP_SIZE_C from rq_regs.rq_regs_c.dpte_group_size */ 3108 uint32_t rq_mpte_group_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->MPTE_GROUP_SIZE_C from rq_regs.rq_regs_c.mpte_group_size */ 3109 uint32_t rq_swath_height_c; /* DCHUBP_REQ_SIZE_CONFIG_C->SWATH_HEIGHT_C from rq_regs.rq_regs_c.swath_height */ 3110 uint32_t rq_pte_row_height_c; /* DCHUBP_REQ_SIZE_CONFIG_C->PTE_ROW_HEIGHT_C from rq_regs.rq_regs_c.pte_row_height */ 3111 3112 /* DML Expansion Modes */ 3113 uint32_t drq_expansion_mode; /* DCN_EXPANSION_MODE->DRQ_EXPANSION_MODE from rq_regs.drq_expansion_mode */ 3114 uint32_t prq_expansion_mode; /* DCN_EXPANSION_MODE->PRQ_EXPANSION_MODE from rq_regs.prq_expansion_mode */ 3115 uint32_t mrq_expansion_mode; /* DCN_EXPANSION_MODE->MRQ_EXPANSION_MODE from rq_regs.mrq_expansion_mode */ 3116 uint32_t crq_expansion_mode; /* DCN_EXPANSION_MODE->CRQ_EXPANSION_MODE from rq_regs.crq_expansion_mode */ 3117 3118 /* DML DLG parameters - nominal */ 3119 uint32_t dst_y_per_vm_vblank; /* NOM_PARAMETERS_0->DST_Y_PER_VM_VBLANK from dlg_regs.dst_y_per_vm_vblank */ 3120 uint32_t dst_y_per_row_vblank; /* NOM_PARAMETERS_0->DST_Y_PER_ROW_VBLANK from dlg_regs.dst_y_per_row_vblank */ 3121 uint32_t dst_y_per_vm_flip; /* NOM_PARAMETERS_1->DST_Y_PER_VM_FLIP from dlg_regs.dst_y_per_vm_flip */ 3122 uint32_t dst_y_per_row_flip; /* NOM_PARAMETERS_1->DST_Y_PER_ROW_FLIP from dlg_regs.dst_y_per_row_flip */ 3123 3124 /* DML prefetch settings */ 3125 uint32_t dst_y_prefetch; /* PREFETCH_SETTINS->DST_Y_PREFETCH from dlg_regs.dst_y_prefetch */ 3126 uint32_t vratio_prefetch; /* PREFETCH_SETTINS->VRATIO_PREFETCH from dlg_regs.vratio_prefetch */ 3127 uint32_t vratio_prefetch_c; /* PREFETCH_SETTINS_C->VRATIO_PREFETCH_C from dlg_regs.vratio_prefetch_c */ 3128 3129 /* TTU parameters */ 3130 uint32_t qos_level_low_wm; /* TTU_CNTL1->QoSLevelLowWaterMark from ttu_regs.qos_level_low_wm */ 3131 uint32_t qos_level_high_wm; /* TTU_CNTL1->QoSLevelHighWaterMark from ttu_regs.qos_level_high_wm */ 3132 uint32_t qos_level_flip; /* TTU_CNTL2->QoS_LEVEL_FLIP_L from ttu_regs.qos_level_flip */ 3133 uint32_t min_ttu_vblank; /* DCN_GLOBAL_TTU_CNTL->MIN_TTU_VBLANK from ttu_regs.min_ttu_vblank */ 3134 } hubp[MAX_PIPES]; 3135 3136 /* HUBBUB register programming variables */ 3137 struct { 3138 /* Individual DET buffer control per pipe - software state that programs DET registers */ 3139 uint32_t det0_size; /* DCHUBBUB_DET0_CTRL->DET0_SIZE from hubbub->funcs->program_det_size(hubbub, 0, det_buffer_size_kb) */ 3140 uint32_t det1_size; /* DCHUBBUB_DET1_CTRL->DET1_SIZE from hubbub->funcs->program_det_size(hubbub, 1, det_buffer_size_kb) */ 3141 uint32_t det2_size; /* DCHUBBUB_DET2_CTRL->DET2_SIZE from hubbub->funcs->program_det_size(hubbub, 2, det_buffer_size_kb) */ 3142 uint32_t det3_size; /* DCHUBBUB_DET3_CTRL->DET3_SIZE from hubbub->funcs->program_det_size(hubbub, 3, det_buffer_size_kb) */ 3143 3144 /* Compression buffer control - software state that programs COMPBUF registers */ 3145 uint32_t compbuf_size; /* DCHUBBUB_COMPBUF_CTRL->COMPBUF_SIZE from hubbub->funcs->program_compbuf_size(hubbub, compbuf_size_kb, safe_to_increase) */ 3146 uint32_t compbuf_reserved_space_64b; /* COMPBUF_RESERVED_SPACE->COMPBUF_RESERVED_SPACE_64B from hubbub2->pixel_chunk_size / 32 */ 3147 uint32_t compbuf_reserved_space_zs; /* COMPBUF_RESERVED_SPACE->COMPBUF_RESERVED_SPACE_ZS from hubbub2->pixel_chunk_size / 128 */ 3148 } hubbub; 3149 3150 /* DPP register programming variables for each pipe (simplified for available fields) */ 3151 struct { 3152 uint32_t dpp_clock_enable; /* DPP_CONTROL->DPP_CLOCK_ENABLE from dppclk_enable */ 3153 3154 /* Recout (Rectangle of Interest) configuration */ 3155 uint32_t recout_start_x; /* RECOUT_START->RECOUT_START_X from pipe_ctx->plane_res.scl_data.recout.x */ 3156 uint32_t recout_start_y; /* RECOUT_START->RECOUT_START_Y from pipe_ctx->plane_res.scl_data.recout.y */ 3157 uint32_t recout_width; /* RECOUT_SIZE->RECOUT_WIDTH from pipe_ctx->plane_res.scl_data.recout.width */ 3158 uint32_t recout_height; /* RECOUT_SIZE->RECOUT_HEIGHT from pipe_ctx->plane_res.scl_data.recout.height */ 3159 3160 /* MPC (Multiple Pipe/Plane Combiner) size configuration */ 3161 uint32_t mpc_width; /* MPC_SIZE->MPC_WIDTH from pipe_ctx->plane_res.scl_data.h_active */ 3162 uint32_t mpc_height; /* MPC_SIZE->MPC_HEIGHT from pipe_ctx->plane_res.scl_data.v_active */ 3163 3164 /* DSCL mode configuration */ 3165 uint32_t dscl_mode; /* SCL_MODE->DSCL_MODE from pipe_ctx->plane_res.scl_data.dscl_prog_data.dscl_mode */ 3166 3167 /* Scaler ratios (simplified to integer parts) */ 3168 uint32_t horz_ratio_int; /* SCL_HORZ_FILTER_SCALE_RATIO->SCL_H_SCALE_RATIO integer part from ratios.horz */ 3169 uint32_t vert_ratio_int; /* SCL_VERT_FILTER_SCALE_RATIO->SCL_V_SCALE_RATIO integer part from ratios.vert */ 3170 3171 /* Basic scaler taps */ 3172 uint32_t h_taps; /* SCL_TAP_CONTROL->SCL_H_NUM_TAPS from taps.h_taps */ 3173 uint32_t v_taps; /* SCL_TAP_CONTROL->SCL_V_NUM_TAPS from taps.v_taps */ 3174 } dpp[MAX_PIPES]; 3175 3176 /* DCCG register programming variables */ 3177 struct { 3178 /* Core Display Clock Control */ 3179 uint32_t dispclk_khz; /* DENTIST_DISPCLK_CNTL->DENTIST_DISPCLK_WDIVIDER from clk_mgr.dispclk_khz */ 3180 uint32_t dc_mem_global_pwr_req_dis; /* DC_MEM_GLOBAL_PWR_REQ_CNTL->DC_MEM_GLOBAL_PWR_REQ_DIS from memory power management settings */ 3181 3182 /* DPP Clock Control - 4 fields per pipe */ 3183 uint32_t dppclk_khz[MAX_PIPES]; /* DPPCLK_CTRL->DPPCLK_R_GATE_DISABLE from dpp_clocks[pipe] */ 3184 uint32_t dppclk_enable[MAX_PIPES]; /* DPPCLK_CTRL->DPPCLK0_EN,DPPCLK1_EN,DPPCLK2_EN,DPPCLK3_EN from dccg31_update_dpp_dto() */ 3185 uint32_t dppclk_dto_enable[MAX_PIPES]; /* DPPCLK_DTO_CTRL->DPPCLK_DTO_ENABLE from dccg->dpp_clock_gated[dpp_inst] state */ 3186 uint32_t dppclk_dto_phase[MAX_PIPES]; /* DPPCLK0_DTO_PARAM->DPPCLK0_DTO_PHASE from phase calculation req_dppclk/ref_dppclk */ 3187 uint32_t dppclk_dto_modulo[MAX_PIPES]; /* DPPCLK0_DTO_PARAM->DPPCLK0_DTO_MODULO from modulo = 0xff */ 3188 3189 /* DSC Clock Control - 4 fields per DSC resource */ 3190 uint32_t dscclk_khz[MAX_PIPES]; /* DSCCLK_DTO_CTRL->DSCCLK_DTO_ENABLE from dsc_clocks */ 3191 uint32_t dscclk_dto_enable[MAX_PIPES]; /* DSCCLK_DTO_CTRL->DSCCLK0_DTO_ENABLE,DSCCLK1_DTO_ENABLE,DSCCLK2_DTO_ENABLE,DSCCLK3_DTO_ENABLE */ 3192 uint32_t dscclk_dto_phase[MAX_PIPES]; /* DSCCLK0_DTO_PARAM->DSCCLK0_DTO_PHASE from dccg31_enable_dscclk() */ 3193 uint32_t dscclk_dto_modulo[MAX_PIPES]; /* DSCCLK0_DTO_PARAM->DSCCLK0_DTO_MODULO from dccg31_enable_dscclk() */ 3194 3195 /* Pixel Clock Control - per pipe */ 3196 uint32_t pixclk_khz[MAX_PIPES]; /* PIXCLK_RESYNC_CNTL->PIXCLK_RESYNC_ENABLE from stream.timing.pix_clk_100hz */ 3197 uint32_t otg_pixel_rate_div[MAX_PIPES]; /* OTG_PIXEL_RATE_DIV->OTG_PIXEL_RATE_DIV from OTG pixel rate divider control */ 3198 uint32_t dtbclk_dto_enable[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->DTBCLK_DTO_ENABLE from dccg31_set_dtbclk_dto() */ 3199 uint32_t pipe_dto_src_sel[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->PIPE_DTO_SRC_SEL from dccg31_set_dtbclk_dto() source selection */ 3200 uint32_t dtbclk_dto_div[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->DTBCLK_DTO_DIV from dtbdto_div calculation */ 3201 uint32_t otg_add_pixel[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->OTG_ADD_PIXEL from dccg31_otg_add_pixel() */ 3202 uint32_t otg_drop_pixel[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->OTG_DROP_PIXEL from dccg31_otg_drop_pixel() */ 3203 3204 /* DTBCLK DTO Control - 4 DTOs */ 3205 uint32_t dtbclk_dto_modulo[4]; /* DTBCLK_DTO0_MODULO->DTBCLK_DTO0_MODULO from dccg31_set_dtbclk_dto() modulo calculation */ 3206 uint32_t dtbclk_dto_phase[4]; /* DTBCLK_DTO0_PHASE->DTBCLK_DTO0_PHASE from phase calculation pixclk_khz/ref_dtbclk_khz */ 3207 uint32_t dtbclk_dto_dbuf_en; /* DTBCLK_DTO_DBUF_EN->DTBCLK DTO data buffer enable */ 3208 3209 /* DP Stream Clock Control - 4 pipes */ 3210 uint32_t dpstreamclk_enable[MAX_PIPES]; /* DPSTREAMCLK_CNTL->DPSTREAMCLK_PIPE0_EN,DPSTREAMCLK_PIPE1_EN,DPSTREAMCLK_PIPE2_EN,DPSTREAMCLK_PIPE3_EN */ 3211 uint32_t dp_dto_modulo[4]; /* DP_DTO0_MODULO->DP_DTO0_MODULO from DP stream DTO programming */ 3212 uint32_t dp_dto_phase[4]; /* DP_DTO0_PHASE->DP_DTO0_PHASE from DP stream DTO programming */ 3213 uint32_t dp_dto_dbuf_en; /* DP_DTO_DBUF_EN->DP DTO data buffer enable */ 3214 3215 /* PHY Symbol Clock Control - 5 PHYs (A,B,C,D,E) */ 3216 uint32_t phy_symclk_force_en[5]; /* PHYASYMCLK_CLOCK_CNTL->PHYASYMCLK_FORCE_EN from dccg31_set_physymclk() force_enable */ 3217 uint32_t phy_symclk_force_src_sel[5]; /* PHYASYMCLK_CLOCK_CNTL->PHYASYMCLK_FORCE_SRC_SEL from dccg31_set_physymclk() clk_src */ 3218 uint32_t phy_symclk_gate_disable[5]; /* DCCG_GATE_DISABLE_CNTL2->PHYASYMCLK_GATE_DISABLE from debug.root_clock_optimization.bits.physymclk */ 3219 3220 /* SYMCLK32 SE Control - 4 instances */ 3221 uint32_t symclk32_se_src_sel[4]; /* SYMCLK32_SE_CNTL->SYMCLK32_SE0_SRC_SEL from dccg31_enable_symclk32_se() with get_phy_mux_symclk() mapping */ 3222 uint32_t symclk32_se_enable[4]; /* SYMCLK32_SE_CNTL->SYMCLK32_SE0_EN from dccg31_enable_symclk32_se() enable */ 3223 uint32_t symclk32_se_gate_disable[4]; /* DCCG_GATE_DISABLE_CNTL3->SYMCLK32_SE0_GATE_DISABLE from debug.root_clock_optimization.bits.symclk32_se */ 3224 3225 /* SYMCLK32 LE Control - 2 instances */ 3226 uint32_t symclk32_le_src_sel[2]; /* SYMCLK32_LE_CNTL->SYMCLK32_LE0_SRC_SEL from dccg31_enable_symclk32_le() phyd32clk source */ 3227 uint32_t symclk32_le_enable[2]; /* SYMCLK32_LE_CNTL->SYMCLK32_LE0_EN from dccg31_enable_symclk32_le() enable */ 3228 uint32_t symclk32_le_gate_disable[2]; /* DCCG_GATE_DISABLE_CNTL3->SYMCLK32_LE0_GATE_DISABLE from debug.root_clock_optimization.bits.symclk32_le */ 3229 3230 /* HDMI Clock Control */ 3231 uint32_t hdmicharclk_enable; /* HDMICHARCLK0_CLOCK_CNTL->HDMICHARCLK0_EN from dccg31_enable_hdmicharclk() */ 3232 uint32_t hdmicharclk_src_sel; /* HDMICHARCLK0_CLOCK_CNTL->HDMICHARCLK0_SRC_SEL from dccg31_enable_hdmicharclk() phypll_inst source */ 3233 uint32_t hdmistreamclk_src_sel; /* HDMISTREAMCLK_CNTL->HDMISTREAMCLK0_SRC_SEL from dccg31_set_hdmistreamclk() src selection */ 3234 uint32_t hdmistreamclk_dto_force_dis; /* HDMISTREAMCLK_CNTL->HDMISTREAMCLK0_DTO_FORCE_DIS from dccg31_set_hdmistreamclk() DTO force bypass */ 3235 uint32_t hdmistreamclk_dto_phase; /* HDMISTREAMCLK0_DTO_PARAM->HDMISTREAMCLK0_DTO_PHASE from dccg31_disable_hdmistreamclk() */ 3236 uint32_t hdmistreamclk_dto_modulo; /* HDMISTREAMCLK0_DTO_PARAM->HDMISTREAMCLK0_DTO_MODULO from dccg31_disable_hdmistreamclk() */ 3237 3238 /* DPIA Clock Control */ 3239 uint32_t dpiaclk_540m_dto_modulo; /* DPIACLK_540M_DTO_MODULO->DPIA 540MHz DTO modulo */ 3240 uint32_t dpiaclk_540m_dto_phase; /* DPIACLK_540M_DTO_PHASE->DPIA 540MHz DTO phase */ 3241 uint32_t dpiaclk_810m_dto_modulo; /* DPIACLK_810M_DTO_MODULO->DPIA 810MHz DTO modulo */ 3242 uint32_t dpiaclk_810m_dto_phase; /* DPIACLK_810M_DTO_PHASE->DPIA 810MHz DTO phase */ 3243 uint32_t dpiaclk_dto_cntl; /* DPIACLK_DTO_CNTL->DPIA clock DTO control */ 3244 uint32_t dpiasymclk_cntl; /* DPIASYMCLK_CNTL->DPIA symbol clock control */ 3245 3246 /* Clock Gating Control */ 3247 uint32_t dccg_gate_disable_cntl; /* DCCG_GATE_DISABLE_CNTL->Clock gate disable control from dccg31_init() */ 3248 uint32_t dpstreamclk_gate_disable; /* DCCG_GATE_DISABLE_CNTL3->DPSTREAMCLK_GATE_DISABLE from debug.root_clock_optimization.bits.dpstream */ 3249 uint32_t dpstreamclk_root_gate_disable; /* DCCG_GATE_DISABLE_CNTL3->DPSTREAMCLK_ROOT_GATE_DISABLE from debug.root_clock_optimization.bits.dpstream */ 3250 3251 /* VSync Control */ 3252 uint32_t vsync_cnt_ctrl; /* DCCG_VSYNC_CNT_CTRL->VSync counter control */ 3253 uint32_t vsync_cnt_int_ctrl; /* DCCG_VSYNC_CNT_INT_CTRL->VSync counter interrupt control */ 3254 uint32_t vsync_otg_latch_value[6]; /* DCCG_VSYNC_OTG0_LATCH_VALUE->OTG0 VSync latch value (for OTG0-5) */ 3255 3256 /* Time Base Control */ 3257 uint32_t microsecond_time_base_div; /* MICROSECOND_TIME_BASE_DIV->Microsecond time base divider */ 3258 uint32_t millisecond_time_base_div; /* MILLISECOND_TIME_BASE_DIV->Millisecond time base divider */ 3259 } dccg; 3260 3261 /* DSC essential configuration for underflow analysis */ 3262 struct { 3263 /* DSC active state - critical for bandwidth analysis */ 3264 uint32_t dsc_clock_enable; /* DSC enabled - affects bandwidth requirements */ 3265 3266 /* DSC configuration affecting bandwidth and timing */ 3267 uint32_t dsc_num_slices_h; /* Horizontal slice count - affects throughput */ 3268 uint32_t dsc_num_slices_v; /* Vertical slice count - affects throughput */ 3269 uint32_t dsc_bits_per_pixel; /* Compression ratio - affects bandwidth */ 3270 3271 /* OPP integration - affects pipeline flow */ 3272 uint32_t dscrm_dsc_forward_enable; /* DSC forwarding to OPP enabled */ 3273 uint32_t dscrm_dsc_opp_pipe_source; /* Which OPP receives DSC output */ 3274 } dsc[MAX_PIPES]; 3275 3276 /* MPC register programming variables */ 3277 struct { 3278 /* MPCC blending tree and mode control */ 3279 uint32_t mpcc_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_MODE from blend_cfg.blend_mode */ 3280 uint32_t mpcc_alpha_blend_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_ALPHA_BLND_MODE from blend_cfg.alpha_mode */ 3281 uint32_t mpcc_alpha_multiplied_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_ALPHA_MULTIPLIED_MODE from blend_cfg.pre_multiplied_alpha */ 3282 uint32_t mpcc_blnd_active_overlap_only[MAX_PIPES]; /* MPCC_CONTROL->MPCC_BLND_ACTIVE_OVERLAP_ONLY from blend_cfg.overlap_only */ 3283 uint32_t mpcc_global_alpha[MAX_PIPES]; /* MPCC_CONTROL->MPCC_GLOBAL_ALPHA from blend_cfg.global_alpha */ 3284 uint32_t mpcc_global_gain[MAX_PIPES]; /* MPCC_CONTROL->MPCC_GLOBAL_GAIN from blend_cfg.global_gain */ 3285 uint32_t mpcc_bg_bpc[MAX_PIPES]; /* MPCC_CONTROL->MPCC_BG_BPC from background color depth */ 3286 uint32_t mpcc_bot_gain_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_BOT_GAIN_MODE from bottom layer gain control */ 3287 3288 /* MPCC blending tree connections */ 3289 uint32_t mpcc_bot_sel[MAX_PIPES]; /* MPCC_BOT_SEL->MPCC_BOT_SEL from mpcc_state->bot_sel */ 3290 uint32_t mpcc_top_sel[MAX_PIPES]; /* MPCC_TOP_SEL->MPCC_TOP_SEL from mpcc_state->dpp_id */ 3291 3292 /* MPCC output gamma control */ 3293 uint32_t mpcc_ogam_mode[MAX_PIPES]; /* MPCC_OGAM_CONTROL->MPCC_OGAM_MODE from output gamma mode */ 3294 uint32_t mpcc_ogam_select[MAX_PIPES]; /* MPCC_OGAM_CONTROL->MPCC_OGAM_SELECT from gamma LUT bank selection */ 3295 uint32_t mpcc_ogam_pwl_disable[MAX_PIPES]; /* MPCC_OGAM_CONTROL->MPCC_OGAM_PWL_DISABLE from PWL control */ 3296 3297 /* MPCC pipe assignment and status */ 3298 uint32_t mpcc_opp_id[MAX_PIPES]; /* MPCC_OPP_ID->MPCC_OPP_ID from mpcc_state->opp_id */ 3299 uint32_t mpcc_idle[MAX_PIPES]; /* MPCC_STATUS->MPCC_IDLE from mpcc idle status */ 3300 uint32_t mpcc_busy[MAX_PIPES]; /* MPCC_STATUS->MPCC_BUSY from mpcc busy status */ 3301 3302 /* MPC output processing */ 3303 uint32_t mpc_out_csc_mode; /* MPC_OUT_CSC_COEF->MPC_OUT_CSC_MODE from output_csc */ 3304 uint32_t mpc_out_gamma_mode; /* MPC_OUT_GAMMA_LUT->MPC_OUT_GAMMA_MODE from output_gamma */ 3305 } mpc; 3306 3307 /* OPP register programming variables for each pipe */ 3308 struct { 3309 /* Display Pattern Generator (DPG) Control - 19 fields from DPG_CONTROL register */ 3310 uint32_t dpg_enable; /* DPG_CONTROL->DPG_EN from test_pattern parameter (enable/disable) */ 3311 3312 /* Format Control (FMT) - 18 fields from FMT_CONTROL register */ 3313 uint32_t fmt_pixel_encoding; /* FMT_CONTROL->FMT_PIXEL_ENCODING from clamping->pixel_encoding */ 3314 uint32_t fmt_subsampling_mode; /* FMT_CONTROL->FMT_SUBSAMPLING_MODE from force_chroma_subsampling_1tap */ 3315 uint32_t fmt_cbcr_bit_reduction_bypass; /* FMT_CONTROL->FMT_CBCR_BIT_REDUCTION_BYPASS from pixel_encoding bypass control */ 3316 uint32_t fmt_stereosync_override; /* FMT_CONTROL->FMT_STEREOSYNC_OVERRIDE from stereo timing override */ 3317 uint32_t fmt_spatial_dither_frame_counter_max; /* FMT_CONTROL->FMT_SPATIAL_DITHER_FRAME_COUNTER_MAX from fmt_bit_depth->flags */ 3318 uint32_t fmt_spatial_dither_frame_counter_bit_swap; /* FMT_CONTROL->FMT_SPATIAL_DITHER_FRAME_COUNTER_BIT_SWAP from dither control */ 3319 uint32_t fmt_truncate_enable; /* FMT_CONTROL->FMT_TRUNCATE_EN from fmt_bit_depth->flags.TRUNCATE_ENABLED */ 3320 uint32_t fmt_truncate_depth; /* FMT_CONTROL->FMT_TRUNCATE_DEPTH from fmt_bit_depth->flags.TRUNCATE_DEPTH */ 3321 uint32_t fmt_truncate_mode; /* FMT_CONTROL->FMT_TRUNCATE_MODE from fmt_bit_depth->flags.TRUNCATE_MODE */ 3322 uint32_t fmt_spatial_dither_enable; /* FMT_CONTROL->FMT_SPATIAL_DITHER_EN from fmt_bit_depth->flags.SPATIAL_DITHER_ENABLED */ 3323 uint32_t fmt_spatial_dither_mode; /* FMT_CONTROL->FMT_SPATIAL_DITHER_MODE from fmt_bit_depth->flags.SPATIAL_DITHER_MODE */ 3324 uint32_t fmt_spatial_dither_depth; /* FMT_CONTROL->FMT_SPATIAL_DITHER_DEPTH from fmt_bit_depth->flags.SPATIAL_DITHER_DEPTH */ 3325 uint32_t fmt_temporal_dither_enable; /* FMT_CONTROL->FMT_TEMPORAL_DITHER_EN from fmt_bit_depth->flags.TEMPORAL_DITHER_ENABLED */ 3326 uint32_t fmt_clamp_data_enable; /* FMT_CONTROL->FMT_CLAMP_DATA_EN from clamping->clamping_range enable */ 3327 uint32_t fmt_clamp_color_format; /* FMT_CONTROL->FMT_CLAMP_COLOR_FORMAT from clamping->color_format */ 3328 uint32_t fmt_dynamic_exp_enable; /* FMT_CONTROL->FMT_DYNAMIC_EXP_EN from color_sp/color_dpth/signal */ 3329 uint32_t fmt_dynamic_exp_mode; /* FMT_CONTROL->FMT_DYNAMIC_EXP_MODE from color space mode mapping */ 3330 uint32_t fmt_bit_depth_control; /* Legacy field - kept for compatibility */ 3331 3332 /* OPP Pipe Control - 1 field from OPP_PIPE_CONTROL register */ 3333 uint32_t opp_pipe_clock_enable; /* OPP_PIPE_CONTROL->OPP_PIPE_CLOCK_EN from enable parameter (bool) */ 3334 3335 /* OPP CRC Control - 3 fields from OPP_PIPE_CRC_CONTROL register */ 3336 uint32_t opp_crc_enable; /* OPP_PIPE_CRC_CONTROL->CRC_EN from CRC enable control */ 3337 uint32_t opp_crc_select_source; /* OPP_PIPE_CRC_CONTROL->CRC_SELECT_SOURCE from CRC source selection */ 3338 uint32_t opp_crc_stereo_cont; /* OPP_PIPE_CRC_CONTROL->CRC_STEREO_CONT from stereo continuous CRC */ 3339 3340 /* Output Buffer (OPPBUF) Control - 6 fields from OPPBUF_CONTROL register */ 3341 uint32_t oppbuf_active_width; /* OPPBUF_CONTROL->OPPBUF_ACTIVE_WIDTH from oppbuf_params->active_width */ 3342 uint32_t oppbuf_pixel_repetition; /* OPPBUF_CONTROL->OPPBUF_PIXEL_REPETITION from oppbuf_params->pixel_repetition */ 3343 uint32_t oppbuf_display_segmentation; /* OPPBUF_CONTROL->OPPBUF_DISPLAY_SEGMENTATION from oppbuf_params->mso_segmentation */ 3344 uint32_t oppbuf_overlap_pixel_num; /* OPPBUF_CONTROL->OPPBUF_OVERLAP_PIXEL_NUM from oppbuf_params->mso_overlap_pixel_num */ 3345 uint32_t oppbuf_3d_vact_space1_size; /* OPPBUF_CONTROL->OPPBUF_3D_VACT_SPACE1_SIZE from 3D timing space1_size */ 3346 uint32_t oppbuf_3d_vact_space2_size; /* OPPBUF_CONTROL->OPPBUF_3D_VACT_SPACE2_SIZE from 3D timing space2_size */ 3347 3348 /* DSC Forward Config - 3 fields from DSCRM_DSC_FORWARD_CONFIG register */ 3349 uint32_t dscrm_dsc_forward_enable; /* DSCRM_DSC_FORWARD_CONFIG->DSCRM_DSC_FORWARD_EN from DSC forward enable control */ 3350 uint32_t dscrm_dsc_opp_pipe_source; /* DSCRM_DSC_FORWARD_CONFIG->DSCRM_DSC_OPP_PIPE_SOURCE from opp_pipe parameter */ 3351 uint32_t dscrm_dsc_forward_enable_status; /* DSCRM_DSC_FORWARD_CONFIG->DSCRM_DSC_FORWARD_EN_STATUS from DSC forward status (read-only) */ 3352 } opp[MAX_PIPES]; 3353 3354 /* OPTC register programming variables for each pipe */ 3355 struct { 3356 uint32_t otg_master_inst; 3357 3358 /* OTG_CONTROL register - 5 fields for OTG control */ 3359 uint32_t otg_master_enable; /* OTG_CONTROL->OTG_MASTER_EN from timing enable/disable control */ 3360 uint32_t otg_disable_point_cntl; /* OTG_CONTROL->OTG_DISABLE_POINT_CNTL from disable timing control */ 3361 uint32_t otg_start_point_cntl; /* OTG_CONTROL->OTG_START_POINT_CNTL from start timing control */ 3362 uint32_t otg_field_number_cntl; /* OTG_CONTROL->OTG_FIELD_NUMBER_CNTL from interlace field control */ 3363 uint32_t otg_out_mux; /* OTG_CONTROL->OTG_OUT_MUX from output mux selection */ 3364 3365 /* OTG Horizontal Timing - 7 fields */ 3366 uint32_t otg_h_total; /* OTG_H_TOTAL->OTG_H_TOTAL from dc_crtc_timing->h_total */ 3367 uint32_t otg_h_blank_start; /* OTG_H_BLANK_START_END->OTG_H_BLANK_START from dc_crtc_timing->h_front_porch */ 3368 uint32_t otg_h_blank_end; /* OTG_H_BLANK_START_END->OTG_H_BLANK_END from dc_crtc_timing->h_addressable_video_pixel_width */ 3369 uint32_t otg_h_sync_start; /* OTG_H_SYNC_A->OTG_H_SYNC_A_START from dc_crtc_timing->h_sync_width */ 3370 uint32_t otg_h_sync_end; /* OTG_H_SYNC_A->OTG_H_SYNC_A_END from calculated sync end position */ 3371 uint32_t otg_h_sync_polarity; /* OTG_H_SYNC_A_CNTL->OTG_H_SYNC_A_POL from dc_crtc_timing->flags.HSYNC_POSITIVE_POLARITY */ 3372 uint32_t otg_h_timing_div_mode; /* OTG_H_TIMING_CNTL->OTG_H_TIMING_DIV_MODE from horizontal timing division mode */ 3373 3374 /* OTG Vertical Timing - 7 fields */ 3375 uint32_t otg_v_total; /* OTG_V_TOTAL->OTG_V_TOTAL from dc_crtc_timing->v_total */ 3376 uint32_t otg_v_blank_start; /* OTG_V_BLANK_START_END->OTG_V_BLANK_START from dc_crtc_timing->v_front_porch */ 3377 uint32_t otg_v_blank_end; /* OTG_V_BLANK_START_END->OTG_V_BLANK_END from dc_crtc_timing->v_addressable_video_line_width */ 3378 uint32_t otg_v_sync_start; /* OTG_V_SYNC_A->OTG_V_SYNC_A_START from dc_crtc_timing->v_sync_width */ 3379 uint32_t otg_v_sync_end; /* OTG_V_SYNC_A->OTG_V_SYNC_A_END from calculated sync end position */ 3380 uint32_t otg_v_sync_polarity; /* OTG_V_SYNC_A_CNTL->OTG_V_SYNC_A_POL from dc_crtc_timing->flags.VSYNC_POSITIVE_POLARITY */ 3381 uint32_t otg_v_sync_mode; /* OTG_V_SYNC_A_CNTL->OTG_V_SYNC_MODE from sync mode selection */ 3382 3383 /* OTG DRR (Dynamic Refresh Rate) Control - 8 fields */ 3384 uint32_t otg_v_total_max; /* OTG_V_TOTAL_MAX->OTG_V_TOTAL_MAX from drr_params->vertical_total_max */ 3385 uint32_t otg_v_total_min; /* OTG_V_TOTAL_MIN->OTG_V_TOTAL_MIN from drr_params->vertical_total_min */ 3386 uint32_t otg_v_total_mid; /* OTG_V_TOTAL_MID->OTG_V_TOTAL_MID from drr_params->vertical_total_mid */ 3387 uint32_t otg_v_total_max_sel; /* OTG_V_TOTAL_CONTROL->OTG_V_TOTAL_MAX_SEL from DRR max selection enable */ 3388 uint32_t otg_v_total_min_sel; /* OTG_V_TOTAL_CONTROL->OTG_V_TOTAL_MIN_SEL from DRR min selection enable */ 3389 uint32_t otg_vtotal_mid_replacing_max_en; /* OTG_V_TOTAL_CONTROL->OTG_VTOTAL_MID_REPLACING_MAX_EN from DRR mid-frame enable */ 3390 uint32_t otg_vtotal_mid_frame_num; /* OTG_V_TOTAL_CONTROL->OTG_VTOTAL_MID_FRAME_NUM from drr_params->vertical_total_mid_frame_num */ 3391 uint32_t otg_set_v_total_min_mask; /* OTG_V_TOTAL_CONTROL->OTG_SET_V_TOTAL_MIN_MASK from DRR trigger mask */ 3392 uint32_t otg_force_lock_on_event; /* OTG_V_TOTAL_CONTROL->OTG_FORCE_LOCK_ON_EVENT from DRR force lock control */ 3393 3394 /* OPTC Data Source and ODM - 6 fields */ 3395 uint32_t optc_seg0_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG0_SRC_SEL from opp_id[0] ODM segment 0 source */ 3396 uint32_t optc_seg1_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG1_SRC_SEL from opp_id[1] ODM segment 1 source */ 3397 uint32_t optc_seg2_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG2_SRC_SEL from opp_id[2] ODM segment 2 source */ 3398 uint32_t optc_seg3_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG3_SRC_SEL from opp_id[3] ODM segment 3 source */ 3399 uint32_t optc_num_of_input_segment; /* OPTC_DATA_SOURCE_SELECT->OPTC_NUM_OF_INPUT_SEGMENT from opp_cnt-1 number of input segments */ 3400 uint32_t optc_mem_sel; /* OPTC_MEMORY_CONFIG->OPTC_MEM_SEL from memory_mask ODM memory selection */ 3401 3402 /* OPTC Data Format and DSC - 4 fields */ 3403 uint32_t optc_data_format; /* OPTC_DATA_FORMAT_CONTROL->OPTC_DATA_FORMAT from data format selection */ 3404 uint32_t optc_dsc_mode; /* OPTC_DATA_FORMAT_CONTROL->OPTC_DSC_MODE from dsc_mode parameter */ 3405 uint32_t optc_dsc_bytes_per_pixel; /* OPTC_BYTES_PER_PIXEL->OPTC_DSC_BYTES_PER_PIXEL from dsc_bytes_per_pixel parameter */ 3406 uint32_t optc_segment_width; /* OPTC_WIDTH_CONTROL->OPTC_SEGMENT_WIDTH from segment_width parameter */ 3407 uint32_t optc_dsc_slice_width; /* OPTC_WIDTH_CONTROL->OPTC_DSC_SLICE_WIDTH from dsc_slice_width parameter */ 3408 3409 /* OPTC Clock and Underflow Control - 4 fields */ 3410 uint32_t optc_input_pix_clk_en; /* OPTC_INPUT_CLOCK_CONTROL->OPTC_INPUT_PIX_CLK_EN from pixel clock enable */ 3411 uint32_t optc_underflow_occurred_status; /* OPTC_INPUT_GLOBAL_CONTROL->OPTC_UNDERFLOW_OCCURRED_STATUS from underflow status (read-only) */ 3412 uint32_t optc_underflow_clear; /* OPTC_INPUT_GLOBAL_CONTROL->OPTC_UNDERFLOW_CLEAR from underflow clear control */ 3413 uint32_t otg_clock_enable; /* OTG_CLOCK_CONTROL->OTG_CLOCK_EN from OTG clock enable */ 3414 uint32_t otg_clock_gate_dis; /* OTG_CLOCK_CONTROL->OTG_CLOCK_GATE_DIS from clock gate disable */ 3415 3416 /* OTG Stereo and 3D Control - 6 fields */ 3417 uint32_t otg_stereo_enable; /* OTG_STEREO_CONTROL->OTG_STEREO_EN from stereo enable control */ 3418 uint32_t otg_stereo_sync_output_line_num; /* OTG_STEREO_CONTROL->OTG_STEREO_SYNC_OUTPUT_LINE_NUM from timing->stereo_3d_format line num */ 3419 uint32_t otg_stereo_sync_output_polarity; /* OTG_STEREO_CONTROL->OTG_STEREO_SYNC_OUTPUT_POLARITY from stereo polarity control */ 3420 uint32_t otg_3d_structure_en; /* OTG_3D_STRUCTURE_CONTROL->OTG_3D_STRUCTURE_EN from 3D structure enable */ 3421 uint32_t otg_3d_structure_v_update_mode; /* OTG_3D_STRUCTURE_CONTROL->OTG_3D_STRUCTURE_V_UPDATE_MODE from 3D vertical update mode */ 3422 uint32_t otg_3d_structure_stereo_sel_ovr; /* OTG_3D_STRUCTURE_CONTROL->OTG_3D_STRUCTURE_STEREO_SEL_OVR from 3D stereo selection override */ 3423 uint32_t otg_interlace_enable; /* OTG_INTERLACE_CONTROL->OTG_INTERLACE_ENABLE from dc_crtc_timing->flags.INTERLACE */ 3424 3425 /* OTG GSL (Global Sync Lock) Control - 5 fields */ 3426 uint32_t otg_gsl0_en; /* OTG_GSL_CONTROL->OTG_GSL0_EN from GSL group 0 enable */ 3427 uint32_t otg_gsl1_en; /* OTG_GSL_CONTROL->OTG_GSL1_EN from GSL group 1 enable */ 3428 uint32_t otg_gsl2_en; /* OTG_GSL_CONTROL->OTG_GSL2_EN from GSL group 2 enable */ 3429 uint32_t otg_gsl_master_en; /* OTG_GSL_CONTROL->OTG_GSL_MASTER_EN from GSL master enable */ 3430 uint32_t otg_gsl_master_mode; /* OTG_GSL_CONTROL->OTG_GSL_MASTER_MODE from gsl_params->gsl_master mode */ 3431 3432 /* OTG DRR Advanced Control - 4 fields */ 3433 uint32_t otg_v_total_last_used_by_drr; /* OTG_DRR_CONTROL->OTG_V_TOTAL_LAST_USED_BY_DRR from last used DRR V_TOTAL (read-only) */ 3434 uint32_t otg_drr_trigger_window_start_x; /* OTG_DRR_TRIGGER_WINDOW->OTG_DRR_TRIGGER_WINDOW_START_X from window_start parameter */ 3435 uint32_t otg_drr_trigger_window_end_x; /* OTG_DRR_TRIGGER_WINDOW->OTG_DRR_TRIGGER_WINDOW_END_X from window_end parameter */ 3436 uint32_t otg_drr_v_total_change_limit; /* OTG_DRR_V_TOTAL_CHANGE->OTG_DRR_V_TOTAL_CHANGE_LIMIT from limit parameter */ 3437 3438 /* OTG DSC Position Control - 2 fields */ 3439 uint32_t otg_dsc_start_position_x; /* OTG_DSC_START_POSITION->OTG_DSC_START_POSITION_X from DSC start X position */ 3440 uint32_t otg_dsc_start_position_line_num; /* OTG_DSC_START_POSITION->OTG_DSC_START_POSITION_LINE_NUM from DSC start line number */ 3441 3442 /* OTG Double Buffer Control - 2 fields */ 3443 uint32_t otg_drr_timing_dbuf_update_mode; /* OTG_DOUBLE_BUFFER_CONTROL->OTG_DRR_TIMING_DBUF_UPDATE_MODE from DRR double buffer mode */ 3444 uint32_t otg_blank_data_double_buffer_en; /* OTG_DOUBLE_BUFFER_CONTROL->OTG_BLANK_DATA_DOUBLE_BUFFER_EN from blank data double buffer enable */ 3445 3446 /* OTG Vertical Interrupts - 6 fields */ 3447 uint32_t otg_vertical_interrupt0_int_enable; /* OTG_VERTICAL_INTERRUPT0_CONTROL->OTG_VERTICAL_INTERRUPT0_INT_ENABLE from interrupt 0 enable */ 3448 uint32_t otg_vertical_interrupt0_line_start; /* OTG_VERTICAL_INTERRUPT0_POSITION->OTG_VERTICAL_INTERRUPT0_LINE_START from start_line parameter */ 3449 uint32_t otg_vertical_interrupt1_int_enable; /* OTG_VERTICAL_INTERRUPT1_CONTROL->OTG_VERTICAL_INTERRUPT1_INT_ENABLE from interrupt 1 enable */ 3450 uint32_t otg_vertical_interrupt1_line_start; /* OTG_VERTICAL_INTERRUPT1_POSITION->OTG_VERTICAL_INTERRUPT1_LINE_START from start_line parameter */ 3451 uint32_t otg_vertical_interrupt2_int_enable; /* OTG_VERTICAL_INTERRUPT2_CONTROL->OTG_VERTICAL_INTERRUPT2_INT_ENABLE from interrupt 2 enable */ 3452 uint32_t otg_vertical_interrupt2_line_start; /* OTG_VERTICAL_INTERRUPT2_POSITION->OTG_VERTICAL_INTERRUPT2_LINE_START from start_line parameter */ 3453 3454 /* OTG Global Sync Parameters - 6 fields */ 3455 uint32_t otg_vready_offset; /* OTG_VREADY_PARAM->OTG_VREADY_OFFSET from vready_offset parameter */ 3456 uint32_t otg_vstartup_start; /* OTG_VSTARTUP_PARAM->OTG_VSTARTUP_START from vstartup_start parameter */ 3457 uint32_t otg_vupdate_offset; /* OTG_VUPDATE_PARAM->OTG_VUPDATE_OFFSET from vupdate_offset parameter */ 3458 uint32_t otg_vupdate_width; /* OTG_VUPDATE_PARAM->OTG_VUPDATE_WIDTH from vupdate_width parameter */ 3459 uint32_t master_update_lock_vupdate_keepout_start_offset; /* OTG_VUPDATE_KEEPOUT->MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_START_OFFSET from pstate_keepout start */ 3460 uint32_t master_update_lock_vupdate_keepout_end_offset; /* OTG_VUPDATE_KEEPOUT->MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_END_OFFSET from pstate_keepout end */ 3461 3462 /* OTG Manual Trigger Control - 11 fields */ 3463 uint32_t otg_triga_source_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_SOURCE_SELECT from trigger A source selection */ 3464 uint32_t otg_triga_source_pipe_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_SOURCE_PIPE_SELECT from trigger A pipe selection */ 3465 uint32_t otg_triga_rising_edge_detect_cntl; /* OTG_TRIGA_CNTL->OTG_TRIGA_RISING_EDGE_DETECT_CNTL from trigger A rising edge detect */ 3466 uint32_t otg_triga_falling_edge_detect_cntl; /* OTG_TRIGA_CNTL->OTG_TRIGA_FALLING_EDGE_DETECT_CNTL from trigger A falling edge detect */ 3467 uint32_t otg_triga_polarity_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_POLARITY_SELECT from trigger A polarity selection */ 3468 uint32_t otg_triga_frequency_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_FREQUENCY_SELECT from trigger A frequency selection */ 3469 uint32_t otg_triga_delay; /* OTG_TRIGA_CNTL->OTG_TRIGA_DELAY from trigger A delay */ 3470 uint32_t otg_triga_clear; /* OTG_TRIGA_CNTL->OTG_TRIGA_CLEAR from trigger A clear */ 3471 uint32_t otg_triga_manual_trig; /* OTG_TRIGA_MANUAL_TRIG->OTG_TRIGA_MANUAL_TRIG from manual trigger A */ 3472 uint32_t otg_trigb_source_select; /* OTG_TRIGB_CNTL->OTG_TRIGB_SOURCE_SELECT from trigger B source selection */ 3473 uint32_t otg_trigb_polarity_select; /* OTG_TRIGB_CNTL->OTG_TRIGB_POLARITY_SELECT from trigger B polarity selection */ 3474 uint32_t otg_trigb_manual_trig; /* OTG_TRIGB_MANUAL_TRIG->OTG_TRIGB_MANUAL_TRIG from manual trigger B */ 3475 3476 /* OTG Static Screen and Update Control - 6 fields */ 3477 uint32_t otg_static_screen_event_mask; /* OTG_STATIC_SCREEN_CONTROL->OTG_STATIC_SCREEN_EVENT_MASK from event_triggers parameter */ 3478 uint32_t otg_static_screen_frame_count; /* OTG_STATIC_SCREEN_CONTROL->OTG_STATIC_SCREEN_FRAME_COUNT from num_frames parameter */ 3479 uint32_t master_update_lock; /* OTG_MASTER_UPDATE_LOCK->MASTER_UPDATE_LOCK from update lock control */ 3480 uint32_t master_update_mode; /* OTG_MASTER_UPDATE_MODE->MASTER_UPDATE_MODE from update mode selection */ 3481 uint32_t otg_force_count_now_mode; /* OTG_FORCE_COUNT_NOW_CNTL->OTG_FORCE_COUNT_NOW_MODE from force count mode */ 3482 uint32_t otg_force_count_now_clear; /* OTG_FORCE_COUNT_NOW_CNTL->OTG_FORCE_COUNT_NOW_CLEAR from force count clear */ 3483 3484 /* VTG Control - 3 fields */ 3485 uint32_t vtg0_enable; /* CONTROL->VTG0_ENABLE from VTG enable control */ 3486 uint32_t vtg0_fp2; /* CONTROL->VTG0_FP2 from VTG front porch 2 */ 3487 uint32_t vtg0_vcount_init; /* CONTROL->VTG0_VCOUNT_INIT from VTG vertical count init */ 3488 3489 /* OTG Status (Read-Only) - 12 fields */ 3490 uint32_t otg_v_blank; /* OTG_STATUS->OTG_V_BLANK from vertical blank status (read-only) */ 3491 uint32_t otg_v_active_disp; /* OTG_STATUS->OTG_V_ACTIVE_DISP from vertical active display (read-only) */ 3492 uint32_t otg_frame_count; /* OTG_STATUS_FRAME_COUNT->OTG_FRAME_COUNT from frame count (read-only) */ 3493 uint32_t otg_horz_count; /* OTG_STATUS_POSITION->OTG_HORZ_COUNT from horizontal position (read-only) */ 3494 uint32_t otg_vert_count; /* OTG_STATUS_POSITION->OTG_VERT_COUNT from vertical position (read-only) */ 3495 uint32_t otg_horz_count_hv; /* OTG_STATUS_HV_COUNT->OTG_HORZ_COUNT from horizontal count (read-only) */ 3496 uint32_t otg_vert_count_nom; /* OTG_STATUS_HV_COUNT->OTG_VERT_COUNT_NOM from vertical count nominal (read-only) */ 3497 uint32_t otg_flip_pending; /* OTG_PIPE_UPDATE_STATUS->OTG_FLIP_PENDING from flip pending status (read-only) */ 3498 uint32_t otg_dc_reg_update_pending; /* OTG_PIPE_UPDATE_STATUS->OTG_DC_REG_UPDATE_PENDING from DC register update pending (read-only) */ 3499 uint32_t otg_cursor_update_pending; /* OTG_PIPE_UPDATE_STATUS->OTG_CURSOR_UPDATE_PENDING from cursor update pending (read-only) */ 3500 uint32_t otg_vupdate_keepout_status; /* OTG_PIPE_UPDATE_STATUS->OTG_VUPDATE_KEEPOUT_STATUS from VUPDATE keepout status (read-only) */ 3501 } optc[MAX_PIPES]; 3502 3503 /* Metadata */ 3504 uint32_t active_pipe_count; 3505 uint32_t active_stream_count; 3506 bool state_valid; 3507 }; 3508 3509 /** 3510 * dc_capture_register_software_state() - Capture software state for register programming 3511 * @dc: DC context containing current display configuration 3512 * @state: Pointer to dc_register_software_state structure to populate 3513 * 3514 * Extracts all software state variables that are used to program hardware register 3515 * fields across the display driver pipeline. This provides a complete snapshot 3516 * of the software configuration that drives hardware register programming. 3517 * 3518 * The function traverses the DC context and extracts values from: 3519 * - Stream configurations (timing, format, DSC settings) 3520 * - Plane states (surface format, rotation, scaling, cursor) 3521 * - Pipe contexts (resource allocation, blending, viewport) 3522 * - Clock manager (display clocks, DPP clocks, pixel clocks) 3523 * - Resource context (DET buffer allocation, ODM configuration) 3524 * 3525 * This is essential for underflow debugging as it captures the exact software 3526 * state that determines how registers are programmed, allowing analysis of 3527 * whether underflow is caused by incorrect register programming or timing issues. 3528 * 3529 * Return: true if state was successfully captured, false on error 3530 */ 3531 bool dc_capture_register_software_state(struct dc *dc, struct dc_register_software_state *state); 3532 3533 /** 3534 * dc_get_qos_info() - Retrieve Quality of Service (QoS) information from display core 3535 * @dc: DC context containing current display configuration 3536 * @info: Pointer to dc_qos_info structure to populate with QoS metrics 3537 * 3538 * This function retrieves QoS metrics from the display core that can be used by 3539 * benchmark tools to analyze display system performance. The function may take 3540 * several milliseconds to execute due to hardware measurement requirements. 3541 * 3542 * QoS information includes: 3543 * - Bandwidth bounds (lower limits in Mbps) 3544 * - Latency bounds (upper limits in nanoseconds) 3545 * - Hardware-measured bandwidth metrics (peak/average in Mbps) 3546 * - Hardware-measured latency metrics (maximum/average in nanoseconds) 3547 * 3548 * The function will populate the provided dc_qos_info structure with current 3549 * QoS measurements. If hardware measurement functions are not available for 3550 * the current DCN version, the function returns false with zero'd info structure. 3551 * 3552 * Return: true if QoS information was successfully retrieved, false if measurement 3553 * functions are unavailable or hardware measurements cannot be performed 3554 */ 3555 bool dc_get_qos_info(struct dc *dc, struct dc_qos_info *info); 3556 3557 /** 3558 * dc_override_memory_bandwidth_request - Override the DCN nominal memory 3559 * bandwidth request sent to PMFW, independent of the current display mode. 3560 * For debug use only. 3561 * @dc: DC instance 3562 * @bw_mbps: requested bandwidth in MB/s; 0 clears the override 3563 * 3564 * Return: capped bandwidth value actually applied (MB/s) 3565 */ 3566 unsigned int dc_override_memory_bandwidth_request( 3567 struct dc *dc, 3568 unsigned int bw_mbps); 3569 3570 #endif /* DC_INTERFACE_H_ */ 3571