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.65"
44 #define MAX_SURFACES 3
47 #define MAX_SINKS_PER_LINK 4
49 /*******************************************************************************
50 * Display Core Interfaces
51 ******************************************************************************/
54 struct dmcu_version dmcu_version;
57 enum dp_protocol_version {
62 DC_PLANE_TYPE_INVALID,
63 DC_PLANE_TYPE_DCE_RGB,
64 DC_PLANE_TYPE_DCE_UNDERLAY,
65 DC_PLANE_TYPE_DCN_UNIVERSAL,
69 enum dc_plane_type type;
70 uint32_t blends_with_above : 1;
71 uint32_t blends_with_below : 1;
72 uint32_t per_pixel_alpha : 1;
74 uint32_t argb8888 : 1;
79 } pixel_format_support;
80 // max upscaling factor x1000
81 // upscaling factors are always >= 1
82 // for example, 1080p -> 8K is 4.0, or 4000 raw value
88 // max downscale factor x1000
89 // downscale factors are always <= 1
90 // for example, 8K -> 1080p is 0.25, or 250 raw value
95 } max_downscale_factor;
102 uint32_t max_slave_planes;
104 uint32_t max_downscale_ratio;
105 uint32_t i2c_speed_in_khz;
106 uint32_t dmdata_alloc_size;
107 unsigned int max_cursor_size;
108 unsigned int max_video_width;
109 int linear_pitch_alignment;
110 bool dcc_const_color;
114 bool post_blend_color_processing;
115 bool force_dp_tps4_for_cp2520;
116 bool disable_dp_clk_share;
117 bool psp_setup_panel_mode;
118 bool extended_aux_timeout_support;
121 enum dp_protocol_version max_dp_protocol_version;
122 struct dc_plane_cap planes[MAX_PLANES];
126 bool no_connect_phy_config;
128 bool skip_clock_update;
131 struct dc_dcc_surface_param {
132 struct dc_size surface_size;
133 enum surface_pixel_format format;
134 enum swizzle_mode_values swizzle_mode;
135 enum dc_scan_direction scan;
138 struct dc_dcc_setting {
139 unsigned int max_compressed_blk_size;
140 unsigned int max_uncompressed_blk_size;
141 bool independent_64b_blks;
144 struct dc_surface_dcc_cap {
147 struct dc_dcc_setting rgb;
151 struct dc_dcc_setting luma;
152 struct dc_dcc_setting chroma;
157 bool const_color_support;
160 struct dc_static_screen_events {
168 /* Surface update type is used by dc_update_surfaces_and_stream
169 * The update type is determined at the very beginning of the function based
170 * on parameters passed in and decides how much programming (or updating) is
171 * going to be done during the call.
173 * UPDATE_TYPE_FAST is used for really fast updates that do not require much
174 * logical calculations or hardware register programming. This update MUST be
175 * ISR safe on windows. Currently fast update will only be used to flip surface
178 * UPDATE_TYPE_MED is used for slower updates which require significant hw
179 * re-programming however do not affect bandwidth consumption or clock
180 * requirements. At present, this is the level at which front end updates
181 * that do not require us to run bw_calcs happen. These are in/out transfer func
182 * updates, viewport offset changes, recout size changes and pixel depth changes.
183 * This update can be done at ISR, but we want to minimize how often this happens.
185 * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our
186 * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front
187 * end related. Any time viewport dimensions, recout dimensions, scaling ratios or
188 * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do
189 * a full update. This cannot be done at ISR level and should be a rare event.
190 * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting
191 * underscan we don't expect to see this call at all.
194 enum surface_update_type {
195 UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */
196 UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/
197 UPDATE_TYPE_FULL, /* may need to shuffle resources */
200 /* Forward declaration*/
202 struct dc_plane_state;
206 struct dc_cap_funcs {
207 bool (*get_dcc_compression_cap)(const struct dc *dc,
208 const struct dc_dcc_surface_param *input,
209 struct dc_surface_dcc_cap *output);
212 struct link_training_settings;
215 /* Structure to hold configuration flags set by dm at dc creation. */
218 bool disable_disp_pll_sharing;
220 bool optimize_edp_link_rate;
221 bool disable_fractional_pwm;
222 bool allow_seamless_boot_optimization;
223 bool power_down_display_on_boot;
224 bool edp_not_connected;
227 bool disable_extended_timeout_support; // Used to disable extended timeout and lttpr feature as well
228 bool multi_mon_pp_mclk_switch;
231 enum visual_confirm {
232 VISUAL_CONFIRM_DISABLE = 0,
233 VISUAL_CONFIRM_SURFACE = 1,
234 VISUAL_CONFIRM_HDR = 2,
235 VISUAL_CONFIRM_MPCTREE = 4,
241 DCC_HALF_REQ_DISALBE = 2,
244 enum pipe_split_policy {
245 MPC_SPLIT_DYNAMIC = 0,
247 MPC_SPLIT_AVOID_MULT_DISP = 2,
250 enum wm_report_mode {
251 WM_REPORT_DEFAULT = 0,
252 WM_REPORT_OVERRIDE = 1,
255 dtm_level_p0 = 0,/*highest voltage*/
259 dtm_level_p4,/*when active_display_count = 0*/
263 DCN_PWR_STATE_UNKNOWN = -1,
264 DCN_PWR_STATE_MISSION_MODE = 0,
265 DCN_PWR_STATE_LOW_POWER = 3,
269 * For any clocks that may differ per pipe
270 * only the max is stored in this structure
277 int dcfclk_deep_sleep_khz;
281 bool p_state_change_support;
282 enum dcn_pwr_state pwr_state;
284 * Elements below are not compared for the purposes of
285 * optimization required
287 bool prev_p_state_change_support;
288 enum dtm_pstate dtm_level;
289 int max_supported_dppclk_khz;
290 int max_supported_dispclk_khz;
291 int bw_dppclk_khz; /*a copy of dppclk_khz*/
295 struct dc_bw_validation_profile {
298 unsigned long long total_ticks;
299 unsigned long long voltage_level_ticks;
300 unsigned long long watermark_ticks;
301 unsigned long long rq_dlg_ticks;
303 unsigned long long total_count;
304 unsigned long long skip_fast_count;
305 unsigned long long skip_pass_count;
306 unsigned long long skip_fail_count;
309 #define BW_VAL_TRACE_SETUP() \
310 unsigned long long end_tick = 0; \
311 unsigned long long voltage_level_tick = 0; \
312 unsigned long long watermark_tick = 0; \
313 unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \
314 dm_get_timestamp(dc->ctx) : 0
316 #define BW_VAL_TRACE_COUNT() \
317 if (dc->debug.bw_val_profile.enable) \
318 dc->debug.bw_val_profile.total_count++
320 #define BW_VAL_TRACE_SKIP(status) \
321 if (dc->debug.bw_val_profile.enable) { \
322 if (!voltage_level_tick) \
323 voltage_level_tick = dm_get_timestamp(dc->ctx); \
324 dc->debug.bw_val_profile.skip_ ## status ## _count++; \
327 #define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \
328 if (dc->debug.bw_val_profile.enable) \
329 voltage_level_tick = dm_get_timestamp(dc->ctx)
331 #define BW_VAL_TRACE_END_WATERMARKS() \
332 if (dc->debug.bw_val_profile.enable) \
333 watermark_tick = dm_get_timestamp(dc->ctx)
335 #define BW_VAL_TRACE_FINISH() \
336 if (dc->debug.bw_val_profile.enable) { \
337 end_tick = dm_get_timestamp(dc->ctx); \
338 dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \
339 dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \
340 if (watermark_tick) { \
341 dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \
342 dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \
346 struct dc_debug_options {
347 enum visual_confirm visual_confirm;
353 bool validation_trace;
354 bool bandwidth_calcs_trace;
355 int max_downscale_src_width;
357 /* stutter efficiency related */
358 bool disable_stutter;
360 enum dcc_option disable_dcc;
361 enum pipe_split_policy pipe_split_policy;
362 bool force_single_disp_pipe_split;
363 bool voltage_align_fclk;
365 bool disable_dfs_bypass;
366 bool disable_dpp_power_gate;
367 bool disable_hubp_power_gate;
368 bool disable_dsc_power_gate;
369 int dsc_min_slice_height_override;
370 int dsc_bpp_increment_div;
371 bool native422_support;
372 bool disable_pplib_wm_range;
373 enum wm_report_mode pplib_wm_report_mode;
374 unsigned int min_disp_clk_khz;
375 unsigned int min_dpp_clk_khz;
376 int sr_exit_time_dpm0_ns;
377 int sr_enter_plus_exit_time_dpm0_ns;
379 int sr_enter_plus_exit_time_ns;
380 int urgent_latency_ns;
381 uint32_t underflow_assert_delay_us;
382 int percent_of_ideal_drambw;
383 int dram_clock_change_latency_ns;
384 bool optimized_watermark;
386 bool disable_pplib_clock_request;
387 bool disable_clock_gate;
390 bool force_abm_enable;
391 bool disable_stereo_support;
393 bool performance_trace;
394 bool az_endpoint_mute_only;
395 bool always_use_regamma;
396 bool p010_mpo_support;
397 bool recovery_enabled;
398 bool avoid_vbios_exec_table;
399 bool scl_reset_length10;
401 bool skip_detection_link_training;
402 bool remove_disconnect_edp;
403 unsigned int force_odm_combine; //bit vector based on otg inst
404 unsigned int force_fclk_khz;
405 bool disable_tri_buf;
406 bool dmub_offload_enabled;
407 bool dmcub_emulation;
408 bool dmub_command_table; /* for testing only */
409 struct dc_bw_validation_profile bw_val_profile;
411 bool disable_48mhz_pwrdwn;
412 /* This forces a hard min on the DCFCLK requested to SMU/PP
413 * watermarks are not affected.
415 unsigned int force_min_dcfclk_mhz;
416 bool disable_timing_sync;
418 int force_clock_mode;/*every mode change.*/
420 bool nv12_iflip_vm_wa;
421 bool disable_dram_clock_change_vactive_support;
422 bool validate_dml_output;
425 struct dc_debug_data {
426 uint32_t ltFailCount;
427 uint32_t i2cErrorCount;
428 uint32_t auxErrorCount;
431 struct dc_phy_addr_space_config {
444 uint64_t page_table_start_addr;
445 uint64_t page_table_end_addr;
446 uint64_t page_table_base_addr;
450 uint64_t page_table_default_page_addr;
453 struct dc_virtual_addr_space_config {
454 uint64_t page_table_base_addr;
455 uint64_t page_table_start_addr;
456 uint64_t page_table_end_addr;
457 uint32_t page_table_block_size_in_bytes;
458 uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid
461 struct dc_bounding_box_overrides {
463 int sr_enter_plus_exit_time_ns;
464 int urgent_latency_ns;
465 int percent_of_ideal_drambw;
466 int dram_clock_change_latency_ns;
467 /* This forces a hard min on the DCFCLK we use
468 * for DML. Unlike the debug option for forcing
469 * DCFCLK, this override affects watermark calculations
475 struct resource_pool;
477 struct gpu_info_soc_bounding_box_v1_0;
479 struct dc_versions versions;
481 struct dc_cap_funcs cap_funcs;
482 struct dc_config config;
483 struct dc_debug_options debug;
484 struct dc_bounding_box_overrides bb_overrides;
485 struct dc_bug_wa work_arounds;
486 struct dc_context *ctx;
487 struct dc_phy_addr_space_config vm_pa_config;
490 struct dc_link *links[MAX_PIPES * 2];
492 struct dc_state *current_state;
493 struct resource_pool *res_pool;
495 struct clk_mgr *clk_mgr;
497 /* Display Engine Clock levels */
498 struct dm_pp_clock_levels sclk_lvls;
500 /* Inputs into BW and WM calculations. */
501 struct bw_calcs_dceip *bw_dceip;
502 struct bw_calcs_vbios *bw_vbios;
503 #ifdef CONFIG_DRM_AMD_DC_DCN
504 struct dcn_soc_bounding_box *dcn_soc;
505 struct dcn_ip_params *dcn_ip;
506 struct display_mode_lib dml;
510 struct hw_sequencer_funcs hwss;
511 struct dce_hwseq *hwseq;
513 /* Require to optimize clocks and bandwidth for added/removed planes */
514 bool optimized_required;
516 /* Require to maintain clocks and bandwidth for UEFI enabled HW */
517 int optimize_seamless_boot_streams;
520 struct compressor *fbc_compressor;
522 struct dc_debug_data debug_data;
524 const char *build_id;
525 struct vm_helper *vm_helper;
526 const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box;
529 enum frame_buffer_mode {
530 FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
531 FRAME_BUFFER_MODE_ZFB_ONLY,
532 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
535 struct dchub_init_data {
536 int64_t zfb_phys_addr_base;
537 int64_t zfb_mc_base_addr;
538 uint64_t zfb_size_in_byte;
539 enum frame_buffer_mode fb_mode;
540 bool dchub_initialzied;
541 bool dchub_info_valid;
544 struct dc_init_data {
545 struct hw_asic_id asic_id;
546 void *driver; /* ctx */
547 struct cgs_device *cgs_device;
548 struct dc_bounding_box_overrides bb_overrides;
550 int num_virtual_links;
552 * If 'vbios_override' not NULL, it will be called instead
553 * of the real VBIOS. Intended use is Diagnostics on FPGA.
555 struct dc_bios *vbios_override;
556 enum dce_environment dce_environment;
558 struct dmub_offload_funcs *dmub_if;
559 struct dc_reg_helper_state *dmub_offload;
561 struct dc_config flags;
564 * gpu_info FW provided soc bounding box struct or 0 if not
567 const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box;
570 struct dc_callback_init {
571 #ifdef CONFIG_DRM_AMD_DC_HDCP
572 struct cp_psp cp_psp;
578 struct dc *dc_create(const struct dc_init_data *init_params);
579 void dc_hardware_init(struct dc *dc);
581 int dc_get_vmid_use_vector(struct dc *dc);
582 void dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid);
583 /* Returns the number of vmids supported */
584 int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config);
585 void dc_init_callbacks(struct dc *dc,
586 const struct dc_callback_init *init_params);
587 void dc_deinit_callbacks(struct dc *dc);
588 void dc_destroy(struct dc **dc);
590 /*******************************************************************************
592 ******************************************************************************/
595 TRANSFER_FUNC_POINTS = 1025
598 struct dc_hdr_static_metadata {
599 /* display chromaticities and white point in units of 0.00001 */
600 unsigned int chromaticity_green_x;
601 unsigned int chromaticity_green_y;
602 unsigned int chromaticity_blue_x;
603 unsigned int chromaticity_blue_y;
604 unsigned int chromaticity_red_x;
605 unsigned int chromaticity_red_y;
606 unsigned int chromaticity_white_point_x;
607 unsigned int chromaticity_white_point_y;
609 uint32_t min_luminance;
610 uint32_t max_luminance;
611 uint32_t maximum_content_light_level;
612 uint32_t maximum_frame_average_light_level;
615 enum dc_transfer_func_type {
617 TF_TYPE_DISTRIBUTED_POINTS,
622 struct dc_transfer_func_distributed_points {
623 struct fixed31_32 red[TRANSFER_FUNC_POINTS];
624 struct fixed31_32 green[TRANSFER_FUNC_POINTS];
625 struct fixed31_32 blue[TRANSFER_FUNC_POINTS];
627 uint16_t end_exponent;
628 uint16_t x_point_at_y1_red;
629 uint16_t x_point_at_y1_green;
630 uint16_t x_point_at_y1_blue;
633 enum dc_transfer_func_predefined {
634 TRANSFER_FUNCTION_SRGB,
635 TRANSFER_FUNCTION_BT709,
636 TRANSFER_FUNCTION_PQ,
637 TRANSFER_FUNCTION_LINEAR,
638 TRANSFER_FUNCTION_UNITY,
639 TRANSFER_FUNCTION_HLG,
640 TRANSFER_FUNCTION_HLG12,
641 TRANSFER_FUNCTION_GAMMA22,
642 TRANSFER_FUNCTION_GAMMA24,
643 TRANSFER_FUNCTION_GAMMA26
647 struct dc_transfer_func {
648 struct kref refcount;
649 enum dc_transfer_func_type type;
650 enum dc_transfer_func_predefined tf;
651 /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/
652 uint32_t sdr_ref_white_level;
653 struct dc_context *ctx;
655 struct pwl_params pwl;
656 struct dc_transfer_func_distributed_points tf_pts;
661 union dc_3dlut_state {
663 uint32_t initialized:1; /*if 3dlut is went through color module for initialization */
664 uint32_t rmu_idx_valid:1; /*if mux settings are valid*/
665 uint32_t rmu_mux_num:3; /*index of mux to use*/
666 uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/
667 uint32_t mpc_rmu1_mux:4;
668 uint32_t mpc_rmu2_mux:4;
669 uint32_t reserved:15;
676 struct kref refcount;
677 struct tetrahedral_params lut_3d;
678 struct fixed31_32 hdr_multiplier;
679 bool initialized; /*remove after diag fix*/
680 union dc_3dlut_state state;
681 struct dc_context *ctx;
684 * This structure is filled in by dc_surface_get_status and contains
685 * the last requested address and the currently active address so the called
686 * can determine if there are any outstanding flips
688 struct dc_plane_status {
689 struct dc_plane_address requested_address;
690 struct dc_plane_address current_address;
691 bool is_flip_pending;
695 union surface_update_flags {
698 uint32_t addr_update:1;
700 uint32_t dcc_change:1;
701 uint32_t color_space_change:1;
702 uint32_t horizontal_mirror_change:1;
703 uint32_t per_pixel_alpha_change:1;
704 uint32_t global_alpha_change:1;
706 uint32_t rotation_change:1;
707 uint32_t swizzle_change:1;
708 uint32_t scaling_change:1;
709 uint32_t position_change:1;
710 uint32_t in_transfer_func_change:1;
711 uint32_t input_csc_change:1;
712 uint32_t coeff_reduction_change:1;
713 uint32_t output_tf_change:1;
714 uint32_t pixel_format_change:1;
715 uint32_t plane_size_change:1;
718 uint32_t new_plane:1;
719 uint32_t bpp_change:1;
720 uint32_t gamma_change:1;
721 uint32_t bandwidth_change:1;
722 uint32_t clock_change:1;
723 uint32_t stereo_format_change:1;
724 uint32_t full_update:1;
730 struct dc_plane_state {
731 struct dc_plane_address address;
732 struct dc_plane_flip_time time;
733 bool triplebuffer_flips;
734 struct scaling_taps scaling_quality;
735 struct rect src_rect;
736 struct rect dst_rect;
737 struct rect clip_rect;
739 struct plane_size plane_size;
740 union dc_tiling_info tiling_info;
742 struct dc_plane_dcc_param dcc;
744 struct dc_gamma *gamma_correction;
745 struct dc_transfer_func *in_transfer_func;
746 struct dc_bias_and_scale *bias_and_scale;
747 struct dc_csc_transform input_csc_color_matrix;
748 struct fixed31_32 coeff_reduction_factor;
749 struct fixed31_32 hdr_mult;
751 // TODO: No longer used, remove
752 struct dc_hdr_static_metadata hdr_static_ctx;
754 enum dc_color_space color_space;
756 struct dc_3dlut *lut3d_func;
757 struct dc_transfer_func *in_shaper_func;
758 struct dc_transfer_func *blend_tf;
760 enum surface_pixel_format format;
761 enum dc_rotation_angle rotation;
762 enum plane_stereo_format stereo_format;
764 bool is_tiling_rotated;
765 bool per_pixel_alpha;
767 int global_alpha_value;
770 bool horizontal_mirror;
773 union surface_update_flags update_flags;
774 /* private to DC core */
775 struct dc_plane_status status;
776 struct dc_context *ctx;
778 /* HACK: Workaround for forcing full reprogramming under some conditions */
779 bool force_full_update;
781 /* private to dc_surface.c */
782 enum dc_irq_source irq_source;
783 struct kref refcount;
786 struct dc_plane_info {
787 struct plane_size plane_size;
788 union dc_tiling_info tiling_info;
789 struct dc_plane_dcc_param dcc;
790 enum surface_pixel_format format;
791 enum dc_rotation_angle rotation;
792 enum plane_stereo_format stereo_format;
793 enum dc_color_space color_space;
794 bool horizontal_mirror;
796 bool per_pixel_alpha;
798 int global_alpha_value;
799 bool input_csc_enabled;
803 struct dc_scaling_info {
804 struct rect src_rect;
805 struct rect dst_rect;
806 struct rect clip_rect;
807 struct scaling_taps scaling_quality;
810 struct dc_surface_update {
811 struct dc_plane_state *surface;
813 /* isr safe update parameters. null means no updates */
814 const struct dc_flip_addrs *flip_addr;
815 const struct dc_plane_info *plane_info;
816 const struct dc_scaling_info *scaling_info;
817 struct fixed31_32 hdr_mult;
818 /* following updates require alloc/sleep/spin that is not isr safe,
819 * null means no updates
821 const struct dc_gamma *gamma;
822 const struct dc_transfer_func *in_transfer_func;
824 const struct dc_csc_transform *input_csc_color_matrix;
825 const struct fixed31_32 *coeff_reduction_factor;
826 const struct dc_transfer_func *func_shaper;
827 const struct dc_3dlut *lut3d_func;
828 const struct dc_transfer_func *blend_tf;
832 * Create a new surface with default parameters;
834 struct dc_plane_state *dc_create_plane_state(struct dc *dc);
835 const struct dc_plane_status *dc_plane_get_status(
836 const struct dc_plane_state *plane_state);
838 void dc_plane_state_retain(struct dc_plane_state *plane_state);
839 void dc_plane_state_release(struct dc_plane_state *plane_state);
841 void dc_gamma_retain(struct dc_gamma *dc_gamma);
842 void dc_gamma_release(struct dc_gamma **dc_gamma);
843 struct dc_gamma *dc_create_gamma(void);
845 void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
846 void dc_transfer_func_release(struct dc_transfer_func *dc_tf);
847 struct dc_transfer_func *dc_create_transfer_func(void);
849 struct dc_3dlut *dc_create_3dlut_func(void);
850 void dc_3dlut_func_release(struct dc_3dlut *lut);
851 void dc_3dlut_func_retain(struct dc_3dlut *lut);
853 * This structure holds a surface address. There could be multiple addresses
854 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
855 * as frame durations and DCC format can also be set.
857 struct dc_flip_addrs {
858 struct dc_plane_address address;
859 unsigned int flip_timestamp_in_us;
861 /* TODO: add flip duration for FreeSync */
864 bool dc_post_update_surfaces_to_stream(
867 #include "dc_stream.h"
870 * Structure to store surface/stream associations for validation
872 struct dc_validation_set {
873 struct dc_stream_state *stream;
874 struct dc_plane_state *plane_states[MAX_SURFACES];
878 bool dc_validate_seamless_boot_timing(const struct dc *dc,
879 const struct dc_sink *sink,
880 struct dc_crtc_timing *crtc_timing);
882 enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state);
884 void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info);
886 bool dc_set_generic_gpio_for_stereo(bool enable,
887 struct gpio_service *gpio_service);
890 * fast_validate: we return after determining if we can support the new state,
891 * but before we populate the programming info
893 enum dc_status dc_validate_global_state(
895 struct dc_state *new_ctx,
899 void dc_resource_state_construct(
901 struct dc_state *dst_ctx);
903 void dc_resource_state_copy_construct(
904 const struct dc_state *src_ctx,
905 struct dc_state *dst_ctx);
907 void dc_resource_state_copy_construct_current(
909 struct dc_state *dst_ctx);
911 void dc_resource_state_destruct(struct dc_state *context);
913 bool dc_resource_is_dsc_encoding_supported(const struct dc *dc);
916 * TODO update to make it about validation sets
917 * Set up streams and links associated to drive sinks
918 * The streams parameter is an absolute set of all active streams.
921 * Phy, Encoder, Timing Generator are programmed and enabled.
922 * New streams are enabled with blank stream; no memory read.
924 bool dc_commit_state(struct dc *dc, struct dc_state *context);
927 struct dc_state *dc_create_state(struct dc *dc);
928 struct dc_state *dc_copy_state(struct dc_state *src_ctx);
929 void dc_retain_state(struct dc_state *context);
930 void dc_release_state(struct dc_state *context);
932 /*******************************************************************************
934 ******************************************************************************/
937 union dpcd_rev dpcd_rev;
938 union max_lane_count max_ln_count;
939 union max_down_spread max_down_spread;
940 union dprx_feature dprx_feature;
942 /* valid only for eDP v1.4 or higher*/
943 uint8_t edp_supported_link_rates_count;
944 enum dc_link_rate edp_supported_link_rates[8];
946 /* dongle type (DP converter, CV smart dongle) */
947 enum display_dongle_type dongle_type;
948 /* branch device or sink device */
950 /* Dongle's downstream count. */
951 union sink_count sink_count;
952 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
953 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
954 struct dc_dongle_caps dongle_caps;
956 uint32_t sink_dev_id;
957 int8_t sink_dev_id_str[6];
958 int8_t sink_hw_revision;
959 int8_t sink_fw_revision[2];
961 uint32_t branch_dev_id;
962 int8_t branch_dev_name[6];
963 int8_t branch_hw_revision;
964 int8_t branch_fw_revision[2];
966 bool allow_invalid_MSA_timing_param;
968 bool dpcd_display_control_capable;
969 bool ext_receiver_cap_field_present;
970 union dpcd_fec_capability fec_cap;
971 struct dpcd_dsc_capabilities dsc_caps;
972 struct dc_lttpr_caps lttpr_caps;
978 /*******************************************************************************
979 * Sink Interfaces - A sink corresponds to a display output device
980 ******************************************************************************/
982 struct dc_container_id {
983 // 128bit GUID in binary form
984 unsigned char guid[16];
985 // 8 byte port ID -> ELD.PortID
986 unsigned int portId[2];
987 // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName
988 unsigned short manufacturerName;
989 // 2 byte product code -> ELD.ProductCode
990 unsigned short productCode;
994 struct dc_sink_dsc_caps {
995 // 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology),
996 // 'false' if they are sink's DSC caps
997 bool is_virtual_dpcd_dsc;
998 struct dsc_dec_dpcd_caps dsc_dec_caps;
1002 * The sink structure contains EDID and other display device properties
1005 enum signal_type sink_signal;
1006 struct dc_edid dc_edid; /* raw edid */
1007 struct dc_edid_caps edid_caps; /* parse display caps */
1008 struct dc_container_id *dc_container_id;
1009 uint32_t dongle_max_pix_clk;
1011 struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
1012 bool converter_disable_audio;
1014 struct dc_sink_dsc_caps sink_dsc_caps;
1016 /* private to DC core */
1017 struct dc_link *link;
1018 struct dc_context *ctx;
1022 /* private to dc_sink.c */
1023 // refcount must be the last member in dc_sink, since we want the
1024 // sink structure to be logically cloneable up to (but not including)
1026 struct kref refcount;
1029 void dc_sink_retain(struct dc_sink *sink);
1030 void dc_sink_release(struct dc_sink *sink);
1032 struct dc_sink_init_data {
1033 enum signal_type sink_signal;
1034 struct dc_link *link;
1035 uint32_t dongle_max_pix_clk;
1036 bool converter_disable_audio;
1039 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
1041 /* Newer interfaces */
1043 struct dc_plane_address address;
1044 struct dc_cursor_attributes attributes;
1048 /*******************************************************************************
1049 * Interrupt interfaces
1050 ******************************************************************************/
1051 enum dc_irq_source dc_interrupt_to_irq_source(
1055 bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable);
1056 void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
1057 enum dc_irq_source dc_get_hpd_irq_source_at_index(
1058 struct dc *dc, uint32_t link_index);
1060 /*******************************************************************************
1062 ******************************************************************************/
1064 void dc_set_power_state(
1066 enum dc_acpi_cm_power_state power_state);
1067 void dc_resume(struct dc *dc);
1068 unsigned int dc_get_current_backlight_pwm(struct dc *dc);
1069 unsigned int dc_get_target_backlight_pwm(struct dc *dc);
1071 bool dc_is_dmcu_initialized(struct dc *dc);
1072 bool dc_is_hw_initialized(struct dc *dc);
1074 enum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping);
1075 void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg);
1076 /*******************************************************************************
1078 ******************************************************************************/
1080 #endif /* DC_INTERFACE_H_ */