14562236bSHarry Wentland /* 24562236bSHarry Wentland * Copyright 2015 Advanced Micro Devices, Inc. 34562236bSHarry Wentland * 44562236bSHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 54562236bSHarry Wentland * copy of this software and associated documentation files (the "Software"), 64562236bSHarry Wentland * to deal in the Software without restriction, including without limitation 74562236bSHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 84562236bSHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 94562236bSHarry Wentland * Software is furnished to do so, subject to the following conditions: 104562236bSHarry Wentland * 114562236bSHarry Wentland * The above copyright notice and this permission notice shall be included in 124562236bSHarry Wentland * all copies or substantial portions of the Software. 134562236bSHarry Wentland * 144562236bSHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 154562236bSHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 164562236bSHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 174562236bSHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 184562236bSHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 194562236bSHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 204562236bSHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 214562236bSHarry Wentland * 224562236bSHarry Wentland * Authors: AMD 234562236bSHarry Wentland * 244562236bSHarry Wentland */ 254562236bSHarry Wentland 264562236bSHarry Wentland #ifndef _CORE_TYPES_H_ 274562236bSHarry Wentland #define _CORE_TYPES_H_ 284562236bSHarry Wentland 294562236bSHarry Wentland #include "dc.h" 305e141de4SHarry Wentland #include "dce_calcs.h" 31ff5ef992SAlex Deucher #include "dcn_calcs.h" 324562236bSHarry Wentland #include "ddc_service_types.h" 334562236bSHarry Wentland #include "dc_bios_types.h" 34ff5ef992SAlex Deucher #include "mem_input.h" 358feabd03SYue Hin Lau #include "hubp.h" 36b86a1aa3SBhawanpreet Lakha #if defined(CONFIG_DRM_AMD_DC_DCN) 37ff5ef992SAlex Deucher #include "mpc.h" 38391e20d8SDuke Du #endif 39345429a6SHarry Wentland #include "dwb.h" 40345429a6SHarry Wentland #include "mcif_wb.h" 41d4caa72eSAnthony Koo #include "panel_cntl.h" 424562236bSHarry Wentland 434562236bSHarry Wentland #define MAX_CLOCK_SOURCES 7 444562236bSHarry Wentland 453be5262eSHarry Wentland void enable_surface_flip_reporting(struct dc_plane_state *plane_state, 464562236bSHarry Wentland uint32_t controller_id); 474562236bSHarry Wentland 484562236bSHarry Wentland #include "grph_object_id.h" 494562236bSHarry Wentland #include "link_encoder.h" 504562236bSHarry Wentland #include "stream_encoder.h" 514562236bSHarry Wentland #include "clock_source.h" 524562236bSHarry Wentland #include "audio.h" 53a185048cSTony Cheng #include "dm_pp_smu.h" 54d462fcf5SBhawanpreet Lakha #ifdef CONFIG_DRM_AMD_DC_HDCP 55d462fcf5SBhawanpreet Lakha #include "dm_cp_psp.h" 56d462fcf5SBhawanpreet Lakha #endif 57*fd249266SWenjing Liu #include "link_hwss.h" 584562236bSHarry Wentland 594562236bSHarry Wentland /************ link *****************/ 604562236bSHarry Wentland struct link_init_data { 61fb3466a4SBhawanpreet Lakha const struct dc *dc; 624562236bSHarry Wentland struct dc_context *ctx; /* TODO: remove 'dal' when DC is complete. */ 634562236bSHarry Wentland uint32_t connector_index; /* this will be mapped to the HPD pins */ 644562236bSHarry Wentland uint32_t link_index; /* this is mapped to DAL display_index 654562236bSHarry Wentland TODO: remove it when DC is complete. */ 669fa0fb77SMeenakshikumar Somasundaram bool is_dpia_link; 674562236bSHarry Wentland }; 684562236bSHarry Wentland 69d0778ebfSHarry Wentland struct dc_link *link_create(const struct link_init_data *init_params); 70d0778ebfSHarry Wentland void link_destroy(struct dc_link **link); 714562236bSHarry Wentland 724562236bSHarry Wentland enum dc_status dc_link_validate_mode_timing( 730971c40eSHarry Wentland const struct dc_stream_state *stream, 74d0778ebfSHarry Wentland struct dc_link *link, 754562236bSHarry Wentland const struct dc_crtc_timing *timing); 764562236bSHarry Wentland 77d0778ebfSHarry Wentland void core_link_resume(struct dc_link *link); 784562236bSHarry Wentland 79ab8db3e1SAndrey Grodzovsky void core_link_enable_stream( 80ab8db3e1SAndrey Grodzovsky struct dc_state *state, 81ab8db3e1SAndrey Grodzovsky struct pipe_ctx *pipe_ctx); 824562236bSHarry Wentland 8357430404SSu Sung Chung void core_link_disable_stream(struct pipe_ctx *pipe_ctx); 844562236bSHarry Wentland 8515e17335SCharlene Liu void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable); 864562236bSHarry Wentland /********** DAL Core*********************/ 874562236bSHarry Wentland #include "transform.h" 88d94585a0SYue Hin Lau #include "dpp.h" 894562236bSHarry Wentland 904562236bSHarry Wentland struct resource_pool; 91608ac7bbSJerry Zuo struct dc_state; 924562236bSHarry Wentland struct resource_context; 93aa919167SBhawanpreet Lakha struct clk_bw_params; 944562236bSHarry Wentland 954562236bSHarry Wentland struct resource_funcs { 964562236bSHarry Wentland void (*destroy)(struct resource_pool **pool); 9766b198ffSDmytro Laktyushkin void (*link_init)(struct dc_link *link); 98d4caa72eSAnthony Koo struct panel_cntl*(*panel_cntl_create)( 99d4caa72eSAnthony Koo const struct panel_cntl_init_data *panel_cntl_init_data); 1004562236bSHarry Wentland struct link_encoder *(*link_enc_create)( 1014562236bSHarry Wentland const struct encoder_init_data *init); 102e1f4328fSJimmy Kizito /* Create a minimal link encoder object with no dc_link object 103e1f4328fSJimmy Kizito * associated with it. */ 104e1f4328fSJimmy Kizito struct link_encoder *(*link_enc_create_minimal)(struct dc_context *ctx, enum engine_id eng_id); 105e1f4328fSJimmy Kizito 10645209ef7SDmytro Laktyushkin bool (*validate_bandwidth)( 107fb3466a4SBhawanpreet Lakha struct dc *dc, 108afcd526bSJoshua Aberback struct dc_state *context, 109afcd526bSJoshua Aberback bool fast_validate); 1108e02c26aSJoshua Aberback void (*calculate_wm_and_dlg)( 111b3ff538cSDmytro Laktyushkin struct dc *dc, struct dc_state *context, 112b3ff538cSDmytro Laktyushkin display_e2e_pipe_params_st *pipes, 113b3ff538cSDmytro Laktyushkin int pipe_cnt, 114b3ff538cSDmytro Laktyushkin int vlevel); 115443dfba0SDmytro Laktyushkin void (*update_soc_for_wm_a)( 116443dfba0SDmytro Laktyushkin struct dc *dc, struct dc_state *context); 117ed07237cSIlya Bakoulin int (*populate_dml_pipes)( 118ed07237cSIlya Bakoulin struct dc *dc, 1192f488884SAlvin Lee struct dc_state *context, 120fa896813SIsabel Zhang display_e2e_pipe_params_st *pipes, 121fa896813SIsabel Zhang bool fast_validate); 122ed07237cSIlya Bakoulin 123f42ef862SJimmy Kizito /* 124f42ef862SJimmy Kizito * Algorithm for assigning available link encoders to links. 125f42ef862SJimmy Kizito * 126f42ef862SJimmy Kizito * Update link_enc_assignments table and link_enc_avail list accordingly in 127f42ef862SJimmy Kizito * struct resource_context. 128f42ef862SJimmy Kizito */ 129f42ef862SJimmy Kizito void (*link_encs_assign)( 130f42ef862SJimmy Kizito struct dc *dc, 131f42ef862SJimmy Kizito struct dc_state *state, 132f42ef862SJimmy Kizito struct dc_stream_state *streams[], 133f42ef862SJimmy Kizito uint8_t stream_count); 134f42ef862SJimmy Kizito /* 135f42ef862SJimmy Kizito * Unassign a link encoder from a stream. 136f42ef862SJimmy Kizito * 137f42ef862SJimmy Kizito * Update link_enc_assignments table and link_enc_avail list accordingly in 138f42ef862SJimmy Kizito * struct resource_context. 139f42ef862SJimmy Kizito */ 140f42ef862SJimmy Kizito void (*link_enc_unassign)( 141f42ef862SJimmy Kizito struct dc_state *state, 142f42ef862SJimmy Kizito struct dc_stream_state *stream); 143f42ef862SJimmy Kizito 1441dc90497SAndrey Grodzovsky enum dc_status (*validate_global)( 1451dc90497SAndrey Grodzovsky struct dc *dc, 146608ac7bbSJerry Zuo struct dc_state *context); 1471dc90497SAndrey Grodzovsky 1484562236bSHarry Wentland struct pipe_ctx *(*acquire_idle_pipe_for_layer)( 149608ac7bbSJerry Zuo struct dc_state *context, 150a2b8659dSTony Cheng const struct resource_pool *pool, 1510971c40eSHarry Wentland struct dc_stream_state *stream); 1521dc90497SAndrey Grodzovsky 1538e7095b9SDmytro Laktyushkin enum dc_status (*validate_plane)(const struct dc_plane_state *plane_state, struct dc_caps *caps); 1541dc90497SAndrey Grodzovsky 1551dc90497SAndrey Grodzovsky enum dc_status (*add_stream_to_ctx)( 1561dc90497SAndrey Grodzovsky struct dc *dc, 157608ac7bbSJerry Zuo struct dc_state *new_ctx, 1581dc90497SAndrey Grodzovsky struct dc_stream_state *dc_stream); 159e56ae556SNikola Cornij 160e56ae556SNikola Cornij enum dc_status (*remove_stream_from_ctx)( 161e56ae556SNikola Cornij struct dc *dc, 162e56ae556SNikola Cornij struct dc_state *new_ctx, 163e56ae556SNikola Cornij struct dc_stream_state *stream); 1648d8c82b6SJoseph Gravenor enum dc_status (*patch_unknown_plane_state)( 16574eac5f3SSu Sung Chung struct dc_plane_state *plane_state); 16674eac5f3SSu Sung Chung 16778cc70b1SWesley Chalmers struct stream_encoder *(*find_first_free_match_stream_enc_for_link)( 16878cc70b1SWesley Chalmers struct resource_context *res_ctx, 16978cc70b1SWesley Chalmers const struct resource_pool *pool, 17078cc70b1SWesley Chalmers struct dc_stream_state *stream); 171345429a6SHarry Wentland void (*populate_dml_writeback_from_context)( 172345429a6SHarry Wentland struct dc *dc, 173345429a6SHarry Wentland struct resource_context *res_ctx, 174345429a6SHarry Wentland display_e2e_pipe_params_st *pipes); 17578cc70b1SWesley Chalmers 176345429a6SHarry Wentland void (*set_mcif_arb_params)( 177345429a6SHarry Wentland struct dc *dc, 178345429a6SHarry Wentland struct dc_state *context, 179345429a6SHarry Wentland display_e2e_pipe_params_st *pipes, 180345429a6SHarry Wentland int pipe_cnt); 1811b2c7b2cSBhawanpreet Lakha void (*update_bw_bounding_box)( 1821b2c7b2cSBhawanpreet Lakha struct dc *dc, 1831b2c7b2cSBhawanpreet Lakha struct clk_bw_params *bw_params); 18420f2ffe5SAlex Deucher #if defined(CONFIG_DRM_AMD_DC_DCN) 1855dba4991SBhawanpreet Lakha bool (*acquire_post_bldn_3dlut)( 1865dba4991SBhawanpreet Lakha struct resource_context *res_ctx, 1875dba4991SBhawanpreet Lakha const struct resource_pool *pool, 1885dba4991SBhawanpreet Lakha int mpcc_id, 1895dba4991SBhawanpreet Lakha struct dc_3dlut **lut, 1905dba4991SBhawanpreet Lakha struct dc_transfer_func **shaper); 1915dba4991SBhawanpreet Lakha 1925dba4991SBhawanpreet Lakha bool (*release_post_bldn_3dlut)( 1935dba4991SBhawanpreet Lakha struct resource_context *res_ctx, 1945dba4991SBhawanpreet Lakha const struct resource_pool *pool, 1955dba4991SBhawanpreet Lakha struct dc_3dlut **lut, 1965dba4991SBhawanpreet Lakha struct dc_transfer_func **shaper); 1975dba4991SBhawanpreet Lakha #endif 198b4f71c8cSAurabindo Pillai enum dc_status (*add_dsc_to_stream_resource)( 199b4f71c8cSAurabindo Pillai struct dc *dc, struct dc_state *state, 200b4f71c8cSAurabindo Pillai struct dc_stream_state *stream); 2014562236bSHarry Wentland }; 2024562236bSHarry Wentland 2034562236bSHarry Wentland struct audio_support{ 2044562236bSHarry Wentland bool dp_audio; 2054562236bSHarry Wentland bool hdmi_audio_on_dongle; 2064562236bSHarry Wentland bool hdmi_audio_native; 2074562236bSHarry Wentland }; 2084562236bSHarry Wentland 209f0e3db90SHarry Wentland #define NO_UNDERLAY_PIPE -1 210f0e3db90SHarry Wentland 2114562236bSHarry Wentland struct resource_pool { 2124562236bSHarry Wentland struct mem_input *mis[MAX_PIPES]; 2138feabd03SYue Hin Lau struct hubp *hubps[MAX_PIPES]; 2144562236bSHarry Wentland struct input_pixel_processor *ipps[MAX_PIPES]; 2154562236bSHarry Wentland struct transform *transforms[MAX_PIPES]; 216d94585a0SYue Hin Lau struct dpp *dpps[MAX_PIPES]; 2174562236bSHarry Wentland struct output_pixel_processor *opps[MAX_PIPES]; 2184562236bSHarry Wentland struct timing_generator *timing_generators[MAX_PIPES]; 2194562236bSHarry Wentland struct stream_encoder *stream_enc[MAX_PIPES * 2]; 220c9ef081dSYue Hin Lau struct hubbub *hubbub; 221cc408d72SDmytro Laktyushkin struct mpc *mpc; 2220f1a6ad7SJun Lei struct pp_smu_funcs *pp_smu; 2231877ccf6SDavid Francis struct dce_aux *engines[MAX_PIPES]; 224c85e6e54SDavid Francis struct dce_i2c_hw *hw_i2cs[MAX_PIPES]; 225c85e6e54SDavid Francis struct dce_i2c_sw *sw_i2cs[MAX_PIPES]; 226c85e6e54SDavid Francis bool i2c_hw_buffer_in_use; 2274562236bSHarry Wentland 228345429a6SHarry Wentland struct dwbc *dwbc[MAX_DWB_PIPES]; 229345429a6SHarry Wentland struct mcif_wb *mcif_wb[MAX_DWB_PIPES]; 230345429a6SHarry Wentland struct { 231345429a6SHarry Wentland unsigned int gsl_0:1; 232345429a6SHarry Wentland unsigned int gsl_1:1; 233345429a6SHarry Wentland unsigned int gsl_2:1; 234345429a6SHarry Wentland } gsl_groups; 235345429a6SHarry Wentland 23697bda032SHarry Wentland struct display_stream_compressor *dscs[MAX_PIPES]; 237345429a6SHarry Wentland 2384562236bSHarry Wentland unsigned int pipe_count; 2394562236bSHarry Wentland unsigned int underlay_pipe_index; 2404562236bSHarry Wentland unsigned int stream_enc_count; 241929c3aaaSEric Bernstein 242e1f4328fSJimmy Kizito /* An array for accessing the link encoder objects that have been created. 243e1f4328fSJimmy Kizito * Index in array corresponds to engine ID - viz. 0: ENGINE_ID_DIGA 244e1f4328fSJimmy Kizito */ 245e1f4328fSJimmy Kizito struct link_encoder *link_encoders[MAX_DIG_LINK_ENCODERS]; 246e1f4328fSJimmy Kizito /* Number of DIG link encoder objects created - i.e. number of valid 247e1f4328fSJimmy Kizito * entries in link_encoders array. 248e1f4328fSJimmy Kizito */ 249e1f4328fSJimmy Kizito unsigned int dig_link_enc_count; 250eabf2019SJimmy Kizito /* Number of USB4 DPIA (DisplayPort Input Adapter) link objects created.*/ 251eabf2019SJimmy Kizito unsigned int usb4_dpia_count; 252e1f4328fSJimmy Kizito 25383228ebbSFangzhi Zuo unsigned int hpo_dp_stream_enc_count; 25483228ebbSFangzhi Zuo struct hpo_dp_stream_encoder *hpo_dp_stream_enc[MAX_HPO_DP2_ENCODERS]; 2553bc8d921SFangzhi Zuo unsigned int hpo_dp_link_enc_count; 2563bc8d921SFangzhi Zuo struct hpo_dp_link_encoder *hpo_dp_link_enc[MAX_HPO_DP2_LINK_ENCODERS]; 25783228ebbSFangzhi Zuo #if defined(CONFIG_DRM_AMD_DC_DCN) 2585dba4991SBhawanpreet Lakha struct dc_3dlut *mpc_lut[MAX_PIPES]; 2595dba4991SBhawanpreet Lakha struct dc_transfer_func *mpc_shaper[MAX_PIPES]; 2605dba4991SBhawanpreet Lakha #endif 26133d7598dSJun Lei struct { 26233d7598dSJun Lei unsigned int xtalin_clock_inKhz; 26333d7598dSJun Lei unsigned int dccg_ref_clock_inKhz; 26433d7598dSJun Lei unsigned int dchub_ref_clock_inKhz; 26533d7598dSJun Lei } ref_clocks; 2663be1406aSYongqiang Sun unsigned int timing_generator_count; 267345429a6SHarry Wentland unsigned int mpcc_count; 2684562236bSHarry Wentland 269345429a6SHarry Wentland unsigned int writeback_pipe_count; 2704562236bSHarry Wentland /* 2714562236bSHarry Wentland * reserved clock source for DP 2724562236bSHarry Wentland */ 2734562236bSHarry Wentland struct clock_source *dp_clock_source; 2744562236bSHarry Wentland 2754562236bSHarry Wentland struct clock_source *clock_sources[MAX_CLOCK_SOURCES]; 2764562236bSHarry Wentland unsigned int clk_src_count; 2774562236bSHarry Wentland 2787352193aSTai Man struct audio *audios[MAX_AUDIOS]; 2794562236bSHarry Wentland unsigned int audio_count; 2804562236bSHarry Wentland struct audio_support audio_support; 2814562236bSHarry Wentland 282ea2e8d92SDmytro Laktyushkin struct dccg *dccg; 2834562236bSHarry Wentland struct irq_service *irqs; 2844562236bSHarry Wentland 2855e7773a2SAnthony Koo struct abm *abm; 2865e7773a2SAnthony Koo struct dmcu *dmcu; 2874c1a1335SWyatt Wood struct dmub_psr *psr; 2885e7773a2SAnthony Koo 28920f2ffe5SAlex Deucher #if defined(CONFIG_DRM_AMD_DC_DCN) 290d99f1387SBhawanpreet Lakha struct abm *multiple_abms[MAX_PIPES]; 291d99f1387SBhawanpreet Lakha #endif 292d99f1387SBhawanpreet Lakha 2934562236bSHarry Wentland const struct resource_funcs *funcs; 2944562236bSHarry Wentland const struct resource_caps *res_cap; 295d9a07577SJun Lei 296d9a07577SJun Lei struct ddc_service *oem_device; 2974562236bSHarry Wentland }; 2984562236bSHarry Wentland 299f553e681SDmytro Laktyushkin struct dcn_fe_bandwidth { 30069338c1fSDmytro Laktyushkin int dppclk_khz; 301799c5b9cSWesley Chalmers 302f553e681SDmytro Laktyushkin }; 303f553e681SDmytro Laktyushkin 30479b06f0cSHarry Wentland struct stream_resource { 305a6a6cb34SHarry Wentland struct output_pixel_processor *opp; 30697bda032SHarry Wentland struct display_stream_compressor *dsc; 3076b670fa9SHarry Wentland struct timing_generator *tg; 3088e9c4c8cSHarry Wentland struct stream_encoder *stream_enc; 30983228ebbSFangzhi Zuo struct hpo_dp_stream_encoder *hpo_dp_stream_enc; 310afaacef4SHarry Wentland struct audio *audio; 31110688217SHarry Wentland 31210688217SHarry Wentland struct pixel_clk_params pix_clk_params; 31396c50c0dSHarry Wentland struct encoder_info_frame encoder_info_frame; 3149aef1a31SSivapiriyanKumarasamy 3159aef1a31SSivapiriyanKumarasamy struct abm *abm; 316345429a6SHarry Wentland /* There are only (num_pipes+1)/2 groups. 0 means unassigned, 317345429a6SHarry Wentland * otherwise it's using group number 'gsl_group-1' 318345429a6SHarry Wentland */ 319345429a6SHarry Wentland uint8_t gsl_group; 32079b06f0cSHarry Wentland }; 32179b06f0cSHarry Wentland 32279b06f0cSHarry Wentland struct plane_resource { 3236702a9acSHarry Wentland struct scaler_data scl_data; 3248feabd03SYue Hin Lau struct hubp *hubp; 32586a66c4eSHarry Wentland struct mem_input *mi; 32686a66c4eSHarry Wentland struct input_pixel_processor *ipp; 32786a66c4eSHarry Wentland struct transform *xfm; 328d94585a0SYue Hin Lau struct dpp *dpp; 329e07f541fSYongqiang Sun uint8_t mpcc_inst; 330f553e681SDmytro Laktyushkin 331f553e681SDmytro Laktyushkin struct dcn_fe_bandwidth bw; 33279b06f0cSHarry Wentland }; 33379b06f0cSHarry Wentland 3344c3adc0bSWenjing Liu #define LINK_RES_HPO_DP_REC_MAP__MASK 0xFFFF 3354c3adc0bSWenjing Liu #define LINK_RES_HPO_DP_REC_MAP__SHIFT 0 3364c3adc0bSWenjing Liu 337ef30f441SWenjing Liu /* all mappable hardware resources used to enable a link */ 338ef30f441SWenjing Liu struct link_resource { 339f3fac948SWenjing Liu struct hpo_dp_link_encoder *hpo_dp_link_enc; 340ef30f441SWenjing Liu }; 341ef30f441SWenjing Liu 34224c18794SDmytro Laktyushkin union pipe_update_flags { 34324c18794SDmytro Laktyushkin struct { 34424c18794SDmytro Laktyushkin uint32_t enable : 1; 34524c18794SDmytro Laktyushkin uint32_t disable : 1; 34624c18794SDmytro Laktyushkin uint32_t odm : 1; 34724c18794SDmytro Laktyushkin uint32_t global_sync : 1; 34824c18794SDmytro Laktyushkin uint32_t opp_changed : 1; 34924c18794SDmytro Laktyushkin uint32_t tg_changed : 1; 35024c18794SDmytro Laktyushkin uint32_t mpcc : 1; 35124c18794SDmytro Laktyushkin uint32_t dppclk : 1; 35224c18794SDmytro Laktyushkin uint32_t hubp_interdependent : 1; 35324c18794SDmytro Laktyushkin uint32_t hubp_rq_dlg_ttu : 1; 35424c18794SDmytro Laktyushkin uint32_t gamut_remap : 1; 35524c18794SDmytro Laktyushkin uint32_t scaler : 1; 35624c18794SDmytro Laktyushkin uint32_t viewport : 1; 357498563cfSJinZe.Xu uint32_t plane_changed : 1; 358ba5a5371SNicholas Kazlauskas uint32_t det_size : 1; 35924c18794SDmytro Laktyushkin } bits; 36024c18794SDmytro Laktyushkin uint32_t raw; 36124c18794SDmytro Laktyushkin }; 36224c18794SDmytro Laktyushkin 3634562236bSHarry Wentland struct pipe_ctx { 3643be5262eSHarry Wentland struct dc_plane_state *plane_state; 3650971c40eSHarry Wentland struct dc_stream_state *stream; 3664562236bSHarry Wentland 36779b06f0cSHarry Wentland struct plane_resource plane_res; 36879b06f0cSHarry Wentland struct stream_resource stream_res; 369ef30f441SWenjing Liu struct link_resource link_res; 37079b06f0cSHarry Wentland 3714562236bSHarry Wentland struct clock_source *clock_source; 3724562236bSHarry Wentland 3734562236bSHarry Wentland struct pll_settings pll_settings; 3744562236bSHarry Wentland 3754562236bSHarry Wentland uint8_t pipe_idx; 376a896f870SMeenakshikumar Somasundaram uint8_t pipe_idx_syncd; 3774562236bSHarry Wentland 3784562236bSHarry Wentland struct pipe_ctx *top_pipe; 3794562236bSHarry Wentland struct pipe_ctx *bottom_pipe; 380b1f6d01cSDmytro Laktyushkin struct pipe_ctx *next_odm_pipe; 381b1f6d01cSDmytro Laktyushkin struct pipe_ctx *prev_odm_pipe; 382f0558542SDmytro Laktyushkin 383b86a1aa3SBhawanpreet Lakha #ifdef CONFIG_DRM_AMD_DC_DCN 384ff5ef992SAlex Deucher struct _vcs_dpi_display_dlg_regs_st dlg_regs; 385ff5ef992SAlex Deucher struct _vcs_dpi_display_ttu_regs_st ttu_regs; 386ff5ef992SAlex Deucher struct _vcs_dpi_display_rq_regs_st rq_regs; 387ff5ef992SAlex Deucher struct _vcs_dpi_display_pipe_dest_params_st pipe_dlg_param; 3881f2fcc81SHarry Wentland struct _vcs_dpi_display_rq_params_st dml_rq_param; 3891f2fcc81SHarry Wentland struct _vcs_dpi_display_dlg_sys_params_st dml_dlg_sys_param; 3901f2fcc81SHarry Wentland struct _vcs_dpi_display_e2e_pipe_params_st dml_input; 391ba5a5371SNicholas Kazlauskas int det_buffer_size_kb; 392ba5a5371SNicholas Kazlauskas bool unbounded_req; 393ba5a5371SNicholas Kazlauskas #endif 39424c18794SDmytro Laktyushkin union pipe_update_flags update_flags; 395345429a6SHarry Wentland struct dwbc *dwbc; 396345429a6SHarry Wentland struct mcif_wb *mcif_wb; 397d209124dSBhawanpreet Lakha bool vtp_locked; 3984562236bSHarry Wentland }; 3994562236bSHarry Wentland 4000d4b4253SJimmy Kizito /* Data used for dynamic link encoder assignment. 4010d4b4253SJimmy Kizito * Tracks current and future assignments; available link encoders; 4020d4b4253SJimmy Kizito * and mode of operation (whether to use current or future assignments). 4030d4b4253SJimmy Kizito */ 4040d4b4253SJimmy Kizito struct link_enc_cfg_context { 4050d4b4253SJimmy Kizito enum link_enc_cfg_mode mode; 4060d4b4253SJimmy Kizito struct link_enc_assignment link_enc_assignments[MAX_PIPES]; 4070d4b4253SJimmy Kizito enum engine_id link_enc_avail[MAX_DIG_LINK_ENCODERS]; 4080d4b4253SJimmy Kizito struct link_enc_assignment transient_assignments[MAX_PIPES]; 4090d4b4253SJimmy Kizito }; 4100d4b4253SJimmy Kizito 4114562236bSHarry Wentland struct resource_context { 4124562236bSHarry Wentland struct pipe_ctx pipe_ctx[MAX_PIPES]; 4134562236bSHarry Wentland bool is_stream_enc_acquired[MAX_PIPES * 2]; 4144562236bSHarry Wentland bool is_audio_acquired[MAX_PIPES]; 4154562236bSHarry Wentland uint8_t clock_source_ref_count[MAX_CLOCK_SOURCES]; 4164562236bSHarry Wentland uint8_t dp_clock_source_ref_count; 417345429a6SHarry Wentland bool is_dsc_acquired[MAX_PIPES]; 4180d4b4253SJimmy Kizito struct link_enc_cfg_context link_enc_cfg_ctx; 41983228ebbSFangzhi Zuo bool is_hpo_dp_stream_enc_acquired[MAX_HPO_DP2_ENCODERS]; 4206dd8931bSWenjing Liu unsigned int hpo_dp_link_enc_to_link_idx[MAX_HPO_DP2_LINK_ENCODERS]; 4216dd8931bSWenjing Liu int hpo_dp_link_enc_ref_cnts[MAX_HPO_DP2_LINK_ENCODERS]; 42283228ebbSFangzhi Zuo #if defined(CONFIG_DRM_AMD_DC_DCN) 4235dba4991SBhawanpreet Lakha bool is_mpc_3dlut_acquired[MAX_PIPES]; 4245dba4991SBhawanpreet Lakha #endif 4254562236bSHarry Wentland }; 4264562236bSHarry Wentland 4279037d802SDmytro Laktyushkin struct dce_bw_output { 4289037d802SDmytro Laktyushkin bool cpuc_state_change_enable; 4299037d802SDmytro Laktyushkin bool cpup_state_change_enable; 4309037d802SDmytro Laktyushkin bool stutter_mode_enable; 4319037d802SDmytro Laktyushkin bool nbp_state_change_enable; 4329037d802SDmytro Laktyushkin bool all_displays_in_sync; 4339037d802SDmytro Laktyushkin struct dce_watermarks urgent_wm_ns[MAX_PIPES]; 4349037d802SDmytro Laktyushkin struct dce_watermarks stutter_exit_wm_ns[MAX_PIPES]; 435b361521fSMikita Lipski struct dce_watermarks stutter_entry_wm_ns[MAX_PIPES]; 4369037d802SDmytro Laktyushkin struct dce_watermarks nbp_state_change_wm_ns[MAX_PIPES]; 4379037d802SDmytro Laktyushkin int sclk_khz; 4389037d802SDmytro Laktyushkin int sclk_deep_sleep_khz; 4399037d802SDmytro Laktyushkin int yclk_khz; 4409037d802SDmytro Laktyushkin int dispclk_khz; 4419037d802SDmytro Laktyushkin int blackout_recovery_time_us; 4429037d802SDmytro Laktyushkin }; 4439037d802SDmytro Laktyushkin 444345429a6SHarry Wentland struct dcn_bw_writeback { 445345429a6SHarry Wentland struct mcif_arb_params mcif_wb_arb[MAX_DWB_PIPES]; 446345429a6SHarry Wentland }; 447345429a6SHarry Wentland 4489037d802SDmytro Laktyushkin struct dcn_bw_output { 449d578839cSDmytro Laktyushkin struct dc_clocks clk; 4509037d802SDmytro Laktyushkin struct dcn_watermark_set watermarks; 451345429a6SHarry Wentland struct dcn_bw_writeback bw_writeback; 452ba5a5371SNicholas Kazlauskas int compbuf_size_kb; 4539037d802SDmytro Laktyushkin }; 4549037d802SDmytro Laktyushkin 455813d20dcSAidan Wood union bw_output { 4569037d802SDmytro Laktyushkin struct dcn_bw_output dcn; 4579037d802SDmytro Laktyushkin struct dce_bw_output dce; 4589037d802SDmytro Laktyushkin }; 4599037d802SDmytro Laktyushkin 460813d20dcSAidan Wood struct bw_context { 461813d20dcSAidan Wood union bw_output bw; 462813d20dcSAidan Wood struct display_mode_lib dml; 463813d20dcSAidan Wood }; 4642119aa17SDavid Francis /** 4652119aa17SDavid Francis * struct dc_state - The full description of a state requested by a user 4662119aa17SDavid Francis * 4672119aa17SDavid Francis * @streams: Stream properties 4682119aa17SDavid Francis * @stream_status: The planes on a given stream 4692119aa17SDavid Francis * @res_ctx: Persistent state of resources 470813d20dcSAidan Wood * @bw_ctx: The output from bandwidth and watermark calculations and the DML 4712119aa17SDavid Francis * @pp_display_cfg: PowerPlay clocks and settings 4722119aa17SDavid Francis * @dcn_bw_vars: non-stack memory to support bandwidth calculations 4732119aa17SDavid Francis * 4742119aa17SDavid Francis */ 475608ac7bbSJerry Zuo struct dc_state { 4760971c40eSHarry Wentland struct dc_stream_state *streams[MAX_PIPES]; 477ab2541b6SAric Cyr struct dc_stream_status stream_status[MAX_PIPES]; 478ab2541b6SAric Cyr uint8_t stream_count; 4790825d965SEric Yang uint8_t stream_mask; 4804562236bSHarry Wentland 4814562236bSHarry Wentland struct resource_context res_ctx; 4824562236bSHarry Wentland 483813d20dcSAidan Wood struct bw_context bw_ctx; 4849037d802SDmytro Laktyushkin 4855ea81b91SDmytro Laktyushkin /* Note: these are big structures, do *not* put on stack! */ 4864562236bSHarry Wentland struct dm_pp_display_configuration pp_display_cfg; 487b86a1aa3SBhawanpreet Lakha #ifdef CONFIG_DRM_AMD_DC_DCN 488ff5ef992SAlex Deucher struct dcn_bw_internal_vars dcn_bw_vars; 489ff5ef992SAlex Deucher #endif 4908a76708eSAndrey Grodzovsky 4910de34efcSDmytro Laktyushkin struct clk_mgr *clk_mgr; 492ab8db3e1SAndrey Grodzovsky 4938ee5702aSDave Airlie struct kref refcount; 4946b85151fSMartin Leung 4956b85151fSMartin Leung struct { 4966b85151fSMartin Leung unsigned int stutter_period_us; 4976b85151fSMartin Leung } perf_params; 4984562236bSHarry Wentland }; 4994562236bSHarry Wentland 5004562236bSHarry Wentland #endif /* _CORE_TYPES_H_ */ 501