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 int bl_idx; 614 615 /* we need to mind the EDID between detect 616 and get modes due to analog/digital/tvencoder */ 617 struct edid *edid; 618 619 /* shared with amdgpu */ 620 struct amdgpu_hpd hpd; 621 622 /* number of modes generated from EDID at 'dc_sink' */ 623 int num_modes; 624 625 /* The 'old' sink - before an HPD. 626 * The 'current' sink is in dc_link->sink. */ 627 struct dc_sink *dc_sink; 628 struct dc_link *dc_link; 629 630 /** 631 * @dc_em_sink: Reference to the emulated (virtual) sink. 632 */ 633 struct dc_sink *dc_em_sink; 634 635 /* DM only */ 636 struct drm_dp_mst_topology_mgr mst_mgr; 637 struct amdgpu_dm_dp_aux dm_dp_aux; 638 struct drm_dp_mst_port *mst_output_port; 639 struct amdgpu_dm_connector *mst_root; 640 struct drm_dp_aux *dsc_aux; 641 /* TODO see if we can merge with ddc_bus or make a dm_connector */ 642 struct amdgpu_i2c_adapter *i2c; 643 644 /* Monitor range limits */ 645 /** 646 * @min_vfreq: Minimal frequency supported by the display in Hz. This 647 * value is set to zero when there is no FreeSync support. 648 */ 649 int min_vfreq; 650 651 /** 652 * @max_vfreq: Maximum frequency supported by the display in Hz. This 653 * value is set to zero when there is no FreeSync support. 654 */ 655 int max_vfreq ; 656 int pixel_clock_mhz; 657 658 /* Audio instance - protected by audio_lock. */ 659 int audio_inst; 660 661 struct mutex hpd_lock; 662 663 bool fake_enable; 664 bool force_yuv420_output; 665 struct dsc_preferred_settings dsc_settings; 666 union dp_downstream_port_present mst_downstream_port_present; 667 /* Cached display modes */ 668 struct drm_display_mode freesync_vid_base; 669 670 int psr_skip_count; 671 672 /* Record progress status of mst*/ 673 uint8_t mst_status; 674 675 /* Automated testing */ 676 bool timing_changed; 677 struct dc_crtc_timing *timing_requested; 678 679 /* Adaptive Sync */ 680 bool pack_sdp_v1_3; 681 enum adaptive_sync_type as_type; 682 struct amdgpu_hdmi_vsdb_info vsdb_info; 683 }; 684 685 static inline void amdgpu_dm_set_mst_status(uint8_t *status, 686 uint8_t flags, bool set) 687 { 688 if (set) 689 *status |= flags; 690 else 691 *status &= ~flags; 692 } 693 694 #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base) 695 696 extern const struct amdgpu_ip_block_version dm_ip_block; 697 698 struct dm_plane_state { 699 struct drm_plane_state base; 700 struct dc_plane_state *dc_state; 701 }; 702 703 struct dm_crtc_state { 704 struct drm_crtc_state base; 705 struct dc_stream_state *stream; 706 707 bool cm_has_degamma; 708 bool cm_is_degamma_srgb; 709 710 bool mpo_requested; 711 712 int update_type; 713 int active_planes; 714 715 int crc_skip_count; 716 717 bool freesync_vrr_info_changed; 718 719 bool dsc_force_changed; 720 bool vrr_supported; 721 struct mod_freesync_config freesync_config; 722 struct dc_info_packet vrr_infopacket; 723 724 int abm_level; 725 }; 726 727 #define to_dm_crtc_state(x) container_of(x, struct dm_crtc_state, base) 728 729 struct dm_atomic_state { 730 struct drm_private_state base; 731 732 struct dc_state *context; 733 }; 734 735 #define to_dm_atomic_state(x) container_of(x, struct dm_atomic_state, base) 736 737 struct dm_connector_state { 738 struct drm_connector_state base; 739 740 enum amdgpu_rmx_type scaling; 741 uint8_t underscan_vborder; 742 uint8_t underscan_hborder; 743 bool underscan_enable; 744 bool freesync_capable; 745 bool update_hdcp; 746 uint8_t abm_level; 747 int vcpi_slots; 748 uint64_t pbn; 749 }; 750 751 #define to_dm_connector_state(x)\ 752 container_of((x), struct dm_connector_state, base) 753 754 void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector); 755 struct drm_connector_state * 756 amdgpu_dm_connector_atomic_duplicate_state(struct drm_connector *connector); 757 int amdgpu_dm_connector_atomic_set_property(struct drm_connector *connector, 758 struct drm_connector_state *state, 759 struct drm_property *property, 760 uint64_t val); 761 762 int amdgpu_dm_connector_atomic_get_property(struct drm_connector *connector, 763 const struct drm_connector_state *state, 764 struct drm_property *property, 765 uint64_t *val); 766 767 int amdgpu_dm_get_encoder_crtc_mask(struct amdgpu_device *adev); 768 769 void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, 770 struct amdgpu_dm_connector *aconnector, 771 int connector_type, 772 struct dc_link *link, 773 int link_index); 774 775 enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connector, 776 struct drm_display_mode *mode); 777 778 void dm_restore_drm_connector_state(struct drm_device *dev, 779 struct drm_connector *connector); 780 781 void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, 782 struct edid *edid); 783 784 void amdgpu_dm_trigger_timing_sync(struct drm_device *dev); 785 786 #define MAX_COLOR_LUT_ENTRIES 4096 787 /* Legacy gamm LUT users such as X doesn't like large LUT sizes */ 788 #define MAX_COLOR_LEGACY_LUT_ENTRIES 256 789 790 void amdgpu_dm_init_color_mod(void); 791 int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state); 792 int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc); 793 int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, 794 struct dc_plane_state *dc_plane_state); 795 796 void amdgpu_dm_update_connector_after_detect( 797 struct amdgpu_dm_connector *aconnector); 798 799 extern const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs; 800 801 int amdgpu_dm_process_dmub_aux_transfer_sync(struct dc_context *ctx, unsigned int link_index, 802 struct aux_payload *payload, enum aux_return_code_type *operation_result); 803 804 int amdgpu_dm_process_dmub_set_config_sync(struct dc_context *ctx, unsigned int link_index, 805 struct set_config_cmd_payload *payload, enum set_config_status *operation_result); 806 807 bool check_seamless_boot_capability(struct amdgpu_device *adev); 808 809 struct dc_stream_state * 810 create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector, 811 const struct drm_display_mode *drm_mode, 812 const struct dm_connector_state *dm_state, 813 const struct dc_stream_state *old_stream); 814 815 int dm_atomic_get_state(struct drm_atomic_state *state, 816 struct dm_atomic_state **dm_state); 817 818 struct amdgpu_dm_connector * 819 amdgpu_dm_find_first_crtc_matching_connector(struct drm_atomic_state *state, 820 struct drm_crtc *crtc); 821 822 int convert_dc_color_depth_into_bpc(enum dc_color_depth display_color_depth); 823 #endif /* __AMDGPU_DM_H__ */ 824