1 /* 2 * Copyright (C) 2015-2020 Advanced Micro Devices, Inc. All rights reserved. 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 __AMDGPU_DM_H__ 27 #define __AMDGPU_DM_H__ 28 29 #include <drm/display/drm_dp_mst_helper.h> 30 #include <drm/drm_atomic.h> 31 #include <drm/drm_connector.h> 32 #include <drm/drm_crtc.h> 33 #include <drm/drm_plane.h> 34 #include "link_service_types.h" 35 36 /* 37 * This file contains the definition for amdgpu_display_manager 38 * and its API for amdgpu driver's use. 39 * This component provides all the display related functionality 40 * and this is the only component that calls DAL API. 41 * The API contained here intended for amdgpu driver use. 42 * The API that is called directly from KMS framework is located 43 * in amdgpu_dm_kms.h file 44 */ 45 46 #define AMDGPU_DM_MAX_DISPLAY_INDEX 31 47 48 #define AMDGPU_DM_MAX_CRTC 6 49 50 #define AMDGPU_DM_MAX_NUM_EDP 2 51 52 #define AMDGPU_DMUB_NOTIFICATION_MAX 5 53 54 /* 55 #include "include/amdgpu_dal_power_if.h" 56 #include "amdgpu_dm_irq.h" 57 */ 58 59 #include "irq_types.h" 60 #include "signal_types.h" 61 #include "amdgpu_dm_crc.h" 62 #include "mod_info_packet.h" 63 struct aux_payload; 64 struct set_config_cmd_payload; 65 enum aux_return_code_type; 66 enum set_config_status; 67 68 /* Forward declarations */ 69 struct amdgpu_device; 70 struct amdgpu_crtc; 71 struct drm_device; 72 struct dc; 73 struct amdgpu_bo; 74 struct dmub_srv; 75 struct dc_plane_state; 76 struct dmub_notification; 77 78 struct common_irq_params { 79 struct amdgpu_device *adev; 80 enum dc_irq_source irq_src; 81 atomic64_t previous_timestamp; 82 }; 83 84 /** 85 * struct dm_compressor_info - Buffer info used by frame buffer compression 86 * @cpu_addr: MMIO cpu addr 87 * @bo_ptr: Pointer to the buffer object 88 * @gpu_addr: MMIO gpu addr 89 */ 90 struct dm_compressor_info { 91 void *cpu_addr; 92 struct amdgpu_bo *bo_ptr; 93 uint64_t gpu_addr; 94 }; 95 96 typedef void (*dmub_notify_interrupt_callback_t)(struct amdgpu_device *adev, struct dmub_notification *notify); 97 98 /** 99 * struct dmub_hpd_work - Handle time consuming work in low priority outbox IRQ 100 * 101 * @handle_hpd_work: Work to be executed in a separate thread to handle hpd_low_irq 102 * @dmub_notify: notification for callback function 103 * @adev: amdgpu_device pointer 104 */ 105 struct dmub_hpd_work { 106 struct work_struct handle_hpd_work; 107 struct dmub_notification *dmub_notify; 108 struct amdgpu_device *adev; 109 }; 110 111 /** 112 * struct vblank_control_work - Work data for vblank control 113 * @work: Kernel work data for the work event 114 * @dm: amdgpu display manager device 115 * @acrtc: amdgpu CRTC instance for which the event has occurred 116 * @stream: DC stream for which the event has occurred 117 * @enable: true if enabling vblank 118 */ 119 struct vblank_control_work { 120 struct work_struct work; 121 struct amdgpu_display_manager *dm; 122 struct amdgpu_crtc *acrtc; 123 struct dc_stream_state *stream; 124 bool enable; 125 }; 126 127 /** 128 * struct amdgpu_dm_backlight_caps - Information about backlight 129 * 130 * Describe the backlight support for ACPI or eDP AUX. 131 */ 132 struct amdgpu_dm_backlight_caps { 133 /** 134 * @ext_caps: Keep the data struct with all the information about the 135 * display support for HDR. 136 */ 137 union dpcd_sink_ext_caps *ext_caps; 138 /** 139 * @aux_min_input_signal: Min brightness value supported by the display 140 */ 141 u32 aux_min_input_signal; 142 /** 143 * @aux_max_input_signal: Max brightness value supported by the display 144 * in nits. 145 */ 146 u32 aux_max_input_signal; 147 /** 148 * @min_input_signal: minimum possible input in range 0-255. 149 */ 150 int min_input_signal; 151 /** 152 * @max_input_signal: maximum possible input in range 0-255. 153 */ 154 int max_input_signal; 155 /** 156 * @caps_valid: true if these values are from the ACPI interface. 157 */ 158 bool caps_valid; 159 /** 160 * @aux_support: Describes if the display supports AUX backlight. 161 */ 162 bool aux_support; 163 }; 164 165 /** 166 * struct dal_allocation - Tracks mapped FB memory for SMU communication 167 * @list: list of dal allocations 168 * @bo: GPU buffer object 169 * @cpu_ptr: CPU virtual address of the GPU buffer object 170 * @gpu_addr: GPU virtual address of the GPU buffer object 171 */ 172 struct dal_allocation { 173 struct list_head list; 174 struct amdgpu_bo *bo; 175 void *cpu_ptr; 176 u64 gpu_addr; 177 }; 178 179 /** 180 * struct hpd_rx_irq_offload_work_queue - Work queue to handle hpd_rx_irq 181 * offload work 182 */ 183 struct hpd_rx_irq_offload_work_queue { 184 /** 185 * @wq: workqueue structure to queue offload work. 186 */ 187 struct workqueue_struct *wq; 188 /** 189 * @offload_lock: To protect fields of offload work queue. 190 */ 191 spinlock_t offload_lock; 192 /** 193 * @is_handling_link_loss: Used to prevent inserting link loss event when 194 * we're handling link loss 195 */ 196 bool is_handling_link_loss; 197 /** 198 * @aconnector: The aconnector that this work queue is attached to 199 */ 200 struct amdgpu_dm_connector *aconnector; 201 }; 202 203 /** 204 * struct hpd_rx_irq_offload_work - hpd_rx_irq offload work structure 205 */ 206 struct hpd_rx_irq_offload_work { 207 /** 208 * @work: offload work 209 */ 210 struct work_struct work; 211 /** 212 * @data: reference irq data which is used while handling offload work 213 */ 214 union hpd_irq_data data; 215 /** 216 * @offload_wq: offload work queue that this work is queued to 217 */ 218 struct hpd_rx_irq_offload_work_queue *offload_wq; 219 }; 220 221 /** 222 * struct amdgpu_display_manager - Central amdgpu display manager device 223 * 224 * @dc: Display Core control structure 225 * @adev: AMDGPU base driver structure 226 * @ddev: DRM base driver structure 227 * @display_indexes_num: Max number of display streams supported 228 * @irq_handler_list_table_lock: Synchronizes access to IRQ tables 229 * @backlight_dev: Backlight control device 230 * @backlight_link: Link on which to control backlight 231 * @backlight_caps: Capabilities of the backlight device 232 * @freesync_module: Module handling freesync calculations 233 * @hdcp_workqueue: AMDGPU content protection queue 234 * @fw_dmcu: Reference to DMCU firmware 235 * @dmcu_fw_version: Version of the DMCU firmware 236 * @soc_bounding_box: SOC bounding box values provided by gpu_info FW 237 * @cached_state: Caches device atomic state for suspend/resume 238 * @cached_dc_state: Cached state of content streams 239 * @compressor: Frame buffer compression buffer. See &struct dm_compressor_info 240 * @force_timing_sync: set via debugfs. When set, indicates that all connected 241 * displays will be forced to synchronize. 242 * @dmcub_trace_event_en: enable dmcub trace events 243 * @dmub_outbox_params: DMUB Outbox parameters 244 * @num_of_edps: number of backlight eDPs 245 * @disable_hpd_irq: disables all HPD and HPD RX interrupt handling in the 246 * driver when true 247 * @dmub_aux_transfer_done: struct completion used to indicate when DMUB 248 * transfers are done 249 * @delayed_hpd_wq: work queue used to delay DMUB HPD work 250 */ 251 struct amdgpu_display_manager { 252 253 struct dc *dc; 254 255 /** 256 * @dmub_srv: 257 * 258 * DMUB service, used for controlling the DMUB on hardware 259 * that supports it. The pointer to the dmub_srv will be 260 * NULL on hardware that does not support it. 261 */ 262 struct dmub_srv *dmub_srv; 263 264 /** 265 * @dmub_notify: 266 * 267 * Notification from DMUB. 268 */ 269 270 struct dmub_notification *dmub_notify; 271 272 /** 273 * @dmub_callback: 274 * 275 * Callback functions to handle notification from DMUB. 276 */ 277 278 dmub_notify_interrupt_callback_t dmub_callback[AMDGPU_DMUB_NOTIFICATION_MAX]; 279 280 /** 281 * @dmub_thread_offload: 282 * 283 * Flag to indicate if callback is offload. 284 */ 285 286 bool dmub_thread_offload[AMDGPU_DMUB_NOTIFICATION_MAX]; 287 288 /** 289 * @dmub_fb_info: 290 * 291 * Framebuffer regions for the DMUB. 292 */ 293 struct dmub_srv_fb_info *dmub_fb_info; 294 295 /** 296 * @dmub_fw: 297 * 298 * DMUB firmware, required on hardware that has DMUB support. 299 */ 300 const struct firmware *dmub_fw; 301 302 /** 303 * @dmub_bo: 304 * 305 * Buffer object for the DMUB. 306 */ 307 struct amdgpu_bo *dmub_bo; 308 309 /** 310 * @dmub_bo_gpu_addr: 311 * 312 * GPU virtual address for the DMUB buffer object. 313 */ 314 u64 dmub_bo_gpu_addr; 315 316 /** 317 * @dmub_bo_cpu_addr: 318 * 319 * CPU address for the DMUB buffer object. 320 */ 321 void *dmub_bo_cpu_addr; 322 323 /** 324 * @dmcub_fw_version: 325 * 326 * DMCUB firmware version. 327 */ 328 uint32_t dmcub_fw_version; 329 330 /** 331 * @cgs_device: 332 * 333 * The Common Graphics Services device. It provides an interface for 334 * accessing registers. 335 */ 336 struct cgs_device *cgs_device; 337 338 struct amdgpu_device *adev; 339 struct drm_device *ddev; 340 u16 display_indexes_num; 341 342 /** 343 * @atomic_obj: 344 * 345 * In combination with &dm_atomic_state it helps manage 346 * global atomic state that doesn't map cleanly into existing 347 * drm resources, like &dc_context. 348 */ 349 struct drm_private_obj atomic_obj; 350 351 /** 352 * @dc_lock: 353 * 354 * Guards access to DC functions that can issue register write 355 * sequences. 356 */ 357 struct mutex dc_lock; 358 359 /** 360 * @audio_lock: 361 * 362 * Guards access to audio instance changes. 363 */ 364 struct mutex audio_lock; 365 366 /** 367 * @audio_component: 368 * 369 * Used to notify ELD changes to sound driver. 370 */ 371 struct drm_audio_component *audio_component; 372 373 /** 374 * @audio_registered: 375 * 376 * True if the audio component has been registered 377 * successfully, false otherwise. 378 */ 379 bool audio_registered; 380 381 /** 382 * @irq_handler_list_low_tab: 383 * 384 * Low priority IRQ handler table. 385 * 386 * It is a n*m table consisting of n IRQ sources, and m handlers per IRQ 387 * source. Low priority IRQ handlers are deferred to a workqueue to be 388 * processed. Hence, they can sleep. 389 * 390 * Note that handlers are called in the same order as they were 391 * registered (FIFO). 392 */ 393 struct list_head irq_handler_list_low_tab[DAL_IRQ_SOURCES_NUMBER]; 394 395 /** 396 * @irq_handler_list_high_tab: 397 * 398 * High priority IRQ handler table. 399 * 400 * It is a n*m table, same as &irq_handler_list_low_tab. However, 401 * handlers in this table are not deferred and are called immediately. 402 */ 403 struct list_head irq_handler_list_high_tab[DAL_IRQ_SOURCES_NUMBER]; 404 405 /** 406 * @pflip_params: 407 * 408 * Page flip IRQ parameters, passed to registered handlers when 409 * triggered. 410 */ 411 struct common_irq_params 412 pflip_params[DC_IRQ_SOURCE_PFLIP_LAST - DC_IRQ_SOURCE_PFLIP_FIRST + 1]; 413 414 /** 415 * @vblank_params: 416 * 417 * Vertical blanking IRQ parameters, passed to registered handlers when 418 * triggered. 419 */ 420 struct common_irq_params 421 vblank_params[DC_IRQ_SOURCE_VBLANK6 - DC_IRQ_SOURCE_VBLANK1 + 1]; 422 423 /** 424 * @vline0_params: 425 * 426 * OTG vertical interrupt0 IRQ parameters, passed to registered 427 * handlers when triggered. 428 */ 429 struct common_irq_params 430 vline0_params[DC_IRQ_SOURCE_DC6_VLINE0 - DC_IRQ_SOURCE_DC1_VLINE0 + 1]; 431 432 /** 433 * @vupdate_params: 434 * 435 * Vertical update IRQ parameters, passed to registered handlers when 436 * triggered. 437 */ 438 struct common_irq_params 439 vupdate_params[DC_IRQ_SOURCE_VUPDATE6 - DC_IRQ_SOURCE_VUPDATE1 + 1]; 440 441 /** 442 * @dmub_trace_params: 443 * 444 * DMUB trace event IRQ parameters, passed to registered handlers when 445 * triggered. 446 */ 447 struct common_irq_params 448 dmub_trace_params[1]; 449 450 struct common_irq_params 451 dmub_outbox_params[1]; 452 453 spinlock_t irq_handler_list_table_lock; 454 455 struct backlight_device *backlight_dev[AMDGPU_DM_MAX_NUM_EDP]; 456 457 const struct dc_link *backlight_link[AMDGPU_DM_MAX_NUM_EDP]; 458 459 uint8_t num_of_edps; 460 461 struct amdgpu_dm_backlight_caps backlight_caps[AMDGPU_DM_MAX_NUM_EDP]; 462 463 struct mod_freesync *freesync_module; 464 struct hdcp_workqueue *hdcp_workqueue; 465 466 /** 467 * @vblank_control_workqueue: 468 * 469 * Deferred work for vblank control events. 470 */ 471 struct workqueue_struct *vblank_control_workqueue; 472 473 struct drm_atomic_state *cached_state; 474 struct dc_state *cached_dc_state; 475 476 struct dm_compressor_info compressor; 477 478 const struct firmware *fw_dmcu; 479 uint32_t dmcu_fw_version; 480 /** 481 * @soc_bounding_box: 482 * 483 * gpu_info FW provided soc bounding box struct or 0 if not 484 * available in FW 485 */ 486 const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; 487 488 /** 489 * @active_vblank_irq_count: 490 * 491 * number of currently active vblank irqs 492 */ 493 uint32_t active_vblank_irq_count; 494 495 #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) 496 /** 497 * @secure_display_ctxs: 498 * 499 * Store the ROI information and the work_struct to command dmub and psp for 500 * all crtcs. 501 */ 502 struct secure_display_context *secure_display_ctxs; 503 #endif 504 /** 505 * @hpd_rx_offload_wq: 506 * 507 * Work queue to offload works of hpd_rx_irq 508 */ 509 struct hpd_rx_irq_offload_work_queue *hpd_rx_offload_wq; 510 /** 511 * @mst_encoders: 512 * 513 * fake encoders used for DP MST. 514 */ 515 struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC]; 516 bool force_timing_sync; 517 bool disable_hpd_irq; 518 bool dmcub_trace_event_en; 519 /** 520 * @da_list: 521 * 522 * DAL fb memory allocation list, for communication with SMU. 523 */ 524 struct list_head da_list; 525 struct completion dmub_aux_transfer_done; 526 struct workqueue_struct *delayed_hpd_wq; 527 528 /** 529 * @brightness: 530 * 531 * cached backlight values. 532 */ 533 u32 brightness[AMDGPU_DM_MAX_NUM_EDP]; 534 /** 535 * @actual_brightness: 536 * 537 * last successfully applied backlight values. 538 */ 539 u32 actual_brightness[AMDGPU_DM_MAX_NUM_EDP]; 540 541 /** 542 * @aux_hpd_discon_quirk: 543 * 544 * quirk for hpd discon while aux is on-going. 545 * occurred on certain intel platform 546 */ 547 bool aux_hpd_discon_quirk; 548 549 /** 550 * @dpia_aux_lock: 551 * 552 * Guards access to DPIA AUX 553 */ 554 struct mutex dpia_aux_lock; 555 }; 556 557 enum dsc_clock_force_state { 558 DSC_CLK_FORCE_DEFAULT = 0, 559 DSC_CLK_FORCE_ENABLE, 560 DSC_CLK_FORCE_DISABLE, 561 }; 562 563 struct dsc_preferred_settings { 564 enum dsc_clock_force_state dsc_force_enable; 565 uint32_t dsc_num_slices_v; 566 uint32_t dsc_num_slices_h; 567 uint32_t dsc_bits_per_pixel; 568 bool dsc_force_disable_passthrough; 569 }; 570 571 enum mst_progress_status { 572 MST_STATUS_DEFAULT = 0, 573 MST_PROBE = BIT(0), 574 MST_REMOTE_EDID = BIT(1), 575 MST_ALLOCATE_NEW_PAYLOAD = BIT(2), 576 MST_CLEAR_ALLOCATED_PAYLOAD = BIT(3), 577 }; 578 579 /** 580 * struct amdgpu_hdmi_vsdb_info - Keep track of the VSDB info 581 * 582 * AMDGPU supports FreeSync over HDMI by using the VSDB section, and this 583 * struct is useful to keep track of the display-specific information about 584 * FreeSync. 585 */ 586 struct amdgpu_hdmi_vsdb_info { 587 /** 588 * @amd_vsdb_version: Vendor Specific Data Block Version, should be 589 * used to determine which Vendor Specific InfoFrame (VSIF) to send. 590 */ 591 unsigned int amd_vsdb_version; 592 593 /** 594 * @freesync_supported: FreeSync Supported. 595 */ 596 bool freesync_supported; 597 598 /** 599 * @min_refresh_rate_hz: FreeSync Minimum Refresh Rate in Hz. 600 */ 601 unsigned int min_refresh_rate_hz; 602 603 /** 604 * @max_refresh_rate_hz: FreeSync Maximum Refresh Rate in Hz 605 */ 606 unsigned int max_refresh_rate_hz; 607 }; 608 609 struct amdgpu_dm_connector { 610 611 struct drm_connector base; 612 uint32_t connector_id; 613 614 /* we need to mind the EDID between detect 615 and get modes due to analog/digital/tvencoder */ 616 struct edid *edid; 617 618 /* shared with amdgpu */ 619 struct amdgpu_hpd hpd; 620 621 /* number of modes generated from EDID at 'dc_sink' */ 622 int num_modes; 623 624 /* The 'old' sink - before an HPD. 625 * The 'current' sink is in dc_link->sink. */ 626 struct dc_sink *dc_sink; 627 struct dc_link *dc_link; 628 629 /** 630 * @dc_em_sink: Reference to the emulated (virtual) sink. 631 */ 632 struct dc_sink *dc_em_sink; 633 634 /* DM only */ 635 struct drm_dp_mst_topology_mgr mst_mgr; 636 struct amdgpu_dm_dp_aux dm_dp_aux; 637 struct drm_dp_mst_port *mst_output_port; 638 struct amdgpu_dm_connector *mst_root; 639 struct drm_dp_aux *dsc_aux; 640 /* TODO see if we can merge with ddc_bus or make a dm_connector */ 641 struct amdgpu_i2c_adapter *i2c; 642 643 /* Monitor range limits */ 644 /** 645 * @min_vfreq: Minimal frequency supported by the display in Hz. This 646 * value is set to zero when there is no FreeSync support. 647 */ 648 int min_vfreq; 649 650 /** 651 * @max_vfreq: Maximum frequency supported by the display in Hz. This 652 * value is set to zero when there is no FreeSync support. 653 */ 654 int max_vfreq ; 655 int pixel_clock_mhz; 656 657 /* Audio instance - protected by audio_lock. */ 658 int audio_inst; 659 660 struct mutex hpd_lock; 661 662 bool fake_enable; 663 #ifdef CONFIG_DEBUG_FS 664 uint32_t debugfs_dpcd_address; 665 uint32_t debugfs_dpcd_size; 666 #endif 667 bool force_yuv420_output; 668 struct dsc_preferred_settings dsc_settings; 669 union dp_downstream_port_present mst_downstream_port_present; 670 /* Cached display modes */ 671 struct drm_display_mode freesync_vid_base; 672 673 int psr_skip_count; 674 675 /* Record progress status of mst*/ 676 uint8_t mst_status; 677 678 /* Automated testing */ 679 bool timing_changed; 680 struct dc_crtc_timing *timing_requested; 681 682 /* Adaptive Sync */ 683 bool pack_sdp_v1_3; 684 enum adaptive_sync_type as_type; 685 struct amdgpu_hdmi_vsdb_info vsdb_info; 686 }; 687 688 static inline void amdgpu_dm_set_mst_status(uint8_t *status, 689 uint8_t flags, bool set) 690 { 691 if (set) 692 *status |= flags; 693 else 694 *status &= ~flags; 695 } 696 697 #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base) 698 699 extern const struct amdgpu_ip_block_version dm_ip_block; 700 701 struct dm_plane_state { 702 struct drm_plane_state base; 703 struct dc_plane_state *dc_state; 704 }; 705 706 struct dm_crtc_state { 707 struct drm_crtc_state base; 708 struct dc_stream_state *stream; 709 710 bool cm_has_degamma; 711 bool cm_is_degamma_srgb; 712 713 bool mpo_requested; 714 715 int update_type; 716 int active_planes; 717 718 int crc_skip_count; 719 720 bool freesync_vrr_info_changed; 721 722 bool dsc_force_changed; 723 bool vrr_supported; 724 struct mod_freesync_config freesync_config; 725 struct dc_info_packet vrr_infopacket; 726 727 int abm_level; 728 }; 729 730 #define to_dm_crtc_state(x) container_of(x, struct dm_crtc_state, base) 731 732 struct dm_atomic_state { 733 struct drm_private_state base; 734 735 struct dc_state *context; 736 }; 737 738 #define to_dm_atomic_state(x) container_of(x, struct dm_atomic_state, base) 739 740 struct dm_connector_state { 741 struct drm_connector_state base; 742 743 enum amdgpu_rmx_type scaling; 744 uint8_t underscan_vborder; 745 uint8_t underscan_hborder; 746 bool underscan_enable; 747 bool freesync_capable; 748 bool update_hdcp; 749 uint8_t abm_level; 750 int vcpi_slots; 751 uint64_t pbn; 752 }; 753 754 #define to_dm_connector_state(x)\ 755 container_of((x), struct dm_connector_state, base) 756 757 void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector); 758 struct drm_connector_state * 759 amdgpu_dm_connector_atomic_duplicate_state(struct drm_connector *connector); 760 int amdgpu_dm_connector_atomic_set_property(struct drm_connector *connector, 761 struct drm_connector_state *state, 762 struct drm_property *property, 763 uint64_t val); 764 765 int amdgpu_dm_connector_atomic_get_property(struct drm_connector *connector, 766 const struct drm_connector_state *state, 767 struct drm_property *property, 768 uint64_t *val); 769 770 int amdgpu_dm_get_encoder_crtc_mask(struct amdgpu_device *adev); 771 772 void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, 773 struct amdgpu_dm_connector *aconnector, 774 int connector_type, 775 struct dc_link *link, 776 int link_index); 777 778 enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector, 779 struct drm_display_mode *mode); 780 781 void dm_restore_drm_connector_state(struct drm_device *dev, 782 struct drm_connector *connector); 783 784 void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, 785 struct edid *edid); 786 787 void amdgpu_dm_trigger_timing_sync(struct drm_device *dev); 788 789 #define MAX_COLOR_LUT_ENTRIES 4096 790 /* Legacy gamm LUT users such as X doesn't like large LUT sizes */ 791 #define MAX_COLOR_LEGACY_LUT_ENTRIES 256 792 793 void amdgpu_dm_init_color_mod(void); 794 int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state); 795 int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc); 796 int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, 797 struct dc_plane_state *dc_plane_state); 798 799 void amdgpu_dm_update_connector_after_detect( 800 struct amdgpu_dm_connector *aconnector); 801 802 extern const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs; 803 804 int amdgpu_dm_process_dmub_aux_transfer_sync(struct dc_context *ctx, unsigned int link_index, 805 struct aux_payload *payload, enum aux_return_code_type *operation_result); 806 807 int amdgpu_dm_process_dmub_set_config_sync(struct dc_context *ctx, unsigned int link_index, 808 struct set_config_cmd_payload *payload, enum set_config_status *operation_result); 809 810 bool check_seamless_boot_capability(struct amdgpu_device *adev); 811 812 struct dc_stream_state * 813 create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector, 814 const struct drm_display_mode *drm_mode, 815 const struct dm_connector_state *dm_state, 816 const struct dc_stream_state *old_stream); 817 818 int dm_atomic_get_state(struct drm_atomic_state *state, 819 struct dm_atomic_state **dm_state); 820 821 struct amdgpu_dm_connector * 822 amdgpu_dm_find_first_crtc_matching_connector(struct drm_atomic_state *state, 823 struct drm_crtc *crtc); 824 825 int convert_dc_color_depth_into_bpc(enum dc_color_depth display_color_depth); 826 #endif /* __AMDGPU_DM_H__ */ 827