2 * Copyright 2012-14 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #ifndef DC_INTERFACE_H_
27 #define DC_INTERFACE_H_
30 #include "grph_object_defs.h"
31 #include "logger_types.h"
32 #include "gpio_types.h"
33 #include "link_service_types.h"
34 #include "grph_object_ctrl_defs.h"
35 #include <inc/hw/opp.h>
37 #include "inc/hw_sequencer.h"
38 #include "inc/compressor.h"
39 #include "inc/hw/dmcu.h"
40 #include "dml/display_mode_lib.h"
42 #define DC_VER "3.2.41"
44 #define MAX_SURFACES 3
47 #define MAX_SINKS_PER_LINK 4
49 /*******************************************************************************
50 * Display Core Interfaces
51 ******************************************************************************/
54 struct dmcu_version dmcu_version;
58 DC_PLANE_TYPE_INVALID,
59 DC_PLANE_TYPE_DCE_RGB,
60 DC_PLANE_TYPE_DCE_UNDERLAY,
61 DC_PLANE_TYPE_DCN_UNIVERSAL,
65 enum dc_plane_type type;
66 uint32_t blends_with_above : 1;
67 uint32_t blends_with_below : 1;
68 uint32_t per_pixel_alpha : 1;
70 uint32_t argb8888 : 1;
75 } pixel_format_support;
76 // max upscaling factor x1000
77 // upscaling factors are always >= 1
78 // for example, 1080p -> 8K is 4.0, or 4000 raw value
84 // max downscale factor x1000
85 // downscale factors are always <= 1
86 // for example, 8K -> 1080p is 0.25, or 250 raw value
91 } max_downscale_factor;
98 uint32_t max_slave_planes;
100 uint32_t max_downscale_ratio;
101 uint32_t i2c_speed_in_khz;
102 uint32_t dmdata_alloc_size;
103 unsigned int max_cursor_size;
104 unsigned int max_video_width;
105 int linear_pitch_alignment;
106 bool dcc_const_color;
110 bool post_blend_color_processing;
111 bool force_dp_tps4_for_cp2520;
112 bool disable_dp_clk_share;
113 bool psp_setup_panel_mode;
114 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
117 struct dc_plane_cap planes[MAX_PLANES];
120 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
122 bool no_connect_phy_config;
127 struct dc_dcc_surface_param {
128 struct dc_size surface_size;
129 enum surface_pixel_format format;
130 enum swizzle_mode_values swizzle_mode;
131 enum dc_scan_direction scan;
134 struct dc_dcc_setting {
135 unsigned int max_compressed_blk_size;
136 unsigned int max_uncompressed_blk_size;
137 bool independent_64b_blks;
140 struct dc_surface_dcc_cap {
143 struct dc_dcc_setting rgb;
147 struct dc_dcc_setting luma;
148 struct dc_dcc_setting chroma;
153 bool const_color_support;
156 struct dc_static_screen_events {
164 /* Surface update type is used by dc_update_surfaces_and_stream
165 * The update type is determined at the very beginning of the function based
166 * on parameters passed in and decides how much programming (or updating) is
167 * going to be done during the call.
169 * UPDATE_TYPE_FAST is used for really fast updates that do not require much
170 * logical calculations or hardware register programming. This update MUST be
171 * ISR safe on windows. Currently fast update will only be used to flip surface
174 * UPDATE_TYPE_MED is used for slower updates which require significant hw
175 * re-programming however do not affect bandwidth consumption or clock
176 * requirements. At present, this is the level at which front end updates
177 * that do not require us to run bw_calcs happen. These are in/out transfer func
178 * updates, viewport offset changes, recout size changes and pixel depth changes.
179 * This update can be done at ISR, but we want to minimize how often this happens.
181 * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our
182 * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front
183 * end related. Any time viewport dimensions, recout dimensions, scaling ratios or
184 * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do
185 * a full update. This cannot be done at ISR level and should be a rare event.
186 * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting
187 * underscan we don't expect to see this call at all.
190 enum surface_update_type {
191 UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */
192 UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/
193 UPDATE_TYPE_FULL, /* may need to shuffle resources */
196 /* Forward declaration*/
198 struct dc_plane_state;
202 struct dc_cap_funcs {
203 bool (*get_dcc_compression_cap)(const struct dc *dc,
204 const struct dc_dcc_surface_param *input,
205 struct dc_surface_dcc_cap *output);
208 struct link_training_settings;
211 /* Structure to hold configuration flags set by dm at dc creation. */
214 bool disable_disp_pll_sharing;
216 bool optimize_edp_link_rate;
217 bool disable_fractional_pwm;
218 bool allow_seamless_boot_optimization;
219 bool power_down_display_on_boot;
220 bool edp_not_connected;
225 enum visual_confirm {
226 VISUAL_CONFIRM_DISABLE = 0,
227 VISUAL_CONFIRM_SURFACE = 1,
228 VISUAL_CONFIRM_HDR = 2,
234 DCC_HALF_REQ_DISALBE = 2,
237 enum pipe_split_policy {
238 MPC_SPLIT_DYNAMIC = 0,
240 MPC_SPLIT_AVOID_MULT_DISP = 2,
243 enum wm_report_mode {
244 WM_REPORT_DEFAULT = 0,
245 WM_REPORT_OVERRIDE = 1,
249 * For any clocks that may differ per pipe
250 * only the max is stored in this structure
254 int max_supported_dppclk_khz;
255 int max_supported_dispclk_khz;
257 int bw_dppclk_khz; /*a copy of dppclk_khz*/
261 int dcfclk_deep_sleep_khz;
265 bool p_state_change_support;
268 struct dc_bw_validation_profile {
271 unsigned long long total_ticks;
272 unsigned long long voltage_level_ticks;
273 unsigned long long watermark_ticks;
274 unsigned long long rq_dlg_ticks;
276 unsigned long long total_count;
277 unsigned long long skip_fast_count;
278 unsigned long long skip_pass_count;
279 unsigned long long skip_fail_count;
282 #define BW_VAL_TRACE_SETUP() \
283 unsigned long long end_tick = 0; \
284 unsigned long long voltage_level_tick = 0; \
285 unsigned long long watermark_tick = 0; \
286 unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \
287 dm_get_timestamp(dc->ctx) : 0
289 #define BW_VAL_TRACE_COUNT() \
290 if (dc->debug.bw_val_profile.enable) \
291 dc->debug.bw_val_profile.total_count++
293 #define BW_VAL_TRACE_SKIP(status) \
294 if (dc->debug.bw_val_profile.enable) { \
295 if (!voltage_level_tick) \
296 voltage_level_tick = dm_get_timestamp(dc->ctx); \
297 dc->debug.bw_val_profile.skip_ ## status ## _count++; \
300 #define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \
301 if (dc->debug.bw_val_profile.enable) \
302 voltage_level_tick = dm_get_timestamp(dc->ctx)
304 #define BW_VAL_TRACE_END_WATERMARKS() \
305 if (dc->debug.bw_val_profile.enable) \
306 watermark_tick = dm_get_timestamp(dc->ctx)
308 #define BW_VAL_TRACE_FINISH() \
309 if (dc->debug.bw_val_profile.enable) { \
310 end_tick = dm_get_timestamp(dc->ctx); \
311 dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \
312 dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \
313 if (watermark_tick) { \
314 dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \
315 dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \
319 struct dc_debug_options {
320 enum visual_confirm visual_confirm;
326 bool validation_trace;
327 bool bandwidth_calcs_trace;
328 int max_downscale_src_width;
330 /* stutter efficiency related */
331 bool disable_stutter;
333 enum dcc_option disable_dcc;
334 enum pipe_split_policy pipe_split_policy;
335 bool force_single_disp_pipe_split;
336 bool voltage_align_fclk;
338 bool disable_dfs_bypass;
339 bool disable_dpp_power_gate;
340 bool disable_hubp_power_gate;
341 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
342 bool disable_dsc_power_gate;
344 bool disable_pplib_wm_range;
345 enum wm_report_mode pplib_wm_report_mode;
346 unsigned int min_disp_clk_khz;
347 unsigned int min_dpp_clk_khz;
348 int sr_exit_time_dpm0_ns;
349 int sr_enter_plus_exit_time_dpm0_ns;
351 int sr_enter_plus_exit_time_ns;
352 int urgent_latency_ns;
353 uint32_t underflow_assert_delay_us;
354 int percent_of_ideal_drambw;
355 int dram_clock_change_latency_ns;
356 bool optimized_watermark;
358 bool disable_pplib_clock_request;
359 bool disable_clock_gate;
362 bool force_abm_enable;
363 bool disable_stereo_support;
365 bool performance_trace;
366 bool az_endpoint_mute_only;
367 bool always_use_regamma;
368 bool p010_mpo_support;
369 bool recovery_enabled;
370 bool avoid_vbios_exec_table;
371 bool scl_reset_length10;
373 bool skip_detection_link_training;
374 unsigned int force_odm_combine; //bit vector based on otg inst
375 unsigned int force_fclk_khz;
376 bool disable_tri_buf;
377 struct dc_bw_validation_profile bw_val_profile;
378 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
381 /* This forces a hard min on the DCFCLK requested to SMU/PP
382 * watermarks are not affected.
384 unsigned int force_min_dcfclk_mhz;
385 bool disable_timing_sync;
386 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
389 int force_clock_mode;/*every mode change.*/
392 struct dc_debug_data {
393 uint32_t ltFailCount;
394 uint32_t i2cErrorCount;
395 uint32_t auxErrorCount;
398 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
399 struct dc_phy_addr_space_config {
412 uint64_t page_table_start_addr;
413 uint64_t page_table_end_addr;
414 uint64_t page_table_base_addr;
420 struct dc_virtual_addr_space_config {
421 uint64_t page_table_base_addr;
422 uint64_t page_table_start_addr;
423 uint64_t page_table_end_addr;
424 uint32_t page_table_block_size_in_bytes;
425 uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid
429 struct dc_bounding_box_overrides {
431 int sr_enter_plus_exit_time_ns;
432 int urgent_latency_ns;
433 int percent_of_ideal_drambw;
434 int dram_clock_change_latency_ns;
435 /* This forces a hard min on the DCFCLK we use
436 * for DML. Unlike the debug option for forcing
437 * DCFCLK, this override affects watermark calculations
443 struct resource_pool;
445 struct gpu_info_soc_bounding_box_v1_0;
447 struct dc_versions versions;
449 struct dc_cap_funcs cap_funcs;
450 struct dc_config config;
451 struct dc_debug_options debug;
452 struct dc_bounding_box_overrides bb_overrides;
453 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
454 struct dc_bug_wa work_arounds;
456 struct dc_context *ctx;
457 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
458 struct dc_phy_addr_space_config vm_pa_config;
462 struct dc_link *links[MAX_PIPES * 2];
464 struct dc_state *current_state;
465 struct resource_pool *res_pool;
467 struct clk_mgr *clk_mgr;
469 /* Display Engine Clock levels */
470 struct dm_pp_clock_levels sclk_lvls;
472 /* Inputs into BW and WM calculations. */
473 struct bw_calcs_dceip *bw_dceip;
474 struct bw_calcs_vbios *bw_vbios;
475 #ifdef CONFIG_DRM_AMD_DC_DCN1_0
476 struct dcn_soc_bounding_box *dcn_soc;
477 struct dcn_ip_params *dcn_ip;
478 struct display_mode_lib dml;
482 struct hw_sequencer_funcs hwss;
483 struct dce_hwseq *hwseq;
485 /* Require to optimize clocks and bandwidth for added/removed planes */
486 bool optimized_required;
488 /* Require to maintain clocks and bandwidth for UEFI enabled HW */
489 bool optimize_seamless_boot;
492 struct compressor *fbc_compressor;
494 struct dc_debug_data debug_data;
496 const char *build_id;
497 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
498 struct vm_helper *vm_helper;
499 const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box;
503 enum frame_buffer_mode {
504 FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
505 FRAME_BUFFER_MODE_ZFB_ONLY,
506 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
509 struct dchub_init_data {
510 int64_t zfb_phys_addr_base;
511 int64_t zfb_mc_base_addr;
512 uint64_t zfb_size_in_byte;
513 enum frame_buffer_mode fb_mode;
514 bool dchub_initialzied;
515 bool dchub_info_valid;
518 struct dc_init_data {
519 struct hw_asic_id asic_id;
520 void *driver; /* ctx */
521 struct cgs_device *cgs_device;
522 struct dc_bounding_box_overrides bb_overrides;
524 int num_virtual_links;
526 * If 'vbios_override' not NULL, it will be called instead
527 * of the real VBIOS. Intended use is Diagnostics on FPGA.
529 struct dc_bios *vbios_override;
530 enum dce_environment dce_environment;
532 struct dc_config flags;
534 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
536 * gpu_info FW provided soc bounding box struct or 0 if not
539 const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box;
543 struct dc_callback_init {
547 struct dc *dc_create(const struct dc_init_data *init_params);
548 int dc_get_vmid_use_vector(struct dc *dc);
549 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
550 void dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid);
551 /* Returns the number of vmids supported */
552 int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config);
554 void dc_init_callbacks(struct dc *dc,
555 const struct dc_callback_init *init_params);
556 void dc_destroy(struct dc **dc);
558 /*******************************************************************************
560 ******************************************************************************/
563 TRANSFER_FUNC_POINTS = 1025
566 struct dc_hdr_static_metadata {
567 /* display chromaticities and white point in units of 0.00001 */
568 unsigned int chromaticity_green_x;
569 unsigned int chromaticity_green_y;
570 unsigned int chromaticity_blue_x;
571 unsigned int chromaticity_blue_y;
572 unsigned int chromaticity_red_x;
573 unsigned int chromaticity_red_y;
574 unsigned int chromaticity_white_point_x;
575 unsigned int chromaticity_white_point_y;
577 uint32_t min_luminance;
578 uint32_t max_luminance;
579 uint32_t maximum_content_light_level;
580 uint32_t maximum_frame_average_light_level;
583 enum dc_transfer_func_type {
585 TF_TYPE_DISTRIBUTED_POINTS,
590 struct dc_transfer_func_distributed_points {
591 struct fixed31_32 red[TRANSFER_FUNC_POINTS];
592 struct fixed31_32 green[TRANSFER_FUNC_POINTS];
593 struct fixed31_32 blue[TRANSFER_FUNC_POINTS];
595 uint16_t end_exponent;
596 uint16_t x_point_at_y1_red;
597 uint16_t x_point_at_y1_green;
598 uint16_t x_point_at_y1_blue;
601 enum dc_transfer_func_predefined {
602 TRANSFER_FUNCTION_SRGB,
603 TRANSFER_FUNCTION_BT709,
604 TRANSFER_FUNCTION_PQ,
605 TRANSFER_FUNCTION_LINEAR,
606 TRANSFER_FUNCTION_UNITY,
607 TRANSFER_FUNCTION_HLG,
608 TRANSFER_FUNCTION_HLG12,
609 TRANSFER_FUNCTION_GAMMA22
612 struct dc_transfer_func {
613 struct kref refcount;
614 enum dc_transfer_func_type type;
615 enum dc_transfer_func_predefined tf;
616 /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/
617 uint32_t sdr_ref_white_level;
618 struct dc_context *ctx;
620 struct pwl_params pwl;
621 struct dc_transfer_func_distributed_points tf_pts;
625 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
627 union dc_3dlut_state {
629 uint32_t initialized:1; /*if 3dlut is went through color module for initialization */
630 uint32_t rmu_idx_valid:1; /*if mux settings are valid*/
631 uint32_t rmu_mux_num:3; /*index of mux to use*/
632 uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/
633 uint32_t mpc_rmu1_mux:4;
634 uint32_t mpc_rmu2_mux:4;
635 uint32_t reserved:15;
642 struct kref refcount;
643 struct tetrahedral_params lut_3d;
644 uint32_t hdr_multiplier;
645 bool initialized; /*remove after diag fix*/
646 union dc_3dlut_state state;
647 struct dc_context *ctx;
651 * This structure is filled in by dc_surface_get_status and contains
652 * the last requested address and the currently active address so the called
653 * can determine if there are any outstanding flips
655 struct dc_plane_status {
656 struct dc_plane_address requested_address;
657 struct dc_plane_address current_address;
658 bool is_flip_pending;
662 union surface_update_flags {
665 uint32_t addr_update:1;
667 uint32_t dcc_change:1;
668 uint32_t color_space_change:1;
669 uint32_t horizontal_mirror_change:1;
670 uint32_t per_pixel_alpha_change:1;
671 uint32_t global_alpha_change:1;
672 uint32_t sdr_white_level:1;
673 uint32_t rotation_change:1;
674 uint32_t swizzle_change:1;
675 uint32_t scaling_change:1;
676 uint32_t position_change:1;
677 uint32_t in_transfer_func_change:1;
678 uint32_t input_csc_change:1;
679 uint32_t coeff_reduction_change:1;
680 uint32_t output_tf_change:1;
681 uint32_t pixel_format_change:1;
682 uint32_t plane_size_change:1;
685 uint32_t new_plane:1;
686 uint32_t bpp_change:1;
687 uint32_t gamma_change:1;
688 uint32_t bandwidth_change:1;
689 uint32_t clock_change:1;
690 uint32_t stereo_format_change:1;
691 uint32_t full_update:1;
697 struct dc_plane_state {
698 struct dc_plane_address address;
699 struct dc_plane_flip_time time;
700 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
701 bool triplebuffer_flips;
703 struct scaling_taps scaling_quality;
704 struct rect src_rect;
705 struct rect dst_rect;
706 struct rect clip_rect;
708 union plane_size plane_size;
709 union dc_tiling_info tiling_info;
711 struct dc_plane_dcc_param dcc;
713 struct dc_gamma *gamma_correction;
714 struct dc_transfer_func *in_transfer_func;
715 struct dc_bias_and_scale *bias_and_scale;
716 struct dc_csc_transform input_csc_color_matrix;
717 struct fixed31_32 coeff_reduction_factor;
718 uint32_t sdr_white_level;
720 // TODO: No longer used, remove
721 struct dc_hdr_static_metadata hdr_static_ctx;
723 enum dc_color_space color_space;
725 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
726 struct dc_3dlut *lut3d_func;
727 struct dc_transfer_func *in_shaper_func;
728 struct dc_transfer_func *blend_tf;
731 enum surface_pixel_format format;
732 enum dc_rotation_angle rotation;
733 enum plane_stereo_format stereo_format;
735 bool is_tiling_rotated;
736 bool per_pixel_alpha;
738 int global_alpha_value;
741 bool horizontal_mirror;
743 union surface_update_flags update_flags;
744 /* private to DC core */
745 struct dc_plane_status status;
746 struct dc_context *ctx;
748 /* HACK: Workaround for forcing full reprogramming under some conditions */
749 bool force_full_update;
751 /* private to dc_surface.c */
752 enum dc_irq_source irq_source;
753 struct kref refcount;
756 struct dc_plane_info {
757 union plane_size plane_size;
758 union dc_tiling_info tiling_info;
759 struct dc_plane_dcc_param dcc;
760 enum surface_pixel_format format;
761 enum dc_rotation_angle rotation;
762 enum plane_stereo_format stereo_format;
763 enum dc_color_space color_space;
764 unsigned int sdr_white_level;
765 bool horizontal_mirror;
767 bool per_pixel_alpha;
769 int global_alpha_value;
770 bool input_csc_enabled;
773 struct dc_scaling_info {
774 struct rect src_rect;
775 struct rect dst_rect;
776 struct rect clip_rect;
777 struct scaling_taps scaling_quality;
780 struct dc_surface_update {
781 struct dc_plane_state *surface;
783 /* isr safe update parameters. null means no updates */
784 const struct dc_flip_addrs *flip_addr;
785 const struct dc_plane_info *plane_info;
786 const struct dc_scaling_info *scaling_info;
788 /* following updates require alloc/sleep/spin that is not isr safe,
789 * null means no updates
791 const struct dc_gamma *gamma;
792 const struct dc_transfer_func *in_transfer_func;
794 const struct dc_csc_transform *input_csc_color_matrix;
795 const struct fixed31_32 *coeff_reduction_factor;
796 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
797 const struct dc_transfer_func *func_shaper;
798 const struct dc_3dlut *lut3d_func;
799 const struct dc_transfer_func *blend_tf;
804 * Create a new surface with default parameters;
806 struct dc_plane_state *dc_create_plane_state(struct dc *dc);
807 const struct dc_plane_status *dc_plane_get_status(
808 const struct dc_plane_state *plane_state);
810 void dc_plane_state_retain(struct dc_plane_state *plane_state);
811 void dc_plane_state_release(struct dc_plane_state *plane_state);
813 void dc_gamma_retain(struct dc_gamma *dc_gamma);
814 void dc_gamma_release(struct dc_gamma **dc_gamma);
815 struct dc_gamma *dc_create_gamma(void);
817 void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
818 void dc_transfer_func_release(struct dc_transfer_func *dc_tf);
819 struct dc_transfer_func *dc_create_transfer_func(void);
821 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
822 struct dc_3dlut *dc_create_3dlut_func(void);
823 void dc_3dlut_func_release(struct dc_3dlut *lut);
824 void dc_3dlut_func_retain(struct dc_3dlut *lut);
827 * This structure holds a surface address. There could be multiple addresses
828 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
829 * as frame durations and DCC format can also be set.
831 struct dc_flip_addrs {
832 struct dc_plane_address address;
833 unsigned int flip_timestamp_in_us;
835 /* TODO: add flip duration for FreeSync */
838 bool dc_post_update_surfaces_to_stream(
841 #include "dc_stream.h"
844 * Structure to store surface/stream associations for validation
846 struct dc_validation_set {
847 struct dc_stream_state *stream;
848 struct dc_plane_state *plane_states[MAX_SURFACES];
852 bool dc_validate_seamless_boot_timing(const struct dc *dc,
853 const struct dc_sink *sink,
854 struct dc_crtc_timing *crtc_timing);
856 enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state);
858 void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info);
860 bool dc_set_generic_gpio_for_stereo(bool enable,
861 struct gpio_service *gpio_service);
864 * fast_validate: we return after determining if we can support the new state,
865 * but before we populate the programming info
867 enum dc_status dc_validate_global_state(
869 struct dc_state *new_ctx,
873 void dc_resource_state_construct(
875 struct dc_state *dst_ctx);
877 void dc_resource_state_copy_construct(
878 const struct dc_state *src_ctx,
879 struct dc_state *dst_ctx);
881 void dc_resource_state_copy_construct_current(
883 struct dc_state *dst_ctx);
885 void dc_resource_state_destruct(struct dc_state *context);
888 * TODO update to make it about validation sets
889 * Set up streams and links associated to drive sinks
890 * The streams parameter is an absolute set of all active streams.
893 * Phy, Encoder, Timing Generator are programmed and enabled.
894 * New streams are enabled with blank stream; no memory read.
896 bool dc_commit_state(struct dc *dc, struct dc_state *context);
899 struct dc_state *dc_create_state(struct dc *dc);
900 struct dc_state *dc_copy_state(struct dc_state *src_ctx);
901 void dc_retain_state(struct dc_state *context);
902 void dc_release_state(struct dc_state *context);
904 /*******************************************************************************
906 ******************************************************************************/
909 union dpcd_rev dpcd_rev;
910 union max_lane_count max_ln_count;
911 union max_down_spread max_down_spread;
912 union dprx_feature dprx_feature;
914 /* valid only for eDP v1.4 or higher*/
915 uint8_t edp_supported_link_rates_count;
916 enum dc_link_rate edp_supported_link_rates[8];
918 /* dongle type (DP converter, CV smart dongle) */
919 enum display_dongle_type dongle_type;
920 /* branch device or sink device */
922 /* Dongle's downstream count. */
923 union sink_count sink_count;
924 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
925 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
926 struct dc_dongle_caps dongle_caps;
928 uint32_t sink_dev_id;
929 int8_t sink_dev_id_str[6];
930 int8_t sink_hw_revision;
931 int8_t sink_fw_revision[2];
933 uint32_t branch_dev_id;
934 int8_t branch_dev_name[6];
935 int8_t branch_hw_revision;
936 int8_t branch_fw_revision[2];
938 bool allow_invalid_MSA_timing_param;
940 bool dpcd_display_control_capable;
941 bool ext_receiver_cap_field_present;
942 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
943 union dpcd_fec_capability fec_cap;
944 struct dpcd_dsc_capabilities dsc_caps;
950 /*******************************************************************************
951 * Sink Interfaces - A sink corresponds to a display output device
952 ******************************************************************************/
954 struct dc_container_id {
955 // 128bit GUID in binary form
956 unsigned char guid[16];
957 // 8 byte port ID -> ELD.PortID
958 unsigned int portId[2];
959 // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName
960 unsigned short manufacturerName;
961 // 2 byte product code -> ELD.ProductCode
962 unsigned short productCode;
966 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
967 struct dc_sink_dsc_caps {
968 // 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology),
969 // 'false' if they are sink's DSC caps
970 bool is_virtual_dpcd_dsc;
971 struct dsc_dec_dpcd_caps dsc_dec_caps;
976 * The sink structure contains EDID and other display device properties
979 enum signal_type sink_signal;
980 struct dc_edid dc_edid; /* raw edid */
981 struct dc_edid_caps edid_caps; /* parse display caps */
982 struct dc_container_id *dc_container_id;
983 uint32_t dongle_max_pix_clk;
985 struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
986 bool converter_disable_audio;
988 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
989 struct dc_sink_dsc_caps sink_dsc_caps;
992 /* private to DC core */
993 struct dc_link *link;
994 struct dc_context *ctx;
998 /* private to dc_sink.c */
999 // refcount must be the last member in dc_sink, since we want the
1000 // sink structure to be logically cloneable up to (but not including)
1002 struct kref refcount;
1005 void dc_sink_retain(struct dc_sink *sink);
1006 void dc_sink_release(struct dc_sink *sink);
1008 struct dc_sink_init_data {
1009 enum signal_type sink_signal;
1010 struct dc_link *link;
1011 uint32_t dongle_max_pix_clk;
1012 bool converter_disable_audio;
1015 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
1017 /* Newer interfaces */
1019 struct dc_plane_address address;
1020 struct dc_cursor_attributes attributes;
1024 /*******************************************************************************
1025 * Interrupt interfaces
1026 ******************************************************************************/
1027 enum dc_irq_source dc_interrupt_to_irq_source(
1031 bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable);
1032 void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
1033 enum dc_irq_source dc_get_hpd_irq_source_at_index(
1034 struct dc *dc, uint32_t link_index);
1036 /*******************************************************************************
1038 ******************************************************************************/
1040 void dc_set_power_state(
1042 enum dc_acpi_cm_power_state power_state);
1043 void dc_resume(struct dc *dc);
1044 unsigned int dc_get_current_backlight_pwm(struct dc *dc);
1045 unsigned int dc_get_target_backlight_pwm(struct dc *dc);
1047 bool dc_is_dmcu_initialized(struct dc *dc);
1049 enum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping);
1050 void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg);
1051 #if defined(CONFIG_DRM_AMD_DC_DSC_SUPPORT)
1052 /*******************************************************************************
1054 ******************************************************************************/
1057 #endif /* DC_INTERFACE_H_ */