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