1 /* 2 * Copyright 2012-14 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 "grph_object_defs.h" 31 #include "logger_types.h" 32 #if defined(CONFIG_DRM_AMD_DC_HDCP) 33 #include "hdcp_types.h" 34 #endif 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 "inc/hw_sequencer.h" 41 #include "inc/compressor.h" 42 #include "inc/hw/dmcu.h" 43 #include "dml/display_mode_lib.h" 44 45 /* forward declaration */ 46 struct aux_payload; 47 struct set_config_cmd_payload; 48 struct dmub_notification; 49 50 #define DC_VER "3.2.162" 51 52 #define MAX_SURFACES 3 53 #define MAX_PLANES 6 54 #define MAX_STREAMS 6 55 #define MAX_SINKS_PER_LINK 4 56 #define MIN_VIEWPORT_SIZE 12 57 #define MAX_NUM_EDP 2 58 59 /******************************************************************************* 60 * Display Core Interfaces 61 ******************************************************************************/ 62 struct dc_versions { 63 const char *dc_ver; 64 struct dmcu_version dmcu_version; 65 }; 66 67 enum dp_protocol_version { 68 DP_VERSION_1_4, 69 }; 70 71 enum dc_plane_type { 72 DC_PLANE_TYPE_INVALID, 73 DC_PLANE_TYPE_DCE_RGB, 74 DC_PLANE_TYPE_DCE_UNDERLAY, 75 DC_PLANE_TYPE_DCN_UNIVERSAL, 76 }; 77 78 struct dc_plane_cap { 79 enum dc_plane_type type; 80 uint32_t blends_with_above : 1; 81 uint32_t blends_with_below : 1; 82 uint32_t per_pixel_alpha : 1; 83 struct { 84 uint32_t argb8888 : 1; 85 uint32_t nv12 : 1; 86 uint32_t fp16 : 1; 87 uint32_t p010 : 1; 88 uint32_t ayuv : 1; 89 } pixel_format_support; 90 // max upscaling factor x1000 91 // upscaling factors are always >= 1 92 // for example, 1080p -> 8K is 4.0, or 4000 raw value 93 struct { 94 uint32_t argb8888; 95 uint32_t nv12; 96 uint32_t fp16; 97 } max_upscale_factor; 98 // max downscale factor x1000 99 // downscale factors are always <= 1 100 // for example, 8K -> 1080p is 0.25, or 250 raw value 101 struct { 102 uint32_t argb8888; 103 uint32_t nv12; 104 uint32_t fp16; 105 } max_downscale_factor; 106 // minimal width/height 107 uint32_t min_width; 108 uint32_t min_height; 109 }; 110 111 // Color management caps (DPP and MPC) 112 struct rom_curve_caps { 113 uint16_t srgb : 1; 114 uint16_t bt2020 : 1; 115 uint16_t gamma2_2 : 1; 116 uint16_t pq : 1; 117 uint16_t hlg : 1; 118 }; 119 120 struct dpp_color_caps { 121 uint16_t dcn_arch : 1; // all DCE generations treated the same 122 // input lut is different than most LUTs, just plain 256-entry lookup 123 uint16_t input_lut_shared : 1; // shared with DGAM 124 uint16_t icsc : 1; 125 uint16_t dgam_ram : 1; 126 uint16_t post_csc : 1; // before gamut remap 127 uint16_t gamma_corr : 1; 128 129 // hdr_mult and gamut remap always available in DPP (in that order) 130 // 3d lut implies shaper LUT, 131 // it may be shared with MPC - check MPC:shared_3d_lut flag 132 uint16_t hw_3d_lut : 1; 133 uint16_t ogam_ram : 1; // blnd gam 134 uint16_t ocsc : 1; 135 uint16_t dgam_rom_for_yuv : 1; 136 struct rom_curve_caps dgam_rom_caps; 137 struct rom_curve_caps ogam_rom_caps; 138 }; 139 140 struct mpc_color_caps { 141 uint16_t gamut_remap : 1; 142 uint16_t ogam_ram : 1; 143 uint16_t ocsc : 1; 144 uint16_t num_3dluts : 3; //3d lut always assumes a preceding shaper LUT 145 uint16_t shared_3d_lut:1; //can be in either DPP or MPC, but single instance 146 147 struct rom_curve_caps ogam_rom_caps; 148 }; 149 150 struct dc_color_caps { 151 struct dpp_color_caps dpp; 152 struct mpc_color_caps mpc; 153 }; 154 155 struct dc_caps { 156 uint32_t max_streams; 157 uint32_t max_links; 158 uint32_t max_audios; 159 uint32_t max_slave_planes; 160 uint32_t max_slave_yuv_planes; 161 uint32_t max_slave_rgb_planes; 162 uint32_t max_planes; 163 uint32_t max_downscale_ratio; 164 uint32_t i2c_speed_in_khz; 165 uint32_t i2c_speed_in_khz_hdcp; 166 uint32_t dmdata_alloc_size; 167 unsigned int max_cursor_size; 168 unsigned int max_video_width; 169 unsigned int min_horizontal_blanking_period; 170 int linear_pitch_alignment; 171 bool dcc_const_color; 172 bool dynamic_audio; 173 bool is_apu; 174 bool dual_link_dvi; 175 bool post_blend_color_processing; 176 bool force_dp_tps4_for_cp2520; 177 bool disable_dp_clk_share; 178 bool psp_setup_panel_mode; 179 bool extended_aux_timeout_support; 180 bool dmcub_support; 181 uint32_t num_of_internal_disp; 182 enum dp_protocol_version max_dp_protocol_version; 183 unsigned int mall_size_per_mem_channel; 184 unsigned int mall_size_total; 185 unsigned int cursor_cache_size; 186 struct dc_plane_cap planes[MAX_PLANES]; 187 struct dc_color_caps color; 188 #if defined(CONFIG_DRM_AMD_DC_DCN) 189 bool dp_hpo; 190 #endif 191 bool edp_dsc_support; 192 bool vbios_lttpr_aware; 193 bool vbios_lttpr_enable; 194 }; 195 196 struct dc_bug_wa { 197 bool no_connect_phy_config; 198 bool dedcn20_305_wa; 199 bool skip_clock_update; 200 bool lt_early_cr_pattern; 201 }; 202 203 struct dc_dcc_surface_param { 204 struct dc_size surface_size; 205 enum surface_pixel_format format; 206 enum swizzle_mode_values swizzle_mode; 207 enum dc_scan_direction scan; 208 }; 209 210 struct dc_dcc_setting { 211 unsigned int max_compressed_blk_size; 212 unsigned int max_uncompressed_blk_size; 213 bool independent_64b_blks; 214 #if defined(CONFIG_DRM_AMD_DC_DCN) 215 //These bitfields to be used starting with DCN 216 struct { 217 uint32_t dcc_256_64_64 : 1;//available in ASICs before DCN (the worst compression case) 218 uint32_t dcc_128_128_uncontrained : 1; //available in ASICs before DCN 219 uint32_t dcc_256_128_128 : 1; //available starting with DCN 220 uint32_t dcc_256_256_unconstrained : 1; //available in ASICs before DCN (the best compression case) 221 } dcc_controls; 222 #endif 223 }; 224 225 struct dc_surface_dcc_cap { 226 union { 227 struct { 228 struct dc_dcc_setting rgb; 229 } grph; 230 231 struct { 232 struct dc_dcc_setting luma; 233 struct dc_dcc_setting chroma; 234 } video; 235 }; 236 237 bool capable; 238 bool const_color_support; 239 }; 240 241 struct dc_static_screen_params { 242 struct { 243 bool force_trigger; 244 bool cursor_update; 245 bool surface_update; 246 bool overlay_update; 247 } triggers; 248 unsigned int num_frames; 249 }; 250 251 252 /* Surface update type is used by dc_update_surfaces_and_stream 253 * The update type is determined at the very beginning of the function based 254 * on parameters passed in and decides how much programming (or updating) is 255 * going to be done during the call. 256 * 257 * UPDATE_TYPE_FAST is used for really fast updates that do not require much 258 * logical calculations or hardware register programming. This update MUST be 259 * ISR safe on windows. Currently fast update will only be used to flip surface 260 * address. 261 * 262 * UPDATE_TYPE_MED is used for slower updates which require significant hw 263 * re-programming however do not affect bandwidth consumption or clock 264 * requirements. At present, this is the level at which front end updates 265 * that do not require us to run bw_calcs happen. These are in/out transfer func 266 * updates, viewport offset changes, recout size changes and pixel depth changes. 267 * This update can be done at ISR, but we want to minimize how often this happens. 268 * 269 * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our 270 * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front 271 * end related. Any time viewport dimensions, recout dimensions, scaling ratios or 272 * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do 273 * a full update. This cannot be done at ISR level and should be a rare event. 274 * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting 275 * underscan we don't expect to see this call at all. 276 */ 277 278 enum surface_update_type { 279 UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */ 280 UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/ 281 UPDATE_TYPE_FULL, /* may need to shuffle resources */ 282 }; 283 284 /* Forward declaration*/ 285 struct dc; 286 struct dc_plane_state; 287 struct dc_state; 288 289 290 struct dc_cap_funcs { 291 bool (*get_dcc_compression_cap)(const struct dc *dc, 292 const struct dc_dcc_surface_param *input, 293 struct dc_surface_dcc_cap *output); 294 }; 295 296 struct link_training_settings; 297 298 #if defined(CONFIG_DRM_AMD_DC_DCN) 299 union allow_lttpr_non_transparent_mode { 300 struct { 301 bool DP1_4A : 1; 302 bool DP2_0 : 1; 303 } bits; 304 unsigned char raw; 305 }; 306 #endif 307 /* Structure to hold configuration flags set by dm at dc creation. */ 308 struct dc_config { 309 bool gpu_vm_support; 310 bool disable_disp_pll_sharing; 311 bool fbc_support; 312 bool disable_fractional_pwm; 313 bool allow_seamless_boot_optimization; 314 bool power_down_display_on_boot; 315 bool edp_not_connected; 316 bool edp_no_power_sequencing; 317 bool force_enum_edp; 318 bool forced_clocks; 319 #if defined(CONFIG_DRM_AMD_DC_DCN) 320 union allow_lttpr_non_transparent_mode allow_lttpr_non_transparent_mode; 321 #else 322 bool allow_lttpr_non_transparent_mode; 323 #endif 324 bool multi_mon_pp_mclk_switch; 325 bool disable_dmcu; 326 bool enable_4to1MPC; 327 bool enable_windowed_mpo_odm; 328 bool allow_edp_hotplug_detection; 329 #if defined(CONFIG_DRM_AMD_DC_DCN) 330 bool clamp_min_dcfclk; 331 #endif 332 uint64_t vblank_alignment_dto_params; 333 uint8_t vblank_alignment_max_frame_time_diff; 334 bool is_asymmetric_memory; 335 bool is_single_rank_dimm; 336 }; 337 338 enum visual_confirm { 339 VISUAL_CONFIRM_DISABLE = 0, 340 VISUAL_CONFIRM_SURFACE = 1, 341 VISUAL_CONFIRM_HDR = 2, 342 VISUAL_CONFIRM_MPCTREE = 4, 343 VISUAL_CONFIRM_PSR = 5, 344 VISUAL_CONFIRM_SWIZZLE = 9, 345 }; 346 347 enum dc_psr_power_opts { 348 psr_power_opt_invalid = 0x0, 349 psr_power_opt_smu_opt_static_screen = 0x1, 350 psr_power_opt_z10_static_screen = 0x10, 351 }; 352 353 enum dcc_option { 354 DCC_ENABLE = 0, 355 DCC_DISABLE = 1, 356 DCC_HALF_REQ_DISALBE = 2, 357 }; 358 359 enum pipe_split_policy { 360 MPC_SPLIT_DYNAMIC = 0, 361 MPC_SPLIT_AVOID = 1, 362 MPC_SPLIT_AVOID_MULT_DISP = 2, 363 }; 364 365 enum wm_report_mode { 366 WM_REPORT_DEFAULT = 0, 367 WM_REPORT_OVERRIDE = 1, 368 }; 369 enum dtm_pstate{ 370 dtm_level_p0 = 0,/*highest voltage*/ 371 dtm_level_p1, 372 dtm_level_p2, 373 dtm_level_p3, 374 dtm_level_p4,/*when active_display_count = 0*/ 375 }; 376 377 enum dcn_pwr_state { 378 DCN_PWR_STATE_UNKNOWN = -1, 379 DCN_PWR_STATE_MISSION_MODE = 0, 380 DCN_PWR_STATE_LOW_POWER = 3, 381 }; 382 383 #if defined(CONFIG_DRM_AMD_DC_DCN) 384 enum dcn_zstate_support_state { 385 DCN_ZSTATE_SUPPORT_UNKNOWN, 386 DCN_ZSTATE_SUPPORT_ALLOW, 387 DCN_ZSTATE_SUPPORT_DISALLOW, 388 }; 389 #endif 390 /* 391 * For any clocks that may differ per pipe 392 * only the max is stored in this structure 393 */ 394 struct dc_clocks { 395 int dispclk_khz; 396 int actual_dispclk_khz; 397 int dppclk_khz; 398 int actual_dppclk_khz; 399 int disp_dpp_voltage_level_khz; 400 int dcfclk_khz; 401 int socclk_khz; 402 int dcfclk_deep_sleep_khz; 403 int fclk_khz; 404 int phyclk_khz; 405 int dramclk_khz; 406 bool p_state_change_support; 407 #if defined(CONFIG_DRM_AMD_DC_DCN) 408 enum dcn_zstate_support_state zstate_support; 409 bool dtbclk_en; 410 #endif 411 enum dcn_pwr_state pwr_state; 412 /* 413 * Elements below are not compared for the purposes of 414 * optimization required 415 */ 416 bool prev_p_state_change_support; 417 enum dtm_pstate dtm_level; 418 int max_supported_dppclk_khz; 419 int max_supported_dispclk_khz; 420 int bw_dppclk_khz; /*a copy of dppclk_khz*/ 421 int bw_dispclk_khz; 422 }; 423 424 struct dc_bw_validation_profile { 425 bool enable; 426 427 unsigned long long total_ticks; 428 unsigned long long voltage_level_ticks; 429 unsigned long long watermark_ticks; 430 unsigned long long rq_dlg_ticks; 431 432 unsigned long long total_count; 433 unsigned long long skip_fast_count; 434 unsigned long long skip_pass_count; 435 unsigned long long skip_fail_count; 436 }; 437 438 #define BW_VAL_TRACE_SETUP() \ 439 unsigned long long end_tick = 0; \ 440 unsigned long long voltage_level_tick = 0; \ 441 unsigned long long watermark_tick = 0; \ 442 unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \ 443 dm_get_timestamp(dc->ctx) : 0 444 445 #define BW_VAL_TRACE_COUNT() \ 446 if (dc->debug.bw_val_profile.enable) \ 447 dc->debug.bw_val_profile.total_count++ 448 449 #define BW_VAL_TRACE_SKIP(status) \ 450 if (dc->debug.bw_val_profile.enable) { \ 451 if (!voltage_level_tick) \ 452 voltage_level_tick = dm_get_timestamp(dc->ctx); \ 453 dc->debug.bw_val_profile.skip_ ## status ## _count++; \ 454 } 455 456 #define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \ 457 if (dc->debug.bw_val_profile.enable) \ 458 voltage_level_tick = dm_get_timestamp(dc->ctx) 459 460 #define BW_VAL_TRACE_END_WATERMARKS() \ 461 if (dc->debug.bw_val_profile.enable) \ 462 watermark_tick = dm_get_timestamp(dc->ctx) 463 464 #define BW_VAL_TRACE_FINISH() \ 465 if (dc->debug.bw_val_profile.enable) { \ 466 end_tick = dm_get_timestamp(dc->ctx); \ 467 dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \ 468 dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \ 469 if (watermark_tick) { \ 470 dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \ 471 dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \ 472 } \ 473 } 474 475 union mem_low_power_enable_options { 476 struct { 477 bool vga: 1; 478 bool i2c: 1; 479 bool dmcu: 1; 480 bool dscl: 1; 481 bool cm: 1; 482 bool mpc: 1; 483 bool optc: 1; 484 bool vpg: 1; 485 bool afmt: 1; 486 } bits; 487 uint32_t u32All; 488 }; 489 490 union root_clock_optimization_options { 491 struct { 492 bool dpp: 1; 493 bool dsc: 1; 494 bool hdmistream: 1; 495 bool hdmichar: 1; 496 bool dpstream: 1; 497 bool symclk32_se: 1; 498 bool symclk32_le: 1; 499 bool symclk_fe: 1; 500 bool physymclk: 1; 501 bool dpiasymclk: 1; 502 uint32_t reserved: 22; 503 } bits; 504 uint32_t u32All; 505 }; 506 507 union dpia_debug_options { 508 struct { 509 uint32_t disable_dpia:1; 510 uint32_t force_non_lttpr:1; 511 uint32_t extend_aux_rd_interval:1; 512 uint32_t reserved:29; 513 } bits; 514 uint32_t raw; 515 }; 516 517 struct dc_debug_data { 518 uint32_t ltFailCount; 519 uint32_t i2cErrorCount; 520 uint32_t auxErrorCount; 521 }; 522 523 struct dc_phy_addr_space_config { 524 struct { 525 uint64_t start_addr; 526 uint64_t end_addr; 527 uint64_t fb_top; 528 uint64_t fb_offset; 529 uint64_t fb_base; 530 uint64_t agp_top; 531 uint64_t agp_bot; 532 uint64_t agp_base; 533 } system_aperture; 534 535 struct { 536 uint64_t page_table_start_addr; 537 uint64_t page_table_end_addr; 538 uint64_t page_table_base_addr; 539 bool base_addr_is_mc_addr; 540 } gart_config; 541 542 bool valid; 543 bool is_hvm_enabled; 544 uint64_t page_table_default_page_addr; 545 }; 546 547 struct dc_virtual_addr_space_config { 548 uint64_t page_table_base_addr; 549 uint64_t page_table_start_addr; 550 uint64_t page_table_end_addr; 551 uint32_t page_table_block_size_in_bytes; 552 uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid 553 }; 554 555 struct dc_bounding_box_overrides { 556 int sr_exit_time_ns; 557 int sr_enter_plus_exit_time_ns; 558 int urgent_latency_ns; 559 int percent_of_ideal_drambw; 560 int dram_clock_change_latency_ns; 561 int dummy_clock_change_latency_ns; 562 /* This forces a hard min on the DCFCLK we use 563 * for DML. Unlike the debug option for forcing 564 * DCFCLK, this override affects watermark calculations 565 */ 566 int min_dcfclk_mhz; 567 }; 568 569 struct dc_state; 570 struct resource_pool; 571 struct dce_hwseq; 572 573 struct dc_debug_options { 574 bool native422_support; 575 bool disable_dsc; 576 enum visual_confirm visual_confirm; 577 int visual_confirm_rect_height; 578 579 bool sanity_checks; 580 bool max_disp_clk; 581 bool surface_trace; 582 bool timing_trace; 583 bool clock_trace; 584 bool validation_trace; 585 bool bandwidth_calcs_trace; 586 int max_downscale_src_width; 587 588 /* stutter efficiency related */ 589 bool disable_stutter; 590 bool use_max_lb; 591 enum dcc_option disable_dcc; 592 enum pipe_split_policy pipe_split_policy; 593 bool force_single_disp_pipe_split; 594 bool voltage_align_fclk; 595 bool disable_min_fclk; 596 597 bool disable_dfs_bypass; 598 bool disable_dpp_power_gate; 599 bool disable_hubp_power_gate; 600 bool disable_dsc_power_gate; 601 int dsc_min_slice_height_override; 602 int dsc_bpp_increment_div; 603 bool disable_pplib_wm_range; 604 enum wm_report_mode pplib_wm_report_mode; 605 unsigned int min_disp_clk_khz; 606 unsigned int min_dpp_clk_khz; 607 unsigned int min_dram_clk_khz; 608 int sr_exit_time_dpm0_ns; 609 int sr_enter_plus_exit_time_dpm0_ns; 610 int sr_exit_time_ns; 611 int sr_enter_plus_exit_time_ns; 612 int urgent_latency_ns; 613 uint32_t underflow_assert_delay_us; 614 int percent_of_ideal_drambw; 615 int dram_clock_change_latency_ns; 616 bool optimized_watermark; 617 int always_scale; 618 bool disable_pplib_clock_request; 619 bool disable_clock_gate; 620 bool disable_mem_low_power; 621 #if defined(CONFIG_DRM_AMD_DC_DCN) 622 bool pstate_enabled; 623 #endif 624 bool disable_dmcu; 625 bool disable_psr; 626 bool force_abm_enable; 627 bool disable_stereo_support; 628 bool vsr_support; 629 bool performance_trace; 630 bool az_endpoint_mute_only; 631 bool always_use_regamma; 632 bool recovery_enabled; 633 bool avoid_vbios_exec_table; 634 bool scl_reset_length10; 635 bool hdmi20_disable; 636 bool skip_detection_link_training; 637 uint32_t edid_read_retry_times; 638 bool remove_disconnect_edp; 639 unsigned int force_odm_combine; //bit vector based on otg inst 640 #if defined(CONFIG_DRM_AMD_DC_DCN) 641 unsigned int force_odm_combine_4to1; //bit vector based on otg inst 642 bool disable_z9_mpc; 643 #endif 644 unsigned int force_fclk_khz; 645 bool enable_tri_buf; 646 bool dmub_offload_enabled; 647 bool dmcub_emulation; 648 #if defined(CONFIG_DRM_AMD_DC_DCN) 649 bool disable_idle_power_optimizations; 650 unsigned int mall_size_override; 651 unsigned int mall_additional_timer_percent; 652 bool mall_error_as_fatal; 653 #endif 654 bool dmub_command_table; /* for testing only */ 655 struct dc_bw_validation_profile bw_val_profile; 656 bool disable_fec; 657 bool disable_48mhz_pwrdwn; 658 /* This forces a hard min on the DCFCLK requested to SMU/PP 659 * watermarks are not affected. 660 */ 661 unsigned int force_min_dcfclk_mhz; 662 #if defined(CONFIG_DRM_AMD_DC_DCN) 663 int dwb_fi_phase; 664 #endif 665 bool disable_timing_sync; 666 bool cm_in_bypass; 667 int force_clock_mode;/*every mode change.*/ 668 669 bool disable_dram_clock_change_vactive_support; 670 bool validate_dml_output; 671 bool enable_dmcub_surface_flip; 672 bool usbc_combo_phy_reset_wa; 673 bool disable_dsc_edp; 674 unsigned int force_dsc_edp_policy; 675 bool enable_dram_clock_change_one_display_vactive; 676 #if defined(CONFIG_DRM_AMD_DC_DCN) 677 /* TODO - remove once tested */ 678 bool legacy_dp2_lt; 679 bool set_mst_en_for_sst; 680 #endif 681 union mem_low_power_enable_options enable_mem_low_power; 682 union root_clock_optimization_options root_clock_optimization; 683 bool hpo_optimization; 684 bool force_vblank_alignment; 685 686 /* Enable dmub aux for legacy ddc */ 687 bool enable_dmub_aux_for_legacy_ddc; 688 bool optimize_edp_link_rate; /* eDP ILR */ 689 /* FEC/PSR1 sequence enable delay in 100us */ 690 uint8_t fec_enable_delay_in100us; 691 bool enable_driver_sequence_debug; 692 #if defined(CONFIG_DRM_AMD_DC_DCN) 693 bool disable_z10; 694 bool enable_sw_cntl_psr; 695 union dpia_debug_options dpia_debug; 696 #endif 697 }; 698 699 struct gpu_info_soc_bounding_box_v1_0; 700 struct dc { 701 struct dc_debug_options debug; 702 struct dc_versions versions; 703 struct dc_caps caps; 704 struct dc_cap_funcs cap_funcs; 705 struct dc_config config; 706 struct dc_bounding_box_overrides bb_overrides; 707 struct dc_bug_wa work_arounds; 708 struct dc_context *ctx; 709 struct dc_phy_addr_space_config vm_pa_config; 710 711 uint8_t link_count; 712 struct dc_link *links[MAX_PIPES * 2]; 713 714 struct dc_state *current_state; 715 struct resource_pool *res_pool; 716 717 struct clk_mgr *clk_mgr; 718 719 /* Display Engine Clock levels */ 720 struct dm_pp_clock_levels sclk_lvls; 721 722 /* Inputs into BW and WM calculations. */ 723 struct bw_calcs_dceip *bw_dceip; 724 struct bw_calcs_vbios *bw_vbios; 725 #ifdef CONFIG_DRM_AMD_DC_DCN 726 struct dcn_soc_bounding_box *dcn_soc; 727 struct dcn_ip_params *dcn_ip; 728 struct display_mode_lib dml; 729 #endif 730 731 /* HW functions */ 732 struct hw_sequencer_funcs hwss; 733 struct dce_hwseq *hwseq; 734 735 /* Require to optimize clocks and bandwidth for added/removed planes */ 736 bool optimized_required; 737 bool wm_optimized_required; 738 #if defined(CONFIG_DRM_AMD_DC_DCN) 739 bool idle_optimizations_allowed; 740 #endif 741 #if defined(CONFIG_DRM_AMD_DC_DCN) 742 bool enable_c20_dtm_b0; 743 #endif 744 745 /* Require to maintain clocks and bandwidth for UEFI enabled HW */ 746 747 /* FBC compressor */ 748 struct compressor *fbc_compressor; 749 750 struct dc_debug_data debug_data; 751 struct dpcd_vendor_signature vendor_signature; 752 753 const char *build_id; 754 struct vm_helper *vm_helper; 755 }; 756 757 enum frame_buffer_mode { 758 FRAME_BUFFER_MODE_LOCAL_ONLY = 0, 759 FRAME_BUFFER_MODE_ZFB_ONLY, 760 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL, 761 } ; 762 763 struct dchub_init_data { 764 int64_t zfb_phys_addr_base; 765 int64_t zfb_mc_base_addr; 766 uint64_t zfb_size_in_byte; 767 enum frame_buffer_mode fb_mode; 768 bool dchub_initialzied; 769 bool dchub_info_valid; 770 }; 771 772 struct dc_init_data { 773 struct hw_asic_id asic_id; 774 void *driver; /* ctx */ 775 struct cgs_device *cgs_device; 776 struct dc_bounding_box_overrides bb_overrides; 777 778 int num_virtual_links; 779 /* 780 * If 'vbios_override' not NULL, it will be called instead 781 * of the real VBIOS. Intended use is Diagnostics on FPGA. 782 */ 783 struct dc_bios *vbios_override; 784 enum dce_environment dce_environment; 785 786 struct dmub_offload_funcs *dmub_if; 787 struct dc_reg_helper_state *dmub_offload; 788 789 struct dc_config flags; 790 uint64_t log_mask; 791 792 struct dpcd_vendor_signature vendor_signature; 793 #if defined(CONFIG_DRM_AMD_DC_DCN) 794 bool force_smu_not_present; 795 #endif 796 }; 797 798 struct dc_callback_init { 799 #ifdef CONFIG_DRM_AMD_DC_HDCP 800 struct cp_psp cp_psp; 801 #else 802 uint8_t reserved; 803 #endif 804 }; 805 806 struct dc *dc_create(const struct dc_init_data *init_params); 807 void dc_hardware_init(struct dc *dc); 808 809 int dc_get_vmid_use_vector(struct dc *dc); 810 void dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid); 811 /* Returns the number of vmids supported */ 812 int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config); 813 void dc_init_callbacks(struct dc *dc, 814 const struct dc_callback_init *init_params); 815 void dc_deinit_callbacks(struct dc *dc); 816 void dc_destroy(struct dc **dc); 817 818 /******************************************************************************* 819 * Surface Interfaces 820 ******************************************************************************/ 821 822 enum { 823 TRANSFER_FUNC_POINTS = 1025 824 }; 825 826 struct dc_hdr_static_metadata { 827 /* display chromaticities and white point in units of 0.00001 */ 828 unsigned int chromaticity_green_x; 829 unsigned int chromaticity_green_y; 830 unsigned int chromaticity_blue_x; 831 unsigned int chromaticity_blue_y; 832 unsigned int chromaticity_red_x; 833 unsigned int chromaticity_red_y; 834 unsigned int chromaticity_white_point_x; 835 unsigned int chromaticity_white_point_y; 836 837 uint32_t min_luminance; 838 uint32_t max_luminance; 839 uint32_t maximum_content_light_level; 840 uint32_t maximum_frame_average_light_level; 841 }; 842 843 enum dc_transfer_func_type { 844 TF_TYPE_PREDEFINED, 845 TF_TYPE_DISTRIBUTED_POINTS, 846 TF_TYPE_BYPASS, 847 TF_TYPE_HWPWL 848 }; 849 850 struct dc_transfer_func_distributed_points { 851 struct fixed31_32 red[TRANSFER_FUNC_POINTS]; 852 struct fixed31_32 green[TRANSFER_FUNC_POINTS]; 853 struct fixed31_32 blue[TRANSFER_FUNC_POINTS]; 854 855 uint16_t end_exponent; 856 uint16_t x_point_at_y1_red; 857 uint16_t x_point_at_y1_green; 858 uint16_t x_point_at_y1_blue; 859 }; 860 861 enum dc_transfer_func_predefined { 862 TRANSFER_FUNCTION_SRGB, 863 TRANSFER_FUNCTION_BT709, 864 TRANSFER_FUNCTION_PQ, 865 TRANSFER_FUNCTION_LINEAR, 866 TRANSFER_FUNCTION_UNITY, 867 TRANSFER_FUNCTION_HLG, 868 TRANSFER_FUNCTION_HLG12, 869 TRANSFER_FUNCTION_GAMMA22, 870 TRANSFER_FUNCTION_GAMMA24, 871 TRANSFER_FUNCTION_GAMMA26 872 }; 873 874 875 struct dc_transfer_func { 876 struct kref refcount; 877 enum dc_transfer_func_type type; 878 enum dc_transfer_func_predefined tf; 879 /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/ 880 uint32_t sdr_ref_white_level; 881 union { 882 struct pwl_params pwl; 883 struct dc_transfer_func_distributed_points tf_pts; 884 }; 885 }; 886 887 888 union dc_3dlut_state { 889 struct { 890 uint32_t initialized:1; /*if 3dlut is went through color module for initialization */ 891 uint32_t rmu_idx_valid:1; /*if mux settings are valid*/ 892 uint32_t rmu_mux_num:3; /*index of mux to use*/ 893 uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/ 894 uint32_t mpc_rmu1_mux:4; 895 uint32_t mpc_rmu2_mux:4; 896 uint32_t reserved:15; 897 } bits; 898 uint32_t raw; 899 }; 900 901 902 struct dc_3dlut { 903 struct kref refcount; 904 struct tetrahedral_params lut_3d; 905 struct fixed31_32 hdr_multiplier; 906 union dc_3dlut_state state; 907 }; 908 /* 909 * This structure is filled in by dc_surface_get_status and contains 910 * the last requested address and the currently active address so the called 911 * can determine if there are any outstanding flips 912 */ 913 struct dc_plane_status { 914 struct dc_plane_address requested_address; 915 struct dc_plane_address current_address; 916 bool is_flip_pending; 917 bool is_right_eye; 918 }; 919 920 union surface_update_flags { 921 922 struct { 923 uint32_t addr_update:1; 924 /* Medium updates */ 925 uint32_t dcc_change:1; 926 uint32_t color_space_change:1; 927 uint32_t horizontal_mirror_change:1; 928 uint32_t per_pixel_alpha_change:1; 929 uint32_t global_alpha_change:1; 930 uint32_t hdr_mult:1; 931 uint32_t rotation_change:1; 932 uint32_t swizzle_change:1; 933 uint32_t scaling_change:1; 934 uint32_t position_change:1; 935 uint32_t in_transfer_func_change:1; 936 uint32_t input_csc_change:1; 937 uint32_t coeff_reduction_change:1; 938 uint32_t output_tf_change:1; 939 uint32_t pixel_format_change:1; 940 uint32_t plane_size_change:1; 941 uint32_t gamut_remap_change:1; 942 943 /* Full updates */ 944 uint32_t new_plane:1; 945 uint32_t bpp_change:1; 946 uint32_t gamma_change:1; 947 uint32_t bandwidth_change:1; 948 uint32_t clock_change:1; 949 uint32_t stereo_format_change:1; 950 uint32_t lut_3d:1; 951 uint32_t full_update:1; 952 } bits; 953 954 uint32_t raw; 955 }; 956 957 struct dc_plane_state { 958 struct dc_plane_address address; 959 struct dc_plane_flip_time time; 960 bool triplebuffer_flips; 961 struct scaling_taps scaling_quality; 962 struct rect src_rect; 963 struct rect dst_rect; 964 struct rect clip_rect; 965 966 struct plane_size plane_size; 967 union dc_tiling_info tiling_info; 968 969 struct dc_plane_dcc_param dcc; 970 971 struct dc_gamma *gamma_correction; 972 struct dc_transfer_func *in_transfer_func; 973 struct dc_bias_and_scale *bias_and_scale; 974 struct dc_csc_transform input_csc_color_matrix; 975 struct fixed31_32 coeff_reduction_factor; 976 struct fixed31_32 hdr_mult; 977 struct colorspace_transform gamut_remap_matrix; 978 979 // TODO: No longer used, remove 980 struct dc_hdr_static_metadata hdr_static_ctx; 981 982 enum dc_color_space color_space; 983 984 struct dc_3dlut *lut3d_func; 985 struct dc_transfer_func *in_shaper_func; 986 struct dc_transfer_func *blend_tf; 987 988 #if defined(CONFIG_DRM_AMD_DC_DCN) 989 struct dc_transfer_func *gamcor_tf; 990 #endif 991 enum surface_pixel_format format; 992 enum dc_rotation_angle rotation; 993 enum plane_stereo_format stereo_format; 994 995 bool is_tiling_rotated; 996 bool per_pixel_alpha; 997 bool global_alpha; 998 int global_alpha_value; 999 bool visible; 1000 bool flip_immediate; 1001 bool horizontal_mirror; 1002 int layer_index; 1003 1004 union surface_update_flags update_flags; 1005 bool flip_int_enabled; 1006 bool skip_manual_trigger; 1007 1008 /* private to DC core */ 1009 struct dc_plane_status status; 1010 struct dc_context *ctx; 1011 1012 /* HACK: Workaround for forcing full reprogramming under some conditions */ 1013 bool force_full_update; 1014 1015 /* private to dc_surface.c */ 1016 enum dc_irq_source irq_source; 1017 struct kref refcount; 1018 }; 1019 1020 struct dc_plane_info { 1021 struct plane_size plane_size; 1022 union dc_tiling_info tiling_info; 1023 struct dc_plane_dcc_param dcc; 1024 enum surface_pixel_format format; 1025 enum dc_rotation_angle rotation; 1026 enum plane_stereo_format stereo_format; 1027 enum dc_color_space color_space; 1028 bool horizontal_mirror; 1029 bool visible; 1030 bool per_pixel_alpha; 1031 bool global_alpha; 1032 int global_alpha_value; 1033 bool input_csc_enabled; 1034 int layer_index; 1035 }; 1036 1037 struct dc_scaling_info { 1038 struct rect src_rect; 1039 struct rect dst_rect; 1040 struct rect clip_rect; 1041 struct scaling_taps scaling_quality; 1042 }; 1043 1044 struct dc_surface_update { 1045 struct dc_plane_state *surface; 1046 1047 /* isr safe update parameters. null means no updates */ 1048 const struct dc_flip_addrs *flip_addr; 1049 const struct dc_plane_info *plane_info; 1050 const struct dc_scaling_info *scaling_info; 1051 struct fixed31_32 hdr_mult; 1052 /* following updates require alloc/sleep/spin that is not isr safe, 1053 * null means no updates 1054 */ 1055 const struct dc_gamma *gamma; 1056 const struct dc_transfer_func *in_transfer_func; 1057 1058 const struct dc_csc_transform *input_csc_color_matrix; 1059 const struct fixed31_32 *coeff_reduction_factor; 1060 const struct dc_transfer_func *func_shaper; 1061 const struct dc_3dlut *lut3d_func; 1062 const struct dc_transfer_func *blend_tf; 1063 const struct colorspace_transform *gamut_remap_matrix; 1064 }; 1065 1066 /* 1067 * Create a new surface with default parameters; 1068 */ 1069 struct dc_plane_state *dc_create_plane_state(struct dc *dc); 1070 const struct dc_plane_status *dc_plane_get_status( 1071 const struct dc_plane_state *plane_state); 1072 1073 void dc_plane_state_retain(struct dc_plane_state *plane_state); 1074 void dc_plane_state_release(struct dc_plane_state *plane_state); 1075 1076 void dc_gamma_retain(struct dc_gamma *dc_gamma); 1077 void dc_gamma_release(struct dc_gamma **dc_gamma); 1078 struct dc_gamma *dc_create_gamma(void); 1079 1080 void dc_transfer_func_retain(struct dc_transfer_func *dc_tf); 1081 void dc_transfer_func_release(struct dc_transfer_func *dc_tf); 1082 struct dc_transfer_func *dc_create_transfer_func(void); 1083 1084 struct dc_3dlut *dc_create_3dlut_func(void); 1085 void dc_3dlut_func_release(struct dc_3dlut *lut); 1086 void dc_3dlut_func_retain(struct dc_3dlut *lut); 1087 /* 1088 * This structure holds a surface address. There could be multiple addresses 1089 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such 1090 * as frame durations and DCC format can also be set. 1091 */ 1092 struct dc_flip_addrs { 1093 struct dc_plane_address address; 1094 unsigned int flip_timestamp_in_us; 1095 bool flip_immediate; 1096 /* TODO: add flip duration for FreeSync */ 1097 bool triplebuffer_flips; 1098 }; 1099 1100 void dc_post_update_surfaces_to_stream( 1101 struct dc *dc); 1102 1103 #include "dc_stream.h" 1104 1105 /* 1106 * Structure to store surface/stream associations for validation 1107 */ 1108 struct dc_validation_set { 1109 struct dc_stream_state *stream; 1110 struct dc_plane_state *plane_states[MAX_SURFACES]; 1111 uint8_t plane_count; 1112 }; 1113 1114 bool dc_validate_seamless_boot_timing(const struct dc *dc, 1115 const struct dc_sink *sink, 1116 struct dc_crtc_timing *crtc_timing); 1117 1118 enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state); 1119 1120 void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info); 1121 1122 bool dc_set_generic_gpio_for_stereo(bool enable, 1123 struct gpio_service *gpio_service); 1124 1125 /* 1126 * fast_validate: we return after determining if we can support the new state, 1127 * but before we populate the programming info 1128 */ 1129 enum dc_status dc_validate_global_state( 1130 struct dc *dc, 1131 struct dc_state *new_ctx, 1132 bool fast_validate); 1133 1134 1135 void dc_resource_state_construct( 1136 const struct dc *dc, 1137 struct dc_state *dst_ctx); 1138 1139 #if defined(CONFIG_DRM_AMD_DC_DCN) 1140 bool dc_acquire_release_mpc_3dlut( 1141 struct dc *dc, bool acquire, 1142 struct dc_stream_state *stream, 1143 struct dc_3dlut **lut, 1144 struct dc_transfer_func **shaper); 1145 #endif 1146 1147 void dc_resource_state_copy_construct( 1148 const struct dc_state *src_ctx, 1149 struct dc_state *dst_ctx); 1150 1151 void dc_resource_state_copy_construct_current( 1152 const struct dc *dc, 1153 struct dc_state *dst_ctx); 1154 1155 void dc_resource_state_destruct(struct dc_state *context); 1156 1157 bool dc_resource_is_dsc_encoding_supported(const struct dc *dc); 1158 1159 /* 1160 * TODO update to make it about validation sets 1161 * Set up streams and links associated to drive sinks 1162 * The streams parameter is an absolute set of all active streams. 1163 * 1164 * After this call: 1165 * Phy, Encoder, Timing Generator are programmed and enabled. 1166 * New streams are enabled with blank stream; no memory read. 1167 */ 1168 bool dc_commit_state(struct dc *dc, struct dc_state *context); 1169 1170 struct dc_state *dc_create_state(struct dc *dc); 1171 struct dc_state *dc_copy_state(struct dc_state *src_ctx); 1172 void dc_retain_state(struct dc_state *context); 1173 void dc_release_state(struct dc_state *context); 1174 1175 /******************************************************************************* 1176 * Link Interfaces 1177 ******************************************************************************/ 1178 1179 struct dpcd_caps { 1180 union dpcd_rev dpcd_rev; 1181 union max_lane_count max_ln_count; 1182 union max_down_spread max_down_spread; 1183 union dprx_feature dprx_feature; 1184 1185 /* valid only for eDP v1.4 or higher*/ 1186 uint8_t edp_supported_link_rates_count; 1187 enum dc_link_rate edp_supported_link_rates[8]; 1188 1189 /* dongle type (DP converter, CV smart dongle) */ 1190 enum display_dongle_type dongle_type; 1191 /* branch device or sink device */ 1192 bool is_branch_dev; 1193 /* Dongle's downstream count. */ 1194 union sink_count sink_count; 1195 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 1196 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 1197 struct dc_dongle_caps dongle_caps; 1198 1199 uint32_t sink_dev_id; 1200 int8_t sink_dev_id_str[6]; 1201 int8_t sink_hw_revision; 1202 int8_t sink_fw_revision[2]; 1203 1204 uint32_t branch_dev_id; 1205 int8_t branch_dev_name[6]; 1206 int8_t branch_hw_revision; 1207 int8_t branch_fw_revision[2]; 1208 1209 bool allow_invalid_MSA_timing_param; 1210 bool panel_mode_edp; 1211 bool dpcd_display_control_capable; 1212 bool ext_receiver_cap_field_present; 1213 bool dynamic_backlight_capable_edp; 1214 union dpcd_fec_capability fec_cap; 1215 struct dpcd_dsc_capabilities dsc_caps; 1216 struct dc_lttpr_caps lttpr_caps; 1217 struct psr_caps psr_caps; 1218 struct dpcd_usb4_dp_tunneling_info usb4_dp_tun_info; 1219 1220 #if defined(CONFIG_DRM_AMD_DC_DCN) 1221 union dp_128b_132b_supported_link_rates dp_128b_132b_supported_link_rates; 1222 union dp_main_line_channel_coding_cap channel_coding_cap; 1223 union dp_sink_video_fallback_formats fallback_formats; 1224 union dp_fec_capability1 fec_cap1; 1225 #endif 1226 }; 1227 1228 union dpcd_sink_ext_caps { 1229 struct { 1230 /* 0 - Sink supports backlight adjust via PWM during SDR/HDR mode 1231 * 1 - Sink supports backlight adjust via AUX during SDR/HDR mode. 1232 */ 1233 uint8_t sdr_aux_backlight_control : 1; 1234 uint8_t hdr_aux_backlight_control : 1; 1235 uint8_t reserved_1 : 2; 1236 uint8_t oled : 1; 1237 uint8_t reserved : 3; 1238 } bits; 1239 uint8_t raw; 1240 }; 1241 1242 #if defined(CONFIG_DRM_AMD_DC_HDCP) 1243 union hdcp_rx_caps { 1244 struct { 1245 uint8_t version; 1246 uint8_t reserved; 1247 struct { 1248 uint8_t repeater : 1; 1249 uint8_t hdcp_capable : 1; 1250 uint8_t reserved : 6; 1251 } byte0; 1252 } fields; 1253 uint8_t raw[3]; 1254 }; 1255 1256 union hdcp_bcaps { 1257 struct { 1258 uint8_t HDCP_CAPABLE:1; 1259 uint8_t REPEATER:1; 1260 uint8_t RESERVED:6; 1261 } bits; 1262 uint8_t raw; 1263 }; 1264 1265 struct hdcp_caps { 1266 union hdcp_rx_caps rx_caps; 1267 union hdcp_bcaps bcaps; 1268 }; 1269 #endif 1270 1271 #include "dc_link.h" 1272 1273 #if defined(CONFIG_DRM_AMD_DC_DCN) 1274 uint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane); 1275 1276 #endif 1277 /******************************************************************************* 1278 * Sink Interfaces - A sink corresponds to a display output device 1279 ******************************************************************************/ 1280 1281 struct dc_container_id { 1282 // 128bit GUID in binary form 1283 unsigned char guid[16]; 1284 // 8 byte port ID -> ELD.PortID 1285 unsigned int portId[2]; 1286 // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName 1287 unsigned short manufacturerName; 1288 // 2 byte product code -> ELD.ProductCode 1289 unsigned short productCode; 1290 }; 1291 1292 1293 struct dc_sink_dsc_caps { 1294 // 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology), 1295 // 'false' if they are sink's DSC caps 1296 bool is_virtual_dpcd_dsc; 1297 struct dsc_dec_dpcd_caps dsc_dec_caps; 1298 }; 1299 1300 struct dc_sink_fec_caps { 1301 bool is_rx_fec_supported; 1302 bool is_topology_fec_supported; 1303 }; 1304 1305 /* 1306 * The sink structure contains EDID and other display device properties 1307 */ 1308 struct dc_sink { 1309 enum signal_type sink_signal; 1310 struct dc_edid dc_edid; /* raw edid */ 1311 struct dc_edid_caps edid_caps; /* parse display caps */ 1312 struct dc_container_id *dc_container_id; 1313 uint32_t dongle_max_pix_clk; 1314 void *priv; 1315 struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX]; 1316 bool converter_disable_audio; 1317 1318 struct dc_sink_dsc_caps dsc_caps; 1319 struct dc_sink_fec_caps fec_caps; 1320 1321 bool is_vsc_sdp_colorimetry_supported; 1322 1323 /* private to DC core */ 1324 struct dc_link *link; 1325 struct dc_context *ctx; 1326 1327 uint32_t sink_id; 1328 1329 /* private to dc_sink.c */ 1330 // refcount must be the last member in dc_sink, since we want the 1331 // sink structure to be logically cloneable up to (but not including) 1332 // refcount 1333 struct kref refcount; 1334 }; 1335 1336 void dc_sink_retain(struct dc_sink *sink); 1337 void dc_sink_release(struct dc_sink *sink); 1338 1339 struct dc_sink_init_data { 1340 enum signal_type sink_signal; 1341 struct dc_link *link; 1342 uint32_t dongle_max_pix_clk; 1343 bool converter_disable_audio; 1344 }; 1345 1346 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params); 1347 1348 /* Newer interfaces */ 1349 struct dc_cursor { 1350 struct dc_plane_address address; 1351 struct dc_cursor_attributes attributes; 1352 }; 1353 1354 1355 /******************************************************************************* 1356 * Interrupt interfaces 1357 ******************************************************************************/ 1358 enum dc_irq_source dc_interrupt_to_irq_source( 1359 struct dc *dc, 1360 uint32_t src_id, 1361 uint32_t ext_id); 1362 bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable); 1363 void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src); 1364 enum dc_irq_source dc_get_hpd_irq_source_at_index( 1365 struct dc *dc, uint32_t link_index); 1366 1367 void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable); 1368 1369 /******************************************************************************* 1370 * Power Interfaces 1371 ******************************************************************************/ 1372 1373 void dc_set_power_state( 1374 struct dc *dc, 1375 enum dc_acpi_cm_power_state power_state); 1376 void dc_resume(struct dc *dc); 1377 1378 void dc_power_down_on_boot(struct dc *dc); 1379 1380 #if defined(CONFIG_DRM_AMD_DC_HDCP) 1381 /* 1382 * HDCP Interfaces 1383 */ 1384 enum hdcp_message_status dc_process_hdcp_msg( 1385 enum signal_type signal, 1386 struct dc_link *link, 1387 struct hdcp_protection_message *message_info); 1388 #endif 1389 bool dc_is_dmcu_initialized(struct dc *dc); 1390 1391 enum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping); 1392 void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg); 1393 #if defined(CONFIG_DRM_AMD_DC_DCN) 1394 1395 bool dc_is_plane_eligible_for_idle_optimizations(struct dc *dc, struct dc_plane_state *plane, 1396 struct dc_cursor_attributes *cursor_attr); 1397 1398 void dc_allow_idle_optimizations(struct dc *dc, bool allow); 1399 1400 /* 1401 * blank all streams, and set min and max memory clock to 1402 * lowest and highest DPM level, respectively 1403 */ 1404 void dc_unlock_memory_clock_frequency(struct dc *dc); 1405 1406 /* 1407 * set min memory clock to the min required for current mode, 1408 * max to maxDPM, and unblank streams 1409 */ 1410 void dc_lock_memory_clock_frequency(struct dc *dc); 1411 1412 /* cleanup on driver unload */ 1413 void dc_hardware_release(struct dc *dc); 1414 1415 #endif 1416 1417 bool dc_set_psr_allow_active(struct dc *dc, bool enable); 1418 #if defined(CONFIG_DRM_AMD_DC_DCN) 1419 void dc_z10_restore(const struct dc *dc); 1420 void dc_z10_save_init(struct dc *dc); 1421 #endif 1422 1423 bool dc_enable_dmub_notifications(struct dc *dc); 1424 1425 bool dc_process_dmub_aux_transfer_async(struct dc *dc, 1426 uint32_t link_index, 1427 struct aux_payload *payload); 1428 1429 /* Get dc link index from dpia port index */ 1430 uint8_t get_link_index_from_dpia_port_index(const struct dc *dc, 1431 uint8_t dpia_port_index); 1432 1433 bool dc_process_dmub_set_config_async(struct dc *dc, 1434 uint32_t link_index, 1435 struct set_config_cmd_payload *payload, 1436 struct dmub_notification *notify); 1437 1438 enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc, 1439 uint32_t link_index, 1440 uint8_t mst_alloc_slots, 1441 uint8_t *mst_slots_in_use); 1442 1443 /******************************************************************************* 1444 * DSC Interfaces 1445 ******************************************************************************/ 1446 #include "dc_dsc.h" 1447 1448 /******************************************************************************* 1449 * Disable acc mode Interfaces 1450 ******************************************************************************/ 1451 void dc_disable_accelerated_mode(struct dc *dc); 1452 1453 #endif /* DC_INTERFACE_H_ */ 1454