1 1.1 riastrad /* $NetBSD: dc.h,v 1.2 2021/12/18 23:45:00 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright 2012-14 Advanced Micro Devices, Inc. 5 1.1 riastrad * 6 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 7 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 8 1.1 riastrad * to deal in the Software without restriction, including without limitation 9 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 11 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 12 1.1 riastrad * 13 1.1 riastrad * The above copyright notice and this permission notice shall be included in 14 1.1 riastrad * all copies or substantial portions of the Software. 15 1.1 riastrad * 16 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 1.1 riastrad * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 1.1 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 1.1 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 1.1 riastrad * OTHER DEALINGS IN THE SOFTWARE. 23 1.1 riastrad * 24 1.1 riastrad * Authors: AMD 25 1.1 riastrad * 26 1.1 riastrad */ 27 1.1 riastrad 28 1.1 riastrad #ifndef DC_INTERFACE_H_ 29 1.1 riastrad #define DC_INTERFACE_H_ 30 1.1 riastrad 31 1.1 riastrad #include "dc_types.h" 32 1.1 riastrad #include "grph_object_defs.h" 33 1.1 riastrad #include "logger_types.h" 34 1.1 riastrad #include "gpio_types.h" 35 1.1 riastrad #include "link_service_types.h" 36 1.1 riastrad #include "grph_object_ctrl_defs.h" 37 1.1 riastrad #include <inc/hw/opp.h> 38 1.1 riastrad 39 1.1 riastrad #include "inc/hw_sequencer.h" 40 1.1 riastrad #include "inc/compressor.h" 41 1.1 riastrad #include "inc/hw/dmcu.h" 42 1.1 riastrad #include "dml/display_mode_lib.h" 43 1.1 riastrad 44 1.1 riastrad #define DC_VER "3.2.69" 45 1.1 riastrad 46 1.1 riastrad #define MAX_SURFACES 3 47 1.1 riastrad #define MAX_PLANES 6 48 1.1 riastrad #define MAX_STREAMS 6 49 1.1 riastrad #define MAX_SINKS_PER_LINK 4 50 1.1 riastrad 51 1.1 riastrad /******************************************************************************* 52 1.1 riastrad * Display Core Interfaces 53 1.1 riastrad ******************************************************************************/ 54 1.1 riastrad struct dc_versions { 55 1.1 riastrad const char *dc_ver; 56 1.1 riastrad struct dmcu_version dmcu_version; 57 1.1 riastrad }; 58 1.1 riastrad 59 1.1 riastrad enum dp_protocol_version { 60 1.1 riastrad DP_VERSION_1_4, 61 1.1 riastrad }; 62 1.1 riastrad 63 1.1 riastrad enum dc_plane_type { 64 1.1 riastrad DC_PLANE_TYPE_INVALID, 65 1.1 riastrad DC_PLANE_TYPE_DCE_RGB, 66 1.1 riastrad DC_PLANE_TYPE_DCE_UNDERLAY, 67 1.1 riastrad DC_PLANE_TYPE_DCN_UNIVERSAL, 68 1.1 riastrad }; 69 1.1 riastrad 70 1.1 riastrad struct dc_plane_cap { 71 1.1 riastrad enum dc_plane_type type; 72 1.1 riastrad uint32_t blends_with_above : 1; 73 1.1 riastrad uint32_t blends_with_below : 1; 74 1.1 riastrad uint32_t per_pixel_alpha : 1; 75 1.1 riastrad struct { 76 1.1 riastrad uint32_t argb8888 : 1; 77 1.1 riastrad uint32_t nv12 : 1; 78 1.1 riastrad uint32_t fp16 : 1; 79 1.1 riastrad uint32_t p010 : 1; 80 1.1 riastrad uint32_t ayuv : 1; 81 1.1 riastrad } pixel_format_support; 82 1.1 riastrad // max upscaling factor x1000 83 1.1 riastrad // upscaling factors are always >= 1 84 1.1 riastrad // for example, 1080p -> 8K is 4.0, or 4000 raw value 85 1.1 riastrad struct { 86 1.1 riastrad uint32_t argb8888; 87 1.1 riastrad uint32_t nv12; 88 1.1 riastrad uint32_t fp16; 89 1.1 riastrad } max_upscale_factor; 90 1.1 riastrad // max downscale factor x1000 91 1.1 riastrad // downscale factors are always <= 1 92 1.1 riastrad // for example, 8K -> 1080p is 0.25, or 250 raw value 93 1.1 riastrad struct { 94 1.1 riastrad uint32_t argb8888; 95 1.1 riastrad uint32_t nv12; 96 1.1 riastrad uint32_t fp16; 97 1.1 riastrad } max_downscale_factor; 98 1.1 riastrad }; 99 1.1 riastrad 100 1.1 riastrad struct dc_caps { 101 1.1 riastrad uint32_t max_streams; 102 1.1 riastrad uint32_t max_links; 103 1.1 riastrad uint32_t max_audios; 104 1.1 riastrad uint32_t max_slave_planes; 105 1.1 riastrad uint32_t max_planes; 106 1.1 riastrad uint32_t max_downscale_ratio; 107 1.1 riastrad uint32_t i2c_speed_in_khz; 108 1.1 riastrad uint32_t dmdata_alloc_size; 109 1.1 riastrad unsigned int max_cursor_size; 110 1.1 riastrad unsigned int max_video_width; 111 1.1 riastrad int linear_pitch_alignment; 112 1.1 riastrad bool dcc_const_color; 113 1.1 riastrad bool dynamic_audio; 114 1.1 riastrad bool is_apu; 115 1.1 riastrad bool dual_link_dvi; 116 1.1 riastrad bool post_blend_color_processing; 117 1.1 riastrad bool force_dp_tps4_for_cp2520; 118 1.1 riastrad bool disable_dp_clk_share; 119 1.1 riastrad bool psp_setup_panel_mode; 120 1.1 riastrad bool extended_aux_timeout_support; 121 1.1 riastrad bool dmcub_support; 122 1.1 riastrad bool hw_3d_lut; 123 1.1 riastrad enum dp_protocol_version max_dp_protocol_version; 124 1.1 riastrad struct dc_plane_cap planes[MAX_PLANES]; 125 1.1 riastrad }; 126 1.1 riastrad 127 1.1 riastrad struct dc_bug_wa { 128 1.1 riastrad bool no_connect_phy_config; 129 1.1 riastrad bool dedcn20_305_wa; 130 1.1 riastrad bool skip_clock_update; 131 1.1 riastrad }; 132 1.1 riastrad 133 1.1 riastrad struct dc_dcc_surface_param { 134 1.1 riastrad struct dc_size surface_size; 135 1.1 riastrad enum surface_pixel_format format; 136 1.1 riastrad enum swizzle_mode_values swizzle_mode; 137 1.1 riastrad enum dc_scan_direction scan; 138 1.1 riastrad }; 139 1.1 riastrad 140 1.1 riastrad struct dc_dcc_setting { 141 1.1 riastrad unsigned int max_compressed_blk_size; 142 1.1 riastrad unsigned int max_uncompressed_blk_size; 143 1.1 riastrad bool independent_64b_blks; 144 1.1 riastrad }; 145 1.1 riastrad 146 1.1 riastrad struct dc_surface_dcc_cap { 147 1.1 riastrad union { 148 1.1 riastrad struct { 149 1.1 riastrad struct dc_dcc_setting rgb; 150 1.1 riastrad } grph; 151 1.1 riastrad 152 1.1 riastrad struct { 153 1.1 riastrad struct dc_dcc_setting luma; 154 1.1 riastrad struct dc_dcc_setting chroma; 155 1.1 riastrad } video; 156 1.1 riastrad }; 157 1.1 riastrad 158 1.1 riastrad bool capable; 159 1.1 riastrad bool const_color_support; 160 1.1 riastrad }; 161 1.1 riastrad 162 1.1 riastrad struct dc_static_screen_params { 163 1.1 riastrad struct { 164 1.1 riastrad bool force_trigger; 165 1.1 riastrad bool cursor_update; 166 1.1 riastrad bool surface_update; 167 1.1 riastrad bool overlay_update; 168 1.1 riastrad } triggers; 169 1.1 riastrad unsigned int num_frames; 170 1.1 riastrad }; 171 1.1 riastrad 172 1.1 riastrad 173 1.1 riastrad /* Surface update type is used by dc_update_surfaces_and_stream 174 1.1 riastrad * The update type is determined at the very beginning of the function based 175 1.1 riastrad * on parameters passed in and decides how much programming (or updating) is 176 1.1 riastrad * going to be done during the call. 177 1.1 riastrad * 178 1.1 riastrad * UPDATE_TYPE_FAST is used for really fast updates that do not require much 179 1.1 riastrad * logical calculations or hardware register programming. This update MUST be 180 1.1 riastrad * ISR safe on windows. Currently fast update will only be used to flip surface 181 1.1 riastrad * address. 182 1.1 riastrad * 183 1.1 riastrad * UPDATE_TYPE_MED is used for slower updates which require significant hw 184 1.1 riastrad * re-programming however do not affect bandwidth consumption or clock 185 1.1 riastrad * requirements. At present, this is the level at which front end updates 186 1.1 riastrad * that do not require us to run bw_calcs happen. These are in/out transfer func 187 1.1 riastrad * updates, viewport offset changes, recout size changes and pixel depth changes. 188 1.1 riastrad * This update can be done at ISR, but we want to minimize how often this happens. 189 1.1 riastrad * 190 1.1 riastrad * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our 191 1.1 riastrad * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front 192 1.1 riastrad * end related. Any time viewport dimensions, recout dimensions, scaling ratios or 193 1.1 riastrad * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do 194 1.1 riastrad * a full update. This cannot be done at ISR level and should be a rare event. 195 1.1 riastrad * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting 196 1.1 riastrad * underscan we don't expect to see this call at all. 197 1.1 riastrad */ 198 1.1 riastrad 199 1.1 riastrad enum surface_update_type { 200 1.1 riastrad UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */ 201 1.1 riastrad UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/ 202 1.1 riastrad UPDATE_TYPE_FULL, /* may need to shuffle resources */ 203 1.1 riastrad }; 204 1.1 riastrad 205 1.1 riastrad /* Forward declaration*/ 206 1.1 riastrad struct dc; 207 1.1 riastrad struct dc_plane_state; 208 1.1 riastrad struct dc_state; 209 1.1 riastrad 210 1.1 riastrad 211 1.1 riastrad struct dc_cap_funcs { 212 1.1 riastrad bool (*get_dcc_compression_cap)(const struct dc *dc, 213 1.1 riastrad const struct dc_dcc_surface_param *input, 214 1.1 riastrad struct dc_surface_dcc_cap *output); 215 1.1 riastrad }; 216 1.1 riastrad 217 1.1 riastrad struct link_training_settings; 218 1.1 riastrad 219 1.1 riastrad 220 1.1 riastrad /* Structure to hold configuration flags set by dm at dc creation. */ 221 1.1 riastrad struct dc_config { 222 1.1 riastrad bool gpu_vm_support; 223 1.1 riastrad bool disable_disp_pll_sharing; 224 1.1 riastrad bool fbc_support; 225 1.1 riastrad bool optimize_edp_link_rate; 226 1.1 riastrad bool disable_fractional_pwm; 227 1.1 riastrad bool allow_seamless_boot_optimization; 228 1.1 riastrad bool power_down_display_on_boot; 229 1.1 riastrad bool edp_not_connected; 230 1.1 riastrad bool force_enum_edp; 231 1.1 riastrad bool forced_clocks; 232 1.1 riastrad bool disable_extended_timeout_support; // Used to disable extended timeout and lttpr feature as well 233 1.1 riastrad bool multi_mon_pp_mclk_switch; 234 1.1 riastrad }; 235 1.1 riastrad 236 1.1 riastrad enum visual_confirm { 237 1.1 riastrad VISUAL_CONFIRM_DISABLE = 0, 238 1.1 riastrad VISUAL_CONFIRM_SURFACE = 1, 239 1.1 riastrad VISUAL_CONFIRM_HDR = 2, 240 1.1 riastrad VISUAL_CONFIRM_MPCTREE = 4, 241 1.1 riastrad }; 242 1.1 riastrad 243 1.1 riastrad enum dcc_option { 244 1.1 riastrad DCC_ENABLE = 0, 245 1.1 riastrad DCC_DISABLE = 1, 246 1.1 riastrad DCC_HALF_REQ_DISALBE = 2, 247 1.1 riastrad }; 248 1.1 riastrad 249 1.1 riastrad enum pipe_split_policy { 250 1.1 riastrad MPC_SPLIT_DYNAMIC = 0, 251 1.1 riastrad MPC_SPLIT_AVOID = 1, 252 1.1 riastrad MPC_SPLIT_AVOID_MULT_DISP = 2, 253 1.1 riastrad }; 254 1.1 riastrad 255 1.1 riastrad enum wm_report_mode { 256 1.1 riastrad WM_REPORT_DEFAULT = 0, 257 1.1 riastrad WM_REPORT_OVERRIDE = 1, 258 1.1 riastrad }; 259 1.1 riastrad enum dtm_pstate{ 260 1.1 riastrad dtm_level_p0 = 0,/*highest voltage*/ 261 1.1 riastrad dtm_level_p1, 262 1.1 riastrad dtm_level_p2, 263 1.1 riastrad dtm_level_p3, 264 1.1 riastrad dtm_level_p4,/*when active_display_count = 0*/ 265 1.1 riastrad }; 266 1.1 riastrad 267 1.1 riastrad enum dcn_pwr_state { 268 1.1 riastrad DCN_PWR_STATE_UNKNOWN = -1, 269 1.1 riastrad DCN_PWR_STATE_MISSION_MODE = 0, 270 1.1 riastrad DCN_PWR_STATE_LOW_POWER = 3, 271 1.1 riastrad }; 272 1.1 riastrad 273 1.1 riastrad /* 274 1.1 riastrad * For any clocks that may differ per pipe 275 1.1 riastrad * only the max is stored in this structure 276 1.1 riastrad */ 277 1.1 riastrad struct dc_clocks { 278 1.1 riastrad int dispclk_khz; 279 1.1 riastrad int dppclk_khz; 280 1.1 riastrad int dcfclk_khz; 281 1.1 riastrad int socclk_khz; 282 1.1 riastrad int dcfclk_deep_sleep_khz; 283 1.1 riastrad int fclk_khz; 284 1.1 riastrad int phyclk_khz; 285 1.1 riastrad int dramclk_khz; 286 1.1 riastrad bool p_state_change_support; 287 1.1 riastrad enum dcn_pwr_state pwr_state; 288 1.1 riastrad /* 289 1.1 riastrad * Elements below are not compared for the purposes of 290 1.1 riastrad * optimization required 291 1.1 riastrad */ 292 1.1 riastrad bool prev_p_state_change_support; 293 1.1 riastrad enum dtm_pstate dtm_level; 294 1.1 riastrad int max_supported_dppclk_khz; 295 1.1 riastrad int max_supported_dispclk_khz; 296 1.1 riastrad int bw_dppclk_khz; /*a copy of dppclk_khz*/ 297 1.1 riastrad int bw_dispclk_khz; 298 1.1 riastrad }; 299 1.1 riastrad 300 1.1 riastrad struct dc_bw_validation_profile { 301 1.1 riastrad bool enable; 302 1.1 riastrad 303 1.1 riastrad unsigned long long total_ticks; 304 1.1 riastrad unsigned long long voltage_level_ticks; 305 1.1 riastrad unsigned long long watermark_ticks; 306 1.1 riastrad unsigned long long rq_dlg_ticks; 307 1.1 riastrad 308 1.1 riastrad unsigned long long total_count; 309 1.1 riastrad unsigned long long skip_fast_count; 310 1.1 riastrad unsigned long long skip_pass_count; 311 1.1 riastrad unsigned long long skip_fail_count; 312 1.1 riastrad }; 313 1.1 riastrad 314 1.1 riastrad #define BW_VAL_TRACE_SETUP() \ 315 1.1 riastrad unsigned long long end_tick = 0; \ 316 1.1 riastrad unsigned long long voltage_level_tick = 0; \ 317 1.1 riastrad unsigned long long watermark_tick = 0; \ 318 1.1 riastrad unsigned long long start_tick = dc->debug.bw_val_profile.enable ? \ 319 1.1 riastrad dm_get_timestamp(dc->ctx) : 0 320 1.1 riastrad 321 1.1 riastrad #define BW_VAL_TRACE_COUNT() \ 322 1.1 riastrad if (dc->debug.bw_val_profile.enable) \ 323 1.1 riastrad dc->debug.bw_val_profile.total_count++ 324 1.1 riastrad 325 1.1 riastrad #define BW_VAL_TRACE_SKIP(status) \ 326 1.1 riastrad if (dc->debug.bw_val_profile.enable) { \ 327 1.1 riastrad if (!voltage_level_tick) \ 328 1.1 riastrad voltage_level_tick = dm_get_timestamp(dc->ctx); \ 329 1.1 riastrad dc->debug.bw_val_profile.skip_ ## status ## _count++; \ 330 1.1 riastrad } 331 1.1 riastrad 332 1.1 riastrad #define BW_VAL_TRACE_END_VOLTAGE_LEVEL() \ 333 1.1 riastrad if (dc->debug.bw_val_profile.enable) \ 334 1.1 riastrad voltage_level_tick = dm_get_timestamp(dc->ctx) 335 1.1 riastrad 336 1.1 riastrad #define BW_VAL_TRACE_END_WATERMARKS() \ 337 1.1 riastrad if (dc->debug.bw_val_profile.enable) \ 338 1.1 riastrad watermark_tick = dm_get_timestamp(dc->ctx) 339 1.1 riastrad 340 1.1 riastrad #define BW_VAL_TRACE_FINISH() \ 341 1.1 riastrad if (dc->debug.bw_val_profile.enable) { \ 342 1.1 riastrad end_tick = dm_get_timestamp(dc->ctx); \ 343 1.1 riastrad dc->debug.bw_val_profile.total_ticks += end_tick - start_tick; \ 344 1.1 riastrad dc->debug.bw_val_profile.voltage_level_ticks += voltage_level_tick - start_tick; \ 345 1.1 riastrad if (watermark_tick) { \ 346 1.1 riastrad dc->debug.bw_val_profile.watermark_ticks += watermark_tick - voltage_level_tick; \ 347 1.1 riastrad dc->debug.bw_val_profile.rq_dlg_ticks += end_tick - watermark_tick; \ 348 1.1 riastrad } \ 349 1.1 riastrad } 350 1.1 riastrad 351 1.1 riastrad struct dc_debug_options { 352 1.1 riastrad enum visual_confirm visual_confirm; 353 1.1 riastrad bool sanity_checks; 354 1.1 riastrad bool max_disp_clk; 355 1.1 riastrad bool surface_trace; 356 1.1 riastrad bool timing_trace; 357 1.1 riastrad bool clock_trace; 358 1.1 riastrad bool validation_trace; 359 1.1 riastrad bool bandwidth_calcs_trace; 360 1.1 riastrad int max_downscale_src_width; 361 1.1 riastrad 362 1.1 riastrad /* stutter efficiency related */ 363 1.1 riastrad bool disable_stutter; 364 1.1 riastrad bool use_max_lb; 365 1.1 riastrad enum dcc_option disable_dcc; 366 1.1 riastrad enum pipe_split_policy pipe_split_policy; 367 1.1 riastrad bool force_single_disp_pipe_split; 368 1.1 riastrad bool voltage_align_fclk; 369 1.1 riastrad 370 1.1 riastrad bool disable_dfs_bypass; 371 1.1 riastrad bool disable_dpp_power_gate; 372 1.1 riastrad bool disable_hubp_power_gate; 373 1.1 riastrad bool disable_dsc_power_gate; 374 1.1 riastrad int dsc_min_slice_height_override; 375 1.1 riastrad int dsc_bpp_increment_div; 376 1.1 riastrad bool native422_support; 377 1.1 riastrad bool disable_pplib_wm_range; 378 1.1 riastrad enum wm_report_mode pplib_wm_report_mode; 379 1.1 riastrad unsigned int min_disp_clk_khz; 380 1.1 riastrad unsigned int min_dpp_clk_khz; 381 1.1 riastrad int sr_exit_time_dpm0_ns; 382 1.1 riastrad int sr_enter_plus_exit_time_dpm0_ns; 383 1.1 riastrad int sr_exit_time_ns; 384 1.1 riastrad int sr_enter_plus_exit_time_ns; 385 1.1 riastrad int urgent_latency_ns; 386 1.1 riastrad uint32_t underflow_assert_delay_us; 387 1.1 riastrad int percent_of_ideal_drambw; 388 1.1 riastrad int dram_clock_change_latency_ns; 389 1.1 riastrad bool optimized_watermark; 390 1.1 riastrad int always_scale; 391 1.1 riastrad bool disable_pplib_clock_request; 392 1.1 riastrad bool disable_clock_gate; 393 1.1 riastrad bool disable_dmcu; 394 1.1 riastrad bool disable_psr; 395 1.1 riastrad bool force_abm_enable; 396 1.1 riastrad bool disable_stereo_support; 397 1.1 riastrad bool vsr_support; 398 1.1 riastrad bool performance_trace; 399 1.1 riastrad bool az_endpoint_mute_only; 400 1.1 riastrad bool always_use_regamma; 401 1.1 riastrad bool p010_mpo_support; 402 1.1 riastrad bool recovery_enabled; 403 1.1 riastrad bool avoid_vbios_exec_table; 404 1.1 riastrad bool scl_reset_length10; 405 1.1 riastrad bool hdmi20_disable; 406 1.1 riastrad bool skip_detection_link_training; 407 1.1 riastrad bool remove_disconnect_edp; 408 1.1 riastrad unsigned int force_odm_combine; //bit vector based on otg inst 409 1.1 riastrad unsigned int force_fclk_khz; 410 1.1 riastrad bool disable_tri_buf; 411 1.1 riastrad bool dmub_offload_enabled; 412 1.1 riastrad bool dmcub_emulation; 413 1.1 riastrad bool dmub_command_table; /* for testing only */ 414 1.1 riastrad struct dc_bw_validation_profile bw_val_profile; 415 1.1 riastrad bool disable_fec; 416 1.1 riastrad bool disable_48mhz_pwrdwn; 417 1.1 riastrad /* This forces a hard min on the DCFCLK requested to SMU/PP 418 1.1 riastrad * watermarks are not affected. 419 1.1 riastrad */ 420 1.1 riastrad unsigned int force_min_dcfclk_mhz; 421 1.1 riastrad bool disable_timing_sync; 422 1.1 riastrad bool cm_in_bypass; 423 1.1 riastrad int force_clock_mode;/*every mode change.*/ 424 1.1 riastrad 425 1.1 riastrad bool nv12_iflip_vm_wa; 426 1.1 riastrad bool disable_dram_clock_change_vactive_support; 427 1.1 riastrad bool validate_dml_output; 428 1.1 riastrad bool enable_dmcub_surface_flip; 429 1.1 riastrad bool usbc_combo_phy_reset_wa; 430 1.1 riastrad bool disable_dsc; 431 1.1 riastrad }; 432 1.1 riastrad 433 1.1 riastrad struct dc_debug_data { 434 1.1 riastrad uint32_t ltFailCount; 435 1.1 riastrad uint32_t i2cErrorCount; 436 1.1 riastrad uint32_t auxErrorCount; 437 1.1 riastrad }; 438 1.1 riastrad 439 1.1 riastrad struct dc_phy_addr_space_config { 440 1.1 riastrad struct { 441 1.1 riastrad uint64_t start_addr; 442 1.1 riastrad uint64_t end_addr; 443 1.1 riastrad uint64_t fb_top; 444 1.1 riastrad uint64_t fb_offset; 445 1.1 riastrad uint64_t fb_base; 446 1.1 riastrad uint64_t agp_top; 447 1.1 riastrad uint64_t agp_bot; 448 1.1 riastrad uint64_t agp_base; 449 1.1 riastrad } system_aperture; 450 1.1 riastrad 451 1.1 riastrad struct { 452 1.1 riastrad uint64_t page_table_start_addr; 453 1.1 riastrad uint64_t page_table_end_addr; 454 1.1 riastrad uint64_t page_table_base_addr; 455 1.1 riastrad } gart_config; 456 1.1 riastrad 457 1.1 riastrad bool valid; 458 1.1 riastrad uint64_t page_table_default_page_addr; 459 1.1 riastrad }; 460 1.1 riastrad 461 1.1 riastrad struct dc_virtual_addr_space_config { 462 1.1 riastrad uint64_t page_table_base_addr; 463 1.1 riastrad uint64_t page_table_start_addr; 464 1.1 riastrad uint64_t page_table_end_addr; 465 1.1 riastrad uint32_t page_table_block_size_in_bytes; 466 1.1 riastrad uint8_t page_table_depth; // 1 = 1 level, 2 = 2 level, etc. 0 = invalid 467 1.1 riastrad }; 468 1.1 riastrad 469 1.1 riastrad struct dc_bounding_box_overrides { 470 1.1 riastrad int sr_exit_time_ns; 471 1.1 riastrad int sr_enter_plus_exit_time_ns; 472 1.1 riastrad int urgent_latency_ns; 473 1.1 riastrad int percent_of_ideal_drambw; 474 1.1 riastrad int dram_clock_change_latency_ns; 475 1.1 riastrad /* This forces a hard min on the DCFCLK we use 476 1.1 riastrad * for DML. Unlike the debug option for forcing 477 1.1 riastrad * DCFCLK, this override affects watermark calculations 478 1.1 riastrad */ 479 1.1 riastrad int min_dcfclk_mhz; 480 1.1 riastrad }; 481 1.1 riastrad 482 1.1 riastrad struct dc_state; 483 1.1 riastrad struct resource_pool; 484 1.1 riastrad struct dce_hwseq; 485 1.1 riastrad struct gpu_info_soc_bounding_box_v1_0; 486 1.1 riastrad struct dc { 487 1.1 riastrad struct dc_versions versions; 488 1.1 riastrad struct dc_caps caps; 489 1.1 riastrad struct dc_cap_funcs cap_funcs; 490 1.1 riastrad struct dc_config config; 491 1.1 riastrad struct dc_debug_options debug; 492 1.1 riastrad struct dc_bounding_box_overrides bb_overrides; 493 1.1 riastrad struct dc_bug_wa work_arounds; 494 1.1 riastrad struct dc_context *ctx; 495 1.1 riastrad struct dc_phy_addr_space_config vm_pa_config; 496 1.1 riastrad 497 1.1 riastrad uint8_t link_count; 498 1.1 riastrad struct dc_link *links[MAX_PIPES * 2]; 499 1.1 riastrad 500 1.1 riastrad struct dc_state *current_state; 501 1.1 riastrad struct resource_pool *res_pool; 502 1.1 riastrad 503 1.1 riastrad struct clk_mgr *clk_mgr; 504 1.1 riastrad 505 1.1 riastrad /* Display Engine Clock levels */ 506 1.1 riastrad struct dm_pp_clock_levels sclk_lvls; 507 1.1 riastrad 508 1.1 riastrad /* Inputs into BW and WM calculations. */ 509 1.1 riastrad struct bw_calcs_dceip *bw_dceip; 510 1.1 riastrad struct bw_calcs_vbios *bw_vbios; 511 1.1 riastrad #ifdef CONFIG_DRM_AMD_DC_DCN 512 1.1 riastrad struct dcn_soc_bounding_box *dcn_soc; 513 1.1 riastrad struct dcn_ip_params *dcn_ip; 514 1.1 riastrad struct display_mode_lib dml; 515 1.1 riastrad #endif 516 1.1 riastrad 517 1.1 riastrad /* HW functions */ 518 1.1 riastrad struct hw_sequencer_funcs hwss; 519 1.1 riastrad struct dce_hwseq *hwseq; 520 1.1 riastrad 521 1.1 riastrad /* Require to optimize clocks and bandwidth for added/removed planes */ 522 1.1 riastrad bool optimized_required; 523 1.1 riastrad 524 1.1 riastrad /* Require to maintain clocks and bandwidth for UEFI enabled HW */ 525 1.1 riastrad int optimize_seamless_boot_streams; 526 1.1 riastrad 527 1.1 riastrad /* FBC compressor */ 528 1.1 riastrad struct compressor *fbc_compressor; 529 1.1 riastrad 530 1.1 riastrad struct dc_debug_data debug_data; 531 1.1 riastrad 532 1.1 riastrad const char *build_id; 533 1.1 riastrad struct vm_helper *vm_helper; 534 1.1 riastrad const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; 535 1.1 riastrad }; 536 1.1 riastrad 537 1.1 riastrad enum frame_buffer_mode { 538 1.1 riastrad FRAME_BUFFER_MODE_LOCAL_ONLY = 0, 539 1.1 riastrad FRAME_BUFFER_MODE_ZFB_ONLY, 540 1.1 riastrad FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL, 541 1.1 riastrad } ; 542 1.1 riastrad 543 1.1 riastrad struct dchub_init_data { 544 1.1 riastrad int64_t zfb_phys_addr_base; 545 1.1 riastrad int64_t zfb_mc_base_addr; 546 1.1 riastrad uint64_t zfb_size_in_byte; 547 1.1 riastrad enum frame_buffer_mode fb_mode; 548 1.1 riastrad bool dchub_initialzied; 549 1.1 riastrad bool dchub_info_valid; 550 1.1 riastrad }; 551 1.1 riastrad 552 1.1 riastrad struct dc_init_data { 553 1.1 riastrad struct hw_asic_id asic_id; 554 1.1 riastrad void *driver; /* ctx */ 555 1.1 riastrad struct cgs_device *cgs_device; 556 1.1 riastrad struct dc_bounding_box_overrides bb_overrides; 557 1.1 riastrad 558 1.1 riastrad int num_virtual_links; 559 1.1 riastrad /* 560 1.1 riastrad * If 'vbios_override' not NULL, it will be called instead 561 1.1 riastrad * of the real VBIOS. Intended use is Diagnostics on FPGA. 562 1.1 riastrad */ 563 1.1 riastrad struct dc_bios *vbios_override; 564 1.1 riastrad enum dce_environment dce_environment; 565 1.1 riastrad 566 1.1 riastrad struct dmub_offload_funcs *dmub_if; 567 1.1 riastrad struct dc_reg_helper_state *dmub_offload; 568 1.1 riastrad 569 1.1 riastrad struct dc_config flags; 570 1.1 riastrad uint32_t log_mask; 571 1.1 riastrad /** 572 1.1 riastrad * gpu_info FW provided soc bounding box struct or 0 if not 573 1.1 riastrad * available in FW 574 1.1 riastrad */ 575 1.1 riastrad const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; 576 1.1 riastrad }; 577 1.1 riastrad 578 1.1 riastrad struct dc_callback_init { 579 1.1 riastrad #ifdef CONFIG_DRM_AMD_DC_HDCP 580 1.1 riastrad struct cp_psp cp_psp; 581 1.1 riastrad #else 582 1.1 riastrad uint8_t reserved; 583 1.1 riastrad #endif 584 1.1 riastrad }; 585 1.1 riastrad 586 1.1 riastrad struct dc *dc_create(const struct dc_init_data *init_params); 587 1.1 riastrad void dc_hardware_init(struct dc *dc); 588 1.1 riastrad 589 1.1 riastrad int dc_get_vmid_use_vector(struct dc *dc); 590 1.1 riastrad void dc_setup_vm_context(struct dc *dc, struct dc_virtual_addr_space_config *va_config, int vmid); 591 1.1 riastrad /* Returns the number of vmids supported */ 592 1.1 riastrad int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_config); 593 1.1 riastrad void dc_init_callbacks(struct dc *dc, 594 1.1 riastrad const struct dc_callback_init *init_params); 595 1.1 riastrad void dc_deinit_callbacks(struct dc *dc); 596 1.1 riastrad void dc_destroy(struct dc **dc); 597 1.1 riastrad 598 1.1 riastrad /******************************************************************************* 599 1.1 riastrad * Surface Interfaces 600 1.1 riastrad ******************************************************************************/ 601 1.1 riastrad 602 1.1 riastrad enum { 603 1.1 riastrad TRANSFER_FUNC_POINTS = 1025 604 1.1 riastrad }; 605 1.1 riastrad 606 1.1 riastrad struct dc_hdr_static_metadata { 607 1.1 riastrad /* display chromaticities and white point in units of 0.00001 */ 608 1.1 riastrad unsigned int chromaticity_green_x; 609 1.1 riastrad unsigned int chromaticity_green_y; 610 1.1 riastrad unsigned int chromaticity_blue_x; 611 1.1 riastrad unsigned int chromaticity_blue_y; 612 1.1 riastrad unsigned int chromaticity_red_x; 613 1.1 riastrad unsigned int chromaticity_red_y; 614 1.1 riastrad unsigned int chromaticity_white_point_x; 615 1.1 riastrad unsigned int chromaticity_white_point_y; 616 1.1 riastrad 617 1.1 riastrad uint32_t min_luminance; 618 1.1 riastrad uint32_t max_luminance; 619 1.1 riastrad uint32_t maximum_content_light_level; 620 1.1 riastrad uint32_t maximum_frame_average_light_level; 621 1.1 riastrad }; 622 1.1 riastrad 623 1.1 riastrad enum dc_transfer_func_type { 624 1.1 riastrad TF_TYPE_PREDEFINED, 625 1.1 riastrad TF_TYPE_DISTRIBUTED_POINTS, 626 1.1 riastrad TF_TYPE_BYPASS, 627 1.1 riastrad TF_TYPE_HWPWL 628 1.1 riastrad }; 629 1.1 riastrad 630 1.1 riastrad struct dc_transfer_func_distributed_points { 631 1.1 riastrad struct fixed31_32 red[TRANSFER_FUNC_POINTS]; 632 1.1 riastrad struct fixed31_32 green[TRANSFER_FUNC_POINTS]; 633 1.1 riastrad struct fixed31_32 blue[TRANSFER_FUNC_POINTS]; 634 1.1 riastrad 635 1.1 riastrad uint16_t end_exponent; 636 1.1 riastrad uint16_t x_point_at_y1_red; 637 1.1 riastrad uint16_t x_point_at_y1_green; 638 1.1 riastrad uint16_t x_point_at_y1_blue; 639 1.1 riastrad }; 640 1.1 riastrad 641 1.1 riastrad enum dc_transfer_func_predefined { 642 1.1 riastrad TRANSFER_FUNCTION_SRGB, 643 1.1 riastrad TRANSFER_FUNCTION_BT709, 644 1.1 riastrad TRANSFER_FUNCTION_PQ, 645 1.1 riastrad TRANSFER_FUNCTION_LINEAR, 646 1.1 riastrad TRANSFER_FUNCTION_UNITY, 647 1.1 riastrad TRANSFER_FUNCTION_HLG, 648 1.1 riastrad TRANSFER_FUNCTION_HLG12, 649 1.1 riastrad TRANSFER_FUNCTION_GAMMA22, 650 1.1 riastrad TRANSFER_FUNCTION_GAMMA24, 651 1.1 riastrad TRANSFER_FUNCTION_GAMMA26 652 1.1 riastrad }; 653 1.1 riastrad 654 1.1 riastrad 655 1.1 riastrad struct dc_transfer_func { 656 1.1 riastrad struct kref refcount; 657 1.1 riastrad enum dc_transfer_func_type type; 658 1.1 riastrad enum dc_transfer_func_predefined tf; 659 1.1 riastrad /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/ 660 1.1 riastrad uint32_t sdr_ref_white_level; 661 1.1 riastrad struct dc_context *ctx; 662 1.1 riastrad union { 663 1.1 riastrad struct pwl_params pwl; 664 1.1 riastrad struct dc_transfer_func_distributed_points tf_pts; 665 1.1 riastrad }; 666 1.1 riastrad }; 667 1.1 riastrad 668 1.1 riastrad 669 1.1 riastrad union dc_3dlut_state { 670 1.1 riastrad struct { 671 1.1 riastrad uint32_t initialized:1; /*if 3dlut is went through color module for initialization */ 672 1.1 riastrad uint32_t rmu_idx_valid:1; /*if mux settings are valid*/ 673 1.1 riastrad uint32_t rmu_mux_num:3; /*index of mux to use*/ 674 1.1 riastrad uint32_t mpc_rmu0_mux:4; /*select mpcc on mux, one of the following : mpcc0, mpcc1, mpcc2, mpcc3*/ 675 1.1 riastrad uint32_t mpc_rmu1_mux:4; 676 1.1 riastrad uint32_t mpc_rmu2_mux:4; 677 1.1 riastrad uint32_t reserved:15; 678 1.1 riastrad } bits; 679 1.1 riastrad uint32_t raw; 680 1.1 riastrad }; 681 1.1 riastrad 682 1.1 riastrad 683 1.1 riastrad struct dc_3dlut { 684 1.1 riastrad struct kref refcount; 685 1.1 riastrad struct tetrahedral_params lut_3d; 686 1.1 riastrad struct fixed31_32 hdr_multiplier; 687 1.1 riastrad bool initialized; /*remove after diag fix*/ 688 1.1 riastrad union dc_3dlut_state state; 689 1.1 riastrad struct dc_context *ctx; 690 1.1 riastrad }; 691 1.1 riastrad /* 692 1.1 riastrad * This structure is filled in by dc_surface_get_status and contains 693 1.1 riastrad * the last requested address and the currently active address so the called 694 1.1 riastrad * can determine if there are any outstanding flips 695 1.1 riastrad */ 696 1.1 riastrad struct dc_plane_status { 697 1.1 riastrad struct dc_plane_address requested_address; 698 1.1 riastrad struct dc_plane_address current_address; 699 1.1 riastrad bool is_flip_pending; 700 1.1 riastrad bool is_right_eye; 701 1.1 riastrad }; 702 1.1 riastrad 703 1.1 riastrad union surface_update_flags { 704 1.1 riastrad 705 1.1 riastrad struct { 706 1.1 riastrad uint32_t addr_update:1; 707 1.1 riastrad /* Medium updates */ 708 1.1 riastrad uint32_t dcc_change:1; 709 1.1 riastrad uint32_t color_space_change:1; 710 1.1 riastrad uint32_t horizontal_mirror_change:1; 711 1.1 riastrad uint32_t per_pixel_alpha_change:1; 712 1.1 riastrad uint32_t global_alpha_change:1; 713 1.1 riastrad uint32_t hdr_mult:1; 714 1.1 riastrad uint32_t rotation_change:1; 715 1.1 riastrad uint32_t swizzle_change:1; 716 1.1 riastrad uint32_t scaling_change:1; 717 1.1 riastrad uint32_t position_change:1; 718 1.1 riastrad uint32_t in_transfer_func_change:1; 719 1.1 riastrad uint32_t input_csc_change:1; 720 1.1 riastrad uint32_t coeff_reduction_change:1; 721 1.1 riastrad uint32_t output_tf_change:1; 722 1.1 riastrad uint32_t pixel_format_change:1; 723 1.1 riastrad uint32_t plane_size_change:1; 724 1.1 riastrad 725 1.1 riastrad /* Full updates */ 726 1.1 riastrad uint32_t new_plane:1; 727 1.1 riastrad uint32_t bpp_change:1; 728 1.1 riastrad uint32_t gamma_change:1; 729 1.1 riastrad uint32_t bandwidth_change:1; 730 1.1 riastrad uint32_t clock_change:1; 731 1.1 riastrad uint32_t stereo_format_change:1; 732 1.1 riastrad uint32_t full_update:1; 733 1.1 riastrad } bits; 734 1.1 riastrad 735 1.1 riastrad uint32_t raw; 736 1.1 riastrad }; 737 1.1 riastrad 738 1.1 riastrad struct dc_plane_state { 739 1.1 riastrad struct dc_plane_address address; 740 1.1 riastrad struct dc_plane_flip_time time; 741 1.1 riastrad bool triplebuffer_flips; 742 1.1 riastrad struct scaling_taps scaling_quality; 743 1.1 riastrad struct rect src_rect; 744 1.1 riastrad struct rect dst_rect; 745 1.1 riastrad struct rect clip_rect; 746 1.1 riastrad 747 1.1 riastrad struct plane_size plane_size; 748 1.1 riastrad union dc_tiling_info tiling_info; 749 1.1 riastrad 750 1.1 riastrad struct dc_plane_dcc_param dcc; 751 1.1 riastrad 752 1.1 riastrad struct dc_gamma *gamma_correction; 753 1.1 riastrad struct dc_transfer_func *in_transfer_func; 754 1.1 riastrad struct dc_bias_and_scale *bias_and_scale; 755 1.1 riastrad struct dc_csc_transform input_csc_color_matrix; 756 1.1 riastrad struct fixed31_32 coeff_reduction_factor; 757 1.1 riastrad struct fixed31_32 hdr_mult; 758 1.1 riastrad 759 1.1 riastrad // TODO: No longer used, remove 760 1.1 riastrad struct dc_hdr_static_metadata hdr_static_ctx; 761 1.1 riastrad 762 1.1 riastrad enum dc_color_space color_space; 763 1.1 riastrad 764 1.1 riastrad struct dc_3dlut *lut3d_func; 765 1.1 riastrad struct dc_transfer_func *in_shaper_func; 766 1.1 riastrad struct dc_transfer_func *blend_tf; 767 1.1 riastrad 768 1.1 riastrad enum surface_pixel_format format; 769 1.1 riastrad enum dc_rotation_angle rotation; 770 1.1 riastrad enum plane_stereo_format stereo_format; 771 1.1 riastrad 772 1.1 riastrad bool is_tiling_rotated; 773 1.1 riastrad bool per_pixel_alpha; 774 1.1 riastrad bool global_alpha; 775 1.1 riastrad int global_alpha_value; 776 1.1 riastrad bool visible; 777 1.1 riastrad bool flip_immediate; 778 1.1 riastrad bool horizontal_mirror; 779 1.1 riastrad int layer_index; 780 1.1 riastrad 781 1.1 riastrad union surface_update_flags update_flags; 782 1.1 riastrad /* private to DC core */ 783 1.1 riastrad struct dc_plane_status status; 784 1.1 riastrad struct dc_context *ctx; 785 1.1 riastrad 786 1.1 riastrad /* HACK: Workaround for forcing full reprogramming under some conditions */ 787 1.1 riastrad bool force_full_update; 788 1.1 riastrad 789 1.1 riastrad /* private to dc_surface.c */ 790 1.1 riastrad enum dc_irq_source irq_source; 791 1.1 riastrad struct kref refcount; 792 1.1 riastrad }; 793 1.1 riastrad 794 1.1 riastrad struct dc_plane_info { 795 1.1 riastrad struct plane_size plane_size; 796 1.1 riastrad union dc_tiling_info tiling_info; 797 1.1 riastrad struct dc_plane_dcc_param dcc; 798 1.1 riastrad enum surface_pixel_format format; 799 1.1 riastrad enum dc_rotation_angle rotation; 800 1.1 riastrad enum plane_stereo_format stereo_format; 801 1.1 riastrad enum dc_color_space color_space; 802 1.1 riastrad bool horizontal_mirror; 803 1.1 riastrad bool visible; 804 1.1 riastrad bool per_pixel_alpha; 805 1.1 riastrad bool global_alpha; 806 1.1 riastrad int global_alpha_value; 807 1.1 riastrad bool input_csc_enabled; 808 1.1 riastrad int layer_index; 809 1.1 riastrad }; 810 1.1 riastrad 811 1.1 riastrad struct dc_scaling_info { 812 1.1 riastrad struct rect src_rect; 813 1.1 riastrad struct rect dst_rect; 814 1.1 riastrad struct rect clip_rect; 815 1.1 riastrad struct scaling_taps scaling_quality; 816 1.1 riastrad }; 817 1.1 riastrad 818 1.1 riastrad struct dc_surface_update { 819 1.1 riastrad struct dc_plane_state *surface; 820 1.1 riastrad 821 1.1 riastrad /* isr safe update parameters. null means no updates */ 822 1.1 riastrad const struct dc_flip_addrs *flip_addr; 823 1.1 riastrad const struct dc_plane_info *plane_info; 824 1.1 riastrad const struct dc_scaling_info *scaling_info; 825 1.1 riastrad struct fixed31_32 hdr_mult; 826 1.1 riastrad /* following updates require alloc/sleep/spin that is not isr safe, 827 1.1 riastrad * null means no updates 828 1.1 riastrad */ 829 1.1 riastrad const struct dc_gamma *gamma; 830 1.1 riastrad const struct dc_transfer_func *in_transfer_func; 831 1.1 riastrad 832 1.1 riastrad const struct dc_csc_transform *input_csc_color_matrix; 833 1.1 riastrad const struct fixed31_32 *coeff_reduction_factor; 834 1.1 riastrad const struct dc_transfer_func *func_shaper; 835 1.1 riastrad const struct dc_3dlut *lut3d_func; 836 1.1 riastrad const struct dc_transfer_func *blend_tf; 837 1.1 riastrad }; 838 1.1 riastrad 839 1.1 riastrad /* 840 1.1 riastrad * Create a new surface with default parameters; 841 1.1 riastrad */ 842 1.1 riastrad struct dc_plane_state *dc_create_plane_state(struct dc *dc); 843 1.1 riastrad const struct dc_plane_status *dc_plane_get_status( 844 1.1 riastrad const struct dc_plane_state *plane_state); 845 1.1 riastrad 846 1.1 riastrad void dc_plane_state_retain(struct dc_plane_state *plane_state); 847 1.1 riastrad void dc_plane_state_release(struct dc_plane_state *plane_state); 848 1.1 riastrad 849 1.1 riastrad void dc_gamma_retain(struct dc_gamma *dc_gamma); 850 1.1 riastrad void dc_gamma_release(struct dc_gamma **dc_gamma); 851 1.1 riastrad struct dc_gamma *dc_create_gamma(void); 852 1.1 riastrad 853 1.1 riastrad void dc_transfer_func_retain(struct dc_transfer_func *dc_tf); 854 1.1 riastrad void dc_transfer_func_release(struct dc_transfer_func *dc_tf); 855 1.1 riastrad struct dc_transfer_func *dc_create_transfer_func(void); 856 1.1 riastrad 857 1.1 riastrad struct dc_3dlut *dc_create_3dlut_func(void); 858 1.1 riastrad void dc_3dlut_func_release(struct dc_3dlut *lut); 859 1.1 riastrad void dc_3dlut_func_retain(struct dc_3dlut *lut); 860 1.1 riastrad /* 861 1.1 riastrad * This structure holds a surface address. There could be multiple addresses 862 1.1 riastrad * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such 863 1.1 riastrad * as frame durations and DCC format can also be set. 864 1.1 riastrad */ 865 1.1 riastrad struct dc_flip_addrs { 866 1.1 riastrad struct dc_plane_address address; 867 1.1 riastrad unsigned int flip_timestamp_in_us; 868 1.1 riastrad bool flip_immediate; 869 1.1 riastrad /* TODO: add flip duration for FreeSync */ 870 1.1 riastrad }; 871 1.1 riastrad 872 1.1 riastrad bool dc_post_update_surfaces_to_stream( 873 1.1 riastrad struct dc *dc); 874 1.1 riastrad 875 1.1 riastrad #include "dc_stream.h" 876 1.1 riastrad 877 1.1 riastrad /* 878 1.1 riastrad * Structure to store surface/stream associations for validation 879 1.1 riastrad */ 880 1.1 riastrad struct dc_validation_set { 881 1.1 riastrad struct dc_stream_state *stream; 882 1.1 riastrad struct dc_plane_state *plane_states[MAX_SURFACES]; 883 1.1 riastrad uint8_t plane_count; 884 1.1 riastrad }; 885 1.1 riastrad 886 1.1 riastrad bool dc_validate_seamless_boot_timing(const struct dc *dc, 887 1.1 riastrad const struct dc_sink *sink, 888 1.1 riastrad struct dc_crtc_timing *crtc_timing); 889 1.1 riastrad 890 1.1 riastrad enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state); 891 1.1 riastrad 892 1.1 riastrad void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info); 893 1.1 riastrad 894 1.1 riastrad bool dc_set_generic_gpio_for_stereo(bool enable, 895 1.1 riastrad struct gpio_service *gpio_service); 896 1.1 riastrad 897 1.1 riastrad /* 898 1.1 riastrad * fast_validate: we return after determining if we can support the new state, 899 1.1 riastrad * but before we populate the programming info 900 1.1 riastrad */ 901 1.1 riastrad enum dc_status dc_validate_global_state( 902 1.1 riastrad struct dc *dc, 903 1.1 riastrad struct dc_state *new_ctx, 904 1.1 riastrad bool fast_validate); 905 1.1 riastrad 906 1.1 riastrad 907 1.1 riastrad void dc_resource_state_construct( 908 1.1 riastrad const struct dc *dc, 909 1.1 riastrad struct dc_state *dst_ctx); 910 1.1 riastrad 911 1.1 riastrad void dc_resource_state_copy_construct( 912 1.1 riastrad const struct dc_state *src_ctx, 913 1.1 riastrad struct dc_state *dst_ctx); 914 1.1 riastrad 915 1.1 riastrad void dc_resource_state_copy_construct_current( 916 1.1 riastrad const struct dc *dc, 917 1.1 riastrad struct dc_state *dst_ctx); 918 1.1 riastrad 919 1.1 riastrad void dc_resource_state_destruct(struct dc_state *context); 920 1.1 riastrad 921 1.1 riastrad bool dc_resource_is_dsc_encoding_supported(const struct dc *dc); 922 1.1 riastrad 923 1.1 riastrad /* 924 1.1 riastrad * TODO update to make it about validation sets 925 1.1 riastrad * Set up streams and links associated to drive sinks 926 1.1 riastrad * The streams parameter is an absolute set of all active streams. 927 1.1 riastrad * 928 1.1 riastrad * After this call: 929 1.1 riastrad * Phy, Encoder, Timing Generator are programmed and enabled. 930 1.1 riastrad * New streams are enabled with blank stream; no memory read. 931 1.1 riastrad */ 932 1.1 riastrad bool dc_commit_state(struct dc *dc, struct dc_state *context); 933 1.1 riastrad 934 1.1 riastrad 935 1.1 riastrad struct dc_state *dc_create_state(struct dc *dc); 936 1.1 riastrad struct dc_state *dc_copy_state(struct dc_state *src_ctx); 937 1.1 riastrad void dc_retain_state(struct dc_state *context); 938 1.1 riastrad void dc_release_state(struct dc_state *context); 939 1.1 riastrad 940 1.1 riastrad /******************************************************************************* 941 1.1 riastrad * Link Interfaces 942 1.1 riastrad ******************************************************************************/ 943 1.1 riastrad 944 1.1 riastrad struct dpcd_caps { 945 1.1 riastrad union dpcd_rev dpcd_rev; 946 1.1 riastrad union max_lane_count max_ln_count; 947 1.1 riastrad union max_down_spread max_down_spread; 948 1.1 riastrad union dprx_feature dprx_feature; 949 1.1 riastrad 950 1.1 riastrad /* valid only for eDP v1.4 or higher*/ 951 1.1 riastrad uint8_t edp_supported_link_rates_count; 952 1.1 riastrad enum dc_link_rate edp_supported_link_rates[8]; 953 1.1 riastrad 954 1.1 riastrad /* dongle type (DP converter, CV smart dongle) */ 955 1.1 riastrad enum display_dongle_type dongle_type; 956 1.1 riastrad /* branch device or sink device */ 957 1.1 riastrad bool is_branch_dev; 958 1.1 riastrad /* Dongle's downstream count. */ 959 1.1 riastrad union sink_count sink_count; 960 1.1 riastrad /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 961 1.1 riastrad indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 962 1.1 riastrad struct dc_dongle_caps dongle_caps; 963 1.1 riastrad 964 1.1 riastrad uint32_t sink_dev_id; 965 1.1 riastrad int8_t sink_dev_id_str[6]; 966 1.1 riastrad int8_t sink_hw_revision; 967 1.1 riastrad int8_t sink_fw_revision[2]; 968 1.1 riastrad 969 1.1 riastrad uint32_t branch_dev_id; 970 1.1 riastrad int8_t branch_dev_name[6]; 971 1.1 riastrad int8_t branch_hw_revision; 972 1.1 riastrad int8_t branch_fw_revision[2]; 973 1.1 riastrad 974 1.1 riastrad bool allow_invalid_MSA_timing_param; 975 1.1 riastrad bool panel_mode_edp; 976 1.1 riastrad bool dpcd_display_control_capable; 977 1.1 riastrad bool ext_receiver_cap_field_present; 978 1.1 riastrad union dpcd_fec_capability fec_cap; 979 1.1 riastrad struct dpcd_dsc_capabilities dsc_caps; 980 1.1 riastrad struct dc_lttpr_caps lttpr_caps; 981 1.1 riastrad 982 1.1 riastrad }; 983 1.1 riastrad 984 1.1 riastrad #include "dc_link.h" 985 1.1 riastrad 986 1.1 riastrad /******************************************************************************* 987 1.1 riastrad * Sink Interfaces - A sink corresponds to a display output device 988 1.1 riastrad ******************************************************************************/ 989 1.1 riastrad 990 1.1 riastrad struct dc_container_id { 991 1.1 riastrad // 128bit GUID in binary form 992 1.1 riastrad unsigned char guid[16]; 993 1.1 riastrad // 8 byte port ID -> ELD.PortID 994 1.1 riastrad unsigned int portId[2]; 995 1.1 riastrad // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName 996 1.1 riastrad unsigned short manufacturerName; 997 1.1 riastrad // 2 byte product code -> ELD.ProductCode 998 1.1 riastrad unsigned short productCode; 999 1.1 riastrad }; 1000 1.1 riastrad 1001 1.1 riastrad 1002 1.1 riastrad struct dc_sink_dsc_caps { 1003 1.1 riastrad // 'true' if these are virtual DPCD's DSC caps (immediately upstream of sink in MST topology), 1004 1.1 riastrad // 'false' if they are sink's DSC caps 1005 1.1 riastrad bool is_virtual_dpcd_dsc; 1006 1.1 riastrad struct dsc_dec_dpcd_caps dsc_dec_caps; 1007 1.1 riastrad }; 1008 1.1 riastrad 1009 1.1 riastrad /* 1010 1.1 riastrad * The sink structure contains EDID and other display device properties 1011 1.1 riastrad */ 1012 1.1 riastrad struct dc_sink { 1013 1.1 riastrad enum signal_type sink_signal; 1014 1.1 riastrad struct dc_edid dc_edid; /* raw edid */ 1015 1.1 riastrad struct dc_edid_caps edid_caps; /* parse display caps */ 1016 1.1 riastrad struct dc_container_id *dc_container_id; 1017 1.1 riastrad uint32_t dongle_max_pix_clk; 1018 1.1 riastrad void *priv; 1019 1.1 riastrad struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX]; 1020 1.1 riastrad bool converter_disable_audio; 1021 1.1 riastrad 1022 1.1 riastrad struct dc_sink_dsc_caps sink_dsc_caps; 1023 1.1 riastrad 1024 1.1 riastrad /* private to DC core */ 1025 1.1 riastrad struct dc_link *link; 1026 1.1 riastrad struct dc_context *ctx; 1027 1.1 riastrad 1028 1.1 riastrad uint32_t sink_id; 1029 1.1 riastrad 1030 1.1 riastrad /* private to dc_sink.c */ 1031 1.1 riastrad // refcount must be the last member in dc_sink, since we want the 1032 1.1 riastrad // sink structure to be logically cloneable up to (but not including) 1033 1.1 riastrad // refcount 1034 1.1 riastrad struct kref refcount; 1035 1.1 riastrad }; 1036 1.1 riastrad 1037 1.1 riastrad void dc_sink_retain(struct dc_sink *sink); 1038 1.1 riastrad void dc_sink_release(struct dc_sink *sink); 1039 1.1 riastrad 1040 1.1 riastrad struct dc_sink_init_data { 1041 1.1 riastrad enum signal_type sink_signal; 1042 1.1 riastrad struct dc_link *link; 1043 1.1 riastrad uint32_t dongle_max_pix_clk; 1044 1.1 riastrad bool converter_disable_audio; 1045 1.1 riastrad }; 1046 1.1 riastrad 1047 1.1 riastrad struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params); 1048 1.1 riastrad 1049 1.1 riastrad /* Newer interfaces */ 1050 1.1 riastrad struct dc_cursor { 1051 1.1 riastrad struct dc_plane_address address; 1052 1.1 riastrad struct dc_cursor_attributes attributes; 1053 1.1 riastrad }; 1054 1.1 riastrad 1055 1.1 riastrad 1056 1.1 riastrad /******************************************************************************* 1057 1.1 riastrad * Interrupt interfaces 1058 1.1 riastrad ******************************************************************************/ 1059 1.1 riastrad enum dc_irq_source dc_interrupt_to_irq_source( 1060 1.1 riastrad struct dc *dc, 1061 1.1 riastrad uint32_t src_id, 1062 1.1 riastrad uint32_t ext_id); 1063 1.1 riastrad bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable); 1064 1.1 riastrad void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src); 1065 1.1 riastrad enum dc_irq_source dc_get_hpd_irq_source_at_index( 1066 1.1 riastrad struct dc *dc, uint32_t link_index); 1067 1.1 riastrad 1068 1.1 riastrad /******************************************************************************* 1069 1.1 riastrad * Power Interfaces 1070 1.1 riastrad ******************************************************************************/ 1071 1.1 riastrad 1072 1.1 riastrad void dc_set_power_state( 1073 1.1 riastrad struct dc *dc, 1074 1.1 riastrad enum dc_acpi_cm_power_state power_state); 1075 1.1 riastrad void dc_resume(struct dc *dc); 1076 1.1 riastrad unsigned int dc_get_current_backlight_pwm(struct dc *dc); 1077 1.1 riastrad unsigned int dc_get_target_backlight_pwm(struct dc *dc); 1078 1.1 riastrad 1079 1.1 riastrad bool dc_is_dmcu_initialized(struct dc *dc); 1080 1.1 riastrad bool dc_is_hw_initialized(struct dc *dc); 1081 1.1 riastrad 1082 1.1 riastrad enum dc_status dc_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, uint32_t stepping); 1083 1.1 riastrad void dc_get_clock(struct dc *dc, enum dc_clock_type clock_type, struct dc_clock_config *clock_cfg); 1084 1.1 riastrad /******************************************************************************* 1085 1.1 riastrad * DSC Interfaces 1086 1.1 riastrad ******************************************************************************/ 1087 1.1 riastrad #include "dc_dsc.h" 1088 1.1 riastrad #endif /* DC_INTERFACE_H_ */ 1089