18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2012-14 Advanced Micro Devices, Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Authors: AMD 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#ifndef DC_INTERFACE_H_ 278c2ecf20Sopenharmony_ci#define DC_INTERFACE_H_ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#include "dc_types.h" 308c2ecf20Sopenharmony_ci#include "grph_object_defs.h" 318c2ecf20Sopenharmony_ci#include "logger_types.h" 328c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_HDCP) 338c2ecf20Sopenharmony_ci#include "hdcp_types.h" 348c2ecf20Sopenharmony_ci#endif 358c2ecf20Sopenharmony_ci#include "gpio_types.h" 368c2ecf20Sopenharmony_ci#include "link_service_types.h" 378c2ecf20Sopenharmony_ci#include "grph_object_ctrl_defs.h" 388c2ecf20Sopenharmony_ci#include <inc/hw/opp.h> 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#include "inc/hw_sequencer.h" 418c2ecf20Sopenharmony_ci#include "inc/compressor.h" 428c2ecf20Sopenharmony_ci#include "inc/hw/dmcu.h" 438c2ecf20Sopenharmony_ci#include "dml/display_mode_lib.h" 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define DC_VER "3.2.104" 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define MAX_SURFACES 3 488c2ecf20Sopenharmony_ci#define MAX_PLANES 6 498c2ecf20Sopenharmony_ci#define MAX_STREAMS 6 508c2ecf20Sopenharmony_ci#define MAX_SINKS_PER_LINK 4 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/******************************************************************************* 538c2ecf20Sopenharmony_ci * Display Core Interfaces 548c2ecf20Sopenharmony_ci ******************************************************************************/ 558c2ecf20Sopenharmony_cistruct dc_versions { 568c2ecf20Sopenharmony_ci const char *dc_ver; 578c2ecf20Sopenharmony_ci struct dmcu_version dmcu_version; 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cienum dp_protocol_version { 618c2ecf20Sopenharmony_ci DP_VERSION_1_4, 628c2ecf20Sopenharmony_ci}; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_cienum dc_plane_type { 658c2ecf20Sopenharmony_ci DC_PLANE_TYPE_INVALID, 668c2ecf20Sopenharmony_ci DC_PLANE_TYPE_DCE_RGB, 678c2ecf20Sopenharmony_ci DC_PLANE_TYPE_DCE_UNDERLAY, 688c2ecf20Sopenharmony_ci DC_PLANE_TYPE_DCN_UNIVERSAL, 698c2ecf20Sopenharmony_ci}; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistruct dc_plane_cap { 728c2ecf20Sopenharmony_ci enum dc_plane_type type; 738c2ecf20Sopenharmony_ci uint32_t blends_with_above : 1; 748c2ecf20Sopenharmony_ci uint32_t blends_with_below : 1; 758c2ecf20Sopenharmony_ci uint32_t per_pixel_alpha : 1; 768c2ecf20Sopenharmony_ci struct { 778c2ecf20Sopenharmony_ci uint32_t argb8888 : 1; 788c2ecf20Sopenharmony_ci uint32_t nv12 : 1; 798c2ecf20Sopenharmony_ci uint32_t fp16 : 1; 808c2ecf20Sopenharmony_ci uint32_t p010 : 1; 818c2ecf20Sopenharmony_ci uint32_t ayuv : 1; 828c2ecf20Sopenharmony_ci } pixel_format_support; 838c2ecf20Sopenharmony_ci // max upscaling factor x1000 848c2ecf20Sopenharmony_ci // upscaling factors are always >= 1 858c2ecf20Sopenharmony_ci // for example, 1080p -> 8K is 4.0, or 4000 raw value 868c2ecf20Sopenharmony_ci struct { 878c2ecf20Sopenharmony_ci uint32_t argb8888; 888c2ecf20Sopenharmony_ci uint32_t nv12; 898c2ecf20Sopenharmony_ci uint32_t fp16; 908c2ecf20Sopenharmony_ci } max_upscale_factor; 918c2ecf20Sopenharmony_ci // max downscale factor x1000 928c2ecf20Sopenharmony_ci // downscale factors are always <= 1 938c2ecf20Sopenharmony_ci // for example, 8K -> 1080p is 0.25, or 250 raw value 948c2ecf20Sopenharmony_ci struct { 958c2ecf20Sopenharmony_ci uint32_t argb8888; 968c2ecf20Sopenharmony_ci uint32_t nv12; 978c2ecf20Sopenharmony_ci uint32_t fp16; 988c2ecf20Sopenharmony_ci } max_downscale_factor; 998c2ecf20Sopenharmony_ci // minimal width/height 1008c2ecf20Sopenharmony_ci uint32_t min_width; 1018c2ecf20Sopenharmony_ci uint32_t min_height; 1028c2ecf20Sopenharmony_ci}; 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci// Color management caps (DPP and MPC) 1058c2ecf20Sopenharmony_cistruct rom_curve_caps { 1068c2ecf20Sopenharmony_ci uint16_t srgb : 1; 1078c2ecf20Sopenharmony_ci uint16_t bt2020 : 1; 1088c2ecf20Sopenharmony_ci uint16_t gamma2_2 : 1; 1098c2ecf20Sopenharmony_ci uint16_t pq : 1; 1108c2ecf20Sopenharmony_ci uint16_t hlg : 1; 1118c2ecf20Sopenharmony_ci}; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_cistruct dpp_color_caps { 1148c2ecf20Sopenharmony_ci uint16_t dcn_arch : 1; // all DCE generations treated the same 1158c2ecf20Sopenharmony_ci // input lut is different than most LUTs, just plain 256-entry lookup 1168c2ecf20Sopenharmony_ci uint16_t input_lut_shared : 1; // shared with DGAM 1178c2ecf20Sopenharmony_ci uint16_t icsc : 1; 1188c2ecf20Sopenharmony_ci uint16_t dgam_ram : 1; 1198c2ecf20Sopenharmony_ci uint16_t post_csc : 1; // before gamut remap 1208c2ecf20Sopenharmony_ci uint16_t gamma_corr : 1; 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci // hdr_mult and gamut remap always available in DPP (in that order) 1238c2ecf20Sopenharmony_ci // 3d lut implies shaper LUT, 1248c2ecf20Sopenharmony_ci // it may be shared with MPC - check MPC:shared_3d_lut flag 1258c2ecf20Sopenharmony_ci uint16_t hw_3d_lut : 1; 1268c2ecf20Sopenharmony_ci uint16_t ogam_ram : 1; // blnd gam 1278c2ecf20Sopenharmony_ci uint16_t ocsc : 1; 1288c2ecf20Sopenharmony_ci struct rom_curve_caps dgam_rom_caps; 1298c2ecf20Sopenharmony_ci struct rom_curve_caps ogam_rom_caps; 1308c2ecf20Sopenharmony_ci}; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_cistruct mpc_color_caps { 1338c2ecf20Sopenharmony_ci uint16_t gamut_remap : 1; 1348c2ecf20Sopenharmony_ci uint16_t ogam_ram : 1; 1358c2ecf20Sopenharmony_ci uint16_t ocsc : 1; 1368c2ecf20Sopenharmony_ci uint16_t num_3dluts : 3; //3d lut always assumes a preceding shaper LUT 1378c2ecf20Sopenharmony_ci uint16_t shared_3d_lut:1; //can be in either DPP or MPC, but single instance 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci struct rom_curve_caps ogam_rom_caps; 1408c2ecf20Sopenharmony_ci}; 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_cistruct dc_color_caps { 1438c2ecf20Sopenharmony_ci struct dpp_color_caps dpp; 1448c2ecf20Sopenharmony_ci struct mpc_color_caps mpc; 1458c2ecf20Sopenharmony_ci}; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_cistruct dc_caps { 1488c2ecf20Sopenharmony_ci uint32_t max_streams; 1498c2ecf20Sopenharmony_ci uint32_t max_links; 1508c2ecf20Sopenharmony_ci uint32_t max_audios; 1518c2ecf20Sopenharmony_ci uint32_t max_slave_planes; 1528c2ecf20Sopenharmony_ci uint32_t max_planes; 1538c2ecf20Sopenharmony_ci uint32_t max_downscale_ratio; 1548c2ecf20Sopenharmony_ci uint32_t i2c_speed_in_khz; 1558c2ecf20Sopenharmony_ci uint32_t dmdata_alloc_size; 1568c2ecf20Sopenharmony_ci unsigned int max_cursor_size; 1578c2ecf20Sopenharmony_ci unsigned int max_video_width; 1588c2ecf20Sopenharmony_ci int linear_pitch_alignment; 1598c2ecf20Sopenharmony_ci bool dcc_const_color; 1608c2ecf20Sopenharmony_ci bool dynamic_audio; 1618c2ecf20Sopenharmony_ci bool is_apu; 1628c2ecf20Sopenharmony_ci bool dual_link_dvi; 1638c2ecf20Sopenharmony_ci bool post_blend_color_processing; 1648c2ecf20Sopenharmony_ci bool force_dp_tps4_for_cp2520; 1658c2ecf20Sopenharmony_ci bool disable_dp_clk_share; 1668c2ecf20Sopenharmony_ci bool psp_setup_panel_mode; 1678c2ecf20Sopenharmony_ci bool extended_aux_timeout_support; 1688c2ecf20Sopenharmony_ci bool dmcub_support; 1698c2ecf20Sopenharmony_ci enum dp_protocol_version max_dp_protocol_version; 1708c2ecf20Sopenharmony_ci struct dc_plane_cap planes[MAX_PLANES]; 1718c2ecf20Sopenharmony_ci struct dc_color_caps color; 1728c2ecf20Sopenharmony_ci}; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistruct dc_bug_wa { 1758c2ecf20Sopenharmony_ci bool no_connect_phy_config; 1768c2ecf20Sopenharmony_ci bool dedcn20_305_wa; 1778c2ecf20Sopenharmony_ci bool skip_clock_update; 1788c2ecf20Sopenharmony_ci bool lt_early_cr_pattern; 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistruct dc_dcc_surface_param { 1828c2ecf20Sopenharmony_ci struct dc_size surface_size; 1838c2ecf20Sopenharmony_ci enum surface_pixel_format format; 1848c2ecf20Sopenharmony_ci enum swizzle_mode_values swizzle_mode; 1858c2ecf20Sopenharmony_ci enum dc_scan_direction scan; 1868c2ecf20Sopenharmony_ci}; 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_cistruct dc_dcc_setting { 1898c2ecf20Sopenharmony_ci unsigned int max_compressed_blk_size; 1908c2ecf20Sopenharmony_ci unsigned int max_uncompressed_blk_size; 1918c2ecf20Sopenharmony_ci bool independent_64b_blks; 1928c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 1938c2ecf20Sopenharmony_ci //These bitfields to be used starting with DCN 3.0 1948c2ecf20Sopenharmony_ci struct { 1958c2ecf20Sopenharmony_ci uint32_t dcc_256_64_64 : 1;//available in ASICs before DCN 3.0 (the worst compression case) 1968c2ecf20Sopenharmony_ci uint32_t dcc_128_128_uncontrained : 1; //available in ASICs before DCN 3.0 1978c2ecf20Sopenharmony_ci uint32_t dcc_256_128_128 : 1; //available starting with DCN 3.0 1988c2ecf20Sopenharmony_ci uint32_t dcc_256_256_unconstrained : 1; //available in ASICs before DCN 3.0 (the best compression case) 1998c2ecf20Sopenharmony_ci } dcc_controls; 2008c2ecf20Sopenharmony_ci#endif 2018c2ecf20Sopenharmony_ci}; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_cistruct dc_surface_dcc_cap { 2048c2ecf20Sopenharmony_ci union { 2058c2ecf20Sopenharmony_ci struct { 2068c2ecf20Sopenharmony_ci struct dc_dcc_setting rgb; 2078c2ecf20Sopenharmony_ci } grph; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci struct { 2108c2ecf20Sopenharmony_ci struct dc_dcc_setting luma; 2118c2ecf20Sopenharmony_ci struct dc_dcc_setting chroma; 2128c2ecf20Sopenharmony_ci } video; 2138c2ecf20Sopenharmony_ci }; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci bool capable; 2168c2ecf20Sopenharmony_ci bool const_color_support; 2178c2ecf20Sopenharmony_ci}; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_cistruct dc_static_screen_params { 2208c2ecf20Sopenharmony_ci struct { 2218c2ecf20Sopenharmony_ci bool force_trigger; 2228c2ecf20Sopenharmony_ci bool cursor_update; 2238c2ecf20Sopenharmony_ci bool surface_update; 2248c2ecf20Sopenharmony_ci bool overlay_update; 2258c2ecf20Sopenharmony_ci } triggers; 2268c2ecf20Sopenharmony_ci unsigned int num_frames; 2278c2ecf20Sopenharmony_ci}; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci/* Surface update type is used by dc_update_surfaces_and_stream 2318c2ecf20Sopenharmony_ci * The update type is determined at the very beginning of the function based 2328c2ecf20Sopenharmony_ci * on parameters passed in and decides how much programming (or updating) is 2338c2ecf20Sopenharmony_ci * going to be done during the call. 2348c2ecf20Sopenharmony_ci * 2358c2ecf20Sopenharmony_ci * UPDATE_TYPE_FAST is used for really fast updates that do not require much 2368c2ecf20Sopenharmony_ci * logical calculations or hardware register programming. This update MUST be 2378c2ecf20Sopenharmony_ci * ISR safe on windows. Currently fast update will only be used to flip surface 2388c2ecf20Sopenharmony_ci * address. 2398c2ecf20Sopenharmony_ci * 2408c2ecf20Sopenharmony_ci * UPDATE_TYPE_MED is used for slower updates which require significant hw 2418c2ecf20Sopenharmony_ci * re-programming however do not affect bandwidth consumption or clock 2428c2ecf20Sopenharmony_ci * requirements. At present, this is the level at which front end updates 2438c2ecf20Sopenharmony_ci * that do not require us to run bw_calcs happen. These are in/out transfer func 2448c2ecf20Sopenharmony_ci * updates, viewport offset changes, recout size changes and pixel depth changes. 2458c2ecf20Sopenharmony_ci * This update can be done at ISR, but we want to minimize how often this happens. 2468c2ecf20Sopenharmony_ci * 2478c2ecf20Sopenharmony_ci * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our 2488c2ecf20Sopenharmony_ci * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front 2498c2ecf20Sopenharmony_ci * end related. Any time viewport dimensions, recout dimensions, scaling ratios or 2508c2ecf20Sopenharmony_ci * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do 2518c2ecf20Sopenharmony_ci * a full update. This cannot be done at ISR level and should be a rare event. 2528c2ecf20Sopenharmony_ci * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting 2538c2ecf20Sopenharmony_ci * underscan we don't expect to see this call at all. 2548c2ecf20Sopenharmony_ci */ 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_cienum surface_update_type { 2578c2ecf20Sopenharmony_ci UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */ 2588c2ecf20Sopenharmony_ci UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/ 2598c2ecf20Sopenharmony_ci UPDATE_TYPE_FULL, /* may need to shuffle resources */ 2608c2ecf20Sopenharmony_ci}; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci/* Forward declaration*/ 2638c2ecf20Sopenharmony_cistruct dc; 2648c2ecf20Sopenharmony_cistruct dc_plane_state; 2658c2ecf20Sopenharmony_cistruct dc_state; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_cistruct dc_cap_funcs { 2698c2ecf20Sopenharmony_ci bool (*get_dcc_compression_cap)(const struct dc *dc, 2708c2ecf20Sopenharmony_ci const struct dc_dcc_surface_param *input, 2718c2ecf20Sopenharmony_ci struct dc_surface_dcc_cap *output); 2728c2ecf20Sopenharmony_ci}; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_cistruct link_training_settings; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci/* Structure to hold configuration flags set by dm at dc creation. */ 2788c2ecf20Sopenharmony_cistruct dc_config { 2798c2ecf20Sopenharmony_ci bool gpu_vm_support; 2808c2ecf20Sopenharmony_ci bool disable_disp_pll_sharing; 2818c2ecf20Sopenharmony_ci bool fbc_support; 2828c2ecf20Sopenharmony_ci bool optimize_edp_link_rate; 2838c2ecf20Sopenharmony_ci bool disable_fractional_pwm; 2848c2ecf20Sopenharmony_ci bool allow_seamless_boot_optimization; 2858c2ecf20Sopenharmony_ci bool power_down_display_on_boot; 2868c2ecf20Sopenharmony_ci bool edp_not_connected; 2878c2ecf20Sopenharmony_ci bool force_enum_edp; 2888c2ecf20Sopenharmony_ci bool forced_clocks; 2898c2ecf20Sopenharmony_ci bool allow_lttpr_non_transparent_mode; 2908c2ecf20Sopenharmony_ci bool multi_mon_pp_mclk_switch; 2918c2ecf20Sopenharmony_ci bool disable_dmcu; 2928c2ecf20Sopenharmony_ci bool enable_4to1MPC; 2938c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 2948c2ecf20Sopenharmony_ci bool clamp_min_dcfclk; 2958c2ecf20Sopenharmony_ci#endif 2968c2ecf20Sopenharmony_ci}; 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_cienum visual_confirm { 2998c2ecf20Sopenharmony_ci VISUAL_CONFIRM_DISABLE = 0, 3008c2ecf20Sopenharmony_ci VISUAL_CONFIRM_SURFACE = 1, 3018c2ecf20Sopenharmony_ci VISUAL_CONFIRM_HDR = 2, 3028c2ecf20Sopenharmony_ci VISUAL_CONFIRM_MPCTREE = 4, 3038c2ecf20Sopenharmony_ci VISUAL_CONFIRM_PSR = 5, 3048c2ecf20Sopenharmony_ci}; 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_cienum dcc_option { 3078c2ecf20Sopenharmony_ci DCC_ENABLE = 0, 3088c2ecf20Sopenharmony_ci DCC_DISABLE = 1, 3098c2ecf20Sopenharmony_ci DCC_HALF_REQ_DISALBE = 2, 3108c2ecf20Sopenharmony_ci}; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_cienum pipe_split_policy { 3138c2ecf20Sopenharmony_ci MPC_SPLIT_DYNAMIC = 0, 3148c2ecf20Sopenharmony_ci MPC_SPLIT_AVOID = 1, 3158c2ecf20Sopenharmony_ci MPC_SPLIT_AVOID_MULT_DISP = 2, 3168c2ecf20Sopenharmony_ci}; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cienum wm_report_mode { 3198c2ecf20Sopenharmony_ci WM_REPORT_DEFAULT = 0, 3208c2ecf20Sopenharmony_ci WM_REPORT_OVERRIDE = 1, 3218c2ecf20Sopenharmony_ci}; 3228c2ecf20Sopenharmony_cienum dtm_pstate{ 3238c2ecf20Sopenharmony_ci dtm_level_p0 = 0,/*highest voltage*/ 3248c2ecf20Sopenharmony_ci dtm_level_p1, 3258c2ecf20Sopenharmony_ci dtm_level_p2, 3268c2ecf20Sopenharmony_ci dtm_level_p3, 3278c2ecf20Sopenharmony_ci dtm_level_p4,/*when active_display_count = 0*/ 3288c2ecf20Sopenharmony_ci}; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_cienum dcn_pwr_state { 3318c2ecf20Sopenharmony_ci DCN_PWR_STATE_UNKNOWN = -1, 3328c2ecf20Sopenharmony_ci DCN_PWR_STATE_MISSION_MODE = 0, 3338c2ecf20Sopenharmony_ci DCN_PWR_STATE_LOW_POWER = 3, 3348c2ecf20Sopenharmony_ci}; 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci/* 3378c2ecf20Sopenharmony_ci * For any clocks that may differ per pipe 3388c2ecf20Sopenharmony_ci * only the max is stored in this structure 3398c2ecf20Sopenharmony_ci */ 3408c2ecf20Sopenharmony_cistruct dc_clocks { 3418c2ecf20Sopenharmony_ci int dispclk_khz; 3428c2ecf20Sopenharmony_ci int dppclk_khz; 3438c2ecf20Sopenharmony_ci int disp_dpp_voltage_level_khz; 3448c2ecf20Sopenharmony_ci int dcfclk_khz; 3458c2ecf20Sopenharmony_ci int socclk_khz; 3468c2ecf20Sopenharmony_ci int dcfclk_deep_sleep_khz; 3478c2ecf20Sopenharmony_ci int fclk_khz; 3488c2ecf20Sopenharmony_ci int phyclk_khz; 3498c2ecf20Sopenharmony_ci int dramclk_khz; 3508c2ecf20Sopenharmony_ci bool p_state_change_support; 3518c2ecf20Sopenharmony_ci enum dcn_pwr_state pwr_state; 3528c2ecf20Sopenharmony_ci /* 3538c2ecf20Sopenharmony_ci * Elements below are not compared for the purposes of 3548c2ecf20Sopenharmony_ci * optimization required 3558c2ecf20Sopenharmony_ci */ 3568c2ecf20Sopenharmony_ci bool prev_p_state_change_support; 3578c2ecf20Sopenharmony_ci enum dtm_pstate dtm_level; 3588c2ecf20Sopenharmony_ci int max_supported_dppclk_khz; 3598c2ecf20Sopenharmony_ci int max_supported_dispclk_khz; 3608c2ecf20Sopenharmony_ci int bw_dppclk_khz; /*a copy of dppclk_khz*/ 3618c2ecf20Sopenharmony_ci int bw_dispclk_khz; 3628c2ecf20Sopenharmony_ci}; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_cistruct dc_bw_validation_profile { 3658c2ecf20Sopenharmony_ci bool enable; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci unsigned long long total_ticks; 3688c2ecf20Sopenharmony_ci unsigned long long voltage_level_ticks; 3698c2ecf20Sopenharmony_ci unsigned long long watermark_ticks; 3708c2ecf20Sopenharmony_ci unsigned long long rq_dlg_ticks; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci unsigned long long total_count; 3738c2ecf20Sopenharmony_ci unsigned long long skip_fast_count; 3748c2ecf20Sopenharmony_ci unsigned long long skip_pass_count; 3758c2ecf20Sopenharmony_ci unsigned long long skip_fail_count; 3768c2ecf20Sopenharmony_ci}; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci#define BW_VAL_TRACE_SETUP() \ 3798c2ecf20Sopenharmony_ci unsigned long long end_tick = 0; \ 3808c2ecf20Sopenharmony_ci unsigned long long voltage_level_tick = 0; \ 3818c2ecf20Sopenharmony_ci unsigned long long watermark_tick = 0; \ 3828c2ecf20Sopenharmony_ci unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \ 3838c2ecf20Sopenharmony_ci dm_get_timestamp(dc->ctx) : 0 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci#define BW_VAL_TRACE_COUNT() \ 3868c2ecf20Sopenharmony_ci if (dc->debug.bw_val_profile.enable) \ 3878c2ecf20Sopenharmony_ci dc->debug.bw_val_profile.total_count++ 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define BW_VAL_TRACE_SKIP(status) \ 3908c2ecf20Sopenharmony_ci if (dc->debug.bw_val_profile.enable) { \ 3918c2ecf20Sopenharmony_ci if (!voltage_level_tick) \ 3928c2ecf20Sopenharmony_ci voltage_level_tick = dm_get_timestamp(dc->ctx); \ 3938c2ecf20Sopenharmony_ci dc->debug.bw_val_profile.skip_ ## status ## _count++; \ 3948c2ecf20Sopenharmony_ci } 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci#define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \ 3978c2ecf20Sopenharmony_ci if (dc->debug.bw_val_profile.enable) \ 3988c2ecf20Sopenharmony_ci voltage_level_tick = dm_get_timestamp(dc->ctx) 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci#define BW_VAL_TRACE_END_WATERMARKS() \ 4018c2ecf20Sopenharmony_ci if (dc->debug.bw_val_profile.enable) \ 4028c2ecf20Sopenharmony_ci watermark_tick = dm_get_timestamp(dc->ctx) 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci#define BW_VAL_TRACE_FINISH() \ 4058c2ecf20Sopenharmony_ci if (dc->debug.bw_val_profile.enable) { \ 4068c2ecf20Sopenharmony_ci end_tick = dm_get_timestamp(dc->ctx); \ 4078c2ecf20Sopenharmony_ci dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \ 4088c2ecf20Sopenharmony_ci dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \ 4098c2ecf20Sopenharmony_ci if (watermark_tick) { \ 4108c2ecf20Sopenharmony_ci dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \ 4118c2ecf20Sopenharmony_ci dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \ 4128c2ecf20Sopenharmony_ci } \ 4138c2ecf20Sopenharmony_ci } 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_cistruct dc_debug_options { 4168c2ecf20Sopenharmony_ci enum visual_confirm visual_confirm; 4178c2ecf20Sopenharmony_ci bool sanity_checks; 4188c2ecf20Sopenharmony_ci bool max_disp_clk; 4198c2ecf20Sopenharmony_ci bool surface_trace; 4208c2ecf20Sopenharmony_ci bool timing_trace; 4218c2ecf20Sopenharmony_ci bool clock_trace; 4228c2ecf20Sopenharmony_ci bool validation_trace; 4238c2ecf20Sopenharmony_ci bool bandwidth_calcs_trace; 4248c2ecf20Sopenharmony_ci int max_downscale_src_width; 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci /* stutter efficiency related */ 4278c2ecf20Sopenharmony_ci bool disable_stutter; 4288c2ecf20Sopenharmony_ci bool use_max_lb; 4298c2ecf20Sopenharmony_ci enum dcc_option disable_dcc; 4308c2ecf20Sopenharmony_ci enum pipe_split_policy pipe_split_policy; 4318c2ecf20Sopenharmony_ci bool force_single_disp_pipe_split; 4328c2ecf20Sopenharmony_ci bool voltage_align_fclk; 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci bool disable_dfs_bypass; 4358c2ecf20Sopenharmony_ci bool disable_dpp_power_gate; 4368c2ecf20Sopenharmony_ci bool disable_hubp_power_gate; 4378c2ecf20Sopenharmony_ci bool disable_dsc_power_gate; 4388c2ecf20Sopenharmony_ci int dsc_min_slice_height_override; 4398c2ecf20Sopenharmony_ci int dsc_bpp_increment_div; 4408c2ecf20Sopenharmony_ci bool native422_support; 4418c2ecf20Sopenharmony_ci bool disable_pplib_wm_range; 4428c2ecf20Sopenharmony_ci enum wm_report_mode pplib_wm_report_mode; 4438c2ecf20Sopenharmony_ci unsigned int min_disp_clk_khz; 4448c2ecf20Sopenharmony_ci unsigned int min_dpp_clk_khz; 4458c2ecf20Sopenharmony_ci int sr_exit_time_dpm0_ns; 4468c2ecf20Sopenharmony_ci int sr_enter_plus_exit_time_dpm0_ns; 4478c2ecf20Sopenharmony_ci int sr_exit_time_ns; 4488c2ecf20Sopenharmony_ci int sr_enter_plus_exit_time_ns; 4498c2ecf20Sopenharmony_ci int urgent_latency_ns; 4508c2ecf20Sopenharmony_ci uint32_t underflow_assert_delay_us; 4518c2ecf20Sopenharmony_ci int percent_of_ideal_drambw; 4528c2ecf20Sopenharmony_ci int dram_clock_change_latency_ns; 4538c2ecf20Sopenharmony_ci bool optimized_watermark; 4548c2ecf20Sopenharmony_ci int always_scale; 4558c2ecf20Sopenharmony_ci bool disable_pplib_clock_request; 4568c2ecf20Sopenharmony_ci bool disable_clock_gate; 4578c2ecf20Sopenharmony_ci bool disable_mem_low_power; 4588c2ecf20Sopenharmony_ci bool disable_dmcu; 4598c2ecf20Sopenharmony_ci bool disable_psr; 4608c2ecf20Sopenharmony_ci bool force_abm_enable; 4618c2ecf20Sopenharmony_ci bool disable_stereo_support; 4628c2ecf20Sopenharmony_ci bool vsr_support; 4638c2ecf20Sopenharmony_ci bool performance_trace; 4648c2ecf20Sopenharmony_ci bool az_endpoint_mute_only; 4658c2ecf20Sopenharmony_ci bool always_use_regamma; 4668c2ecf20Sopenharmony_ci bool p010_mpo_support; 4678c2ecf20Sopenharmony_ci bool recovery_enabled; 4688c2ecf20Sopenharmony_ci bool avoid_vbios_exec_table; 4698c2ecf20Sopenharmony_ci bool scl_reset_length10; 4708c2ecf20Sopenharmony_ci bool hdmi20_disable; 4718c2ecf20Sopenharmony_ci bool skip_detection_link_training; 4728c2ecf20Sopenharmony_ci bool edid_read_retry_times; 4738c2ecf20Sopenharmony_ci bool remove_disconnect_edp; 4748c2ecf20Sopenharmony_ci unsigned int force_odm_combine; //bit vector based on otg inst 4758c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 4768c2ecf20Sopenharmony_ci unsigned int force_odm_combine_4to1; //bit vector based on otg inst 4778c2ecf20Sopenharmony_ci#endif 4788c2ecf20Sopenharmony_ci unsigned int force_fclk_khz; 4798c2ecf20Sopenharmony_ci bool enable_tri_buf; 4808c2ecf20Sopenharmony_ci bool dmub_offload_enabled; 4818c2ecf20Sopenharmony_ci bool dmcub_emulation; 4828c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 4838c2ecf20Sopenharmony_ci bool disable_idle_power_optimizations; 4848c2ecf20Sopenharmony_ci#endif 4858c2ecf20Sopenharmony_ci bool dmub_command_table; /* for testing only */ 4868c2ecf20Sopenharmony_ci struct dc_bw_validation_profile bw_val_profile; 4878c2ecf20Sopenharmony_ci bool disable_fec; 4888c2ecf20Sopenharmony_ci bool disable_48mhz_pwrdwn; 4898c2ecf20Sopenharmony_ci /* This forces a hard min on the DCFCLK requested to SMU/PP 4908c2ecf20Sopenharmony_ci * watermarks are not affected. 4918c2ecf20Sopenharmony_ci */ 4928c2ecf20Sopenharmony_ci unsigned int force_min_dcfclk_mhz; 4938c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 4948c2ecf20Sopenharmony_ci int dwb_fi_phase; 4958c2ecf20Sopenharmony_ci#endif 4968c2ecf20Sopenharmony_ci bool disable_timing_sync; 4978c2ecf20Sopenharmony_ci bool cm_in_bypass; 4988c2ecf20Sopenharmony_ci int force_clock_mode;/*every mode change.*/ 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_ci bool disable_dram_clock_change_vactive_support; 5018c2ecf20Sopenharmony_ci bool validate_dml_output; 5028c2ecf20Sopenharmony_ci bool enable_dmcub_surface_flip; 5038c2ecf20Sopenharmony_ci bool usbc_combo_phy_reset_wa; 5048c2ecf20Sopenharmony_ci bool disable_dsc; 5058c2ecf20Sopenharmony_ci bool enable_dram_clock_change_one_display_vactive; 5068c2ecf20Sopenharmony_ci bool force_ignore_link_settings; 5078c2ecf20Sopenharmony_ci}; 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_cistruct dc_debug_data { 5108c2ecf20Sopenharmony_ci uint32_t ltFailCount; 5118c2ecf20Sopenharmony_ci uint32_t i2cErrorCount; 5128c2ecf20Sopenharmony_ci uint32_t auxErrorCount; 5138c2ecf20Sopenharmony_ci}; 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_cistruct dc_phy_addr_space_config { 5168c2ecf20Sopenharmony_ci struct { 5178c2ecf20Sopenharmony_ci uint64_t start_addr; 5188c2ecf20Sopenharmony_ci uint64_t end_addr; 5198c2ecf20Sopenharmony_ci uint64_t fb_top; 5208c2ecf20Sopenharmony_ci uint64_t fb_offset; 5218c2ecf20Sopenharmony_ci uint64_t fb_base; 5228c2ecf20Sopenharmony_ci uint64_t agp_top; 5238c2ecf20Sopenharmony_ci uint64_t agp_bot; 5248c2ecf20Sopenharmony_ci uint64_t agp_base; 5258c2ecf20Sopenharmony_ci } system_aperture; 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci struct { 5288c2ecf20Sopenharmony_ci uint64_t page_table_start_addr; 5298c2ecf20Sopenharmony_ci uint64_t page_table_end_addr; 5308c2ecf20Sopenharmony_ci uint64_t page_table_base_addr; 5318c2ecf20Sopenharmony_ci } gart_config; 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_ci bool valid; 5348c2ecf20Sopenharmony_ci bool is_hvm_enabled; 5358c2ecf20Sopenharmony_ci uint64_t page_table_default_page_addr; 5368c2ecf20Sopenharmony_ci}; 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_cistruct dc_virtual_addr_space_config { 5398c2ecf20Sopenharmony_ci uint64_t page_table_base_addr; 5408c2ecf20Sopenharmony_ci uint64_t page_table_start_addr; 5418c2ecf20Sopenharmony_ci uint64_t page_table_end_addr; 5428c2ecf20Sopenharmony_ci uint32_t page_table_block_size_in_bytes; 5438c2ecf20Sopenharmony_ci uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid 5448c2ecf20Sopenharmony_ci}; 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_cistruct dc_bounding_box_overrides { 5478c2ecf20Sopenharmony_ci int sr_exit_time_ns; 5488c2ecf20Sopenharmony_ci int sr_enter_plus_exit_time_ns; 5498c2ecf20Sopenharmony_ci int urgent_latency_ns; 5508c2ecf20Sopenharmony_ci int percent_of_ideal_drambw; 5518c2ecf20Sopenharmony_ci int dram_clock_change_latency_ns; 5528c2ecf20Sopenharmony_ci int dummy_clock_change_latency_ns; 5538c2ecf20Sopenharmony_ci /* This forces a hard min on the DCFCLK we use 5548c2ecf20Sopenharmony_ci * for DML. Unlike the debug option for forcing 5558c2ecf20Sopenharmony_ci * DCFCLK, this override affects watermark calculations 5568c2ecf20Sopenharmony_ci */ 5578c2ecf20Sopenharmony_ci int min_dcfclk_mhz; 5588c2ecf20Sopenharmony_ci}; 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_cistruct dc_state; 5618c2ecf20Sopenharmony_cistruct resource_pool; 5628c2ecf20Sopenharmony_cistruct dce_hwseq; 5638c2ecf20Sopenharmony_cistruct gpu_info_soc_bounding_box_v1_0; 5648c2ecf20Sopenharmony_cistruct dc { 5658c2ecf20Sopenharmony_ci struct dc_versions versions; 5668c2ecf20Sopenharmony_ci struct dc_caps caps; 5678c2ecf20Sopenharmony_ci struct dc_cap_funcs cap_funcs; 5688c2ecf20Sopenharmony_ci struct dc_config config; 5698c2ecf20Sopenharmony_ci struct dc_debug_options debug; 5708c2ecf20Sopenharmony_ci struct dc_bounding_box_overrides bb_overrides; 5718c2ecf20Sopenharmony_ci struct dc_bug_wa work_arounds; 5728c2ecf20Sopenharmony_ci struct dc_context *ctx; 5738c2ecf20Sopenharmony_ci struct dc_phy_addr_space_config vm_pa_config; 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci uint8_t link_count; 5768c2ecf20Sopenharmony_ci struct dc_link *links[MAX_PIPES * 2]; 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci struct dc_state *current_state; 5798c2ecf20Sopenharmony_ci struct resource_pool *res_pool; 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci struct clk_mgr *clk_mgr; 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_ci /* Display Engine Clock levels */ 5848c2ecf20Sopenharmony_ci struct dm_pp_clock_levels sclk_lvls; 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_ci /* Inputs into BW and WM calculations. */ 5878c2ecf20Sopenharmony_ci struct bw_calcs_dceip *bw_dceip; 5888c2ecf20Sopenharmony_ci struct bw_calcs_vbios *bw_vbios; 5898c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMD_DC_DCN 5908c2ecf20Sopenharmony_ci struct dcn_soc_bounding_box *dcn_soc; 5918c2ecf20Sopenharmony_ci struct dcn_ip_params *dcn_ip; 5928c2ecf20Sopenharmony_ci struct display_mode_lib dml; 5938c2ecf20Sopenharmony_ci#endif 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_ci /* HW functions */ 5968c2ecf20Sopenharmony_ci struct hw_sequencer_funcs hwss; 5978c2ecf20Sopenharmony_ci struct dce_hwseq *hwseq; 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_ci /* Require to optimize clocks and bandwidth for added/removed planes */ 6008c2ecf20Sopenharmony_ci bool optimized_required; 6018c2ecf20Sopenharmony_ci bool wm_optimized_required; 6028c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 6038c2ecf20Sopenharmony_ci bool idle_optimizations_allowed; 6048c2ecf20Sopenharmony_ci#endif 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_ci /* Require to maintain clocks and bandwidth for UEFI enabled HW */ 6078c2ecf20Sopenharmony_ci int optimize_seamless_boot_streams; 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ci /* FBC compressor */ 6108c2ecf20Sopenharmony_ci struct compressor *fbc_compressor; 6118c2ecf20Sopenharmony_ci 6128c2ecf20Sopenharmony_ci struct dc_debug_data debug_data; 6138c2ecf20Sopenharmony_ci struct dpcd_vendor_signature vendor_signature; 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci const char *build_id; 6168c2ecf20Sopenharmony_ci struct vm_helper *vm_helper; 6178c2ecf20Sopenharmony_ci const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; 6188c2ecf20Sopenharmony_ci}; 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_cienum frame_buffer_mode { 6218c2ecf20Sopenharmony_ci FRAME_BUFFER_MODE_LOCAL_ONLY = 0, 6228c2ecf20Sopenharmony_ci FRAME_BUFFER_MODE_ZFB_ONLY, 6238c2ecf20Sopenharmony_ci FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL, 6248c2ecf20Sopenharmony_ci} ; 6258c2ecf20Sopenharmony_ci 6268c2ecf20Sopenharmony_cistruct dchub_init_data { 6278c2ecf20Sopenharmony_ci int64_t zfb_phys_addr_base; 6288c2ecf20Sopenharmony_ci int64_t zfb_mc_base_addr; 6298c2ecf20Sopenharmony_ci uint64_t zfb_size_in_byte; 6308c2ecf20Sopenharmony_ci enum frame_buffer_mode fb_mode; 6318c2ecf20Sopenharmony_ci bool dchub_initialzied; 6328c2ecf20Sopenharmony_ci bool dchub_info_valid; 6338c2ecf20Sopenharmony_ci}; 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_cistruct dc_init_data { 6368c2ecf20Sopenharmony_ci struct hw_asic_id asic_id; 6378c2ecf20Sopenharmony_ci void *driver; /* ctx */ 6388c2ecf20Sopenharmony_ci struct cgs_device *cgs_device; 6398c2ecf20Sopenharmony_ci struct dc_bounding_box_overrides bb_overrides; 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_ci int num_virtual_links; 6428c2ecf20Sopenharmony_ci /* 6438c2ecf20Sopenharmony_ci * If 'vbios_override' not NULL, it will be called instead 6448c2ecf20Sopenharmony_ci * of the real VBIOS. Intended use is Diagnostics on FPGA. 6458c2ecf20Sopenharmony_ci */ 6468c2ecf20Sopenharmony_ci struct dc_bios *vbios_override; 6478c2ecf20Sopenharmony_ci enum dce_environment dce_environment; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci struct dmub_offload_funcs *dmub_if; 6508c2ecf20Sopenharmony_ci struct dc_reg_helper_state *dmub_offload; 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci struct dc_config flags; 6538c2ecf20Sopenharmony_ci uint64_t log_mask; 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci /** 6568c2ecf20Sopenharmony_ci * gpu_info FW provided soc bounding box struct or 0 if not 6578c2ecf20Sopenharmony_ci * available in FW 6588c2ecf20Sopenharmony_ci */ 6598c2ecf20Sopenharmony_ci const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; 6608c2ecf20Sopenharmony_ci struct dpcd_vendor_signature vendor_signature; 6618c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 6628c2ecf20Sopenharmony_ci bool force_smu_not_present; 6638c2ecf20Sopenharmony_ci#endif 6648c2ecf20Sopenharmony_ci bool force_ignore_link_settings; 6658c2ecf20Sopenharmony_ci}; 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_cistruct dc_callback_init { 6688c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_AMD_DC_HDCP 6698c2ecf20Sopenharmony_ci struct cp_psp cp_psp; 6708c2ecf20Sopenharmony_ci#else 6718c2ecf20Sopenharmony_ci uint8_t reserved; 6728c2ecf20Sopenharmony_ci#endif 6738c2ecf20Sopenharmony_ci}; 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_cistruct dc *dc_create(const struct dc_init_data *init_params); 6768c2ecf20Sopenharmony_civoid dc_hardware_init(struct dc *dc); 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_ciint dc_get_vmid_use_vector(struct dc *dc); 6798c2ecf20Sopenharmony_civoid dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid); 6808c2ecf20Sopenharmony_ci/* Returns the number of vmids supported */ 6818c2ecf20Sopenharmony_ciint dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config); 6828c2ecf20Sopenharmony_civoid dc_init_callbacks(struct dc *dc, 6838c2ecf20Sopenharmony_ci const struct dc_callback_init *init_params); 6848c2ecf20Sopenharmony_civoid dc_deinit_callbacks(struct dc *dc); 6858c2ecf20Sopenharmony_civoid dc_destroy(struct dc **dc); 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci/******************************************************************************* 6888c2ecf20Sopenharmony_ci * Surface Interfaces 6898c2ecf20Sopenharmony_ci ******************************************************************************/ 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_cienum { 6928c2ecf20Sopenharmony_ci TRANSFER_FUNC_POINTS = 1025 6938c2ecf20Sopenharmony_ci}; 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_cistruct dc_hdr_static_metadata { 6968c2ecf20Sopenharmony_ci /* display chromaticities and white point in units of 0.00001 */ 6978c2ecf20Sopenharmony_ci unsigned int chromaticity_green_x; 6988c2ecf20Sopenharmony_ci unsigned int chromaticity_green_y; 6998c2ecf20Sopenharmony_ci unsigned int chromaticity_blue_x; 7008c2ecf20Sopenharmony_ci unsigned int chromaticity_blue_y; 7018c2ecf20Sopenharmony_ci unsigned int chromaticity_red_x; 7028c2ecf20Sopenharmony_ci unsigned int chromaticity_red_y; 7038c2ecf20Sopenharmony_ci unsigned int chromaticity_white_point_x; 7048c2ecf20Sopenharmony_ci unsigned int chromaticity_white_point_y; 7058c2ecf20Sopenharmony_ci 7068c2ecf20Sopenharmony_ci uint32_t min_luminance; 7078c2ecf20Sopenharmony_ci uint32_t max_luminance; 7088c2ecf20Sopenharmony_ci uint32_t maximum_content_light_level; 7098c2ecf20Sopenharmony_ci uint32_t maximum_frame_average_light_level; 7108c2ecf20Sopenharmony_ci}; 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_cienum dc_transfer_func_type { 7138c2ecf20Sopenharmony_ci TF_TYPE_PREDEFINED, 7148c2ecf20Sopenharmony_ci TF_TYPE_DISTRIBUTED_POINTS, 7158c2ecf20Sopenharmony_ci TF_TYPE_BYPASS, 7168c2ecf20Sopenharmony_ci TF_TYPE_HWPWL 7178c2ecf20Sopenharmony_ci}; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_cistruct dc_transfer_func_distributed_points { 7208c2ecf20Sopenharmony_ci struct fixed31_32 red[TRANSFER_FUNC_POINTS]; 7218c2ecf20Sopenharmony_ci struct fixed31_32 green[TRANSFER_FUNC_POINTS]; 7228c2ecf20Sopenharmony_ci struct fixed31_32 blue[TRANSFER_FUNC_POINTS]; 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_ci uint16_t end_exponent; 7258c2ecf20Sopenharmony_ci uint16_t x_point_at_y1_red; 7268c2ecf20Sopenharmony_ci uint16_t x_point_at_y1_green; 7278c2ecf20Sopenharmony_ci uint16_t x_point_at_y1_blue; 7288c2ecf20Sopenharmony_ci}; 7298c2ecf20Sopenharmony_ci 7308c2ecf20Sopenharmony_cienum dc_transfer_func_predefined { 7318c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_SRGB, 7328c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_BT709, 7338c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_PQ, 7348c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_LINEAR, 7358c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_UNITY, 7368c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_HLG, 7378c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_HLG12, 7388c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_GAMMA22, 7398c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_GAMMA24, 7408c2ecf20Sopenharmony_ci TRANSFER_FUNCTION_GAMMA26 7418c2ecf20Sopenharmony_ci}; 7428c2ecf20Sopenharmony_ci 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_cistruct dc_transfer_func { 7458c2ecf20Sopenharmony_ci struct kref refcount; 7468c2ecf20Sopenharmony_ci enum dc_transfer_func_type type; 7478c2ecf20Sopenharmony_ci enum dc_transfer_func_predefined tf; 7488c2ecf20Sopenharmony_ci /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/ 7498c2ecf20Sopenharmony_ci uint32_t sdr_ref_white_level; 7508c2ecf20Sopenharmony_ci union { 7518c2ecf20Sopenharmony_ci struct pwl_params pwl; 7528c2ecf20Sopenharmony_ci struct dc_transfer_func_distributed_points tf_pts; 7538c2ecf20Sopenharmony_ci }; 7548c2ecf20Sopenharmony_ci}; 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ciunion dc_3dlut_state { 7588c2ecf20Sopenharmony_ci struct { 7598c2ecf20Sopenharmony_ci uint32_t initialized:1; /*if 3dlut is went through color module for initialization */ 7608c2ecf20Sopenharmony_ci uint32_t rmu_idx_valid:1; /*if mux settings are valid*/ 7618c2ecf20Sopenharmony_ci uint32_t rmu_mux_num:3; /*index of mux to use*/ 7628c2ecf20Sopenharmony_ci uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/ 7638c2ecf20Sopenharmony_ci uint32_t mpc_rmu1_mux:4; 7648c2ecf20Sopenharmony_ci uint32_t mpc_rmu2_mux:4; 7658c2ecf20Sopenharmony_ci uint32_t reserved:15; 7668c2ecf20Sopenharmony_ci } bits; 7678c2ecf20Sopenharmony_ci uint32_t raw; 7688c2ecf20Sopenharmony_ci}; 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci 7718c2ecf20Sopenharmony_cistruct dc_3dlut { 7728c2ecf20Sopenharmony_ci struct kref refcount; 7738c2ecf20Sopenharmony_ci struct tetrahedral_params lut_3d; 7748c2ecf20Sopenharmony_ci struct fixed31_32 hdr_multiplier; 7758c2ecf20Sopenharmony_ci union dc_3dlut_state state; 7768c2ecf20Sopenharmony_ci}; 7778c2ecf20Sopenharmony_ci/* 7788c2ecf20Sopenharmony_ci * This structure is filled in by dc_surface_get_status and contains 7798c2ecf20Sopenharmony_ci * the last requested address and the currently active address so the called 7808c2ecf20Sopenharmony_ci * can determine if there are any outstanding flips 7818c2ecf20Sopenharmony_ci */ 7828c2ecf20Sopenharmony_cistruct dc_plane_status { 7838c2ecf20Sopenharmony_ci struct dc_plane_address requested_address; 7848c2ecf20Sopenharmony_ci struct dc_plane_address current_address; 7858c2ecf20Sopenharmony_ci bool is_flip_pending; 7868c2ecf20Sopenharmony_ci bool is_right_eye; 7878c2ecf20Sopenharmony_ci}; 7888c2ecf20Sopenharmony_ci 7898c2ecf20Sopenharmony_ciunion surface_update_flags { 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_ci struct { 7928c2ecf20Sopenharmony_ci uint32_t addr_update:1; 7938c2ecf20Sopenharmony_ci /* Medium updates */ 7948c2ecf20Sopenharmony_ci uint32_t dcc_change:1; 7958c2ecf20Sopenharmony_ci uint32_t color_space_change:1; 7968c2ecf20Sopenharmony_ci uint32_t horizontal_mirror_change:1; 7978c2ecf20Sopenharmony_ci uint32_t per_pixel_alpha_change:1; 7988c2ecf20Sopenharmony_ci uint32_t global_alpha_change:1; 7998c2ecf20Sopenharmony_ci uint32_t hdr_mult:1; 8008c2ecf20Sopenharmony_ci uint32_t rotation_change:1; 8018c2ecf20Sopenharmony_ci uint32_t swizzle_change:1; 8028c2ecf20Sopenharmony_ci uint32_t scaling_change:1; 8038c2ecf20Sopenharmony_ci uint32_t position_change:1; 8048c2ecf20Sopenharmony_ci uint32_t in_transfer_func_change:1; 8058c2ecf20Sopenharmony_ci uint32_t input_csc_change:1; 8068c2ecf20Sopenharmony_ci uint32_t coeff_reduction_change:1; 8078c2ecf20Sopenharmony_ci uint32_t output_tf_change:1; 8088c2ecf20Sopenharmony_ci uint32_t pixel_format_change:1; 8098c2ecf20Sopenharmony_ci uint32_t plane_size_change:1; 8108c2ecf20Sopenharmony_ci uint32_t gamut_remap_change:1; 8118c2ecf20Sopenharmony_ci 8128c2ecf20Sopenharmony_ci /* Full updates */ 8138c2ecf20Sopenharmony_ci uint32_t new_plane:1; 8148c2ecf20Sopenharmony_ci uint32_t bpp_change:1; 8158c2ecf20Sopenharmony_ci uint32_t gamma_change:1; 8168c2ecf20Sopenharmony_ci uint32_t bandwidth_change:1; 8178c2ecf20Sopenharmony_ci uint32_t clock_change:1; 8188c2ecf20Sopenharmony_ci uint32_t stereo_format_change:1; 8198c2ecf20Sopenharmony_ci uint32_t full_update:1; 8208c2ecf20Sopenharmony_ci } bits; 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_ci uint32_t raw; 8238c2ecf20Sopenharmony_ci}; 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_cistruct dc_plane_state { 8268c2ecf20Sopenharmony_ci struct dc_plane_address address; 8278c2ecf20Sopenharmony_ci struct dc_plane_flip_time time; 8288c2ecf20Sopenharmony_ci bool triplebuffer_flips; 8298c2ecf20Sopenharmony_ci struct scaling_taps scaling_quality; 8308c2ecf20Sopenharmony_ci struct rect src_rect; 8318c2ecf20Sopenharmony_ci struct rect dst_rect; 8328c2ecf20Sopenharmony_ci struct rect clip_rect; 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_ci struct plane_size plane_size; 8358c2ecf20Sopenharmony_ci union dc_tiling_info tiling_info; 8368c2ecf20Sopenharmony_ci 8378c2ecf20Sopenharmony_ci struct dc_plane_dcc_param dcc; 8388c2ecf20Sopenharmony_ci 8398c2ecf20Sopenharmony_ci struct dc_gamma *gamma_correction; 8408c2ecf20Sopenharmony_ci struct dc_transfer_func *in_transfer_func; 8418c2ecf20Sopenharmony_ci struct dc_bias_and_scale *bias_and_scale; 8428c2ecf20Sopenharmony_ci struct dc_csc_transform input_csc_color_matrix; 8438c2ecf20Sopenharmony_ci struct fixed31_32 coeff_reduction_factor; 8448c2ecf20Sopenharmony_ci struct fixed31_32 hdr_mult; 8458c2ecf20Sopenharmony_ci struct colorspace_transform gamut_remap_matrix; 8468c2ecf20Sopenharmony_ci 8478c2ecf20Sopenharmony_ci // TODO: No longer used, remove 8488c2ecf20Sopenharmony_ci struct dc_hdr_static_metadata hdr_static_ctx; 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_ci enum dc_color_space color_space; 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_ci struct dc_3dlut *lut3d_func; 8538c2ecf20Sopenharmony_ci struct dc_transfer_func *in_shaper_func; 8548c2ecf20Sopenharmony_ci struct dc_transfer_func *blend_tf; 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 8578c2ecf20Sopenharmony_ci struct dc_transfer_func *gamcor_tf; 8588c2ecf20Sopenharmony_ci#endif 8598c2ecf20Sopenharmony_ci enum surface_pixel_format format; 8608c2ecf20Sopenharmony_ci enum dc_rotation_angle rotation; 8618c2ecf20Sopenharmony_ci enum plane_stereo_format stereo_format; 8628c2ecf20Sopenharmony_ci 8638c2ecf20Sopenharmony_ci bool is_tiling_rotated; 8648c2ecf20Sopenharmony_ci bool per_pixel_alpha; 8658c2ecf20Sopenharmony_ci bool global_alpha; 8668c2ecf20Sopenharmony_ci int global_alpha_value; 8678c2ecf20Sopenharmony_ci bool visible; 8688c2ecf20Sopenharmony_ci bool flip_immediate; 8698c2ecf20Sopenharmony_ci bool horizontal_mirror; 8708c2ecf20Sopenharmony_ci int layer_index; 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci union surface_update_flags update_flags; 8738c2ecf20Sopenharmony_ci /* private to DC core */ 8748c2ecf20Sopenharmony_ci struct dc_plane_status status; 8758c2ecf20Sopenharmony_ci struct dc_context *ctx; 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_ci /* HACK: Workaround for forcing full reprogramming under some conditions */ 8788c2ecf20Sopenharmony_ci bool force_full_update; 8798c2ecf20Sopenharmony_ci 8808c2ecf20Sopenharmony_ci /* private to dc_surface.c */ 8818c2ecf20Sopenharmony_ci enum dc_irq_source irq_source; 8828c2ecf20Sopenharmony_ci struct kref refcount; 8838c2ecf20Sopenharmony_ci}; 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_cistruct dc_plane_info { 8868c2ecf20Sopenharmony_ci struct plane_size plane_size; 8878c2ecf20Sopenharmony_ci union dc_tiling_info tiling_info; 8888c2ecf20Sopenharmony_ci struct dc_plane_dcc_param dcc; 8898c2ecf20Sopenharmony_ci enum surface_pixel_format format; 8908c2ecf20Sopenharmony_ci enum dc_rotation_angle rotation; 8918c2ecf20Sopenharmony_ci enum plane_stereo_format stereo_format; 8928c2ecf20Sopenharmony_ci enum dc_color_space color_space; 8938c2ecf20Sopenharmony_ci bool horizontal_mirror; 8948c2ecf20Sopenharmony_ci bool visible; 8958c2ecf20Sopenharmony_ci bool per_pixel_alpha; 8968c2ecf20Sopenharmony_ci bool global_alpha; 8978c2ecf20Sopenharmony_ci int global_alpha_value; 8988c2ecf20Sopenharmony_ci bool input_csc_enabled; 8998c2ecf20Sopenharmony_ci int layer_index; 9008c2ecf20Sopenharmony_ci}; 9018c2ecf20Sopenharmony_ci 9028c2ecf20Sopenharmony_cistruct dc_scaling_info { 9038c2ecf20Sopenharmony_ci struct rect src_rect; 9048c2ecf20Sopenharmony_ci struct rect dst_rect; 9058c2ecf20Sopenharmony_ci struct rect clip_rect; 9068c2ecf20Sopenharmony_ci struct scaling_taps scaling_quality; 9078c2ecf20Sopenharmony_ci}; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_cistruct dc_surface_update { 9108c2ecf20Sopenharmony_ci struct dc_plane_state *surface; 9118c2ecf20Sopenharmony_ci 9128c2ecf20Sopenharmony_ci /* isr safe update parameters. null means no updates */ 9138c2ecf20Sopenharmony_ci const struct dc_flip_addrs *flip_addr; 9148c2ecf20Sopenharmony_ci const struct dc_plane_info *plane_info; 9158c2ecf20Sopenharmony_ci const struct dc_scaling_info *scaling_info; 9168c2ecf20Sopenharmony_ci struct fixed31_32 hdr_mult; 9178c2ecf20Sopenharmony_ci /* following updates require alloc/sleep/spin that is not isr safe, 9188c2ecf20Sopenharmony_ci * null means no updates 9198c2ecf20Sopenharmony_ci */ 9208c2ecf20Sopenharmony_ci const struct dc_gamma *gamma; 9218c2ecf20Sopenharmony_ci const struct dc_transfer_func *in_transfer_func; 9228c2ecf20Sopenharmony_ci 9238c2ecf20Sopenharmony_ci const struct dc_csc_transform *input_csc_color_matrix; 9248c2ecf20Sopenharmony_ci const struct fixed31_32 *coeff_reduction_factor; 9258c2ecf20Sopenharmony_ci const struct dc_transfer_func *func_shaper; 9268c2ecf20Sopenharmony_ci const struct dc_3dlut *lut3d_func; 9278c2ecf20Sopenharmony_ci const struct dc_transfer_func *blend_tf; 9288c2ecf20Sopenharmony_ci const struct colorspace_transform *gamut_remap_matrix; 9298c2ecf20Sopenharmony_ci}; 9308c2ecf20Sopenharmony_ci 9318c2ecf20Sopenharmony_ci/* 9328c2ecf20Sopenharmony_ci * Create a new surface with default parameters; 9338c2ecf20Sopenharmony_ci */ 9348c2ecf20Sopenharmony_cistruct dc_plane_state *dc_create_plane_state(struct dc *dc); 9358c2ecf20Sopenharmony_ciconst struct dc_plane_status *dc_plane_get_status( 9368c2ecf20Sopenharmony_ci const struct dc_plane_state *plane_state); 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_civoid dc_plane_state_retain(struct dc_plane_state *plane_state); 9398c2ecf20Sopenharmony_civoid dc_plane_state_release(struct dc_plane_state *plane_state); 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_civoid dc_gamma_retain(struct dc_gamma *dc_gamma); 9428c2ecf20Sopenharmony_civoid dc_gamma_release(struct dc_gamma **dc_gamma); 9438c2ecf20Sopenharmony_cistruct dc_gamma *dc_create_gamma(void); 9448c2ecf20Sopenharmony_ci 9458c2ecf20Sopenharmony_civoid dc_transfer_func_retain(struct dc_transfer_func *dc_tf); 9468c2ecf20Sopenharmony_civoid dc_transfer_func_release(struct dc_transfer_func *dc_tf); 9478c2ecf20Sopenharmony_cistruct dc_transfer_func *dc_create_transfer_func(void); 9488c2ecf20Sopenharmony_ci 9498c2ecf20Sopenharmony_cistruct dc_3dlut *dc_create_3dlut_func(void); 9508c2ecf20Sopenharmony_civoid dc_3dlut_func_release(struct dc_3dlut *lut); 9518c2ecf20Sopenharmony_civoid dc_3dlut_func_retain(struct dc_3dlut *lut); 9528c2ecf20Sopenharmony_ci/* 9538c2ecf20Sopenharmony_ci * This structure holds a surface address. There could be multiple addresses 9548c2ecf20Sopenharmony_ci * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such 9558c2ecf20Sopenharmony_ci * as frame durations and DCC format can also be set. 9568c2ecf20Sopenharmony_ci */ 9578c2ecf20Sopenharmony_cistruct dc_flip_addrs { 9588c2ecf20Sopenharmony_ci struct dc_plane_address address; 9598c2ecf20Sopenharmony_ci unsigned int flip_timestamp_in_us; 9608c2ecf20Sopenharmony_ci bool flip_immediate; 9618c2ecf20Sopenharmony_ci /* TODO: add flip duration for FreeSync */ 9628c2ecf20Sopenharmony_ci bool triplebuffer_flips; 9638c2ecf20Sopenharmony_ci}; 9648c2ecf20Sopenharmony_ci 9658c2ecf20Sopenharmony_cibool dc_post_update_surfaces_to_stream( 9668c2ecf20Sopenharmony_ci struct dc *dc); 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_ci#include "dc_stream.h" 9698c2ecf20Sopenharmony_ci 9708c2ecf20Sopenharmony_ci/* 9718c2ecf20Sopenharmony_ci * Structure to store surface/stream associations for validation 9728c2ecf20Sopenharmony_ci */ 9738c2ecf20Sopenharmony_cistruct dc_validation_set { 9748c2ecf20Sopenharmony_ci struct dc_stream_state *stream; 9758c2ecf20Sopenharmony_ci struct dc_plane_state *plane_states[MAX_SURFACES]; 9768c2ecf20Sopenharmony_ci uint8_t plane_count; 9778c2ecf20Sopenharmony_ci}; 9788c2ecf20Sopenharmony_ci 9798c2ecf20Sopenharmony_cibool dc_validate_seamless_boot_timing(const struct dc *dc, 9808c2ecf20Sopenharmony_ci const struct dc_sink *sink, 9818c2ecf20Sopenharmony_ci struct dc_crtc_timing *crtc_timing); 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_cienum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state); 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_civoid get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info); 9868c2ecf20Sopenharmony_ci 9878c2ecf20Sopenharmony_cibool dc_set_generic_gpio_for_stereo(bool enable, 9888c2ecf20Sopenharmony_ci struct gpio_service *gpio_service); 9898c2ecf20Sopenharmony_ci 9908c2ecf20Sopenharmony_ci/* 9918c2ecf20Sopenharmony_ci * fast_validate: we return after determining if we can support the new state, 9928c2ecf20Sopenharmony_ci * but before we populate the programming info 9938c2ecf20Sopenharmony_ci */ 9948c2ecf20Sopenharmony_cienum dc_status dc_validate_global_state( 9958c2ecf20Sopenharmony_ci struct dc *dc, 9968c2ecf20Sopenharmony_ci struct dc_state *new_ctx, 9978c2ecf20Sopenharmony_ci bool fast_validate); 9988c2ecf20Sopenharmony_ci 9998c2ecf20Sopenharmony_ci 10008c2ecf20Sopenharmony_civoid dc_resource_state_construct( 10018c2ecf20Sopenharmony_ci const struct dc *dc, 10028c2ecf20Sopenharmony_ci struct dc_state *dst_ctx); 10038c2ecf20Sopenharmony_ci 10048c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 10058c2ecf20Sopenharmony_cibool dc_acquire_release_mpc_3dlut( 10068c2ecf20Sopenharmony_ci struct dc *dc, bool acquire, 10078c2ecf20Sopenharmony_ci struct dc_stream_state *stream, 10088c2ecf20Sopenharmony_ci struct dc_3dlut **lut, 10098c2ecf20Sopenharmony_ci struct dc_transfer_func **shaper); 10108c2ecf20Sopenharmony_ci#endif 10118c2ecf20Sopenharmony_ci 10128c2ecf20Sopenharmony_civoid dc_resource_state_copy_construct( 10138c2ecf20Sopenharmony_ci const struct dc_state *src_ctx, 10148c2ecf20Sopenharmony_ci struct dc_state *dst_ctx); 10158c2ecf20Sopenharmony_ci 10168c2ecf20Sopenharmony_civoid dc_resource_state_copy_construct_current( 10178c2ecf20Sopenharmony_ci const struct dc *dc, 10188c2ecf20Sopenharmony_ci struct dc_state *dst_ctx); 10198c2ecf20Sopenharmony_ci 10208c2ecf20Sopenharmony_civoid dc_resource_state_destruct(struct dc_state *context); 10218c2ecf20Sopenharmony_ci 10228c2ecf20Sopenharmony_cibool dc_resource_is_dsc_encoding_supported(const struct dc *dc); 10238c2ecf20Sopenharmony_ci 10248c2ecf20Sopenharmony_ci/* 10258c2ecf20Sopenharmony_ci * TODO update to make it about validation sets 10268c2ecf20Sopenharmony_ci * Set up streams and links associated to drive sinks 10278c2ecf20Sopenharmony_ci * The streams parameter is an absolute set of all active streams. 10288c2ecf20Sopenharmony_ci * 10298c2ecf20Sopenharmony_ci * After this call: 10308c2ecf20Sopenharmony_ci * Phy, Encoder, Timing Generator are programmed and enabled. 10318c2ecf20Sopenharmony_ci * New streams are enabled with blank stream; no memory read. 10328c2ecf20Sopenharmony_ci */ 10338c2ecf20Sopenharmony_cibool dc_commit_state(struct dc *dc, struct dc_state *context); 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_civoid dc_power_down_on_boot(struct dc *dc); 10368c2ecf20Sopenharmony_ci 10378c2ecf20Sopenharmony_cistruct dc_state *dc_create_state(struct dc *dc); 10388c2ecf20Sopenharmony_cistruct dc_state *dc_copy_state(struct dc_state *src_ctx); 10398c2ecf20Sopenharmony_civoid dc_retain_state(struct dc_state *context); 10408c2ecf20Sopenharmony_civoid dc_release_state(struct dc_state *context); 10418c2ecf20Sopenharmony_ci 10428c2ecf20Sopenharmony_ci/******************************************************************************* 10438c2ecf20Sopenharmony_ci * Link Interfaces 10448c2ecf20Sopenharmony_ci ******************************************************************************/ 10458c2ecf20Sopenharmony_ci 10468c2ecf20Sopenharmony_cistruct dpcd_caps { 10478c2ecf20Sopenharmony_ci union dpcd_rev dpcd_rev; 10488c2ecf20Sopenharmony_ci union max_lane_count max_ln_count; 10498c2ecf20Sopenharmony_ci union max_down_spread max_down_spread; 10508c2ecf20Sopenharmony_ci union dprx_feature dprx_feature; 10518c2ecf20Sopenharmony_ci 10528c2ecf20Sopenharmony_ci /* valid only for eDP v1.4 or higher*/ 10538c2ecf20Sopenharmony_ci uint8_t edp_supported_link_rates_count; 10548c2ecf20Sopenharmony_ci enum dc_link_rate edp_supported_link_rates[8]; 10558c2ecf20Sopenharmony_ci 10568c2ecf20Sopenharmony_ci /* dongle type (DP converter, CV smart dongle) */ 10578c2ecf20Sopenharmony_ci enum display_dongle_type dongle_type; 10588c2ecf20Sopenharmony_ci /* branch device or sink device */ 10598c2ecf20Sopenharmony_ci bool is_branch_dev; 10608c2ecf20Sopenharmony_ci /* Dongle's downstream count. */ 10618c2ecf20Sopenharmony_ci union sink_count sink_count; 10628c2ecf20Sopenharmony_ci /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 10638c2ecf20Sopenharmony_ci indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 10648c2ecf20Sopenharmony_ci struct dc_dongle_caps dongle_caps; 10658c2ecf20Sopenharmony_ci 10668c2ecf20Sopenharmony_ci uint32_t sink_dev_id; 10678c2ecf20Sopenharmony_ci int8_t sink_dev_id_str[6]; 10688c2ecf20Sopenharmony_ci int8_t sink_hw_revision; 10698c2ecf20Sopenharmony_ci int8_t sink_fw_revision[2]; 10708c2ecf20Sopenharmony_ci 10718c2ecf20Sopenharmony_ci uint32_t branch_dev_id; 10728c2ecf20Sopenharmony_ci int8_t branch_dev_name[6]; 10738c2ecf20Sopenharmony_ci int8_t branch_hw_revision; 10748c2ecf20Sopenharmony_ci int8_t branch_fw_revision[2]; 10758c2ecf20Sopenharmony_ci 10768c2ecf20Sopenharmony_ci bool allow_invalid_MSA_timing_param; 10778c2ecf20Sopenharmony_ci bool panel_mode_edp; 10788c2ecf20Sopenharmony_ci bool dpcd_display_control_capable; 10798c2ecf20Sopenharmony_ci bool ext_receiver_cap_field_present; 10808c2ecf20Sopenharmony_ci union dpcd_fec_capability fec_cap; 10818c2ecf20Sopenharmony_ci struct dpcd_dsc_capabilities dsc_caps; 10828c2ecf20Sopenharmony_ci struct dc_lttpr_caps lttpr_caps; 10838c2ecf20Sopenharmony_ci struct psr_caps psr_caps; 10848c2ecf20Sopenharmony_ci 10858c2ecf20Sopenharmony_ci}; 10868c2ecf20Sopenharmony_ci 10878c2ecf20Sopenharmony_ciunion dpcd_sink_ext_caps { 10888c2ecf20Sopenharmony_ci struct { 10898c2ecf20Sopenharmony_ci /* 0 - Sink supports backlight adjust via PWM during SDR/HDR mode 10908c2ecf20Sopenharmony_ci * 1 - Sink supports backlight adjust via AUX during SDR/HDR mode. 10918c2ecf20Sopenharmony_ci */ 10928c2ecf20Sopenharmony_ci uint8_t sdr_aux_backlight_control : 1; 10938c2ecf20Sopenharmony_ci uint8_t hdr_aux_backlight_control : 1; 10948c2ecf20Sopenharmony_ci uint8_t reserved_1 : 2; 10958c2ecf20Sopenharmony_ci uint8_t oled : 1; 10968c2ecf20Sopenharmony_ci uint8_t reserved : 3; 10978c2ecf20Sopenharmony_ci } bits; 10988c2ecf20Sopenharmony_ci uint8_t raw; 10998c2ecf20Sopenharmony_ci}; 11008c2ecf20Sopenharmony_ci 11018c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_HDCP) 11028c2ecf20Sopenharmony_ciunion hdcp_rx_caps { 11038c2ecf20Sopenharmony_ci struct { 11048c2ecf20Sopenharmony_ci uint8_t version; 11058c2ecf20Sopenharmony_ci uint8_t reserved; 11068c2ecf20Sopenharmony_ci struct { 11078c2ecf20Sopenharmony_ci uint8_t repeater : 1; 11088c2ecf20Sopenharmony_ci uint8_t hdcp_capable : 1; 11098c2ecf20Sopenharmony_ci uint8_t reserved : 6; 11108c2ecf20Sopenharmony_ci } byte0; 11118c2ecf20Sopenharmony_ci } fields; 11128c2ecf20Sopenharmony_ci uint8_t raw[3]; 11138c2ecf20Sopenharmony_ci}; 11148c2ecf20Sopenharmony_ci 11158c2ecf20Sopenharmony_ciunion hdcp_bcaps { 11168c2ecf20Sopenharmony_ci struct { 11178c2ecf20Sopenharmony_ci uint8_t HDCP_CAPABLE:1; 11188c2ecf20Sopenharmony_ci uint8_t REPEATER:1; 11198c2ecf20Sopenharmony_ci uint8_t RESERVED:6; 11208c2ecf20Sopenharmony_ci } bits; 11218c2ecf20Sopenharmony_ci uint8_t raw; 11228c2ecf20Sopenharmony_ci}; 11238c2ecf20Sopenharmony_ci 11248c2ecf20Sopenharmony_cistruct hdcp_caps { 11258c2ecf20Sopenharmony_ci union hdcp_rx_caps rx_caps; 11268c2ecf20Sopenharmony_ci union hdcp_bcaps bcaps; 11278c2ecf20Sopenharmony_ci}; 11288c2ecf20Sopenharmony_ci#endif 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_ci#include "dc_link.h" 11318c2ecf20Sopenharmony_ci 11328c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 11338c2ecf20Sopenharmony_ciuint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane); 11348c2ecf20Sopenharmony_ci 11358c2ecf20Sopenharmony_ci#endif 11368c2ecf20Sopenharmony_ci/******************************************************************************* 11378c2ecf20Sopenharmony_ci * Sink Interfaces - A sink corresponds to a display output device 11388c2ecf20Sopenharmony_ci ******************************************************************************/ 11398c2ecf20Sopenharmony_ci 11408c2ecf20Sopenharmony_cistruct dc_container_id { 11418c2ecf20Sopenharmony_ci // 128bit GUID in binary form 11428c2ecf20Sopenharmony_ci unsigned char guid[16]; 11438c2ecf20Sopenharmony_ci // 8 byte port ID -> ELD.PortID 11448c2ecf20Sopenharmony_ci unsigned int portId[2]; 11458c2ecf20Sopenharmony_ci // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName 11468c2ecf20Sopenharmony_ci unsigned short manufacturerName; 11478c2ecf20Sopenharmony_ci // 2 byte product code -> ELD.ProductCode 11488c2ecf20Sopenharmony_ci unsigned short productCode; 11498c2ecf20Sopenharmony_ci}; 11508c2ecf20Sopenharmony_ci 11518c2ecf20Sopenharmony_ci 11528c2ecf20Sopenharmony_cistruct dc_sink_dsc_caps { 11538c2ecf20Sopenharmony_ci // 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology), 11548c2ecf20Sopenharmony_ci // 'false' if they are sink's DSC caps 11558c2ecf20Sopenharmony_ci bool is_virtual_dpcd_dsc; 11568c2ecf20Sopenharmony_ci struct dsc_dec_dpcd_caps dsc_dec_caps; 11578c2ecf20Sopenharmony_ci}; 11588c2ecf20Sopenharmony_ci 11598c2ecf20Sopenharmony_cistruct dc_sink_fec_caps { 11608c2ecf20Sopenharmony_ci bool is_rx_fec_supported; 11618c2ecf20Sopenharmony_ci bool is_topology_fec_supported; 11628c2ecf20Sopenharmony_ci}; 11638c2ecf20Sopenharmony_ci 11648c2ecf20Sopenharmony_ci/* 11658c2ecf20Sopenharmony_ci * The sink structure contains EDID and other display device properties 11668c2ecf20Sopenharmony_ci */ 11678c2ecf20Sopenharmony_cistruct dc_sink { 11688c2ecf20Sopenharmony_ci enum signal_type sink_signal; 11698c2ecf20Sopenharmony_ci struct dc_edid dc_edid; /* raw edid */ 11708c2ecf20Sopenharmony_ci struct dc_edid_caps edid_caps; /* parse display caps */ 11718c2ecf20Sopenharmony_ci struct dc_container_id *dc_container_id; 11728c2ecf20Sopenharmony_ci uint32_t dongle_max_pix_clk; 11738c2ecf20Sopenharmony_ci void *priv; 11748c2ecf20Sopenharmony_ci struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX]; 11758c2ecf20Sopenharmony_ci bool converter_disable_audio; 11768c2ecf20Sopenharmony_ci bool is_mst_legacy; 11778c2ecf20Sopenharmony_ci struct dc_sink_dsc_caps dsc_caps; 11788c2ecf20Sopenharmony_ci struct dc_sink_fec_caps fec_caps; 11798c2ecf20Sopenharmony_ci 11808c2ecf20Sopenharmony_ci bool is_vsc_sdp_colorimetry_supported; 11818c2ecf20Sopenharmony_ci 11828c2ecf20Sopenharmony_ci /* private to DC core */ 11838c2ecf20Sopenharmony_ci struct dc_link *link; 11848c2ecf20Sopenharmony_ci struct dc_context *ctx; 11858c2ecf20Sopenharmony_ci 11868c2ecf20Sopenharmony_ci uint32_t sink_id; 11878c2ecf20Sopenharmony_ci 11888c2ecf20Sopenharmony_ci /* private to dc_sink.c */ 11898c2ecf20Sopenharmony_ci // refcount must be the last member in dc_sink, since we want the 11908c2ecf20Sopenharmony_ci // sink structure to be logically cloneable up to (but not including) 11918c2ecf20Sopenharmony_ci // refcount 11928c2ecf20Sopenharmony_ci struct kref refcount; 11938c2ecf20Sopenharmony_ci}; 11948c2ecf20Sopenharmony_ci 11958c2ecf20Sopenharmony_civoid dc_sink_retain(struct dc_sink *sink); 11968c2ecf20Sopenharmony_civoid dc_sink_release(struct dc_sink *sink); 11978c2ecf20Sopenharmony_ci 11988c2ecf20Sopenharmony_cistruct dc_sink_init_data { 11998c2ecf20Sopenharmony_ci enum signal_type sink_signal; 12008c2ecf20Sopenharmony_ci struct dc_link *link; 12018c2ecf20Sopenharmony_ci uint32_t dongle_max_pix_clk; 12028c2ecf20Sopenharmony_ci bool converter_disable_audio; 12038c2ecf20Sopenharmony_ci bool sink_is_legacy; 12048c2ecf20Sopenharmony_ci}; 12058c2ecf20Sopenharmony_ci 12068c2ecf20Sopenharmony_cistruct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params); 12078c2ecf20Sopenharmony_ci 12088c2ecf20Sopenharmony_ci/* Newer interfaces */ 12098c2ecf20Sopenharmony_cistruct dc_cursor { 12108c2ecf20Sopenharmony_ci struct dc_plane_address address; 12118c2ecf20Sopenharmony_ci struct dc_cursor_attributes attributes; 12128c2ecf20Sopenharmony_ci}; 12138c2ecf20Sopenharmony_ci 12148c2ecf20Sopenharmony_ci 12158c2ecf20Sopenharmony_ci/******************************************************************************* 12168c2ecf20Sopenharmony_ci * Interrupt interfaces 12178c2ecf20Sopenharmony_ci ******************************************************************************/ 12188c2ecf20Sopenharmony_cienum dc_irq_source dc_interrupt_to_irq_source( 12198c2ecf20Sopenharmony_ci struct dc *dc, 12208c2ecf20Sopenharmony_ci uint32_t src_id, 12218c2ecf20Sopenharmony_ci uint32_t ext_id); 12228c2ecf20Sopenharmony_cibool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable); 12238c2ecf20Sopenharmony_civoid dc_interrupt_ack(struct dc *dc, enum dc_irq_source src); 12248c2ecf20Sopenharmony_cienum dc_irq_source dc_get_hpd_irq_source_at_index( 12258c2ecf20Sopenharmony_ci struct dc *dc, uint32_t link_index); 12268c2ecf20Sopenharmony_ci 12278c2ecf20Sopenharmony_ci/******************************************************************************* 12288c2ecf20Sopenharmony_ci * Power Interfaces 12298c2ecf20Sopenharmony_ci ******************************************************************************/ 12308c2ecf20Sopenharmony_ci 12318c2ecf20Sopenharmony_civoid dc_set_power_state( 12328c2ecf20Sopenharmony_ci struct dc *dc, 12338c2ecf20Sopenharmony_ci enum dc_acpi_cm_power_state power_state); 12348c2ecf20Sopenharmony_civoid dc_resume(struct dc *dc); 12358c2ecf20Sopenharmony_ci 12368c2ecf20Sopenharmony_civoid dc_power_down_on_boot(struct dc *dc); 12378c2ecf20Sopenharmony_ci 12388c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_HDCP) 12398c2ecf20Sopenharmony_ci/* 12408c2ecf20Sopenharmony_ci * HDCP Interfaces 12418c2ecf20Sopenharmony_ci */ 12428c2ecf20Sopenharmony_cienum hdcp_message_status dc_process_hdcp_msg( 12438c2ecf20Sopenharmony_ci enum signal_type signal, 12448c2ecf20Sopenharmony_ci struct dc_link *link, 12458c2ecf20Sopenharmony_ci struct hdcp_protection_message *message_info); 12468c2ecf20Sopenharmony_ci#endif 12478c2ecf20Sopenharmony_cibool dc_is_dmcu_initialized(struct dc *dc); 12488c2ecf20Sopenharmony_ci 12498c2ecf20Sopenharmony_cienum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping); 12508c2ecf20Sopenharmony_civoid dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg); 12518c2ecf20Sopenharmony_ci#if defined(CONFIG_DRM_AMD_DC_DCN3_0) 12528c2ecf20Sopenharmony_ci 12538c2ecf20Sopenharmony_cibool dc_is_plane_eligible_for_idle_optimizations(struct dc *dc, 12548c2ecf20Sopenharmony_ci struct dc_plane_state *plane); 12558c2ecf20Sopenharmony_ci 12568c2ecf20Sopenharmony_civoid dc_allow_idle_optimizations(struct dc *dc, bool allow); 12578c2ecf20Sopenharmony_ci 12588c2ecf20Sopenharmony_ci/* 12598c2ecf20Sopenharmony_ci * blank all streams, and set min and max memory clock to 12608c2ecf20Sopenharmony_ci * lowest and highest DPM level, respectively 12618c2ecf20Sopenharmony_ci */ 12628c2ecf20Sopenharmony_civoid dc_unlock_memory_clock_frequency(struct dc *dc); 12638c2ecf20Sopenharmony_ci 12648c2ecf20Sopenharmony_ci/* 12658c2ecf20Sopenharmony_ci * set min memory clock to the min required for current mode, 12668c2ecf20Sopenharmony_ci * max to maxDPM, and unblank streams 12678c2ecf20Sopenharmony_ci */ 12688c2ecf20Sopenharmony_civoid dc_lock_memory_clock_frequency(struct dc *dc); 12698c2ecf20Sopenharmony_ci 12708c2ecf20Sopenharmony_ci#endif 12718c2ecf20Sopenharmony_ci 12728c2ecf20Sopenharmony_cibool dc_set_psr_allow_active(struct dc *dc, bool enable); 12738c2ecf20Sopenharmony_ci 12748c2ecf20Sopenharmony_ci/******************************************************************************* 12758c2ecf20Sopenharmony_ci * DSC Interfaces 12768c2ecf20Sopenharmony_ci ******************************************************************************/ 12778c2ecf20Sopenharmony_ci#include "dc_dsc.h" 12788c2ecf20Sopenharmony_ci#endif /* DC_INTERFACE_H_ */ 1279