/*1* Copyright 2012-2023 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*21* Authors: AMD22*23*/2425#ifndef DC_INTERFACE_H_26#define DC_INTERFACE_H_2728#include "dc_types.h"29#include "dc_state.h"30#include "dc_plane.h"31#include "grph_object_defs.h"32#include "logger_types.h"33#include "hdcp_msg_types.h"34#include "gpio_types.h"35#include "link_service_types.h"36#include "grph_object_ctrl_defs.h"37#include <inc/hw/opp.h>3839#include "hwss/hw_sequencer.h"40#include "inc/compressor.h"41#include "inc/hw/dmcu.h"42#include "dml/display_mode_lib.h"4344#include "dml2_0/dml2_wrapper.h"4546#include "dmub/inc/dmub_cmd.h"4748#include "sspl/dc_spl_types.h"4950struct abm_save_restore;5152/* forward declaration */53struct aux_payload;54struct set_config_cmd_payload;55struct dmub_notification;56struct dcn_hubbub_reg_state;57struct dcn_hubp_reg_state;58struct dcn_dpp_reg_state;59struct dcn_mpc_reg_state;60struct dcn_opp_reg_state;61struct dcn_dsc_reg_state;62struct dcn_optc_reg_state;63struct dcn_dccg_reg_state;6465#define DC_VER "3.2.359"6667/**68* MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC69*/70#define MAX_SURFACES 471/**72* MAX_PLANES - representative of the upper bound of planes that are supported by the HW73*/74#define MAX_PLANES 675#define MAX_STREAMS 676#define MIN_VIEWPORT_SIZE 1277#define MAX_NUM_EDP 278#define MAX_SUPPORTED_FORMATS 77980#define MAX_HOST_ROUTERS_NUM 381#define MAX_DPIA_PER_HOST_ROUTER 382#define MAX_DPIA_NUM (MAX_HOST_ROUTERS_NUM * MAX_DPIA_PER_HOST_ROUTER)8384/* Display Core Interfaces */85struct dc_versions {86const char *dc_ver;87struct dmcu_version dmcu_version;88};8990enum dp_protocol_version {91DP_VERSION_1_4 = 0,92DP_VERSION_2_1,93DP_VERSION_UNKNOWN,94};9596enum dc_plane_type {97DC_PLANE_TYPE_INVALID,98DC_PLANE_TYPE_DCE_RGB,99DC_PLANE_TYPE_DCE_UNDERLAY,100DC_PLANE_TYPE_DCN_UNIVERSAL,101};102103// Sizes defined as multiples of 64KB104enum det_size {105DET_SIZE_DEFAULT = 0,106DET_SIZE_192KB = 3,107DET_SIZE_256KB = 4,108DET_SIZE_320KB = 5,109DET_SIZE_384KB = 6110};111112113struct dc_plane_cap {114enum dc_plane_type type;115uint32_t per_pixel_alpha : 1;116struct {117uint32_t argb8888 : 1;118uint32_t nv12 : 1;119uint32_t fp16 : 1;120uint32_t p010 : 1;121uint32_t ayuv : 1;122} pixel_format_support;123// max upscaling factor x1000124// upscaling factors are always >= 1125// for example, 1080p -> 8K is 4.0, or 4000 raw value126struct {127uint32_t argb8888;128uint32_t nv12;129uint32_t fp16;130} max_upscale_factor;131// max downscale factor x1000132// downscale factors are always <= 1133// for example, 8K -> 1080p is 0.25, or 250 raw value134struct {135uint32_t argb8888;136uint32_t nv12;137uint32_t fp16;138} max_downscale_factor;139// minimal width/height140uint32_t min_width;141uint32_t min_height;142};143144/**145* DOC: color-management-caps146*147* **Color management caps (DPP and MPC)**148*149* Modules/color calculates various color operations which are translated to150* abstracted HW. DCE 5-12 had almost no important changes, but starting with151* DCN1, every new generation comes with fairly major differences in color152* pipeline. Therefore, we abstract color pipe capabilities so modules/DM can153* decide mapping to HW block based on logical capabilities.154*/155156/**157* struct rom_curve_caps - predefined transfer function caps for degamma and regamma158* @srgb: RGB color space transfer func159* @bt2020: BT.2020 transfer func160* @gamma2_2: standard gamma161* @pq: perceptual quantizer transfer function162* @hlg: hybrid log–gamma transfer function163*/164struct rom_curve_caps {165uint16_t srgb : 1;166uint16_t bt2020 : 1;167uint16_t gamma2_2 : 1;168uint16_t pq : 1;169uint16_t hlg : 1;170};171172/**173* struct dpp_color_caps - color pipeline capabilities for display pipe and174* plane blocks175*176* @dcn_arch: all DCE generations treated the same177* @input_lut_shared: shared with DGAM. Input LUT is different than most LUTs,178* just plain 256-entry lookup179* @icsc: input color space conversion180* @dgam_ram: programmable degamma LUT181* @post_csc: post color space conversion, before gamut remap182* @gamma_corr: degamma correction183* @hw_3d_lut: 3D LUT support. It implies a shaper LUT before. It may be shared184* with MPC by setting mpc:shared_3d_lut flag185* @ogam_ram: programmable out/blend gamma LUT186* @ocsc: output color space conversion187* @dgam_rom_for_yuv: pre-defined degamma LUT for YUV planes188* @dgam_rom_caps: pre-definied curve caps for degamma 1D LUT189* @ogam_rom_caps: pre-definied curve caps for regamma 1D LUT190*191* Note: hdr_mult and gamut remap (CTM) are always available in DPP (in that order)192*/193struct dpp_color_caps {194uint16_t dcn_arch : 1;195uint16_t input_lut_shared : 1;196uint16_t icsc : 1;197uint16_t dgam_ram : 1;198uint16_t post_csc : 1;199uint16_t gamma_corr : 1;200uint16_t hw_3d_lut : 1;201uint16_t ogam_ram : 1;202uint16_t ocsc : 1;203uint16_t dgam_rom_for_yuv : 1;204struct rom_curve_caps dgam_rom_caps;205struct rom_curve_caps ogam_rom_caps;206};207208/* Below structure is to describe the HW support for mem layout, extend support209range to match what OS could handle in the roadmap */210struct lut3d_caps {211uint32_t dma_3d_lut : 1; /*< DMA mode support for 3D LUT */212struct {213uint32_t swizzle_3d_rgb : 1;214uint32_t swizzle_3d_bgr : 1;215uint32_t linear_1d : 1;216} mem_layout_support;217struct {218uint32_t unorm_12msb : 1;219uint32_t unorm_12lsb : 1;220uint32_t float_fp1_5_10 : 1;221} mem_format_support;222struct {223uint32_t order_rgba : 1;224uint32_t order_bgra : 1;225} mem_pixel_order_support;226/*< size options are 9, 17, 33, 45, 65 */227struct {228uint32_t dim_9 : 1; /* 3D LUT support for 9x9x9 */229uint32_t dim_17 : 1; /* 3D LUT support for 17x17x17 */230uint32_t dim_33 : 1; /* 3D LUT support for 33x33x33 */231uint32_t dim_45 : 1; /* 3D LUT support for 45x45x45 */232uint32_t dim_65 : 1; /* 3D LUT support for 65x65x65 */233} lut_dim_caps;234};235236/**237* struct mpc_color_caps - color pipeline capabilities for multiple pipe and238* plane combined blocks239*240* @gamut_remap: color transformation matrix241* @ogam_ram: programmable out gamma LUT242* @ocsc: output color space conversion matrix243* @num_3dluts: MPC 3D LUT; always assumes a preceding shaper LUT244* @num_rmcm_3dluts: number of RMCM 3D LUTS; always assumes a preceding shaper LUT245* @shared_3d_lut: shared 3D LUT flag. Can be either DPP or MPC, but single246* instance247* @ogam_rom_caps: pre-definied curve caps for regamma 1D LUT248* @mcm_3d_lut_caps: HW support cap for MCM LUT memory249* @rmcm_3d_lut_caps: HW support cap for RMCM LUT memory250* @preblend: whether color manager supports preblend with MPC251*/252struct mpc_color_caps {253uint16_t gamut_remap : 1;254uint16_t ogam_ram : 1;255uint16_t ocsc : 1;256uint16_t num_3dluts : 3;257uint16_t num_rmcm_3dluts : 3;258uint16_t shared_3d_lut:1;259struct rom_curve_caps ogam_rom_caps;260struct lut3d_caps mcm_3d_lut_caps;261struct lut3d_caps rmcm_3d_lut_caps;262bool preblend;263};264265/**266* struct dc_color_caps - color pipes capabilities for DPP and MPC hw blocks267* @dpp: color pipes caps for DPP268* @mpc: color pipes caps for MPC269*/270struct dc_color_caps {271struct dpp_color_caps dpp;272struct mpc_color_caps mpc;273};274275struct dc_dmub_caps {276bool psr;277bool mclk_sw;278bool subvp_psr;279bool gecc_enable;280uint8_t fams_ver;281bool aux_backlight_support;282};283284struct dc_scl_caps {285bool sharpener_support;286};287288struct dc_check_config {289/**290* max video plane width that can be safely assumed to be always291* supported by single DPP pipe.292*/293unsigned int max_optimizable_video_width;294bool enable_legacy_fast_update;295};296297struct dc_caps {298uint32_t max_streams;299uint32_t max_links;300uint32_t max_audios;301uint32_t max_slave_planes;302uint32_t max_slave_yuv_planes;303uint32_t max_slave_rgb_planes;304uint32_t max_planes;305uint32_t max_downscale_ratio;306uint32_t i2c_speed_in_khz;307uint32_t i2c_speed_in_khz_hdcp;308uint32_t dmdata_alloc_size;309unsigned int max_cursor_size;310unsigned int max_buffered_cursor_size;311unsigned int max_video_width;312unsigned int min_horizontal_blanking_period;313int linear_pitch_alignment;314bool dcc_const_color;315bool dynamic_audio;316bool is_apu;317bool dual_link_dvi;318bool post_blend_color_processing;319bool force_dp_tps4_for_cp2520;320bool disable_dp_clk_share;321bool psp_setup_panel_mode;322bool extended_aux_timeout_support;323bool dmcub_support;324bool zstate_support;325bool ips_support;326bool ips_v2_support;327uint32_t num_of_internal_disp;328enum dp_protocol_version max_dp_protocol_version;329unsigned int mall_size_per_mem_channel;330unsigned int mall_size_total;331unsigned int cursor_cache_size;332struct dc_plane_cap planes[MAX_PLANES];333struct dc_color_caps color;334struct dc_dmub_caps dmub_caps;335bool dp_hpo;336bool dp_hdmi21_pcon_support;337bool edp_dsc_support;338bool vbios_lttpr_aware;339bool vbios_lttpr_enable;340bool fused_io_supported;341uint32_t max_otg_num;342uint32_t max_cab_allocation_bytes;343uint32_t cache_line_size;344uint32_t cache_num_ways;345uint16_t subvp_fw_processing_delay_us;346uint8_t subvp_drr_max_vblank_margin_us;347uint16_t subvp_prefetch_end_to_mall_start_us;348uint8_t subvp_swath_height_margin_lines; // subvp start line must be aligned to 2 x swath height349uint16_t subvp_pstate_allow_width_us;350uint16_t subvp_vertical_int_margin_us;351bool seamless_odm;352uint32_t max_v_total;353bool vtotal_limited_by_fp2;354uint32_t max_disp_clock_khz_at_vmin;355uint8_t subvp_drr_vblank_start_margin_us;356bool cursor_not_scaled;357bool dcmode_power_limits_present;358bool sequential_ono;359/* Conservative limit for DCC cases which require ODM4:1 to support*/360uint32_t dcc_plane_width_limit;361struct dc_scl_caps scl_caps;362uint8_t num_of_host_routers;363uint8_t num_of_dpias_per_host_router;364/* limit of the ODM only, could be limited by other factors (like pipe count)*/365uint8_t max_odm_combine_factor;366};367368struct dc_bug_wa {369bool no_connect_phy_config;370bool dedcn20_305_wa;371bool skip_clock_update;372bool lt_early_cr_pattern;373struct {374uint8_t uclk : 1;375uint8_t fclk : 1;376uint8_t dcfclk : 1;377uint8_t dcfclk_ds: 1;378} clock_update_disable_mask;379bool skip_psr_ips_crtc_disable;380};381struct dc_dcc_surface_param {382struct dc_size surface_size;383enum surface_pixel_format format;384unsigned int plane0_pitch;385struct dc_size plane1_size;386unsigned int plane1_pitch;387union {388enum swizzle_mode_values swizzle_mode;389enum swizzle_mode_addr3_values swizzle_mode_addr3;390};391enum dc_scan_direction scan;392};393394struct dc_dcc_setting {395unsigned int max_compressed_blk_size;396unsigned int max_uncompressed_blk_size;397bool independent_64b_blks;398//These bitfields to be used starting with DCN 3.0399struct {400uint32_t dcc_256_64_64 : 1;//available in ASICs before DCN 3.0 (the worst compression case)401uint32_t dcc_128_128_uncontrained : 1; //available in ASICs before DCN 3.0402uint32_t dcc_256_128_128 : 1; //available starting with DCN 3.0403uint32_t dcc_256_256_unconstrained : 1; //available in ASICs before DCN 3.0 (the best compression case)404uint32_t dcc_256_256 : 1; //available in ASICs starting with DCN 4.0x (the best compression case)405uint32_t dcc_256_128 : 1; //available in ASICs starting with DCN 4.0x406uint32_t dcc_256_64 : 1; //available in ASICs starting with DCN 4.0x (the worst compression case)407} dcc_controls;408};409410struct dc_surface_dcc_cap {411union {412struct {413struct dc_dcc_setting rgb;414} grph;415416struct {417struct dc_dcc_setting luma;418struct dc_dcc_setting chroma;419} video;420};421422bool capable;423bool const_color_support;424};425426struct dc_static_screen_params {427struct {428bool force_trigger;429bool cursor_update;430bool surface_update;431bool overlay_update;432} triggers;433unsigned int num_frames;434};435436437/* Surface update type is used by dc_update_surfaces_and_stream438* The update type is determined at the very beginning of the function based439* on parameters passed in and decides how much programming (or updating) is440* going to be done during the call.441*442* UPDATE_TYPE_FAST is used for really fast updates that do not require much443* logical calculations or hardware register programming. This update MUST be444* ISR safe on windows. Currently fast update will only be used to flip surface445* address.446*447* UPDATE_TYPE_MED is used for slower updates which require significant hw448* re-programming however do not affect bandwidth consumption or clock449* requirements. At present, this is the level at which front end updates450* that do not require us to run bw_calcs happen. These are in/out transfer func451* updates, viewport offset changes, recout size changes and pixel depth changes.452* This update can be done at ISR, but we want to minimize how often this happens.453*454* UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our455* bandwidth and clocks, possibly rearrange some pipes and reprogram anything front456* end related. Any time viewport dimensions, recout dimensions, scaling ratios or457* gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do458* a full update. This cannot be done at ISR level and should be a rare event.459* Unless someone is stress testing mpo enter/exit, playing with colour or adjusting460* underscan we don't expect to see this call at all.461*/462463enum surface_update_type {464UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */465UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/466UPDATE_TYPE_FULL, /* may need to shuffle resources */467};468469enum dc_lock_descriptor {470LOCK_DESCRIPTOR_NONE = 0x0,471LOCK_DESCRIPTOR_STREAM = 0x1,472LOCK_DESCRIPTOR_LINK = 0x2,473LOCK_DESCRIPTOR_GLOBAL = 0x4,474};475476struct surface_update_descriptor {477enum surface_update_type update_type;478enum dc_lock_descriptor lock_descriptor;479};480481/* Forward declaration*/482struct dc;483struct dc_plane_state;484struct dc_state;485486struct dc_cap_funcs {487bool (*get_dcc_compression_cap)(const struct dc *dc,488const struct dc_dcc_surface_param *input,489struct dc_surface_dcc_cap *output);490bool (*get_subvp_en)(struct dc *dc, struct dc_state *context);491};492493struct link_training_settings;494495union allow_lttpr_non_transparent_mode {496struct {497bool DP1_4A : 1;498bool DP2_0 : 1;499} bits;500unsigned char raw;501};502503/* Structure to hold configuration flags set by dm at dc creation. */504struct dc_config {505bool gpu_vm_support;506bool disable_disp_pll_sharing;507bool fbc_support;508bool disable_fractional_pwm;509bool allow_seamless_boot_optimization;510bool seamless_boot_edp_requested;511bool edp_not_connected;512bool edp_no_power_sequencing;513bool force_enum_edp;514bool forced_clocks;515union allow_lttpr_non_transparent_mode allow_lttpr_non_transparent_mode;516bool multi_mon_pp_mclk_switch;517bool disable_dmcu;518bool enable_4to1MPC;519bool enable_windowed_mpo_odm;520bool forceHBR2CP2520; // Used for switching between test patterns TPS4 and CP2520521uint32_t allow_edp_hotplug_detection;522bool skip_riommu_prefetch_wa;523bool clamp_min_dcfclk;524uint64_t vblank_alignment_dto_params;525uint8_t vblank_alignment_max_frame_time_diff;526bool is_asymmetric_memory;527bool is_single_rank_dimm;528bool is_vmin_only_asic;529bool use_spl;530bool prefer_easf;531bool use_pipe_ctx_sync_logic;532int smart_mux_version;533bool ignore_dpref_ss;534bool enable_mipi_converter_optimization;535bool use_default_clock_table;536bool force_bios_enable_lttpr;537uint8_t force_bios_fixed_vs;538int sdpif_request_limit_words_per_umc;539bool dc_mode_clk_limit_support;540bool EnableMinDispClkODM;541bool enable_auto_dpm_test_logs;542unsigned int disable_ips;543unsigned int disable_ips_rcg;544unsigned int disable_ips_in_vpb;545bool disable_ips_in_dpms_off;546bool usb4_bw_alloc_support;547bool allow_0_dtb_clk;548bool use_assr_psp_message;549bool support_edp0_on_dp1;550unsigned int enable_fpo_flicker_detection;551bool disable_hbr_audio_dp2;552bool consolidated_dpia_dp_lt;553bool set_pipe_unlock_order;554bool enable_dpia_pre_training;555bool unify_link_enc_assignment;556bool enable_cursor_offload;557struct spl_sharpness_range dcn_sharpness_range;558struct spl_sharpness_range dcn_override_sharpness_range;559};560561enum visual_confirm {562VISUAL_CONFIRM_DISABLE = 0,563VISUAL_CONFIRM_SURFACE = 1,564VISUAL_CONFIRM_HDR = 2,565VISUAL_CONFIRM_MPCTREE = 4,566VISUAL_CONFIRM_PSR = 5,567VISUAL_CONFIRM_SWAPCHAIN = 6,568VISUAL_CONFIRM_FAMS = 7,569VISUAL_CONFIRM_SWIZZLE = 9,570VISUAL_CONFIRM_SMARTMUX_DGPU = 10,571VISUAL_CONFIRM_REPLAY = 12,572VISUAL_CONFIRM_SUBVP = 14,573VISUAL_CONFIRM_MCLK_SWITCH = 16,574VISUAL_CONFIRM_FAMS2 = 19,575VISUAL_CONFIRM_HW_CURSOR = 20,576VISUAL_CONFIRM_VABC = 21,577VISUAL_CONFIRM_DCC = 22,578VISUAL_CONFIRM_EXPLICIT = 0x80000000,579};580581enum dc_psr_power_opts {582psr_power_opt_invalid = 0x0,583psr_power_opt_smu_opt_static_screen = 0x1,584psr_power_opt_z10_static_screen = 0x10,585psr_power_opt_ds_disable_allow = 0x100,586};587588enum dml_hostvm_override_opts {589DML_HOSTVM_NO_OVERRIDE = 0x0,590DML_HOSTVM_OVERRIDE_FALSE = 0x1,591DML_HOSTVM_OVERRIDE_TRUE = 0x2,592};593594enum dc_replay_power_opts {595replay_power_opt_invalid = 0x0,596replay_power_opt_smu_opt_static_screen = 0x1,597replay_power_opt_z10_static_screen = 0x10,598};599600enum dcc_option {601DCC_ENABLE = 0,602DCC_DISABLE = 1,603DCC_HALF_REQ_DISALBE = 2,604};605606enum in_game_fams_config {607INGAME_FAMS_SINGLE_DISP_ENABLE, // enable in-game fams608INGAME_FAMS_DISABLE, // disable in-game fams609INGAME_FAMS_MULTI_DISP_ENABLE, //enable in-game fams for multi-display610INGAME_FAMS_MULTI_DISP_CLAMPED_ONLY, //enable in-game fams for multi-display only for clamped RR strategies611};612613/**614* enum pipe_split_policy - Pipe split strategy supported by DCN615*616* This enum is used to define the pipe split policy supported by DCN. By617* default, DC favors MPC_SPLIT_DYNAMIC.618*/619enum pipe_split_policy {620/**621* @MPC_SPLIT_DYNAMIC: DC will automatically decide how to split the622* pipe in order to bring the best trade-off between performance and623* power consumption. This is the recommended option.624*/625MPC_SPLIT_DYNAMIC = 0,626627/**628* @MPC_SPLIT_AVOID: Avoid pipe split, which means that DC will not629* try any sort of split optimization.630*/631MPC_SPLIT_AVOID = 1,632633/**634* @MPC_SPLIT_AVOID_MULT_DISP: With this option, DC will only try to635* optimize the pipe utilization when using a single display; if the636* user connects to a second display, DC will avoid pipe split.637*/638MPC_SPLIT_AVOID_MULT_DISP = 2,639};640641enum wm_report_mode {642WM_REPORT_DEFAULT = 0,643WM_REPORT_OVERRIDE = 1,644};645enum dtm_pstate{646dtm_level_p0 = 0,/*highest voltage*/647dtm_level_p1,648dtm_level_p2,649dtm_level_p3,650dtm_level_p4,/*when active_display_count = 0*/651};652653enum dcn_pwr_state {654DCN_PWR_STATE_UNKNOWN = -1,655DCN_PWR_STATE_MISSION_MODE = 0,656DCN_PWR_STATE_LOW_POWER = 3,657};658659enum dcn_zstate_support_state {660DCN_ZSTATE_SUPPORT_UNKNOWN,661DCN_ZSTATE_SUPPORT_ALLOW,662DCN_ZSTATE_SUPPORT_ALLOW_Z8_ONLY,663DCN_ZSTATE_SUPPORT_ALLOW_Z8_Z10_ONLY,664DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY,665DCN_ZSTATE_SUPPORT_DISALLOW,666};667668/*669* struct dc_clocks - DC pipe clocks670*671* For any clocks that may differ per pipe only the max is stored in this672* structure673*/674struct dc_clocks {675int dispclk_khz;676int actual_dispclk_khz;677int dppclk_khz;678int actual_dppclk_khz;679int disp_dpp_voltage_level_khz;680int dcfclk_khz;681int socclk_khz;682int dcfclk_deep_sleep_khz;683int fclk_khz;684int phyclk_khz;685int dramclk_khz;686bool p_state_change_support;687enum dcn_zstate_support_state zstate_support;688bool dtbclk_en;689int ref_dtbclk_khz;690bool fclk_p_state_change_support;691enum dcn_pwr_state pwr_state;692/*693* Elements below are not compared for the purposes of694* optimization required695*/696bool prev_p_state_change_support;697bool fclk_prev_p_state_change_support;698int num_ways;699int host_router_bw_kbps[MAX_HOST_ROUTERS_NUM];700701/*702* @fw_based_mclk_switching703*704* DC has a mechanism that leverage the variable refresh rate to switch705* memory clock in cases that we have a large latency to achieve the706* memory clock change and a short vblank window. DC has some707* requirements to enable this feature, and this field describes if the708* system support or not such a feature.709*/710bool fw_based_mclk_switching;711bool fw_based_mclk_switching_shut_down;712int prev_num_ways;713enum dtm_pstate dtm_level;714int max_supported_dppclk_khz;715int max_supported_dispclk_khz;716int bw_dppclk_khz; /*a copy of dppclk_khz*/717int bw_dispclk_khz;718int idle_dramclk_khz;719int idle_fclk_khz;720int subvp_prefetch_dramclk_khz;721int subvp_prefetch_fclk_khz;722723/* Stutter efficiency is technically not clock values724* but stored here so the values are part of the update_clocks call similar to num_ways725* Efficiencies are stored as percentage (0-100)726*/727struct {728uint8_t base_efficiency; //LP1729uint8_t low_power_efficiency; //LP2730} stutter_efficiency;731};732733struct dc_bw_validation_profile {734bool enable;735736unsigned long long total_ticks;737unsigned long long voltage_level_ticks;738unsigned long long watermark_ticks;739unsigned long long rq_dlg_ticks;740741unsigned long long total_count;742unsigned long long skip_fast_count;743unsigned long long skip_pass_count;744unsigned long long skip_fail_count;745};746747#define BW_VAL_TRACE_SETUP() \748unsigned long long end_tick = 0; \749unsigned long long voltage_level_tick = 0; \750unsigned long long watermark_tick = 0; \751unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \752dm_get_timestamp(dc->ctx) : 0753754#define BW_VAL_TRACE_COUNT() \755if (dc->debug.bw_val_profile.enable) \756dc->debug.bw_val_profile.total_count++757758#define BW_VAL_TRACE_SKIP(status) \759if (dc->debug.bw_val_profile.enable) { \760if (!voltage_level_tick) \761voltage_level_tick = dm_get_timestamp(dc->ctx); \762dc->debug.bw_val_profile.skip_ ## status ## _count++; \763}764765#define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \766if (dc->debug.bw_val_profile.enable) \767voltage_level_tick = dm_get_timestamp(dc->ctx)768769#define BW_VAL_TRACE_END_WATERMARKS() \770if (dc->debug.bw_val_profile.enable) \771watermark_tick = dm_get_timestamp(dc->ctx)772773#define BW_VAL_TRACE_FINISH() \774if (dc->debug.bw_val_profile.enable) { \775end_tick = dm_get_timestamp(dc->ctx); \776dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \777dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \778if (watermark_tick) { \779dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \780dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \781} \782}783784union mem_low_power_enable_options {785struct {786bool vga: 1;787bool i2c: 1;788bool dmcu: 1;789bool dscl: 1;790bool cm: 1;791bool mpc: 1;792bool optc: 1;793bool vpg: 1;794bool afmt: 1;795} bits;796uint32_t u32All;797};798799union root_clock_optimization_options {800struct {801bool dpp: 1;802bool dsc: 1;803bool hdmistream: 1;804bool hdmichar: 1;805bool dpstream: 1;806bool symclk32_se: 1;807bool symclk32_le: 1;808bool symclk_fe: 1;809bool physymclk: 1;810bool dpiasymclk: 1;811uint32_t reserved: 22;812} bits;813uint32_t u32All;814};815816union fine_grain_clock_gating_enable_options {817struct {818bool dccg_global_fgcg_rep : 1; /* Global fine grain clock gating of repeaters */819bool dchub : 1; /* Display controller hub */820bool dchubbub : 1;821bool dpp : 1; /* Display pipes and planes */822bool opp : 1; /* Output pixel processing */823bool optc : 1; /* Output pipe timing combiner */824bool dio : 1; /* Display output */825bool dwb : 1; /* Display writeback */826bool mmhubbub : 1; /* Multimedia hub */827bool dmu : 1; /* Display core management unit */828bool az : 1; /* Azalia */829bool dchvm : 1;830bool dsc : 1; /* Display stream compression */831832uint32_t reserved : 19;833} bits;834uint32_t u32All;835};836837enum pg_hw_pipe_resources {838PG_HUBP = 0,839PG_DPP,840PG_DSC,841PG_MPCC,842PG_OPP,843PG_OPTC,844PG_DPSTREAM,845PG_HDMISTREAM,846PG_PHYSYMCLK,847PG_HW_PIPE_RESOURCES_NUM_ELEMENT848};849850enum pg_hw_resources {851PG_DCCG = 0,852PG_DCIO,853PG_DIO,854PG_DCHUBBUB,855PG_DCHVM,856PG_DWB,857PG_HPO,858PG_DCOH,859PG_HW_RESOURCES_NUM_ELEMENT860};861862struct pg_block_update {863bool pg_pipe_res_update[PG_HW_PIPE_RESOURCES_NUM_ELEMENT][MAX_PIPES];864bool pg_res_update[PG_HW_RESOURCES_NUM_ELEMENT];865};866867union dpia_debug_options {868struct {869uint32_t disable_dpia:1; /* bit 0 */870uint32_t force_non_lttpr:1; /* bit 1 */871uint32_t extend_aux_rd_interval:1; /* bit 2 */872uint32_t disable_mst_dsc_work_around:1; /* bit 3 */873uint32_t enable_force_tbt3_work_around:1; /* bit 4 */874uint32_t disable_usb4_pm_support:1; /* bit 5 */875uint32_t enable_usb4_bw_zero_alloc_patch:1; /* bit 6 */876uint32_t reserved:25;877} bits;878uint32_t raw;879};880881/* AUX wake work around options882* 0: enable/disable work around883* 1: use default timeout LINK_AUX_WAKE_TIMEOUT_MS884* 15-2: reserved885* 31-16: timeout in ms886*/887union aux_wake_wa_options {888struct {889uint32_t enable_wa : 1;890uint32_t use_default_timeout : 1;891uint32_t rsvd: 14;892uint32_t timeout_ms : 16;893} bits;894uint32_t raw;895};896897struct dc_debug_data {898uint32_t ltFailCount;899uint32_t i2cErrorCount;900uint32_t auxErrorCount;901struct pipe_topology_history topology_history;902};903904struct dc_phy_addr_space_config {905struct {906uint64_t start_addr;907uint64_t end_addr;908uint64_t fb_top;909uint64_t fb_offset;910uint64_t fb_base;911uint64_t agp_top;912uint64_t agp_bot;913uint64_t agp_base;914} system_aperture;915916struct {917uint64_t page_table_start_addr;918uint64_t page_table_end_addr;919uint64_t page_table_base_addr;920bool base_addr_is_mc_addr;921} gart_config;922923bool valid;924bool is_hvm_enabled;925uint64_t page_table_default_page_addr;926};927928struct dc_virtual_addr_space_config {929uint64_t page_table_base_addr;930uint64_t page_table_start_addr;931uint64_t page_table_end_addr;932uint32_t page_table_block_size_in_bytes;933uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid934};935936struct dc_bounding_box_overrides {937int sr_exit_time_ns;938int sr_enter_plus_exit_time_ns;939int sr_exit_z8_time_ns;940int sr_enter_plus_exit_z8_time_ns;941int urgent_latency_ns;942int percent_of_ideal_drambw;943int dram_clock_change_latency_ns;944int dummy_clock_change_latency_ns;945int fclk_clock_change_latency_ns;946/* This forces a hard min on the DCFCLK we use947* for DML. Unlike the debug option for forcing948* DCFCLK, this override affects watermark calculations949*/950int min_dcfclk_mhz;951};952953struct dc_state;954struct resource_pool;955struct dce_hwseq;956struct link_service;957958/*959* struct dc_debug_options - DC debug struct960*961* This struct provides a simple mechanism for developers to change some962* configurations, enable/disable features, and activate extra debug options.963* This can be very handy to narrow down whether some specific feature is964* causing an issue or not.965*/966struct dc_debug_options {967bool native422_support;968bool disable_dsc;969enum visual_confirm visual_confirm;970int visual_confirm_rect_height;971972bool sanity_checks;973bool max_disp_clk;974bool surface_trace;975bool clock_trace;976bool validation_trace;977bool bandwidth_calcs_trace;978int max_downscale_src_width;979980/* stutter efficiency related */981bool disable_stutter;982bool use_max_lb;983enum dcc_option disable_dcc;984985/*986* @pipe_split_policy: Define which pipe split policy is used by the987* display core.988*/989enum pipe_split_policy pipe_split_policy;990bool force_single_disp_pipe_split;991bool voltage_align_fclk;992bool disable_min_fclk;993994bool hdcp_lc_force_fw_enable;995bool hdcp_lc_enable_sw_fallback;996997bool disable_dfs_bypass;998bool disable_dpp_power_gate;999bool disable_hubp_power_gate;1000bool disable_dsc_power_gate;1001bool disable_optc_power_gate;1002bool disable_hpo_power_gate;1003bool disable_io_clk_power_gate;1004bool disable_mem_power_gate;1005bool disable_dio_power_gate;1006int dsc_min_slice_height_override;1007int dsc_bpp_increment_div;1008bool disable_pplib_wm_range;1009enum wm_report_mode pplib_wm_report_mode;1010unsigned int min_disp_clk_khz;1011unsigned int min_dpp_clk_khz;1012unsigned int min_dram_clk_khz;1013int sr_exit_time_dpm0_ns;1014int sr_enter_plus_exit_time_dpm0_ns;1015int sr_exit_time_ns;1016int sr_enter_plus_exit_time_ns;1017int sr_exit_z8_time_ns;1018int sr_enter_plus_exit_z8_time_ns;1019int urgent_latency_ns;1020uint32_t underflow_assert_delay_us;1021int percent_of_ideal_drambw;1022int dram_clock_change_latency_ns;1023bool optimized_watermark;1024int always_scale;1025bool disable_pplib_clock_request;1026bool disable_clock_gate;1027bool disable_mem_low_power;1028bool pstate_enabled;1029bool disable_dmcu;1030bool force_abm_enable;1031bool disable_stereo_support;1032bool vsr_support;1033bool performance_trace;1034bool az_endpoint_mute_only;1035bool always_use_regamma;1036bool recovery_enabled;1037bool avoid_vbios_exec_table;1038bool scl_reset_length10;1039bool hdmi20_disable;1040bool skip_detection_link_training;1041uint32_t edid_read_retry_times;1042unsigned int force_odm_combine; //bit vector based on otg inst1043unsigned int seamless_boot_odm_combine;1044unsigned int force_odm_combine_4to1; //bit vector based on otg inst1045int minimum_z8_residency_time;1046int minimum_z10_residency_time;1047bool disable_z9_mpc;1048unsigned int force_fclk_khz;1049bool enable_tri_buf;1050bool ips_disallow_entry;1051bool dmub_offload_enabled;1052bool dmcub_emulation;1053bool disable_idle_power_optimizations;1054unsigned int mall_size_override;1055unsigned int mall_additional_timer_percent;1056bool mall_error_as_fatal;1057bool dmub_command_table; /* for testing only */1058struct dc_bw_validation_profile bw_val_profile;1059bool disable_fec;1060bool disable_48mhz_pwrdwn;1061/* This forces a hard min on the DCFCLK requested to SMU/PP1062* watermarks are not affected.1063*/1064unsigned int force_min_dcfclk_mhz;1065int dwb_fi_phase;1066bool disable_timing_sync;1067bool cm_in_bypass;1068int force_clock_mode;/*every mode change.*/10691070bool disable_dram_clock_change_vactive_support;1071bool validate_dml_output;1072bool enable_dmcub_surface_flip;1073bool usbc_combo_phy_reset_wa;1074bool enable_dram_clock_change_one_display_vactive;1075/* TODO - remove once tested */1076bool legacy_dp2_lt;1077bool set_mst_en_for_sst;1078bool disable_uhbr;1079bool force_dp2_lt_fallback_method;1080bool ignore_cable_id;1081union mem_low_power_enable_options enable_mem_low_power;1082union root_clock_optimization_options root_clock_optimization;1083union fine_grain_clock_gating_enable_options enable_fine_grain_clock_gating;1084bool hpo_optimization;1085bool force_vblank_alignment;10861087/* Enable dmub aux for legacy ddc */1088bool enable_dmub_aux_for_legacy_ddc;1089bool disable_fams;1090enum in_game_fams_config disable_fams_gaming;1091/* FEC/PSR1 sequence enable delay in 100us */1092uint8_t fec_enable_delay_in100us;1093bool enable_driver_sequence_debug;1094enum det_size crb_alloc_policy;1095int crb_alloc_policy_min_disp_count;1096bool disable_z10;1097bool enable_z9_disable_interface;1098bool psr_skip_crtc_disable;1099uint32_t ips_skip_crtc_disable_mask;1100union dpia_debug_options dpia_debug;1101bool disable_fixed_vs_aux_timeout_wa;1102uint32_t fixed_vs_aux_delay_config_wa;1103bool force_disable_subvp;1104bool force_subvp_mclk_switch;1105bool allow_sw_cursor_fallback;1106unsigned int force_subvp_num_ways;1107unsigned int force_mall_ss_num_ways;1108bool alloc_extra_way_for_cursor;1109uint32_t subvp_extra_lines;1110bool disable_force_pstate_allow_on_hw_release;1111bool force_usr_allow;1112/* uses value at boot and disables switch */1113bool disable_dtb_ref_clk_switch;1114bool extended_blank_optimization;1115union aux_wake_wa_options aux_wake_wa;1116uint32_t mst_start_top_delay;1117uint8_t psr_power_use_phy_fsm;1118enum dml_hostvm_override_opts dml_hostvm_override;1119bool dml_disallow_alternate_prefetch_modes;1120bool use_legacy_soc_bb_mechanism;1121bool exit_idle_opt_for_cursor_updates;1122bool using_dml2;1123bool enable_single_display_2to1_odm_policy;1124bool enable_double_buffered_dsc_pg_support;1125bool enable_dp_dig_pixel_rate_div_policy;1126bool using_dml21;1127enum lttpr_mode lttpr_mode_override;1128unsigned int dsc_delay_factor_wa_x1000;1129unsigned int min_prefetch_in_strobe_ns;1130bool disable_unbounded_requesting;1131bool dig_fifo_off_in_blank;1132bool override_dispclk_programming;1133bool otg_crc_db;1134bool disallow_dispclk_dppclk_ds;1135bool disable_fpo_optimizations;1136bool support_eDP1_5;1137uint32_t fpo_vactive_margin_us;1138bool disable_fpo_vactive;1139bool disable_boot_optimizations;1140bool override_odm_optimization;1141bool minimize_dispclk_using_odm;1142bool disable_subvp_high_refresh;1143bool disable_dp_plus_plus_wa;1144uint32_t fpo_vactive_min_active_margin_us;1145uint32_t fpo_vactive_max_blank_us;1146bool enable_hpo_pg_support;1147bool disable_dc_mode_overwrite;1148bool replay_skip_crtc_disabled;1149bool ignore_pg;/*do nothing, let pmfw control it*/1150bool psp_disabled_wa;1151unsigned int ips2_eval_delay_us;1152unsigned int ips2_entry_delay_us;1153bool optimize_ips_handshake;1154bool disable_dmub_reallow_idle;1155bool disable_timeout;1156bool disable_extblankadj;1157bool enable_idle_reg_checks;1158unsigned int static_screen_wait_frames;1159uint32_t pwm_freq;1160bool force_chroma_subsampling_1tap;1161unsigned int dcc_meta_propagation_delay_us;1162bool disable_422_left_edge_pixel;1163bool dml21_force_pstate_method;1164uint32_t dml21_force_pstate_method_values[MAX_PIPES];1165uint32_t dml21_disable_pstate_method_mask;1166union fw_assisted_mclk_switch_version fams_version;1167union dmub_fams2_global_feature_config fams2_config;1168unsigned int force_cositing;1169unsigned int disable_spl;1170unsigned int force_easf;1171unsigned int force_sharpness;1172unsigned int force_sharpness_level;1173unsigned int force_lls;1174bool notify_dpia_hr_bw;1175bool enable_ips_visual_confirm;1176unsigned int sharpen_policy;1177unsigned int scale_to_sharpness_policy;1178unsigned int enable_oled_edp_power_up_opt;1179bool enable_hblank_borrow;1180bool force_subvp_df_throttle;1181uint32_t acpi_transition_bitmasks[MAX_PIPES];1182bool enable_pg_cntl_debug_logs;1183unsigned int auxless_alpm_lfps_setup_ns;1184unsigned int auxless_alpm_lfps_period_ns;1185unsigned int auxless_alpm_lfps_silence_ns;1186unsigned int auxless_alpm_lfps_t1t2_us;1187short auxless_alpm_lfps_t1t2_offset_us;1188bool disable_stutter_for_wm_program;1189bool enable_block_sequence_programming;1190};119111921193/* Generic structure that can be used to query properties of DC. More fields1194* can be added as required.1195*/1196struct dc_current_properties {1197unsigned int cursor_size_limit;1198};11991200enum frame_buffer_mode {1201FRAME_BUFFER_MODE_LOCAL_ONLY = 0,1202FRAME_BUFFER_MODE_ZFB_ONLY,1203FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,1204} ;12051206struct dchub_init_data {1207int64_t zfb_phys_addr_base;1208int64_t zfb_mc_base_addr;1209uint64_t zfb_size_in_byte;1210enum frame_buffer_mode fb_mode;1211bool dchub_initialzied;1212bool dchub_info_valid;1213};12141215struct dml2_soc_bb;12161217struct dc_init_data {1218struct hw_asic_id asic_id;1219void *driver; /* ctx */1220struct cgs_device *cgs_device;1221struct dc_bounding_box_overrides bb_overrides;12221223int num_virtual_links;1224/*1225* If 'vbios_override' not NULL, it will be called instead1226* of the real VBIOS. Intended use is Diagnostics on FPGA.1227*/1228struct dc_bios *vbios_override;1229enum dce_environment dce_environment;12301231struct dmub_offload_funcs *dmub_if;1232struct dc_reg_helper_state *dmub_offload;12331234struct dc_config flags;1235uint64_t log_mask;12361237struct dpcd_vendor_signature vendor_signature;1238bool force_smu_not_present;1239/*1240* IP offset for run time initializaion of register addresses1241*1242* DCN3.5+ will fail dc_create() if these fields are null for them. They are1243* applicable starting with DCN32/321 and are not used for ASICs upstreamed1244* before them.1245*/1246uint32_t *dcn_reg_offsets;1247uint32_t *nbio_reg_offsets;1248uint32_t *clk_reg_offsets;1249void *bb_from_dmub;1250};12511252struct dc_callback_init {1253struct cp_psp cp_psp;1254};12551256struct dc *dc_create(const struct dc_init_data *init_params);1257void dc_hardware_init(struct dc *dc);12581259int dc_get_vmid_use_vector(struct dc *dc);1260void dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid);1261/* Returns the number of vmids supported */1262int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config);1263void dc_init_callbacks(struct dc *dc,1264const struct dc_callback_init *init_params);1265void dc_deinit_callbacks(struct dc *dc);1266void dc_destroy(struct dc **dc);12671268/* Surface Interfaces */12691270enum {1271TRANSFER_FUNC_POINTS = 10251272};12731274struct dc_hdr_static_metadata {1275/* display chromaticities and white point in units of 0.00001 */1276unsigned int chromaticity_green_x;1277unsigned int chromaticity_green_y;1278unsigned int chromaticity_blue_x;1279unsigned int chromaticity_blue_y;1280unsigned int chromaticity_red_x;1281unsigned int chromaticity_red_y;1282unsigned int chromaticity_white_point_x;1283unsigned int chromaticity_white_point_y;12841285uint32_t min_luminance;1286uint32_t max_luminance;1287uint32_t maximum_content_light_level;1288uint32_t maximum_frame_average_light_level;1289};12901291enum dc_transfer_func_type {1292TF_TYPE_PREDEFINED,1293TF_TYPE_DISTRIBUTED_POINTS,1294TF_TYPE_BYPASS,1295TF_TYPE_HWPWL1296};12971298struct dc_transfer_func_distributed_points {1299struct fixed31_32 red[TRANSFER_FUNC_POINTS];1300struct fixed31_32 green[TRANSFER_FUNC_POINTS];1301struct fixed31_32 blue[TRANSFER_FUNC_POINTS];13021303uint16_t end_exponent;1304uint16_t x_point_at_y1_red;1305uint16_t x_point_at_y1_green;1306uint16_t x_point_at_y1_blue;1307};13081309enum dc_transfer_func_predefined {1310TRANSFER_FUNCTION_SRGB,1311TRANSFER_FUNCTION_BT709,1312TRANSFER_FUNCTION_PQ,1313TRANSFER_FUNCTION_LINEAR,1314TRANSFER_FUNCTION_UNITY,1315TRANSFER_FUNCTION_HLG,1316TRANSFER_FUNCTION_HLG12,1317TRANSFER_FUNCTION_GAMMA22,1318TRANSFER_FUNCTION_GAMMA24,1319TRANSFER_FUNCTION_GAMMA261320};132113221323struct dc_transfer_func {1324struct kref refcount;1325enum dc_transfer_func_type type;1326enum dc_transfer_func_predefined tf;1327/* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/1328uint32_t sdr_ref_white_level;1329union {1330struct pwl_params pwl;1331struct dc_transfer_func_distributed_points tf_pts;1332};1333};133413351336union dc_3dlut_state {1337struct {1338uint32_t initialized:1; /*if 3dlut is went through color module for initialization */1339uint32_t rmu_idx_valid:1; /*if mux settings are valid*/1340uint32_t rmu_mux_num:3; /*index of mux to use*/1341uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/1342uint32_t mpc_rmu1_mux:4;1343uint32_t mpc_rmu2_mux:4;1344uint32_t reserved:15;1345} bits;1346uint32_t raw;1347};134813491350#define MATRIX_9C__DIM_128_ALIGNED_LEN 16 // 9+8 : 9 * 8 + 7 * 8 = 72 + 56 = 128 % 128 = 01351#define MATRIX_17C__DIM_128_ALIGNED_LEN 32 //17+15: 17 * 8 + 15 * 8 = 136 + 120 = 256 % 128 = 01352#define MATRIX_33C__DIM_128_ALIGNED_LEN 64 //17+47: 17 * 8 + 47 * 8 = 136 + 376 = 512 % 128 = 013531354struct lut_rgb {1355uint16_t b;1356uint16_t g;1357uint16_t r;1358uint16_t padding;1359};13601361//this structure maps directly to how the lut will read it from memory1362struct lut_mem_mapping {1363union {1364//NATIVE MODE 1, 21365//RGB layout [b][g][r] //red is 128 byte aligned1366//BGR layout [r][g][b] //blue is 128 byte aligned1367struct lut_rgb rgb_17c[17][17][MATRIX_17C__DIM_128_ALIGNED_LEN];1368struct lut_rgb rgb_33c[33][33][MATRIX_33C__DIM_128_ALIGNED_LEN];13691370//TRANSFORMED1371uint16_t linear_rgb[(33*33*33*4/128+1)*128];1372};1373uint16_t size;1374};13751376struct dc_rmcm_3dlut {1377bool isInUse;1378const struct dc_stream_state *stream;1379uint8_t protection_bits;1380};13811382struct dc_3dlut {1383struct kref refcount;1384struct tetrahedral_params lut_3d;1385struct fixed31_32 hdr_multiplier;1386union dc_3dlut_state state;1387};1388/*1389* This structure is filled in by dc_surface_get_status and contains1390* the last requested address and the currently active address so the called1391* can determine if there are any outstanding flips1392*/1393struct dc_plane_status {1394struct dc_plane_address requested_address;1395struct dc_plane_address current_address;1396bool is_flip_pending;1397bool is_right_eye;1398};13991400union surface_update_flags {14011402struct {1403uint32_t addr_update:1;1404/* Medium updates */1405uint32_t dcc_change:1;1406uint32_t color_space_change:1;1407uint32_t horizontal_mirror_change:1;1408uint32_t per_pixel_alpha_change:1;1409uint32_t global_alpha_change:1;1410uint32_t hdr_mult:1;1411uint32_t rotation_change:1;1412uint32_t swizzle_change:1;1413uint32_t scaling_change:1;1414uint32_t position_change:1;1415uint32_t in_transfer_func_change:1;1416uint32_t input_csc_change:1;1417uint32_t coeff_reduction_change:1;1418uint32_t pixel_format_change:1;1419uint32_t plane_size_change:1;1420uint32_t gamut_remap_change:1;14211422/* Full updates */1423uint32_t new_plane:1;1424uint32_t bpp_change:1;1425uint32_t gamma_change:1;1426uint32_t bandwidth_change:1;1427uint32_t clock_change:1;1428uint32_t stereo_format_change:1;1429uint32_t lut_3d:1;1430uint32_t tmz_changed:1;1431uint32_t mcm_transfer_function_enable_change:1; /* disable or enable MCM transfer func */1432uint32_t full_update:1;1433uint32_t sdr_white_level_nits:1;1434} bits;14351436uint32_t raw;1437};14381439#define DC_REMOVE_PLANE_POINTERS 114401441struct dc_plane_state {1442struct dc_plane_address address;1443struct dc_plane_flip_time time;1444bool triplebuffer_flips;1445struct scaling_taps scaling_quality;1446struct rect src_rect;1447struct rect dst_rect;1448struct rect clip_rect;14491450struct plane_size plane_size;1451struct dc_tiling_info tiling_info;14521453struct dc_plane_dcc_param dcc;14541455struct dc_gamma gamma_correction;1456struct dc_transfer_func in_transfer_func;1457struct dc_bias_and_scale bias_and_scale;1458struct dc_csc_transform input_csc_color_matrix;1459struct fixed31_32 coeff_reduction_factor;1460struct fixed31_32 hdr_mult;1461struct colorspace_transform gamut_remap_matrix;14621463// TODO: No longer used, remove1464struct dc_hdr_static_metadata hdr_static_ctx;14651466enum dc_color_space color_space;14671468struct dc_3dlut lut3d_func;1469struct dc_transfer_func in_shaper_func;1470struct dc_transfer_func blend_tf;14711472struct dc_transfer_func *gamcor_tf;1473enum surface_pixel_format format;1474enum dc_rotation_angle rotation;1475enum plane_stereo_format stereo_format;14761477bool is_tiling_rotated;1478bool per_pixel_alpha;1479bool pre_multiplied_alpha;1480bool global_alpha;1481int global_alpha_value;1482bool visible;1483bool flip_immediate;1484bool horizontal_mirror;1485int layer_index;14861487union surface_update_flags update_flags;1488bool flip_int_enabled;1489bool skip_manual_trigger;14901491/* private to DC core */1492struct dc_plane_status status;1493struct dc_context *ctx;14941495/* HACK: Workaround for forcing full reprogramming under some conditions */1496bool force_full_update;14971498bool is_phantom; // TODO: Change mall_stream_config into mall_plane_config instead14991500/* private to dc_surface.c */1501enum dc_irq_source irq_source;1502struct kref refcount;1503struct tg_color visual_confirm_color;15041505bool is_statically_allocated;1506enum chroma_cositing cositing;1507enum dc_cm2_shaper_3dlut_setting mcm_shaper_3dlut_setting;1508bool mcm_lut1d_enable;1509struct dc_cm2_func_luts mcm_luts;1510bool lut_bank_a;1511enum mpcc_movable_cm_location mcm_location;1512struct dc_csc_transform cursor_csc_color_matrix;1513bool adaptive_sharpness_en;1514int adaptive_sharpness_policy;1515int sharpness_level;1516enum linear_light_scaling linear_light_scaling;1517unsigned int sdr_white_level_nits;1518struct spl_sharpness_range sharpness_range;1519enum sharpness_range_source sharpness_source;1520};15211522struct dc_plane_info {1523struct plane_size plane_size;1524struct dc_tiling_info tiling_info;1525struct dc_plane_dcc_param dcc;1526enum surface_pixel_format format;1527enum dc_rotation_angle rotation;1528enum plane_stereo_format stereo_format;1529enum dc_color_space color_space;1530bool horizontal_mirror;1531bool visible;1532bool per_pixel_alpha;1533bool pre_multiplied_alpha;1534bool global_alpha;1535int global_alpha_value;1536bool input_csc_enabled;1537int layer_index;1538enum chroma_cositing cositing;1539};15401541#include "dc_stream.h"15421543struct dc_scratch_space {1544/* used to temporarily backup plane states of a stream during1545* dc update. The reason is that plane states are overwritten1546* with surface updates in dc update. Once they are overwritten1547* current state is no longer valid. We want to temporarily1548* store current value in plane states so we can still recover1549* a valid current state during dc update.1550*/1551struct dc_plane_state plane_states[MAX_SURFACES];15521553struct dc_stream_state stream_state;1554};15551556/*1557* A link contains one or more sinks and their connected status.1558* The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.1559*/1560struct dc_link {1561struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];1562unsigned int sink_count;1563struct dc_sink *local_sink;1564unsigned int link_index;1565enum dc_connection_type type;1566enum signal_type connector_signal;1567enum dc_irq_source irq_source_hpd;1568enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */1569enum dc_irq_source irq_source_read_request;/* Read Request */15701571bool is_hpd_filter_disabled;1572bool dp_ss_off;15731574/**1575* @link_state_valid:1576*1577* If there is no link and local sink, this variable should be set to1578* false. Otherwise, it should be set to true; usually, the function1579* core_link_enable_stream sets this field to true.1580*/1581bool link_state_valid;1582bool aux_access_disabled;1583bool sync_lt_in_progress;1584bool skip_stream_reenable;1585bool is_internal_display;1586/** @todo Rename. Flag an endpoint as having a programmable mapping to a DIG encoder. */1587bool is_dig_mapping_flexible;1588bool hpd_status; /* HPD status of link without physical HPD pin. */1589bool is_hpd_pending; /* Indicates a new received hpd */15901591/* USB4 DPIA links skip verifying link cap, instead performing the fallback method1592* for every link training. This is incompatible with DP LL compliance automation,1593* which expects the same link settings to be used every retry on a link loss.1594* This flag is used to skip the fallback when link loss occurs during automation.1595*/1596bool skip_fallback_on_link_loss;15971598bool edp_sink_present;15991600struct dp_trace dp_trace;16011602/* caps is the same as reported_link_cap. link_traing use1603* reported_link_cap. Will clean up. TODO1604*/1605struct dc_link_settings reported_link_cap;1606struct dc_link_settings verified_link_cap;1607struct dc_link_settings cur_link_settings;1608struct dc_lane_settings cur_lane_setting[LANE_COUNT_DP_MAX];1609struct dc_link_settings preferred_link_setting;1610/* preferred_training_settings are override values that1611* come from DM. DM is responsible for the memory1612* management of the override pointers.1613*/1614struct dc_link_training_overrides preferred_training_settings;1615struct dp_audio_test_data audio_test_data;16161617uint8_t ddc_hw_inst;16181619uint8_t hpd_src;16201621uint8_t link_enc_hw_inst;1622/* DIG link encoder ID. Used as index in link encoder resource pool.1623* For links with fixed mapping to DIG, this is not changed after dc_link1624* object creation.1625*/1626enum engine_id eng_id;1627enum engine_id dpia_preferred_eng_id;16281629bool test_pattern_enabled;1630/* Pending/Current test pattern are only used to perform and track1631* FIXED_VS retimer test pattern/lane adjustment override state.1632* Pending allows link HWSS to differentiate PHY vs non-PHY pattern,1633* to perform specific lane adjust overrides before setting certain1634* PHY test patterns. In cases when lane adjust and set test pattern1635* calls are not performed atomically (i.e. performing link training),1636* pending_test_pattern will be invalid or contain a non-PHY test pattern1637* and current_test_pattern will contain required context for any future1638* set pattern/set lane adjust to transition between override state(s).1639* */1640enum dp_test_pattern current_test_pattern;1641enum dp_test_pattern pending_test_pattern;16421643union compliance_test_state compliance_test_state;16441645void *priv;16461647struct ddc_service *ddc;16481649enum dp_panel_mode panel_mode;1650bool aux_mode;16511652/* Private to DC core */16531654const struct dc *dc;16551656struct dc_context *ctx;16571658struct panel_cntl *panel_cntl;1659struct link_encoder *link_enc;1660struct graphics_object_id link_id;1661/* Endpoint type distinguishes display endpoints which do not have entries1662* in the BIOS connector table from those that do. Helps when tracking link1663* encoder to display endpoint assignments.1664*/1665enum display_endpoint_type ep_type;1666union ddi_channel_mapping ddi_channel_mapping;1667struct connector_device_tag_info device_tag;1668struct dpcd_caps dpcd_caps;1669uint32_t dongle_max_pix_clk;1670unsigned short chip_caps;1671unsigned int dpcd_sink_count;1672struct hdcp_caps hdcp_caps;1673enum edp_revision edp_revision;1674union dpcd_sink_ext_caps dpcd_sink_ext_caps;16751676struct psr_settings psr_settings;1677struct replay_settings replay_settings;16781679/* Drive settings read from integrated info table */1680struct dc_lane_settings bios_forced_drive_settings;16811682/* Vendor specific LTTPR workaround variables */1683uint8_t vendor_specific_lttpr_link_rate_wa;1684bool apply_vendor_specific_lttpr_link_rate_wa;16851686/* MST record stream using this link */1687struct link_flags {1688bool dp_keep_receiver_powered;1689bool dp_skip_DID2;1690bool dp_skip_reset_segment;1691bool dp_skip_fs_144hz;1692bool dp_mot_reset_segment;1693/* Some USB4 docks do not handle turning off MST DSC once it has been enabled. */1694bool dpia_mst_dsc_always_on;1695/* Forced DPIA into TBT3 compatibility mode. */1696bool dpia_forced_tbt3_mode;1697bool dongle_mode_timing_override;1698bool blank_stream_on_ocs_change;1699bool read_dpcd204h_on_irq_hpd;1700bool force_dp_ffe_preset;1701bool skip_phy_ssc_reduction;1702} wa_flags;1703union dc_dp_ffe_preset forced_dp_ffe_preset;1704struct link_mst_stream_allocation_table mst_stream_alloc_table;17051706struct dc_link_status link_status;1707struct dprx_states dprx_states;17081709struct gpio *hpd_gpio;1710enum dc_link_fec_state fec_state;1711bool is_dds;1712bool is_display_mux_present;1713bool link_powered_externally; // Used to bypass hardware sequencing delays when panel is powered down forcibly17141715struct dc_panel_config panel_config;1716struct phy_state phy_state;1717uint32_t phy_transition_bitmask;1718// BW ALLOCATON USB4 ONLY1719struct dc_dpia_bw_alloc dpia_bw_alloc_config;1720bool skip_implict_edp_power_control;1721enum backlight_control_type backlight_control_type;1722};17231724struct dc {1725struct dc_debug_options debug;1726struct dc_versions versions;1727struct dc_caps caps;1728struct dc_check_config check_config;1729struct dc_cap_funcs cap_funcs;1730struct dc_config config;1731struct dc_bounding_box_overrides bb_overrides;1732struct dc_bug_wa work_arounds;1733struct dc_context *ctx;1734struct dc_phy_addr_space_config vm_pa_config;17351736uint8_t link_count;1737struct dc_link *links[MAX_LINKS];1738uint8_t lowest_dpia_link_index;1739struct link_service *link_srv;17401741struct dc_state *current_state;1742struct resource_pool *res_pool;17431744struct clk_mgr *clk_mgr;17451746/* Display Engine Clock levels */1747struct dm_pp_clock_levels sclk_lvls;17481749/* Inputs into BW and WM calculations. */1750struct bw_calcs_dceip *bw_dceip;1751struct bw_calcs_vbios *bw_vbios;1752struct dcn_soc_bounding_box *dcn_soc;1753struct dcn_ip_params *dcn_ip;1754struct display_mode_lib dml;17551756/* HW functions */1757struct hw_sequencer_funcs hwss;1758struct dce_hwseq *hwseq;17591760/* Require to optimize clocks and bandwidth for added/removed planes */1761bool optimized_required;1762bool idle_optimizations_allowed;1763bool enable_c20_dtm_b0;17641765/* Require to maintain clocks and bandwidth for UEFI enabled HW */17661767/* For eDP to know the switching state of SmartMux */1768bool is_switch_in_progress_orig;1769bool is_switch_in_progress_dest;17701771/* FBC compressor */1772struct compressor *fbc_compressor;17731774struct dc_debug_data debug_data;1775struct dpcd_vendor_signature vendor_signature;17761777const char *build_id;1778struct vm_helper *vm_helper;17791780uint32_t *dcn_reg_offsets;1781uint32_t *nbio_reg_offsets;1782uint32_t *clk_reg_offsets;17831784/* Scratch memory */1785struct {1786struct {1787/*1788* For matching clock_limits table in driver with table1789* from PMFW.1790*/1791struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES];1792} update_bw_bounding_box;1793struct dc_scratch_space current_state;1794struct dc_scratch_space new_state;1795struct dc_stream_state temp_stream; // Used so we don't need to allocate stream on the stack1796struct dc_link temp_link;1797bool pipes_to_unlock_first[MAX_PIPES]; /* Any of the pipes indicated here should be unlocked first */1798} scratch;17991800struct dml2_configuration_options dml2_options;1801struct dml2_configuration_options dml2_dc_power_options;1802enum dc_acpi_cm_power_state power_state;1803struct soc_and_ip_translator *soc_and_ip_translator;1804};18051806struct dc_scaling_info {1807struct rect src_rect;1808struct rect dst_rect;1809struct rect clip_rect;1810struct scaling_taps scaling_quality;1811};18121813struct dc_fast_update {1814const struct dc_flip_addrs *flip_addr;1815const struct dc_gamma *gamma;1816const struct colorspace_transform *gamut_remap_matrix;1817const struct dc_csc_transform *input_csc_color_matrix;1818const struct fixed31_32 *coeff_reduction_factor;1819struct dc_transfer_func *out_transfer_func;1820struct dc_csc_transform *output_csc_transform;1821const struct dc_csc_transform *cursor_csc_color_matrix;1822};18231824struct dc_surface_update {1825struct dc_plane_state *surface;18261827/* isr safe update parameters. null means no updates */1828const struct dc_flip_addrs *flip_addr;1829const struct dc_plane_info *plane_info;1830const struct dc_scaling_info *scaling_info;1831struct fixed31_32 hdr_mult;1832/* following updates require alloc/sleep/spin that is not isr safe,1833* null means no updates1834*/1835const struct dc_gamma *gamma;1836const struct dc_transfer_func *in_transfer_func;18371838const struct dc_csc_transform *input_csc_color_matrix;1839const struct fixed31_32 *coeff_reduction_factor;1840const struct dc_transfer_func *func_shaper;1841const struct dc_3dlut *lut3d_func;1842const struct dc_transfer_func *blend_tf;1843const struct colorspace_transform *gamut_remap_matrix;1844/*1845* Color Transformations for pre-blend MCM (Shaper, 3DLUT, 1DLUT)1846*1847* change cm2_params.component_settings: Full update1848* change cm2_params.cm2_luts: Fast update1849*/1850const struct dc_cm2_parameters *cm2_params;1851const struct dc_csc_transform *cursor_csc_color_matrix;1852unsigned int sdr_white_level_nits;1853struct dc_bias_and_scale bias_and_scale;1854};18551856struct dc_underflow_debug_data {1857struct dcn_hubbub_reg_state *hubbub_reg_state;1858struct dcn_hubp_reg_state *hubp_reg_state[MAX_PIPES];1859struct dcn_dpp_reg_state *dpp_reg_state[MAX_PIPES];1860struct dcn_mpc_reg_state *mpc_reg_state[MAX_PIPES];1861struct dcn_opp_reg_state *opp_reg_state[MAX_PIPES];1862struct dcn_dsc_reg_state *dsc_reg_state[MAX_PIPES];1863struct dcn_optc_reg_state *optc_reg_state[MAX_PIPES];1864struct dcn_dccg_reg_state *dccg_reg_state[MAX_PIPES];1865};18661867struct power_features {1868bool ips;1869bool rcg;1870bool replay;1871bool dds;1872bool sprs;1873bool psr;1874bool fams;1875bool mpo;1876bool uclk_p_state;1877};18781879/*1880* Create a new surface with default parameters;1881*/1882void dc_gamma_retain(struct dc_gamma *dc_gamma);1883void dc_gamma_release(struct dc_gamma **dc_gamma);1884struct dc_gamma *dc_create_gamma(void);18851886void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);1887void dc_transfer_func_release(struct dc_transfer_func *dc_tf);1888struct dc_transfer_func *dc_create_transfer_func(void);18891890struct dc_3dlut *dc_create_3dlut_func(void);1891void dc_3dlut_func_release(struct dc_3dlut *lut);1892void dc_3dlut_func_retain(struct dc_3dlut *lut);18931894void dc_post_update_surfaces_to_stream(1895struct dc *dc);18961897/**1898* struct dc_validation_set - Struct to store surface/stream associations for validation1899*/1900struct dc_validation_set {1901/**1902* @stream: Stream state properties1903*/1904struct dc_stream_state *stream;19051906/**1907* @plane_states: Surface state1908*/1909struct dc_plane_state *plane_states[MAX_SURFACES];19101911/**1912* @plane_count: Total of active planes1913*/1914uint8_t plane_count;1915};19161917bool dc_validate_boot_timing(const struct dc *dc,1918const struct dc_sink *sink,1919struct dc_crtc_timing *crtc_timing);19201921enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state);19221923enum dc_status dc_validate_with_context(struct dc *dc,1924const struct dc_validation_set set[],1925int set_count,1926struct dc_state *context,1927enum dc_validate_mode validate_mode);19281929bool dc_set_generic_gpio_for_stereo(bool enable,1930struct gpio_service *gpio_service);19311932enum dc_status dc_validate_global_state(1933struct dc *dc,1934struct dc_state *new_ctx,1935enum dc_validate_mode validate_mode);19361937bool dc_acquire_release_mpc_3dlut(1938struct dc *dc, bool acquire,1939struct dc_stream_state *stream,1940struct dc_3dlut **lut,1941struct dc_transfer_func **shaper);19421943bool dc_resource_is_dsc_encoding_supported(const struct dc *dc);1944void get_audio_check(struct audio_info *aud_modes,1945struct audio_check *aud_chk);19461947bool fast_nonaddr_updates_exist(struct dc_fast_update *fast_update, int surface_count);1948void populate_fast_updates(struct dc_fast_update *fast_update,1949struct dc_surface_update *srf_updates,1950int surface_count,1951struct dc_stream_update *stream_update);1952/*1953* Set up streams and links associated to drive sinks1954* The streams parameter is an absolute set of all active streams.1955*1956* After this call:1957* Phy, Encoder, Timing Generator are programmed and enabled.1958* New streams are enabled with blank stream; no memory read.1959*/1960enum dc_status dc_commit_streams(struct dc *dc, struct dc_commit_streams_params *params);196119621963struct dc_plane_state *dc_get_surface_for_mpcc(struct dc *dc,1964struct dc_stream_state *stream,1965int mpcc_inst);196619671968uint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane);19691970void dc_set_disable_128b_132b_stream_overhead(bool disable);19711972/* The function returns minimum bandwidth required to drive a given timing1973* return - minimum required timing bandwidth in kbps.1974*/1975uint32_t dc_bandwidth_in_kbps_from_timing(1976const struct dc_crtc_timing *timing,1977const enum dc_link_encoding_format link_encoding);19781979/* Link Interfaces */1980/* Return an enumerated dc_link.1981* dc_link order is constant and determined at1982* boot time. They cannot be created or destroyed.1983* Use dc_get_caps() to get number of links.1984*/1985struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index);19861987/* Return instance id of the edp link. Inst 0 is primary edp link. */1988bool dc_get_edp_link_panel_inst(const struct dc *dc,1989const struct dc_link *link,1990unsigned int *inst_out);19911992/* Return an array of link pointers to edp links. */1993void dc_get_edp_links(const struct dc *dc,1994struct dc_link **edp_links,1995int *edp_num);19961997void dc_set_edp_power(const struct dc *dc, struct dc_link *edp_link,1998bool powerOn);19992000/* The function initiates detection handshake over the given link. It first2001* determines if there are display connections over the link. If so it initiates2002* detection protocols supported by the connected receiver device. The function2003* contains protocol specific handshake sequences which are sometimes mandatory2004* to establish a proper connection between TX and RX. So it is always2005* recommended to call this function as the first link operation upon HPD event2006* or power up event. Upon completion, the function will update link structure2007* in place based on latest RX capabilities. The function may also cause dpms2008* to be reset to off for all currently enabled streams to the link. It is DM's2009* responsibility to serialize detection and DPMS updates.2010*2011* @reason - Indicate which event triggers this detection. dc may customize2012* detection flow depending on the triggering events.2013* return false - if detection is not fully completed. This could happen when2014* there is an unrecoverable error during detection or detection is partially2015* completed (detection has been delegated to dm mst manager ie.2016* link->connection_type == dc_connection_mst_branch when returning false).2017* return true - detection is completed, link has been fully updated with latest2018* detection result.2019*/2020bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason);20212022struct dc_sink_init_data;20232024/* When link connection type is dc_connection_mst_branch, remote sink can be2025* added to the link. The interface creates a remote sink and associates it with2026* current link. The sink will be retained by link until remove remote sink is2027* called.2028*2029* @dc_link - link the remote sink will be added to.2030* @edid - byte array of EDID raw data.2031* @len - size of the edid in byte2032* @init_data -2033*/2034struct dc_sink *dc_link_add_remote_sink(2035struct dc_link *dc_link,2036const uint8_t *edid,2037int len,2038struct dc_sink_init_data *init_data);20392040/* Remove remote sink from a link with dc_connection_mst_branch connection type.2041* @link - link the sink should be removed from2042* @sink - sink to be removed.2043*/2044void dc_link_remove_remote_sink(2045struct dc_link *link,2046struct dc_sink *sink);20472048/* Enable HPD interrupt handler for a given link */2049void dc_link_enable_hpd(const struct dc_link *link);20502051/* Disable HPD interrupt handler for a given link */2052void dc_link_disable_hpd(const struct dc_link *link);20532054/* determine if there is a sink connected to the link2055*2056* @type - dc_connection_single if connected, dc_connection_none otherwise.2057* return - false if an unexpected error occurs, true otherwise.2058*2059* NOTE: This function doesn't detect downstream sink connections i.e2060* dc_connection_mst_branch, dc_connection_sst_branch. In this case, it will2061* return dc_connection_single if the branch device is connected despite of2062* downstream sink's connection status.2063*/2064bool dc_link_detect_connection_type(struct dc_link *link,2065enum dc_connection_type *type);20662067/* query current hpd pin value2068* return - true HPD is asserted (HPD high), false otherwise (HPD low)2069*2070*/2071bool dc_link_get_hpd_state(struct dc_link *link);20722073/* Getter for cached link status from given link */2074const struct dc_link_status *dc_link_get_status(const struct dc_link *link);20752076/* enable/disable hardware HPD filter.2077*2078* @link - The link the HPD pin is associated with.2079* @enable = true - enable hardware HPD filter. HPD event will only queued to irq2080* handler once after no HPD change has been detected within dc default HPD2081* filtering interval since last HPD event. i.e if display keeps toggling hpd2082* pulses within default HPD interval, no HPD event will be received until HPD2083* toggles have stopped. Then HPD event will be queued to irq handler once after2084* dc default HPD filtering interval since last HPD event.2085*2086* @enable = false - disable hardware HPD filter. HPD event will be queued2087* immediately to irq handler after no HPD change has been detected within2088* IRQ_HPD (aka HPD short pulse) interval (i.e 2ms).2089*/2090void dc_link_enable_hpd_filter(struct dc_link *link, bool enable);20912092/* submit i2c read/write payloads through ddc channel2093* @link_index - index to a link with ddc in i2c mode2094* @cmd - i2c command structure2095* return - true if success, false otherwise.2096*/2097bool dc_submit_i2c(2098struct dc *dc,2099uint32_t link_index,2100struct i2c_command *cmd);21012102/* submit i2c read/write payloads through oem channel2103* @link_index - index to a link with ddc in i2c mode2104* @cmd - i2c command structure2105* return - true if success, false otherwise.2106*/2107bool dc_submit_i2c_oem(2108struct dc *dc,2109struct i2c_command *cmd);21102111enum aux_return_code_type;2112/* Attempt to transfer the given aux payload. This function does not perform2113* retries or handle error states. The reply is returned in the payload->reply2114* and the result through operation_result. Returns the number of bytes2115* transferred,or -1 on a failure.2116*/2117int dc_link_aux_transfer_raw(struct ddc_service *ddc,2118struct aux_payload *payload,2119enum aux_return_code_type *operation_result);21202121struct ddc_service *2122dc_get_oem_i2c_device(struct dc *dc);21232124bool dc_is_oem_i2c_device_present(2125struct dc *dc,2126size_t slave_address2127);21282129/* return true if the connected receiver supports the hdcp version */2130bool dc_link_is_hdcp14(struct dc_link *link, enum signal_type signal);2131bool dc_link_is_hdcp22(struct dc_link *link, enum signal_type signal);21322133/* Notify DC about DP RX Interrupt (aka DP IRQ_HPD).2134*2135* TODO - When defer_handling is true the function will have a different purpose.2136* It no longer does complete hpd rx irq handling. We should create a separate2137* interface specifically for this case.2138*2139* Return:2140* true - Downstream port status changed. DM should call DC to do the2141* detection.2142* false - no change in Downstream port status. No further action required2143* from DM.2144*/2145bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,2146union hpd_irq_data *hpd_irq_dpcd_data, bool *out_link_loss,2147bool defer_handling, bool *has_left_work);2148/* handle DP specs define test automation sequence*/2149void dc_link_dp_handle_automated_test(struct dc_link *link);21502151/* handle DP Link loss sequence and try to recover RX link loss with best2152* effort2153*/2154void dc_link_dp_handle_link_loss(struct dc_link *link);21552156/* Determine if hpd rx irq should be handled or ignored2157* return true - hpd rx irq should be handled.2158* return false - it is safe to ignore hpd rx irq event2159*/2160bool dc_link_dp_allow_hpd_rx_irq(const struct dc_link *link);21612162/* Determine if link loss is indicated with a given hpd_irq_dpcd_data.2163* @link - link the hpd irq data associated with2164* @hpd_irq_dpcd_data - input hpd irq data2165* return - true if hpd irq data indicates a link lost2166*/2167bool dc_link_check_link_loss_status(struct dc_link *link,2168union hpd_irq_data *hpd_irq_dpcd_data);21692170/* Read hpd rx irq data from a given link2171* @link - link where the hpd irq data should be read from2172* @irq_data - output hpd irq data2173* return - DC_OK if hpd irq data is read successfully, otherwise hpd irq data2174* read has failed.2175*/2176enum dc_status dc_link_dp_read_hpd_rx_irq_data(2177struct dc_link *link,2178union hpd_irq_data *irq_data);21792180/* The function clears recorded DP RX states in the link. DM should call this2181* function when it is resuming from S3 power state to previously connected links.2182*2183* TODO - in the future we should consider to expand link resume interface to2184* support clearing previous rx states. So we don't have to rely on dm to call2185* this interface explicitly.2186*/2187void dc_link_clear_dprx_states(struct dc_link *link);21882189/* Destruct the mst topology of the link and reset the allocated payload table2190*2191* NOTE: this should only be called if DM chooses not to call dc_link_detect but2192* still wants to reset MST topology on an unplug event */2193bool dc_link_reset_cur_dp_mst_topology(struct dc_link *link);21942195/* The function calculates effective DP link bandwidth when a given link is2196* using the given link settings.2197*2198* return - total effective link bandwidth in kbps.2199*/2200uint32_t dc_link_bandwidth_kbps(2201const struct dc_link *link,2202const struct dc_link_settings *link_setting);22032204struct dp_audio_bandwidth_params {2205const struct dc_crtc_timing *crtc_timing;2206enum dp_link_encoding link_encoding;2207uint32_t channel_count;2208uint32_t sample_rate_hz;2209};22102211/* The function calculates the minimum size of hblank (in bytes) needed to2212* support the specified channel count and sample rate combination, given the2213* link encoding and timing to be used. This calculation is not supported2214* for 8b/10b SST.2215*2216* return - min hblank size in bytes, 0 if 8b/10b SST.2217*/2218uint32_t dc_link_required_hblank_size_bytes(2219const struct dc_link *link,2220struct dp_audio_bandwidth_params *audio_params);22212222/* The function takes a snapshot of current link resource allocation state2223* @dc: pointer to dc of the dm calling this2224* @map: a dc link resource snapshot defined internally to dc.2225*2226* DM needs to capture a snapshot of current link resource allocation mapping2227* and store it in its persistent storage.2228*2229* Some of the link resource is using first come first serve policy.2230* The allocation mapping depends on original hotplug order. This information2231* is lost after driver is loaded next time. The snapshot is used in order to2232* restore link resource to its previous state so user will get consistent2233* link capability allocation across reboot.2234*2235*/2236void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map);22372238/* This function restores link resource allocation state from a snapshot2239* @dc: pointer to dc of the dm calling this2240* @map: a dc link resource snapshot defined internally to dc.2241*2242* DM needs to call this function after initial link detection on boot and2243* before first commit streams to restore link resource allocation state2244* from previous boot session.2245*2246* Some of the link resource is using first come first serve policy.2247* The allocation mapping depends on original hotplug order. This information2248* is lost after driver is loaded next time. The snapshot is used in order to2249* restore link resource to its previous state so user will get consistent2250* link capability allocation across reboot.2251*2252*/2253void dc_restore_link_res_map(const struct dc *dc, uint32_t *map);22542255/* TODO: this is not meant to be exposed to DM. Should switch to stream update2256* interface i.e stream_update->dsc_config2257*/2258bool dc_link_update_dsc_config(struct pipe_ctx *pipe_ctx);22592260/* translate a raw link rate data to bandwidth in kbps */2261uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(const struct dc *dc, uint8_t bw);22622263/* determine the optimal bandwidth given link and required bw.2264* @link - current detected link2265* @req_bw - requested bandwidth in kbps2266* @link_settings - returned most optimal link settings that can fit the2267* requested bandwidth2268* return - false if link can't support requested bandwidth, true if link2269* settings is found.2270*/2271bool dc_link_decide_edp_link_settings(struct dc_link *link,2272struct dc_link_settings *link_settings,2273uint32_t req_bw);22742275/* return the max dp link settings can be driven by the link without considering2276* connected RX device and its capability2277*/2278bool dc_link_dp_get_max_link_enc_cap(const struct dc_link *link,2279struct dc_link_settings *max_link_enc_cap);22802281/* determine when the link is driving MST mode, what DP link channel coding2282* format will be used. The decision will remain unchanged until next HPD event.2283*2284* @link - a link with DP RX connection2285* return - if stream is committed to this link with MST signal type, type of2286* channel coding format dc will choose.2287*/2288enum dp_link_encoding dc_link_dp_mst_decide_link_encoding_format(2289const struct dc_link *link);22902291/* get max dp link settings the link can enable with all things considered. (i.e2292* TX/RX/Cable capabilities and dp override policies.2293*2294* @link - a link with DP RX connection2295* return - max dp link settings the link can enable.2296*2297*/2298const struct dc_link_settings *dc_link_get_link_cap(const struct dc_link *link);22992300/* Get the highest encoding format that the link supports; highest meaning the2301* encoding format which supports the maximum bandwidth.2302*2303* @link - a link with DP RX connection2304* return - highest encoding format link supports.2305*/2306enum dc_link_encoding_format dc_link_get_highest_encoding_format(const struct dc_link *link);23072308/* Check if a RX (ex. DP sink, MST hub, passive or active dongle) is connected2309* to a link with dp connector signal type.2310* @link - a link with dp connector signal type2311* return - true if connected, false otherwise2312*/2313bool dc_link_is_dp_sink_present(struct dc_link *link);23142315/* Force DP lane settings update to main-link video signal and notify the change2316* to DP RX via DPCD. This is a debug interface used for video signal integrity2317* tuning purpose. The interface assumes link has already been enabled with DP2318* signal.2319*2320* @lt_settings - a container structure with desired hw_lane_settings2321*/2322void dc_link_set_drive_settings(struct dc *dc,2323struct link_training_settings *lt_settings,2324struct dc_link *link);23252326/* Enable a test pattern in Link or PHY layer in an active link for compliance2327* test or debugging purpose. The test pattern will remain until next un-plug.2328*2329* @link - active link with DP signal output enabled.2330* @test_pattern - desired test pattern to output.2331* NOTE: set to DP_TEST_PATTERN_VIDEO_MODE to disable previous test pattern.2332* @test_pattern_color_space - for video test pattern choose a desired color2333* space.2334* @p_link_settings - For PHY pattern choose a desired link settings2335* @p_custom_pattern - some test pattern will require a custom input to2336* customize some pattern details. Otherwise keep it to NULL.2337* @cust_pattern_size - size of the custom pattern input.2338*2339*/2340bool dc_link_dp_set_test_pattern(2341struct dc_link *link,2342enum dp_test_pattern test_pattern,2343enum dp_test_pattern_color_space test_pattern_color_space,2344const struct link_training_settings *p_link_settings,2345const unsigned char *p_custom_pattern,2346unsigned int cust_pattern_size);23472348/* Force DP link settings to always use a specific value until reboot to a2349* specific link. If link has already been enabled, the interface will also2350* switch to desired link settings immediately. This is a debug interface to2351* generic dp issue trouble shooting.2352*/2353void dc_link_set_preferred_link_settings(struct dc *dc,2354struct dc_link_settings *link_setting,2355struct dc_link *link);23562357/* Force DP link to customize a specific link training behavior by overriding to2358* standard DP specs defined protocol. This is a debug interface to trouble shoot2359* display specific link training issues or apply some display specific2360* workaround in link training.2361*2362* @link_settings - if not NULL, force preferred link settings to the link.2363* @lt_override - a set of override pointers. If any pointer is none NULL, dc2364* will apply this particular override in future link training. If NULL is2365* passed in, dc resets previous overrides.2366* NOTE: DM must keep the memory from override pointers until DM resets preferred2367* training settings.2368*/2369void dc_link_set_preferred_training_settings(struct dc *dc,2370struct dc_link_settings *link_setting,2371struct dc_link_training_overrides *lt_overrides,2372struct dc_link *link,2373bool skip_immediate_retrain);23742375/* return - true if FEC is supported with connected DP RX, false otherwise */2376bool dc_link_is_fec_supported(const struct dc_link *link);23772378/* query FEC enablement policy to determine if FEC will be enabled by dc during2379* link enablement.2380* return - true if FEC should be enabled, false otherwise.2381*/2382bool dc_link_should_enable_fec(const struct dc_link *link);23832384/* determine lttpr mode the current link should be enabled with a specific link2385* settings.2386*/2387enum lttpr_mode dc_link_decide_lttpr_mode(struct dc_link *link,2388struct dc_link_settings *link_setting);23892390/* Force DP RX to update its power state.2391* NOTE: this interface doesn't update dp main-link. Calling this function will2392* cause DP TX main-link and DP RX power states out of sync. DM has to restore2393* RX power state back upon finish DM specific execution requiring DP RX in a2394* specific power state.2395* @on - true to set DP RX in D0 power state, false to set DP RX in D3 power2396* state.2397*/2398void dc_link_dp_receiver_power_ctrl(struct dc_link *link, bool on);23992400/* Force link to read base dp receiver caps from dpcd 000h - 00Fh and overwrite2401* current value read from extended receiver cap from 02200h - 0220Fh.2402* Some DP RX has problems of providing accurate DP receiver caps from extended2403* field, this interface is a workaround to revert link back to use base caps.2404*/2405void dc_link_overwrite_extended_receiver_cap(2406struct dc_link *link);24072408void dc_link_edp_panel_backlight_power_on(struct dc_link *link,2409bool wait_for_hpd);24102411/* Set backlight level of an embedded panel (eDP, LVDS).2412* backlight_pwm_u16_16 is unsigned 32 bit with 16 bit integer2413* and 16 bit fractional, where 1.0 is max backlight value.2414*/2415bool dc_link_set_backlight_level(const struct dc_link *dc_link,2416struct set_backlight_level_params *backlight_level_params);24172418/* Set/get nits-based backlight level of an embedded panel (eDP, LVDS). */2419bool dc_link_set_backlight_level_nits(struct dc_link *link,2420bool isHDR,2421uint32_t backlight_millinits,2422uint32_t transition_time_in_ms);24232424bool dc_link_get_backlight_level_nits(struct dc_link *link,2425uint32_t *backlight_millinits,2426uint32_t *backlight_millinits_peak);24272428int dc_link_get_backlight_level(const struct dc_link *dc_link);24292430int dc_link_get_target_backlight_pwm(const struct dc_link *link);24312432bool dc_link_set_psr_allow_active(struct dc_link *dc_link, const bool *enable,2433bool wait, bool force_static, const unsigned int *power_opts);24342435bool dc_link_get_psr_state(const struct dc_link *dc_link, enum dc_psr_state *state);24362437bool dc_link_setup_psr(struct dc_link *dc_link,2438const struct dc_stream_state *stream, struct psr_config *psr_config,2439struct psr_context *psr_context);24402441/*2442* Communicate with DMUB to allow or disallow Panel Replay on the specified link:2443*2444* @link: pointer to the dc_link struct instance2445* @enable: enable(active) or disable(inactive) replay2446* @wait: state transition need to wait the active set completed.2447* @force_static: force disable(inactive) the replay2448* @power_opts: set power optimazation parameters to DMUB.2449*2450* return: allow Replay active will return true, else will return false.2451*/2452bool dc_link_set_replay_allow_active(struct dc_link *dc_link, const bool *enable,2453bool wait, bool force_static, const unsigned int *power_opts);24542455bool dc_link_get_replay_state(const struct dc_link *dc_link, uint64_t *state);24562457/* On eDP links this function call will stall until T12 has elapsed.2458* If the panel is not in power off state, this function will return2459* immediately.2460*/2461bool dc_link_wait_for_t12(struct dc_link *link);24622463/* Determine if dp trace has been initialized to reflect upto date result *2464* return - true if trace is initialized and has valid data. False dp trace2465* doesn't have valid result.2466*/2467bool dc_dp_trace_is_initialized(struct dc_link *link);24682469/* Query a dp trace flag to indicate if the current dp trace data has been2470* logged before2471*/2472bool dc_dp_trace_is_logged(struct dc_link *link,2473bool in_detection);24742475/* Set dp trace flag to indicate whether DM has already logged the current dp2476* trace data. DM can set is_logged to true upon logging and check2477* dc_dp_trace_is_logged before logging to avoid logging the same result twice.2478*/2479void dc_dp_trace_set_is_logged_flag(struct dc_link *link,2480bool in_detection,2481bool is_logged);24822483/* Obtain driver time stamp for last dp link training end. The time stamp is2484* formatted based on dm_get_timestamp DM function.2485* @in_detection - true to get link training end time stamp of last link2486* training in detection sequence. false to get link training end time stamp2487* of last link training in commit (dpms) sequence2488*/2489unsigned long long dc_dp_trace_get_lt_end_timestamp(struct dc_link *link,2490bool in_detection);24912492/* Get how many link training attempts dc has done with latest sequence.2493* @in_detection - true to get link training count of last link2494* training in detection sequence. false to get link training count of last link2495* training in commit (dpms) sequence2496*/2497const struct dp_trace_lt_counts *dc_dp_trace_get_lt_counts(struct dc_link *link,2498bool in_detection);24992500/* Get how many link loss has happened since last link training attempts */2501unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link);25022503/*2504* USB4 DPIA BW ALLOCATION PUBLIC FUNCTIONS2505*/2506/*2507* Send a request from DP-Tx requesting to allocate BW remotely after2508* allocating it locally. This will get processed by CM and a CB function2509* will be called.2510*2511* @link: pointer to the dc_link struct instance2512* @req_bw: The requested bw in Kbyte to allocated2513*2514* return: none2515*/2516void dc_link_set_usb4_req_bw_req(struct dc_link *link, int req_bw);25172518/*2519* Handle the USB4 BW Allocation related functionality here:2520* Plug => Try to allocate max bw from timing parameters supported by the sink2521* Unplug => de-allocate bw2522*2523* @link: pointer to the dc_link struct instance2524* @peak_bw: Peak bw used by the link/sink2525*2526*/2527void dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(2528struct dc_link *link, int peak_bw);25292530/*2531* Calculates the DP tunneling bandwidth required for the stream timing2532* and aggregates the stream bandwidth for the respective DP tunneling link2533*2534* return: dc_status2535*/2536enum dc_status dc_link_validate_dp_tunneling_bandwidth(const struct dc *dc, const struct dc_state *new_ctx);25372538/*2539* Get if ALPM is supported by the link2540*/2541void dc_link_get_alpm_support(struct dc_link *link, bool *auxless_support,2542bool *auxwake_support);25432544/* Sink Interfaces - A sink corresponds to a display output device */25452546struct dc_container_id {2547// 128bit GUID in binary form2548unsigned char guid[16];2549// 8 byte port ID -> ELD.PortID2550unsigned int portId[2];2551// 128bit GUID in binary formufacturer name -> ELD.ManufacturerName2552unsigned short manufacturerName;2553// 2 byte product code -> ELD.ProductCode2554unsigned short productCode;2555};255625572558struct dc_sink_dsc_caps {2559// 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology),2560// 'false' if they are sink's DSC caps2561bool is_virtual_dpcd_dsc;2562// 'true' if MST topology supports DSC passthrough for sink2563// 'false' if MST topology does not support DSC passthrough2564bool is_dsc_passthrough_supported;2565struct dsc_dec_dpcd_caps dsc_dec_caps;2566};25672568struct dc_sink_hblank_expansion_caps {2569// 'true' if these are virtual DPCD's HBlank expansion caps (immediately upstream of sink in MST topology),2570// 'false' if they are sink's HBlank expansion caps2571bool is_virtual_dpcd_hblank_expansion;2572struct hblank_expansion_dpcd_caps dpcd_caps;2573};25742575struct dc_sink_fec_caps {2576bool is_rx_fec_supported;2577bool is_topology_fec_supported;2578};25792580struct scdc_caps {2581union hdmi_scdc_manufacturer_OUI_data manufacturer_OUI;2582union hdmi_scdc_device_id_data device_id;2583};25842585/*2586* The sink structure contains EDID and other display device properties2587*/2588struct dc_sink {2589enum signal_type sink_signal;2590struct dc_edid dc_edid; /* raw edid */2591struct dc_edid_caps edid_caps; /* parse display caps */2592struct dc_container_id *dc_container_id;2593uint32_t dongle_max_pix_clk;2594void *priv;2595struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];2596bool converter_disable_audio;25972598struct scdc_caps scdc_caps;2599struct dc_sink_dsc_caps dsc_caps;2600struct dc_sink_fec_caps fec_caps;2601struct dc_sink_hblank_expansion_caps hblank_expansion_caps;26022603bool is_vsc_sdp_colorimetry_supported;26042605/* private to DC core */2606struct dc_link *link;2607struct dc_context *ctx;26082609uint32_t sink_id;26102611/* private to dc_sink.c */2612// refcount must be the last member in dc_sink, since we want the2613// sink structure to be logically cloneable up to (but not including)2614// refcount2615struct kref refcount;2616};26172618void dc_sink_retain(struct dc_sink *sink);2619void dc_sink_release(struct dc_sink *sink);26202621struct dc_sink_init_data {2622enum signal_type sink_signal;2623struct dc_link *link;2624uint32_t dongle_max_pix_clk;2625bool converter_disable_audio;2626};26272628struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);26292630/* Newer interfaces */2631struct dc_cursor {2632struct dc_plane_address address;2633struct dc_cursor_attributes attributes;2634};263526362637/* Interrupt interfaces */2638enum dc_irq_source dc_interrupt_to_irq_source(2639struct dc *dc,2640uint32_t src_id,2641uint32_t ext_id);2642bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable);2643void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);2644enum dc_irq_source dc_get_hpd_irq_source_at_index(2645struct dc *dc, uint32_t link_index);26462647void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable);26482649/* Power Interfaces */26502651void dc_set_power_state(2652struct dc *dc,2653enum dc_acpi_cm_power_state power_state);2654void dc_resume(struct dc *dc);26552656void dc_power_down_on_boot(struct dc *dc);26572658/*2659* HDCP Interfaces2660*/2661enum hdcp_message_status dc_process_hdcp_msg(2662enum signal_type signal,2663struct dc_link *link,2664struct hdcp_protection_message *message_info);2665bool dc_is_dmcu_initialized(struct dc *dc);26662667enum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping);2668void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg);26692670bool dc_is_plane_eligible_for_idle_optimizations(struct dc *dc,2671unsigned int pitch,2672unsigned int height,2673enum surface_pixel_format format,2674struct dc_cursor_attributes *cursor_attr);26752676#define dc_allow_idle_optimizations(dc, allow) dc_allow_idle_optimizations_internal(dc, allow, __func__)2677#define dc_exit_ips_for_hw_access(dc) dc_exit_ips_for_hw_access_internal(dc, __func__)26782679void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, const char *caller_name);2680void dc_exit_ips_for_hw_access_internal(struct dc *dc, const char *caller_name);2681bool dc_dmub_is_ips_idle_state(struct dc *dc);26822683/* set min and max memory clock to lowest and highest DPM level, respectively */2684void dc_unlock_memory_clock_frequency(struct dc *dc);26852686/* set min memory clock to the min required for current mode, max to maxDPM */2687void dc_lock_memory_clock_frequency(struct dc *dc);26882689/* set soft max for memclk, to be used for AC/DC switching clock limitations */2690void dc_enable_dcmode_clk_limit(struct dc *dc, bool enable);26912692/* cleanup on driver unload */2693void dc_hardware_release(struct dc *dc);26942695/* disables fw based mclk switch */2696void dc_mclk_switch_using_fw_based_vblank_stretch_shut_down(struct dc *dc);26972698bool dc_set_psr_allow_active(struct dc *dc, bool enable);26992700bool dc_set_replay_allow_active(struct dc *dc, bool active);27012702bool dc_set_ips_disable(struct dc *dc, unsigned int disable_ips);27032704void dc_z10_restore(const struct dc *dc);2705void dc_z10_save_init(struct dc *dc);27062707bool dc_is_dmub_outbox_supported(struct dc *dc);2708bool dc_enable_dmub_notifications(struct dc *dc);27092710bool dc_abm_save_restore(2711struct dc *dc,2712struct dc_stream_state *stream,2713struct abm_save_restore *pData);27142715void dc_enable_dmub_outbox(struct dc *dc);27162717bool dc_process_dmub_aux_transfer_async(struct dc *dc,2718uint32_t link_index,2719struct aux_payload *payload);27202721/*2722* smart power OLED Interfaces2723*/2724bool dc_smart_power_oled_enable(const struct dc_link *link, bool enable, uint16_t peak_nits,2725uint8_t debug_control, uint16_t fixed_CLL, uint32_t triggerline);2726bool dc_smart_power_oled_get_max_cll(const struct dc_link *link, unsigned int *pCurrent_MaxCLL);27272728/* Get dc link index from dpia port index */2729uint8_t get_link_index_from_dpia_port_index(const struct dc *dc,2730uint8_t dpia_port_index);27312732bool dc_process_dmub_set_config_async(struct dc *dc,2733uint32_t link_index,2734struct set_config_cmd_payload *payload,2735struct dmub_notification *notify);27362737enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc,2738uint32_t link_index,2739uint8_t mst_alloc_slots,2740uint8_t *mst_slots_in_use);27412742void dc_process_dmub_dpia_set_tps_notification(const struct dc *dc, uint32_t link_index, uint8_t tps);27432744void dc_process_dmub_dpia_hpd_int_enable(const struct dc *dc,2745uint32_t hpd_int_enable);27462747void dc_print_dmub_diagnostic_data(const struct dc *dc);27482749void dc_query_current_properties(struct dc *dc, struct dc_current_properties *properties);27502751struct dc_power_profile {2752int power_level; /* Lower is better */2753};27542755struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state *context);27562757unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context);27582759bool dc_get_host_router_index(const struct dc_link *link, unsigned int *host_router_index);27602761void dc_log_preos_dmcub_info(const struct dc *dc);27622763/* DSC Interfaces */2764#include "dc_dsc.h"27652766void dc_get_visual_confirm_for_stream(2767struct dc *dc,2768struct dc_stream_state *stream_state,2769struct tg_color *color);27702771/* Disable acc mode Interfaces */2772void dc_disable_accelerated_mode(struct dc *dc);27732774bool dc_is_timing_changed(struct dc_stream_state *cur_stream,2775struct dc_stream_state *new_stream);27762777bool dc_is_cursor_limit_pending(struct dc *dc);2778bool dc_can_clear_cursor_limit(const struct dc *dc);27792780/**2781* dc_get_underflow_debug_data_for_otg() - Retrieve underflow debug data.2782*2783* @dc: Pointer to the display core context.2784* @primary_otg_inst: Instance index of the primary OTG that underflowed.2785* @out_data: Pointer to a dc_underflow_debug_data struct to be filled with debug information.2786*2787* This function collects and logs underflow-related HW states when underflow happens,2788* including OTG underflow status, current read positions, frame count, and per-HUBP debug data.2789* The results are stored in the provided out_data structure for further analysis or logging.2790*/2791void dc_get_underflow_debug_data_for_otg(struct dc *dc, int primary_otg_inst, struct dc_underflow_debug_data *out_data);27922793void dc_get_power_feature_status(struct dc *dc, int primary_otg_inst, struct power_features *out_data);27942795/**2796* Software state variables used to program register fields across the display pipeline2797*/2798struct dc_register_software_state {2799/* HUBP register programming variables for each pipe */2800struct {2801bool valid_plane_state;2802bool valid_stream;2803bool min_dc_gfx_version9;2804uint32_t vtg_sel; /* DCHUBP_CNTL->HUBP_VTG_SEL from pipe_ctx->stream_res.tg->inst */2805uint32_t hubp_clock_enable; /* HUBP_CLK_CNTL->HUBP_CLOCK_ENABLE from power management */2806uint32_t surface_pixel_format; /* DCSURF_SURFACE_CONFIG->SURFACE_PIXEL_FORMAT from plane_state->format */2807uint32_t rotation_angle; /* DCSURF_SURFACE_CONFIG->ROTATION_ANGLE from plane_state->rotation */2808uint32_t h_mirror_en; /* DCSURF_SURFACE_CONFIG->H_MIRROR_EN from plane_state->horizontal_mirror */2809uint32_t surface_dcc_en; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_DCC_EN from dcc->enable */2810uint32_t surface_size_width; /* HUBP_SIZE->SURFACE_SIZE_WIDTH from plane_size.surface_size.width */2811uint32_t surface_size_height; /* HUBP_SIZE->SURFACE_SIZE_HEIGHT from plane_size.surface_size.height */2812uint32_t pri_viewport_width; /* DCSURF_PRI_VIEWPORT_DIMENSION->PRI_VIEWPORT_WIDTH from scaler_data.viewport.width */2813uint32_t pri_viewport_height; /* DCSURF_PRI_VIEWPORT_DIMENSION->PRI_VIEWPORT_HEIGHT from scaler_data.viewport.height */2814uint32_t pri_viewport_x_start; /* DCSURF_PRI_VIEWPORT_START->PRI_VIEWPORT_X_START from scaler_data.viewport.x */2815uint32_t pri_viewport_y_start; /* DCSURF_PRI_VIEWPORT_START->PRI_VIEWPORT_Y_START from scaler_data.viewport.y */2816uint32_t cursor_enable; /* CURSOR_CONTROL->CURSOR_ENABLE from cursor_attributes.enable */2817uint32_t cursor_width; /* CURSOR_SETTINGS->CURSOR_WIDTH from cursor_position.width */2818uint32_t cursor_height; /* CURSOR_SETTINGS->CURSOR_HEIGHT from cursor_position.height */28192820/* Additional DCC configuration */2821uint32_t surface_dcc_ind_64b_blk; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_DCC_IND_64B_BLK from dcc.independent_64b_blks */2822uint32_t surface_dcc_ind_128b_blk; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_DCC_IND_128B_BLK from dcc.independent_128b_blks */28232824/* Surface pitch configuration */2825uint32_t surface_pitch; /* DCSURF_SURFACE_PITCH->PITCH from plane_size.surface_pitch */2826uint32_t meta_pitch; /* DCSURF_SURFACE_PITCH->META_PITCH from dcc.meta_pitch */2827uint32_t chroma_pitch; /* DCSURF_SURFACE_PITCH_C->PITCH_C from plane_size.chroma_pitch */2828uint32_t meta_pitch_c; /* DCSURF_SURFACE_PITCH_C->META_PITCH_C from dcc.meta_pitch_c */28292830/* Surface addresses */2831uint32_t primary_surface_address_low; /* DCSURF_PRIMARY_SURFACE_ADDRESS->PRIMARY_SURFACE_ADDRESS from address.grph.addr.low_part */2832uint32_t primary_surface_address_high; /* DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH->PRIMARY_SURFACE_ADDRESS_HIGH from address.grph.addr.high_part */2833uint32_t primary_meta_surface_address_low; /* DCSURF_PRIMARY_META_SURFACE_ADDRESS->PRIMARY_META_SURFACE_ADDRESS from address.grph.meta_addr.low_part */2834uint32_t primary_meta_surface_address_high; /* DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH->PRIMARY_META_SURFACE_ADDRESS_HIGH from address.grph.meta_addr.high_part */28352836/* TMZ configuration */2837uint32_t primary_surface_tmz; /* DCSURF_SURFACE_CONTROL->PRIMARY_SURFACE_TMZ from address.tmz_surface */2838uint32_t primary_meta_surface_tmz; /* DCSURF_SURFACE_CONTROL->PRIMARY_META_SURFACE_TMZ from address.tmz_surface */28392840/* Tiling configuration */2841uint32_t sw_mode; /* DCSURF_TILING_CONFIG->SW_MODE from tiling_info.gfx9.swizzle */2842uint32_t num_pipes; /* DCSURF_ADDR_CONFIG->NUM_PIPES from tiling_info.gfx9.num_pipes */2843uint32_t num_banks; /* DCSURF_ADDR_CONFIG->NUM_BANKS from tiling_info.gfx9.num_banks */2844uint32_t pipe_interleave; /* DCSURF_ADDR_CONFIG->PIPE_INTERLEAVE from tiling_info.gfx9.pipe_interleave */2845uint32_t num_shader_engines; /* DCSURF_ADDR_CONFIG->NUM_SE from tiling_info.gfx9.num_shader_engines */2846uint32_t num_rb_per_se; /* DCSURF_ADDR_CONFIG->NUM_RB_PER_SE from tiling_info.gfx9.num_rb_per_se */2847uint32_t num_pkrs; /* DCSURF_ADDR_CONFIG->NUM_PKRS from tiling_info.gfx9.num_pkrs */28482849/* DML Request Size Configuration - Luma */2850uint32_t rq_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->CHUNK_SIZE from rq_regs.rq_regs_l.chunk_size */2851uint32_t rq_min_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->MIN_CHUNK_SIZE from rq_regs.rq_regs_l.min_chunk_size */2852uint32_t rq_meta_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->META_CHUNK_SIZE from rq_regs.rq_regs_l.meta_chunk_size */2853uint32_t rq_min_meta_chunk_size; /* DCHUBP_REQ_SIZE_CONFIG->MIN_META_CHUNK_SIZE from rq_regs.rq_regs_l.min_meta_chunk_size */2854uint32_t rq_dpte_group_size; /* DCHUBP_REQ_SIZE_CONFIG->DPTE_GROUP_SIZE from rq_regs.rq_regs_l.dpte_group_size */2855uint32_t rq_mpte_group_size; /* DCHUBP_REQ_SIZE_CONFIG->MPTE_GROUP_SIZE from rq_regs.rq_regs_l.mpte_group_size */2856uint32_t rq_swath_height_l; /* DCHUBP_REQ_SIZE_CONFIG->SWATH_HEIGHT_L from rq_regs.rq_regs_l.swath_height */2857uint32_t rq_pte_row_height_l; /* DCHUBP_REQ_SIZE_CONFIG->PTE_ROW_HEIGHT_L from rq_regs.rq_regs_l.pte_row_height */28582859/* DML Request Size Configuration - Chroma */2860uint32_t rq_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->CHUNK_SIZE_C from rq_regs.rq_regs_c.chunk_size */2861uint32_t rq_min_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->MIN_CHUNK_SIZE_C from rq_regs.rq_regs_c.min_chunk_size */2862uint32_t rq_meta_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->META_CHUNK_SIZE_C from rq_regs.rq_regs_c.meta_chunk_size */2863uint32_t rq_min_meta_chunk_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->MIN_META_CHUNK_SIZE_C from rq_regs.rq_regs_c.min_meta_chunk_size */2864uint32_t rq_dpte_group_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->DPTE_GROUP_SIZE_C from rq_regs.rq_regs_c.dpte_group_size */2865uint32_t rq_mpte_group_size_c; /* DCHUBP_REQ_SIZE_CONFIG_C->MPTE_GROUP_SIZE_C from rq_regs.rq_regs_c.mpte_group_size */2866uint32_t rq_swath_height_c; /* DCHUBP_REQ_SIZE_CONFIG_C->SWATH_HEIGHT_C from rq_regs.rq_regs_c.swath_height */2867uint32_t rq_pte_row_height_c; /* DCHUBP_REQ_SIZE_CONFIG_C->PTE_ROW_HEIGHT_C from rq_regs.rq_regs_c.pte_row_height */28682869/* DML Expansion Modes */2870uint32_t drq_expansion_mode; /* DCN_EXPANSION_MODE->DRQ_EXPANSION_MODE from rq_regs.drq_expansion_mode */2871uint32_t prq_expansion_mode; /* DCN_EXPANSION_MODE->PRQ_EXPANSION_MODE from rq_regs.prq_expansion_mode */2872uint32_t mrq_expansion_mode; /* DCN_EXPANSION_MODE->MRQ_EXPANSION_MODE from rq_regs.mrq_expansion_mode */2873uint32_t crq_expansion_mode; /* DCN_EXPANSION_MODE->CRQ_EXPANSION_MODE from rq_regs.crq_expansion_mode */28742875/* DML DLG parameters - nominal */2876uint32_t dst_y_per_vm_vblank; /* NOM_PARAMETERS_0->DST_Y_PER_VM_VBLANK from dlg_regs.dst_y_per_vm_vblank */2877uint32_t dst_y_per_row_vblank; /* NOM_PARAMETERS_0->DST_Y_PER_ROW_VBLANK from dlg_regs.dst_y_per_row_vblank */2878uint32_t dst_y_per_vm_flip; /* NOM_PARAMETERS_1->DST_Y_PER_VM_FLIP from dlg_regs.dst_y_per_vm_flip */2879uint32_t dst_y_per_row_flip; /* NOM_PARAMETERS_1->DST_Y_PER_ROW_FLIP from dlg_regs.dst_y_per_row_flip */28802881/* DML prefetch settings */2882uint32_t dst_y_prefetch; /* PREFETCH_SETTINS->DST_Y_PREFETCH from dlg_regs.dst_y_prefetch */2883uint32_t vratio_prefetch; /* PREFETCH_SETTINS->VRATIO_PREFETCH from dlg_regs.vratio_prefetch */2884uint32_t vratio_prefetch_c; /* PREFETCH_SETTINS_C->VRATIO_PREFETCH_C from dlg_regs.vratio_prefetch_c */28852886/* TTU parameters */2887uint32_t qos_level_low_wm; /* TTU_CNTL1->QoSLevelLowWaterMark from ttu_regs.qos_level_low_wm */2888uint32_t qos_level_high_wm; /* TTU_CNTL1->QoSLevelHighWaterMark from ttu_regs.qos_level_high_wm */2889uint32_t qos_level_flip; /* TTU_CNTL2->QoS_LEVEL_FLIP_L from ttu_regs.qos_level_flip */2890uint32_t min_ttu_vblank; /* DCN_GLOBAL_TTU_CNTL->MIN_TTU_VBLANK from ttu_regs.min_ttu_vblank */2891} hubp[MAX_PIPES];28922893/* HUBBUB register programming variables */2894struct {2895/* Individual DET buffer control per pipe - software state that programs DET registers */2896uint32_t det0_size; /* DCHUBBUB_DET0_CTRL->DET0_SIZE from hubbub->funcs->program_det_size(hubbub, 0, det_buffer_size_kb) */2897uint32_t det1_size; /* DCHUBBUB_DET1_CTRL->DET1_SIZE from hubbub->funcs->program_det_size(hubbub, 1, det_buffer_size_kb) */2898uint32_t det2_size; /* DCHUBBUB_DET2_CTRL->DET2_SIZE from hubbub->funcs->program_det_size(hubbub, 2, det_buffer_size_kb) */2899uint32_t det3_size; /* DCHUBBUB_DET3_CTRL->DET3_SIZE from hubbub->funcs->program_det_size(hubbub, 3, det_buffer_size_kb) */29002901/* Compression buffer control - software state that programs COMPBUF registers */2902uint32_t compbuf_size; /* DCHUBBUB_COMPBUF_CTRL->COMPBUF_SIZE from hubbub->funcs->program_compbuf_size(hubbub, compbuf_size_kb, safe_to_increase) */2903uint32_t compbuf_reserved_space_64b; /* COMPBUF_RESERVED_SPACE->COMPBUF_RESERVED_SPACE_64B from hubbub2->pixel_chunk_size / 32 */2904uint32_t compbuf_reserved_space_zs; /* COMPBUF_RESERVED_SPACE->COMPBUF_RESERVED_SPACE_ZS from hubbub2->pixel_chunk_size / 128 */2905} hubbub;29062907/* DPP register programming variables for each pipe (simplified for available fields) */2908struct {2909uint32_t dpp_clock_enable; /* DPP_CONTROL->DPP_CLOCK_ENABLE from dppclk_enable */29102911/* Recout (Rectangle of Interest) configuration */2912uint32_t recout_start_x; /* RECOUT_START->RECOUT_START_X from pipe_ctx->plane_res.scl_data.recout.x */2913uint32_t recout_start_y; /* RECOUT_START->RECOUT_START_Y from pipe_ctx->plane_res.scl_data.recout.y */2914uint32_t recout_width; /* RECOUT_SIZE->RECOUT_WIDTH from pipe_ctx->plane_res.scl_data.recout.width */2915uint32_t recout_height; /* RECOUT_SIZE->RECOUT_HEIGHT from pipe_ctx->plane_res.scl_data.recout.height */29162917/* MPC (Multiple Pipe/Plane Combiner) size configuration */2918uint32_t mpc_width; /* MPC_SIZE->MPC_WIDTH from pipe_ctx->plane_res.scl_data.h_active */2919uint32_t mpc_height; /* MPC_SIZE->MPC_HEIGHT from pipe_ctx->plane_res.scl_data.v_active */29202921/* DSCL mode configuration */2922uint32_t dscl_mode; /* SCL_MODE->DSCL_MODE from pipe_ctx->plane_res.scl_data.dscl_prog_data.dscl_mode */29232924/* Scaler ratios (simplified to integer parts) */2925uint32_t horz_ratio_int; /* SCL_HORZ_FILTER_SCALE_RATIO->SCL_H_SCALE_RATIO integer part from ratios.horz */2926uint32_t vert_ratio_int; /* SCL_VERT_FILTER_SCALE_RATIO->SCL_V_SCALE_RATIO integer part from ratios.vert */29272928/* Basic scaler taps */2929uint32_t h_taps; /* SCL_TAP_CONTROL->SCL_H_NUM_TAPS from taps.h_taps */2930uint32_t v_taps; /* SCL_TAP_CONTROL->SCL_V_NUM_TAPS from taps.v_taps */2931} dpp[MAX_PIPES];29322933/* DCCG register programming variables */2934struct {2935/* Core Display Clock Control */2936uint32_t dispclk_khz; /* DENTIST_DISPCLK_CNTL->DENTIST_DISPCLK_WDIVIDER from clk_mgr.dispclk_khz */2937uint32_t dc_mem_global_pwr_req_dis; /* DC_MEM_GLOBAL_PWR_REQ_CNTL->DC_MEM_GLOBAL_PWR_REQ_DIS from memory power management settings */29382939/* DPP Clock Control - 4 fields per pipe */2940uint32_t dppclk_khz[MAX_PIPES]; /* DPPCLK_CTRL->DPPCLK_R_GATE_DISABLE from dpp_clocks[pipe] */2941uint32_t dppclk_enable[MAX_PIPES]; /* DPPCLK_CTRL->DPPCLK0_EN,DPPCLK1_EN,DPPCLK2_EN,DPPCLK3_EN from dccg31_update_dpp_dto() */2942uint32_t dppclk_dto_enable[MAX_PIPES]; /* DPPCLK_DTO_CTRL->DPPCLK_DTO_ENABLE from dccg->dpp_clock_gated[dpp_inst] state */2943uint32_t dppclk_dto_phase[MAX_PIPES]; /* DPPCLK0_DTO_PARAM->DPPCLK0_DTO_PHASE from phase calculation req_dppclk/ref_dppclk */2944uint32_t dppclk_dto_modulo[MAX_PIPES]; /* DPPCLK0_DTO_PARAM->DPPCLK0_DTO_MODULO from modulo = 0xff */29452946/* DSC Clock Control - 4 fields per DSC resource */2947uint32_t dscclk_khz[MAX_PIPES]; /* DSCCLK_DTO_CTRL->DSCCLK_DTO_ENABLE from dsc_clocks */2948uint32_t dscclk_dto_enable[MAX_PIPES]; /* DSCCLK_DTO_CTRL->DSCCLK0_DTO_ENABLE,DSCCLK1_DTO_ENABLE,DSCCLK2_DTO_ENABLE,DSCCLK3_DTO_ENABLE */2949uint32_t dscclk_dto_phase[MAX_PIPES]; /* DSCCLK0_DTO_PARAM->DSCCLK0_DTO_PHASE from dccg31_enable_dscclk() */2950uint32_t dscclk_dto_modulo[MAX_PIPES]; /* DSCCLK0_DTO_PARAM->DSCCLK0_DTO_MODULO from dccg31_enable_dscclk() */29512952/* Pixel Clock Control - per pipe */2953uint32_t pixclk_khz[MAX_PIPES]; /* PIXCLK_RESYNC_CNTL->PIXCLK_RESYNC_ENABLE from stream.timing.pix_clk_100hz */2954uint32_t otg_pixel_rate_div[MAX_PIPES]; /* OTG_PIXEL_RATE_DIV->OTG_PIXEL_RATE_DIV from OTG pixel rate divider control */2955uint32_t dtbclk_dto_enable[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->DTBCLK_DTO_ENABLE from dccg31_set_dtbclk_dto() */2956uint32_t pipe_dto_src_sel[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->PIPE_DTO_SRC_SEL from dccg31_set_dtbclk_dto() source selection */2957uint32_t dtbclk_dto_div[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->DTBCLK_DTO_DIV from dtbdto_div calculation */2958uint32_t otg_add_pixel[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->OTG_ADD_PIXEL from dccg31_otg_add_pixel() */2959uint32_t otg_drop_pixel[MAX_PIPES]; /* OTG0_PIXEL_RATE_CNTL->OTG_DROP_PIXEL from dccg31_otg_drop_pixel() */29602961/* DTBCLK DTO Control - 4 DTOs */2962uint32_t dtbclk_dto_modulo[4]; /* DTBCLK_DTO0_MODULO->DTBCLK_DTO0_MODULO from dccg31_set_dtbclk_dto() modulo calculation */2963uint32_t dtbclk_dto_phase[4]; /* DTBCLK_DTO0_PHASE->DTBCLK_DTO0_PHASE from phase calculation pixclk_khz/ref_dtbclk_khz */2964uint32_t dtbclk_dto_dbuf_en; /* DTBCLK_DTO_DBUF_EN->DTBCLK DTO data buffer enable */29652966/* DP Stream Clock Control - 4 pipes */2967uint32_t dpstreamclk_enable[MAX_PIPES]; /* DPSTREAMCLK_CNTL->DPSTREAMCLK_PIPE0_EN,DPSTREAMCLK_PIPE1_EN,DPSTREAMCLK_PIPE2_EN,DPSTREAMCLK_PIPE3_EN */2968uint32_t dp_dto_modulo[4]; /* DP_DTO0_MODULO->DP_DTO0_MODULO from DP stream DTO programming */2969uint32_t dp_dto_phase[4]; /* DP_DTO0_PHASE->DP_DTO0_PHASE from DP stream DTO programming */2970uint32_t dp_dto_dbuf_en; /* DP_DTO_DBUF_EN->DP DTO data buffer enable */29712972/* PHY Symbol Clock Control - 5 PHYs (A,B,C,D,E) */2973uint32_t phy_symclk_force_en[5]; /* PHYASYMCLK_CLOCK_CNTL->PHYASYMCLK_FORCE_EN from dccg31_set_physymclk() force_enable */2974uint32_t phy_symclk_force_src_sel[5]; /* PHYASYMCLK_CLOCK_CNTL->PHYASYMCLK_FORCE_SRC_SEL from dccg31_set_physymclk() clk_src */2975uint32_t phy_symclk_gate_disable[5]; /* DCCG_GATE_DISABLE_CNTL2->PHYASYMCLK_GATE_DISABLE from debug.root_clock_optimization.bits.physymclk */29762977/* SYMCLK32 SE Control - 4 instances */2978uint32_t symclk32_se_src_sel[4]; /* SYMCLK32_SE_CNTL->SYMCLK32_SE0_SRC_SEL from dccg31_enable_symclk32_se() with get_phy_mux_symclk() mapping */2979uint32_t symclk32_se_enable[4]; /* SYMCLK32_SE_CNTL->SYMCLK32_SE0_EN from dccg31_enable_symclk32_se() enable */2980uint32_t symclk32_se_gate_disable[4]; /* DCCG_GATE_DISABLE_CNTL3->SYMCLK32_SE0_GATE_DISABLE from debug.root_clock_optimization.bits.symclk32_se */29812982/* SYMCLK32 LE Control - 2 instances */2983uint32_t symclk32_le_src_sel[2]; /* SYMCLK32_LE_CNTL->SYMCLK32_LE0_SRC_SEL from dccg31_enable_symclk32_le() phyd32clk source */2984uint32_t symclk32_le_enable[2]; /* SYMCLK32_LE_CNTL->SYMCLK32_LE0_EN from dccg31_enable_symclk32_le() enable */2985uint32_t symclk32_le_gate_disable[2]; /* DCCG_GATE_DISABLE_CNTL3->SYMCLK32_LE0_GATE_DISABLE from debug.root_clock_optimization.bits.symclk32_le */29862987/* DPIA Clock Control */2988uint32_t dpiaclk_540m_dto_modulo; /* DPIACLK_540M_DTO_MODULO->DPIA 540MHz DTO modulo */2989uint32_t dpiaclk_540m_dto_phase; /* DPIACLK_540M_DTO_PHASE->DPIA 540MHz DTO phase */2990uint32_t dpiaclk_810m_dto_modulo; /* DPIACLK_810M_DTO_MODULO->DPIA 810MHz DTO modulo */2991uint32_t dpiaclk_810m_dto_phase; /* DPIACLK_810M_DTO_PHASE->DPIA 810MHz DTO phase */2992uint32_t dpiaclk_dto_cntl; /* DPIACLK_DTO_CNTL->DPIA clock DTO control */2993uint32_t dpiasymclk_cntl; /* DPIASYMCLK_CNTL->DPIA symbol clock control */29942995/* Clock Gating Control */2996uint32_t dccg_gate_disable_cntl; /* DCCG_GATE_DISABLE_CNTL->Clock gate disable control from dccg31_init() */2997uint32_t dpstreamclk_gate_disable; /* DCCG_GATE_DISABLE_CNTL3->DPSTREAMCLK_GATE_DISABLE from debug.root_clock_optimization.bits.dpstream */2998uint32_t dpstreamclk_root_gate_disable; /* DCCG_GATE_DISABLE_CNTL3->DPSTREAMCLK_ROOT_GATE_DISABLE from debug.root_clock_optimization.bits.dpstream */29993000/* VSync Control */3001uint32_t vsync_cnt_ctrl; /* DCCG_VSYNC_CNT_CTRL->VSync counter control */3002uint32_t vsync_cnt_int_ctrl; /* DCCG_VSYNC_CNT_INT_CTRL->VSync counter interrupt control */3003uint32_t vsync_otg_latch_value[6]; /* DCCG_VSYNC_OTG0_LATCH_VALUE->OTG0 VSync latch value (for OTG0-5) */30043005/* Time Base Control */3006uint32_t microsecond_time_base_div; /* MICROSECOND_TIME_BASE_DIV->Microsecond time base divider */3007uint32_t millisecond_time_base_div; /* MILLISECOND_TIME_BASE_DIV->Millisecond time base divider */3008} dccg;30093010/* DSC essential configuration for underflow analysis */3011struct {3012/* DSC active state - critical for bandwidth analysis */3013uint32_t dsc_clock_enable; /* DSC enabled - affects bandwidth requirements */30143015/* DSC configuration affecting bandwidth and timing */3016uint32_t dsc_num_slices_h; /* Horizontal slice count - affects throughput */3017uint32_t dsc_num_slices_v; /* Vertical slice count - affects throughput */3018uint32_t dsc_bits_per_pixel; /* Compression ratio - affects bandwidth */30193020/* OPP integration - affects pipeline flow */3021uint32_t dscrm_dsc_forward_enable; /* DSC forwarding to OPP enabled */3022uint32_t dscrm_dsc_opp_pipe_source; /* Which OPP receives DSC output */3023} dsc[MAX_PIPES];30243025/* MPC register programming variables */3026struct {3027/* MPCC blending tree and mode control */3028uint32_t mpcc_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_MODE from blend_cfg.blend_mode */3029uint32_t mpcc_alpha_blend_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_ALPHA_BLND_MODE from blend_cfg.alpha_mode */3030uint32_t mpcc_alpha_multiplied_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_ALPHA_MULTIPLIED_MODE from blend_cfg.pre_multiplied_alpha */3031uint32_t mpcc_blnd_active_overlap_only[MAX_PIPES]; /* MPCC_CONTROL->MPCC_BLND_ACTIVE_OVERLAP_ONLY from blend_cfg.overlap_only */3032uint32_t mpcc_global_alpha[MAX_PIPES]; /* MPCC_CONTROL->MPCC_GLOBAL_ALPHA from blend_cfg.global_alpha */3033uint32_t mpcc_global_gain[MAX_PIPES]; /* MPCC_CONTROL->MPCC_GLOBAL_GAIN from blend_cfg.global_gain */3034uint32_t mpcc_bg_bpc[MAX_PIPES]; /* MPCC_CONTROL->MPCC_BG_BPC from background color depth */3035uint32_t mpcc_bot_gain_mode[MAX_PIPES]; /* MPCC_CONTROL->MPCC_BOT_GAIN_MODE from bottom layer gain control */30363037/* MPCC blending tree connections */3038uint32_t mpcc_bot_sel[MAX_PIPES]; /* MPCC_BOT_SEL->MPCC_BOT_SEL from mpcc_state->bot_sel */3039uint32_t mpcc_top_sel[MAX_PIPES]; /* MPCC_TOP_SEL->MPCC_TOP_SEL from mpcc_state->dpp_id */30403041/* MPCC output gamma control */3042uint32_t mpcc_ogam_mode[MAX_PIPES]; /* MPCC_OGAM_CONTROL->MPCC_OGAM_MODE from output gamma mode */3043uint32_t mpcc_ogam_select[MAX_PIPES]; /* MPCC_OGAM_CONTROL->MPCC_OGAM_SELECT from gamma LUT bank selection */3044uint32_t mpcc_ogam_pwl_disable[MAX_PIPES]; /* MPCC_OGAM_CONTROL->MPCC_OGAM_PWL_DISABLE from PWL control */30453046/* MPCC pipe assignment and status */3047uint32_t mpcc_opp_id[MAX_PIPES]; /* MPCC_OPP_ID->MPCC_OPP_ID from mpcc_state->opp_id */3048uint32_t mpcc_idle[MAX_PIPES]; /* MPCC_STATUS->MPCC_IDLE from mpcc idle status */3049uint32_t mpcc_busy[MAX_PIPES]; /* MPCC_STATUS->MPCC_BUSY from mpcc busy status */30503051/* MPC output processing */3052uint32_t mpc_out_csc_mode; /* MPC_OUT_CSC_COEF->MPC_OUT_CSC_MODE from output_csc */3053uint32_t mpc_out_gamma_mode; /* MPC_OUT_GAMMA_LUT->MPC_OUT_GAMMA_MODE from output_gamma */3054} mpc;30553056/* OPP register programming variables for each pipe */3057struct {3058/* Display Pattern Generator (DPG) Control - 19 fields from DPG_CONTROL register */3059uint32_t dpg_enable; /* DPG_CONTROL->DPG_EN from test_pattern parameter (enable/disable) */30603061/* Format Control (FMT) - 18 fields from FMT_CONTROL register */3062uint32_t fmt_pixel_encoding; /* FMT_CONTROL->FMT_PIXEL_ENCODING from clamping->pixel_encoding */3063uint32_t fmt_subsampling_mode; /* FMT_CONTROL->FMT_SUBSAMPLING_MODE from force_chroma_subsampling_1tap */3064uint32_t fmt_cbcr_bit_reduction_bypass; /* FMT_CONTROL->FMT_CBCR_BIT_REDUCTION_BYPASS from pixel_encoding bypass control */3065uint32_t fmt_stereosync_override; /* FMT_CONTROL->FMT_STEREOSYNC_OVERRIDE from stereo timing override */3066uint32_t fmt_spatial_dither_frame_counter_max; /* FMT_CONTROL->FMT_SPATIAL_DITHER_FRAME_COUNTER_MAX from fmt_bit_depth->flags */3067uint32_t fmt_spatial_dither_frame_counter_bit_swap; /* FMT_CONTROL->FMT_SPATIAL_DITHER_FRAME_COUNTER_BIT_SWAP from dither control */3068uint32_t fmt_truncate_enable; /* FMT_CONTROL->FMT_TRUNCATE_EN from fmt_bit_depth->flags.TRUNCATE_ENABLED */3069uint32_t fmt_truncate_depth; /* FMT_CONTROL->FMT_TRUNCATE_DEPTH from fmt_bit_depth->flags.TRUNCATE_DEPTH */3070uint32_t fmt_truncate_mode; /* FMT_CONTROL->FMT_TRUNCATE_MODE from fmt_bit_depth->flags.TRUNCATE_MODE */3071uint32_t fmt_spatial_dither_enable; /* FMT_CONTROL->FMT_SPATIAL_DITHER_EN from fmt_bit_depth->flags.SPATIAL_DITHER_ENABLED */3072uint32_t fmt_spatial_dither_mode; /* FMT_CONTROL->FMT_SPATIAL_DITHER_MODE from fmt_bit_depth->flags.SPATIAL_DITHER_MODE */3073uint32_t fmt_spatial_dither_depth; /* FMT_CONTROL->FMT_SPATIAL_DITHER_DEPTH from fmt_bit_depth->flags.SPATIAL_DITHER_DEPTH */3074uint32_t fmt_temporal_dither_enable; /* FMT_CONTROL->FMT_TEMPORAL_DITHER_EN from fmt_bit_depth->flags.TEMPORAL_DITHER_ENABLED */3075uint32_t fmt_clamp_data_enable; /* FMT_CONTROL->FMT_CLAMP_DATA_EN from clamping->clamping_range enable */3076uint32_t fmt_clamp_color_format; /* FMT_CONTROL->FMT_CLAMP_COLOR_FORMAT from clamping->color_format */3077uint32_t fmt_dynamic_exp_enable; /* FMT_CONTROL->FMT_DYNAMIC_EXP_EN from color_sp/color_dpth/signal */3078uint32_t fmt_dynamic_exp_mode; /* FMT_CONTROL->FMT_DYNAMIC_EXP_MODE from color space mode mapping */3079uint32_t fmt_bit_depth_control; /* Legacy field - kept for compatibility */30803081/* OPP Pipe Control - 1 field from OPP_PIPE_CONTROL register */3082uint32_t opp_pipe_clock_enable; /* OPP_PIPE_CONTROL->OPP_PIPE_CLOCK_EN from enable parameter (bool) */30833084/* OPP CRC Control - 3 fields from OPP_PIPE_CRC_CONTROL register */3085uint32_t opp_crc_enable; /* OPP_PIPE_CRC_CONTROL->CRC_EN from CRC enable control */3086uint32_t opp_crc_select_source; /* OPP_PIPE_CRC_CONTROL->CRC_SELECT_SOURCE from CRC source selection */3087uint32_t opp_crc_stereo_cont; /* OPP_PIPE_CRC_CONTROL->CRC_STEREO_CONT from stereo continuous CRC */30883089/* Output Buffer (OPPBUF) Control - 6 fields from OPPBUF_CONTROL register */3090uint32_t oppbuf_active_width; /* OPPBUF_CONTROL->OPPBUF_ACTIVE_WIDTH from oppbuf_params->active_width */3091uint32_t oppbuf_pixel_repetition; /* OPPBUF_CONTROL->OPPBUF_PIXEL_REPETITION from oppbuf_params->pixel_repetition */3092uint32_t oppbuf_display_segmentation; /* OPPBUF_CONTROL->OPPBUF_DISPLAY_SEGMENTATION from oppbuf_params->mso_segmentation */3093uint32_t oppbuf_overlap_pixel_num; /* OPPBUF_CONTROL->OPPBUF_OVERLAP_PIXEL_NUM from oppbuf_params->mso_overlap_pixel_num */3094uint32_t oppbuf_3d_vact_space1_size; /* OPPBUF_CONTROL->OPPBUF_3D_VACT_SPACE1_SIZE from 3D timing space1_size */3095uint32_t oppbuf_3d_vact_space2_size; /* OPPBUF_CONTROL->OPPBUF_3D_VACT_SPACE2_SIZE from 3D timing space2_size */30963097/* DSC Forward Config - 3 fields from DSCRM_DSC_FORWARD_CONFIG register */3098uint32_t dscrm_dsc_forward_enable; /* DSCRM_DSC_FORWARD_CONFIG->DSCRM_DSC_FORWARD_EN from DSC forward enable control */3099uint32_t dscrm_dsc_opp_pipe_source; /* DSCRM_DSC_FORWARD_CONFIG->DSCRM_DSC_OPP_PIPE_SOURCE from opp_pipe parameter */3100uint32_t dscrm_dsc_forward_enable_status; /* DSCRM_DSC_FORWARD_CONFIG->DSCRM_DSC_FORWARD_EN_STATUS from DSC forward status (read-only) */3101} opp[MAX_PIPES];31023103/* OPTC register programming variables for each pipe */3104struct {3105uint32_t otg_master_inst;31063107/* OTG_CONTROL register - 5 fields for OTG control */3108uint32_t otg_master_enable; /* OTG_CONTROL->OTG_MASTER_EN from timing enable/disable control */3109uint32_t otg_disable_point_cntl; /* OTG_CONTROL->OTG_DISABLE_POINT_CNTL from disable timing control */3110uint32_t otg_start_point_cntl; /* OTG_CONTROL->OTG_START_POINT_CNTL from start timing control */3111uint32_t otg_field_number_cntl; /* OTG_CONTROL->OTG_FIELD_NUMBER_CNTL from interlace field control */3112uint32_t otg_out_mux; /* OTG_CONTROL->OTG_OUT_MUX from output mux selection */31133114/* OTG Horizontal Timing - 7 fields */3115uint32_t otg_h_total; /* OTG_H_TOTAL->OTG_H_TOTAL from dc_crtc_timing->h_total */3116uint32_t otg_h_blank_start; /* OTG_H_BLANK_START_END->OTG_H_BLANK_START from dc_crtc_timing->h_front_porch */3117uint32_t otg_h_blank_end; /* OTG_H_BLANK_START_END->OTG_H_BLANK_END from dc_crtc_timing->h_addressable_video_pixel_width */3118uint32_t otg_h_sync_start; /* OTG_H_SYNC_A->OTG_H_SYNC_A_START from dc_crtc_timing->h_sync_width */3119uint32_t otg_h_sync_end; /* OTG_H_SYNC_A->OTG_H_SYNC_A_END from calculated sync end position */3120uint32_t otg_h_sync_polarity; /* OTG_H_SYNC_A_CNTL->OTG_H_SYNC_A_POL from dc_crtc_timing->flags.HSYNC_POSITIVE_POLARITY */3121uint32_t otg_h_timing_div_mode; /* OTG_H_TIMING_CNTL->OTG_H_TIMING_DIV_MODE from horizontal timing division mode */31223123/* OTG Vertical Timing - 7 fields */3124uint32_t otg_v_total; /* OTG_V_TOTAL->OTG_V_TOTAL from dc_crtc_timing->v_total */3125uint32_t otg_v_blank_start; /* OTG_V_BLANK_START_END->OTG_V_BLANK_START from dc_crtc_timing->v_front_porch */3126uint32_t otg_v_blank_end; /* OTG_V_BLANK_START_END->OTG_V_BLANK_END from dc_crtc_timing->v_addressable_video_line_width */3127uint32_t otg_v_sync_start; /* OTG_V_SYNC_A->OTG_V_SYNC_A_START from dc_crtc_timing->v_sync_width */3128uint32_t otg_v_sync_end; /* OTG_V_SYNC_A->OTG_V_SYNC_A_END from calculated sync end position */3129uint32_t otg_v_sync_polarity; /* OTG_V_SYNC_A_CNTL->OTG_V_SYNC_A_POL from dc_crtc_timing->flags.VSYNC_POSITIVE_POLARITY */3130uint32_t otg_v_sync_mode; /* OTG_V_SYNC_A_CNTL->OTG_V_SYNC_MODE from sync mode selection */31313132/* OTG DRR (Dynamic Refresh Rate) Control - 8 fields */3133uint32_t otg_v_total_max; /* OTG_V_TOTAL_MAX->OTG_V_TOTAL_MAX from drr_params->vertical_total_max */3134uint32_t otg_v_total_min; /* OTG_V_TOTAL_MIN->OTG_V_TOTAL_MIN from drr_params->vertical_total_min */3135uint32_t otg_v_total_mid; /* OTG_V_TOTAL_MID->OTG_V_TOTAL_MID from drr_params->vertical_total_mid */3136uint32_t otg_v_total_max_sel; /* OTG_V_TOTAL_CONTROL->OTG_V_TOTAL_MAX_SEL from DRR max selection enable */3137uint32_t otg_v_total_min_sel; /* OTG_V_TOTAL_CONTROL->OTG_V_TOTAL_MIN_SEL from DRR min selection enable */3138uint32_t otg_vtotal_mid_replacing_max_en; /* OTG_V_TOTAL_CONTROL->OTG_VTOTAL_MID_REPLACING_MAX_EN from DRR mid-frame enable */3139uint32_t otg_vtotal_mid_frame_num; /* OTG_V_TOTAL_CONTROL->OTG_VTOTAL_MID_FRAME_NUM from drr_params->vertical_total_mid_frame_num */3140uint32_t otg_set_v_total_min_mask; /* OTG_V_TOTAL_CONTROL->OTG_SET_V_TOTAL_MIN_MASK from DRR trigger mask */3141uint32_t otg_force_lock_on_event; /* OTG_V_TOTAL_CONTROL->OTG_FORCE_LOCK_ON_EVENT from DRR force lock control */31423143/* OPTC Data Source and ODM - 6 fields */3144uint32_t optc_seg0_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG0_SRC_SEL from opp_id[0] ODM segment 0 source */3145uint32_t optc_seg1_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG1_SRC_SEL from opp_id[1] ODM segment 1 source */3146uint32_t optc_seg2_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG2_SRC_SEL from opp_id[2] ODM segment 2 source */3147uint32_t optc_seg3_src_sel; /* OPTC_DATA_SOURCE_SELECT->OPTC_SEG3_SRC_SEL from opp_id[3] ODM segment 3 source */3148uint32_t optc_num_of_input_segment; /* OPTC_DATA_SOURCE_SELECT->OPTC_NUM_OF_INPUT_SEGMENT from opp_cnt-1 number of input segments */3149uint32_t optc_mem_sel; /* OPTC_MEMORY_CONFIG->OPTC_MEM_SEL from memory_mask ODM memory selection */31503151/* OPTC Data Format and DSC - 4 fields */3152uint32_t optc_data_format; /* OPTC_DATA_FORMAT_CONTROL->OPTC_DATA_FORMAT from data format selection */3153uint32_t optc_dsc_mode; /* OPTC_DATA_FORMAT_CONTROL->OPTC_DSC_MODE from dsc_mode parameter */3154uint32_t optc_dsc_bytes_per_pixel; /* OPTC_BYTES_PER_PIXEL->OPTC_DSC_BYTES_PER_PIXEL from dsc_bytes_per_pixel parameter */3155uint32_t optc_segment_width; /* OPTC_WIDTH_CONTROL->OPTC_SEGMENT_WIDTH from segment_width parameter */3156uint32_t optc_dsc_slice_width; /* OPTC_WIDTH_CONTROL->OPTC_DSC_SLICE_WIDTH from dsc_slice_width parameter */31573158/* OPTC Clock and Underflow Control - 4 fields */3159uint32_t optc_input_pix_clk_en; /* OPTC_INPUT_CLOCK_CONTROL->OPTC_INPUT_PIX_CLK_EN from pixel clock enable */3160uint32_t optc_underflow_occurred_status; /* OPTC_INPUT_GLOBAL_CONTROL->OPTC_UNDERFLOW_OCCURRED_STATUS from underflow status (read-only) */3161uint32_t optc_underflow_clear; /* OPTC_INPUT_GLOBAL_CONTROL->OPTC_UNDERFLOW_CLEAR from underflow clear control */3162uint32_t otg_clock_enable; /* OTG_CLOCK_CONTROL->OTG_CLOCK_EN from OTG clock enable */3163uint32_t otg_clock_gate_dis; /* OTG_CLOCK_CONTROL->OTG_CLOCK_GATE_DIS from clock gate disable */31643165/* OTG Stereo and 3D Control - 6 fields */3166uint32_t otg_stereo_enable; /* OTG_STEREO_CONTROL->OTG_STEREO_EN from stereo enable control */3167uint32_t otg_stereo_sync_output_line_num; /* OTG_STEREO_CONTROL->OTG_STEREO_SYNC_OUTPUT_LINE_NUM from timing->stereo_3d_format line num */3168uint32_t otg_stereo_sync_output_polarity; /* OTG_STEREO_CONTROL->OTG_STEREO_SYNC_OUTPUT_POLARITY from stereo polarity control */3169uint32_t otg_3d_structure_en; /* OTG_3D_STRUCTURE_CONTROL->OTG_3D_STRUCTURE_EN from 3D structure enable */3170uint32_t otg_3d_structure_v_update_mode; /* OTG_3D_STRUCTURE_CONTROL->OTG_3D_STRUCTURE_V_UPDATE_MODE from 3D vertical update mode */3171uint32_t otg_3d_structure_stereo_sel_ovr; /* OTG_3D_STRUCTURE_CONTROL->OTG_3D_STRUCTURE_STEREO_SEL_OVR from 3D stereo selection override */3172uint32_t otg_interlace_enable; /* OTG_INTERLACE_CONTROL->OTG_INTERLACE_ENABLE from dc_crtc_timing->flags.INTERLACE */31733174/* OTG GSL (Global Sync Lock) Control - 5 fields */3175uint32_t otg_gsl0_en; /* OTG_GSL_CONTROL->OTG_GSL0_EN from GSL group 0 enable */3176uint32_t otg_gsl1_en; /* OTG_GSL_CONTROL->OTG_GSL1_EN from GSL group 1 enable */3177uint32_t otg_gsl2_en; /* OTG_GSL_CONTROL->OTG_GSL2_EN from GSL group 2 enable */3178uint32_t otg_gsl_master_en; /* OTG_GSL_CONTROL->OTG_GSL_MASTER_EN from GSL master enable */3179uint32_t otg_gsl_master_mode; /* OTG_GSL_CONTROL->OTG_GSL_MASTER_MODE from gsl_params->gsl_master mode */31803181/* OTG DRR Advanced Control - 4 fields */3182uint32_t otg_v_total_last_used_by_drr; /* OTG_DRR_CONTROL->OTG_V_TOTAL_LAST_USED_BY_DRR from last used DRR V_TOTAL (read-only) */3183uint32_t otg_drr_trigger_window_start_x; /* OTG_DRR_TRIGGER_WINDOW->OTG_DRR_TRIGGER_WINDOW_START_X from window_start parameter */3184uint32_t otg_drr_trigger_window_end_x; /* OTG_DRR_TRIGGER_WINDOW->OTG_DRR_TRIGGER_WINDOW_END_X from window_end parameter */3185uint32_t otg_drr_v_total_change_limit; /* OTG_DRR_V_TOTAL_CHANGE->OTG_DRR_V_TOTAL_CHANGE_LIMIT from limit parameter */31863187/* OTG DSC Position Control - 2 fields */3188uint32_t otg_dsc_start_position_x; /* OTG_DSC_START_POSITION->OTG_DSC_START_POSITION_X from DSC start X position */3189uint32_t otg_dsc_start_position_line_num; /* OTG_DSC_START_POSITION->OTG_DSC_START_POSITION_LINE_NUM from DSC start line number */31903191/* OTG Double Buffer Control - 2 fields */3192uint32_t otg_drr_timing_dbuf_update_mode; /* OTG_DOUBLE_BUFFER_CONTROL->OTG_DRR_TIMING_DBUF_UPDATE_MODE from DRR double buffer mode */3193uint32_t otg_blank_data_double_buffer_en; /* OTG_DOUBLE_BUFFER_CONTROL->OTG_BLANK_DATA_DOUBLE_BUFFER_EN from blank data double buffer enable */31943195/* OTG Vertical Interrupts - 6 fields */3196uint32_t otg_vertical_interrupt0_int_enable; /* OTG_VERTICAL_INTERRUPT0_CONTROL->OTG_VERTICAL_INTERRUPT0_INT_ENABLE from interrupt 0 enable */3197uint32_t otg_vertical_interrupt0_line_start; /* OTG_VERTICAL_INTERRUPT0_POSITION->OTG_VERTICAL_INTERRUPT0_LINE_START from start_line parameter */3198uint32_t otg_vertical_interrupt1_int_enable; /* OTG_VERTICAL_INTERRUPT1_CONTROL->OTG_VERTICAL_INTERRUPT1_INT_ENABLE from interrupt 1 enable */3199uint32_t otg_vertical_interrupt1_line_start; /* OTG_VERTICAL_INTERRUPT1_POSITION->OTG_VERTICAL_INTERRUPT1_LINE_START from start_line parameter */3200uint32_t otg_vertical_interrupt2_int_enable; /* OTG_VERTICAL_INTERRUPT2_CONTROL->OTG_VERTICAL_INTERRUPT2_INT_ENABLE from interrupt 2 enable */3201uint32_t otg_vertical_interrupt2_line_start; /* OTG_VERTICAL_INTERRUPT2_POSITION->OTG_VERTICAL_INTERRUPT2_LINE_START from start_line parameter */32023203/* OTG Global Sync Parameters - 6 fields */3204uint32_t otg_vready_offset; /* OTG_VREADY_PARAM->OTG_VREADY_OFFSET from vready_offset parameter */3205uint32_t otg_vstartup_start; /* OTG_VSTARTUP_PARAM->OTG_VSTARTUP_START from vstartup_start parameter */3206uint32_t otg_vupdate_offset; /* OTG_VUPDATE_PARAM->OTG_VUPDATE_OFFSET from vupdate_offset parameter */3207uint32_t otg_vupdate_width; /* OTG_VUPDATE_PARAM->OTG_VUPDATE_WIDTH from vupdate_width parameter */3208uint32_t master_update_lock_vupdate_keepout_start_offset; /* OTG_VUPDATE_KEEPOUT->MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_START_OFFSET from pstate_keepout start */3209uint32_t master_update_lock_vupdate_keepout_end_offset; /* OTG_VUPDATE_KEEPOUT->MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_END_OFFSET from pstate_keepout end */32103211/* OTG Manual Trigger Control - 11 fields */3212uint32_t otg_triga_source_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_SOURCE_SELECT from trigger A source selection */3213uint32_t otg_triga_source_pipe_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_SOURCE_PIPE_SELECT from trigger A pipe selection */3214uint32_t otg_triga_rising_edge_detect_cntl; /* OTG_TRIGA_CNTL->OTG_TRIGA_RISING_EDGE_DETECT_CNTL from trigger A rising edge detect */3215uint32_t otg_triga_falling_edge_detect_cntl; /* OTG_TRIGA_CNTL->OTG_TRIGA_FALLING_EDGE_DETECT_CNTL from trigger A falling edge detect */3216uint32_t otg_triga_polarity_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_POLARITY_SELECT from trigger A polarity selection */3217uint32_t otg_triga_frequency_select; /* OTG_TRIGA_CNTL->OTG_TRIGA_FREQUENCY_SELECT from trigger A frequency selection */3218uint32_t otg_triga_delay; /* OTG_TRIGA_CNTL->OTG_TRIGA_DELAY from trigger A delay */3219uint32_t otg_triga_clear; /* OTG_TRIGA_CNTL->OTG_TRIGA_CLEAR from trigger A clear */3220uint32_t otg_triga_manual_trig; /* OTG_TRIGA_MANUAL_TRIG->OTG_TRIGA_MANUAL_TRIG from manual trigger A */3221uint32_t otg_trigb_source_select; /* OTG_TRIGB_CNTL->OTG_TRIGB_SOURCE_SELECT from trigger B source selection */3222uint32_t otg_trigb_polarity_select; /* OTG_TRIGB_CNTL->OTG_TRIGB_POLARITY_SELECT from trigger B polarity selection */3223uint32_t otg_trigb_manual_trig; /* OTG_TRIGB_MANUAL_TRIG->OTG_TRIGB_MANUAL_TRIG from manual trigger B */32243225/* OTG Static Screen and Update Control - 6 fields */3226uint32_t otg_static_screen_event_mask; /* OTG_STATIC_SCREEN_CONTROL->OTG_STATIC_SCREEN_EVENT_MASK from event_triggers parameter */3227uint32_t otg_static_screen_frame_count; /* OTG_STATIC_SCREEN_CONTROL->OTG_STATIC_SCREEN_FRAME_COUNT from num_frames parameter */3228uint32_t master_update_lock; /* OTG_MASTER_UPDATE_LOCK->MASTER_UPDATE_LOCK from update lock control */3229uint32_t master_update_mode; /* OTG_MASTER_UPDATE_MODE->MASTER_UPDATE_MODE from update mode selection */3230uint32_t otg_force_count_now_mode; /* OTG_FORCE_COUNT_NOW_CNTL->OTG_FORCE_COUNT_NOW_MODE from force count mode */3231uint32_t otg_force_count_now_clear; /* OTG_FORCE_COUNT_NOW_CNTL->OTG_FORCE_COUNT_NOW_CLEAR from force count clear */32323233/* VTG Control - 3 fields */3234uint32_t vtg0_enable; /* CONTROL->VTG0_ENABLE from VTG enable control */3235uint32_t vtg0_fp2; /* CONTROL->VTG0_FP2 from VTG front porch 2 */3236uint32_t vtg0_vcount_init; /* CONTROL->VTG0_VCOUNT_INIT from VTG vertical count init */32373238/* OTG Status (Read-Only) - 12 fields */3239uint32_t otg_v_blank; /* OTG_STATUS->OTG_V_BLANK from vertical blank status (read-only) */3240uint32_t otg_v_active_disp; /* OTG_STATUS->OTG_V_ACTIVE_DISP from vertical active display (read-only) */3241uint32_t otg_frame_count; /* OTG_STATUS_FRAME_COUNT->OTG_FRAME_COUNT from frame count (read-only) */3242uint32_t otg_horz_count; /* OTG_STATUS_POSITION->OTG_HORZ_COUNT from horizontal position (read-only) */3243uint32_t otg_vert_count; /* OTG_STATUS_POSITION->OTG_VERT_COUNT from vertical position (read-only) */3244uint32_t otg_horz_count_hv; /* OTG_STATUS_HV_COUNT->OTG_HORZ_COUNT from horizontal count (read-only) */3245uint32_t otg_vert_count_nom; /* OTG_STATUS_HV_COUNT->OTG_VERT_COUNT_NOM from vertical count nominal (read-only) */3246uint32_t otg_flip_pending; /* OTG_PIPE_UPDATE_STATUS->OTG_FLIP_PENDING from flip pending status (read-only) */3247uint32_t otg_dc_reg_update_pending; /* OTG_PIPE_UPDATE_STATUS->OTG_DC_REG_UPDATE_PENDING from DC register update pending (read-only) */3248uint32_t otg_cursor_update_pending; /* OTG_PIPE_UPDATE_STATUS->OTG_CURSOR_UPDATE_PENDING from cursor update pending (read-only) */3249uint32_t otg_vupdate_keepout_status; /* OTG_PIPE_UPDATE_STATUS->OTG_VUPDATE_KEEPOUT_STATUS from VUPDATE keepout status (read-only) */3250} optc[MAX_PIPES];32513252/* Metadata */3253uint32_t active_pipe_count;3254uint32_t active_stream_count;3255bool state_valid;3256};32573258/**3259* dc_capture_register_software_state() - Capture software state for register programming3260* @dc: DC context containing current display configuration3261* @state: Pointer to dc_register_software_state structure to populate3262*3263* Extracts all software state variables that are used to program hardware register3264* fields across the display driver pipeline. This provides a complete snapshot3265* of the software configuration that drives hardware register programming.3266*3267* The function traverses the DC context and extracts values from:3268* - Stream configurations (timing, format, DSC settings)3269* - Plane states (surface format, rotation, scaling, cursor)3270* - Pipe contexts (resource allocation, blending, viewport)3271* - Clock manager (display clocks, DPP clocks, pixel clocks)3272* - Resource context (DET buffer allocation, ODM configuration)3273*3274* This is essential for underflow debugging as it captures the exact software3275* state that determines how registers are programmed, allowing analysis of3276* whether underflow is caused by incorrect register programming or timing issues.3277*3278* Return: true if state was successfully captured, false on error3279*/3280bool dc_capture_register_software_state(struct dc *dc, struct dc_register_software_state *state);32813282#endif /* DC_INTERFACE_H_ */328332843285