17ed4e635SHarry Wentland /* 27ed4e635SHarry Wentland * Copyright 2017 Advanced Micro Devices, Inc. 37ed4e635SHarry Wentland * 47ed4e635SHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 57ed4e635SHarry Wentland * copy of this software and associated documentation files (the "Software"), 67ed4e635SHarry Wentland * to deal in the Software without restriction, including without limitation 77ed4e635SHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 87ed4e635SHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 97ed4e635SHarry Wentland * Software is furnished to do so, subject to the following conditions: 107ed4e635SHarry Wentland * 117ed4e635SHarry Wentland * The above copyright notice and this permission notice shall be included in 127ed4e635SHarry Wentland * all copies or substantial portions of the Software. 137ed4e635SHarry Wentland * 147ed4e635SHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 157ed4e635SHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167ed4e635SHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 177ed4e635SHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 187ed4e635SHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 197ed4e635SHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 207ed4e635SHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 217ed4e635SHarry Wentland * 227ed4e635SHarry Wentland * Authors: AMD 237ed4e635SHarry Wentland * 247ed4e635SHarry Wentland */ 257ed4e635SHarry Wentland 267ed4e635SHarry Wentland #ifndef __DC_RESOURCE_DCN20_H__ 277ed4e635SHarry Wentland #define __DC_RESOURCE_DCN20_H__ 287ed4e635SHarry Wentland 297ed4e635SHarry Wentland #include "core_types.h" 307ed4e635SHarry Wentland 317ed4e635SHarry Wentland #define TO_DCN20_RES_POOL(pool)\ 327ed4e635SHarry Wentland container_of(pool, struct dcn20_resource_pool, base) 337ed4e635SHarry Wentland 347ed4e635SHarry Wentland struct dc; 357ed4e635SHarry Wentland struct resource_pool; 367ed4e635SHarry Wentland struct _vcs_dpi_display_pipe_params_st; 377ed4e635SHarry Wentland 387ed4e635SHarry Wentland struct dcn20_resource_pool { 397ed4e635SHarry Wentland struct resource_pool base; 407ed4e635SHarry Wentland }; 417ed4e635SHarry Wentland struct resource_pool *dcn20_create_resource_pool( 427ed4e635SHarry Wentland const struct dc_init_data *init_data, 437ed4e635SHarry Wentland struct dc *dc); 447ed4e635SHarry Wentland 457ed4e635SHarry Wentland struct link_encoder *dcn20_link_encoder_create( 467ed4e635SHarry Wentland const struct encoder_init_data *enc_init_data); 477ed4e635SHarry Wentland 487ed4e635SHarry Wentland unsigned int dcn20_calc_max_scaled_time( 497ed4e635SHarry Wentland unsigned int time_per_pixel, 507ed4e635SHarry Wentland enum mmhubbub_wbif_mode mode, 517ed4e635SHarry Wentland unsigned int urgent_watermark); 527ed4e635SHarry Wentland int dcn20_populate_dml_pipes_from_context( 53*fa896813SIsabel Zhang struct dc *dc, 54*fa896813SIsabel Zhang struct dc_state *context, 55*fa896813SIsabel Zhang display_e2e_pipe_params_st *pipes, 56*fa896813SIsabel Zhang bool fast_validate); 577ed4e635SHarry Wentland struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer( 587ed4e635SHarry Wentland struct dc_state *state, 597ed4e635SHarry Wentland const struct resource_pool *pool, 607ed4e635SHarry Wentland struct dc_stream_state *stream); 617ed4e635SHarry Wentland void dcn20_populate_dml_writeback_from_context( 627ed4e635SHarry Wentland struct dc *dc, struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes); 637ed4e635SHarry Wentland 647ed4e635SHarry Wentland struct stream_encoder *dcn20_stream_encoder_create( 657ed4e635SHarry Wentland enum engine_id eng_id, 667ed4e635SHarry Wentland struct dc_context *ctx); 677ed4e635SHarry Wentland 687ed4e635SHarry Wentland struct dce_hwseq *dcn20_hwseq_create( 697ed4e635SHarry Wentland struct dc_context *ctx); 707ed4e635SHarry Wentland 717ed4e635SHarry Wentland bool dcn20_get_dcc_compression_cap(const struct dc *dc, 727ed4e635SHarry Wentland const struct dc_dcc_surface_param *input, 737ed4e635SHarry Wentland struct dc_surface_dcc_cap *output); 747ed4e635SHarry Wentland 757ed4e635SHarry Wentland void dcn20_dpp_destroy(struct dpp **dpp); 767ed4e635SHarry Wentland 777ed4e635SHarry Wentland struct dpp *dcn20_dpp_create( 787ed4e635SHarry Wentland struct dc_context *ctx, 797ed4e635SHarry Wentland uint32_t inst); 807ed4e635SHarry Wentland 817ed4e635SHarry Wentland struct input_pixel_processor *dcn20_ipp_create( 827ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 837ed4e635SHarry Wentland 847ed4e635SHarry Wentland 857ed4e635SHarry Wentland struct output_pixel_processor *dcn20_opp_create( 867ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 877ed4e635SHarry Wentland 887ed4e635SHarry Wentland struct dce_aux *dcn20_aux_engine_create( 897ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 907ed4e635SHarry Wentland 917ed4e635SHarry Wentland struct dce_i2c_hw *dcn20_i2c_hw_create( 927ed4e635SHarry Wentland struct dc_context *ctx, 937ed4e635SHarry Wentland uint32_t inst); 947ed4e635SHarry Wentland 957ed4e635SHarry Wentland void dcn20_clock_source_destroy(struct clock_source **clk_src); 967ed4e635SHarry Wentland 977ed4e635SHarry Wentland struct display_stream_compressor *dcn20_dsc_create( 987ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 997ed4e635SHarry Wentland void dcn20_dsc_destroy(struct display_stream_compressor **dsc); 1007ed4e635SHarry Wentland 10144ce0cd3SDmytro Laktyushkin void dcn20_cap_soc_clocks( 10244ce0cd3SDmytro Laktyushkin struct _vcs_dpi_soc_bounding_box_st *bb, 10344ce0cd3SDmytro Laktyushkin struct pp_smu_nv_clock_table max_clocks); 10444ce0cd3SDmytro Laktyushkin void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb, 10544ce0cd3SDmytro Laktyushkin struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states); 1067ed4e635SHarry Wentland struct hubp *dcn20_hubp_create( 1077ed4e635SHarry Wentland struct dc_context *ctx, 1087ed4e635SHarry Wentland uint32_t inst); 1097ed4e635SHarry Wentland struct timing_generator *dcn20_timing_generator_create( 1107ed4e635SHarry Wentland struct dc_context *ctx, 1117ed4e635SHarry Wentland uint32_t instance); 1127ed4e635SHarry Wentland struct mpc *dcn20_mpc_create(struct dc_context *ctx); 1137ed4e635SHarry Wentland struct hubbub *dcn20_hubbub_create(struct dc_context *ctx); 1147ed4e635SHarry Wentland 1157ed4e635SHarry Wentland bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool); 1167ed4e635SHarry Wentland bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool); 1177ed4e635SHarry Wentland 1187ed4e635SHarry Wentland void dcn20_set_mcif_arb_params( 1197ed4e635SHarry Wentland struct dc *dc, 1207ed4e635SHarry Wentland struct dc_state *context, 1217ed4e635SHarry Wentland display_e2e_pipe_params_st *pipes, 1227ed4e635SHarry Wentland int pipe_cnt); 123cb0b554aSAlex Deucher bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate); 124ea817dd5SDmytro Laktyushkin void dcn20_merge_pipes_for_validate( 125ea817dd5SDmytro Laktyushkin struct dc *dc, 126ea817dd5SDmytro Laktyushkin struct dc_state *context); 127b6bfba6cSDmytro Laktyushkin int dcn20_validate_apply_pipe_split_flags( 128b6bfba6cSDmytro Laktyushkin struct dc *dc, 129b6bfba6cSDmytro Laktyushkin struct dc_state *context, 130b6bfba6cSDmytro Laktyushkin int vlevel, 13165d68369SIsabel Zhang int *split, 1327287a675SDmytro Laktyushkin bool *merge); 1337287a675SDmytro Laktyushkin void dcn20_release_dsc(struct resource_context *res_ctx, 1347287a675SDmytro Laktyushkin const struct resource_pool *pool, 1357287a675SDmytro Laktyushkin struct display_stream_compressor **dsc); 136b6bfba6cSDmytro Laktyushkin bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx); 13765d68369SIsabel Zhang void dcn20_split_stream_for_mpc( 138b6bfba6cSDmytro Laktyushkin struct resource_context *res_ctx, 139b6bfba6cSDmytro Laktyushkin const struct resource_pool *pool, 140b6bfba6cSDmytro Laktyushkin struct pipe_ctx *primary_pipe, 141b6bfba6cSDmytro Laktyushkin struct pipe_ctx *secondary_pipe); 142b6bfba6cSDmytro Laktyushkin bool dcn20_split_stream_for_odm( 14314e49bb3SNikola Cornij const struct dc *dc, 144b6bfba6cSDmytro Laktyushkin struct resource_context *res_ctx, 145b6bfba6cSDmytro Laktyushkin struct pipe_ctx *prev_odm_pipe, 146b6bfba6cSDmytro Laktyushkin struct pipe_ctx *next_odm_pipe); 147570bc18cSDmytro Laktyushkin void dcn20_acquire_dsc(const struct dc *dc, 148570bc18cSDmytro Laktyushkin struct resource_context *res_ctx, 149570bc18cSDmytro Laktyushkin struct display_stream_compressor **dsc, 150570bc18cSDmytro Laktyushkin int pipe_idx); 151b6bfba6cSDmytro Laktyushkin struct pipe_ctx *dcn20_find_secondary_pipe(struct dc *dc, 152b6bfba6cSDmytro Laktyushkin struct resource_context *res_ctx, 153b6bfba6cSDmytro Laktyushkin const struct resource_pool *pool, 154b6bfba6cSDmytro Laktyushkin const struct pipe_ctx *primary_pipe); 1556de20237SEric Yang bool dcn20_fast_validate_bw( 1566de20237SEric Yang struct dc *dc, 1576de20237SEric Yang struct dc_state *context, 1586de20237SEric Yang display_e2e_pipe_params_st *pipes, 1595e335addSEric Yang int *pipe_cnt_out, 1606de20237SEric Yang int *pipe_split_from, 161*fa896813SIsabel Zhang int *vlevel_out, 162*fa896813SIsabel Zhang bool fast_validate); 1636de20237SEric Yang void dcn20_calculate_dlg_params( 1646de20237SEric Yang struct dc *dc, struct dc_state *context, 1656de20237SEric Yang display_e2e_pipe_params_st *pipes, 1666de20237SEric Yang int pipe_cnt, 1676de20237SEric Yang int vlevel); 1687ed4e635SHarry Wentland 1697ed4e635SHarry Wentland enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream); 1707ed4e635SHarry Wentland enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream); 1718c20a1edSDavid Francis enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct dc_state *dc_ctx, struct dc_stream_state *dc_stream); 1727ed4e635SHarry Wentland enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream); 1738d8c82b6SJoseph Gravenor enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_state); 1747ed4e635SHarry Wentland 1757ed4e635SHarry Wentland void dcn20_patch_bounding_box( 1767ed4e635SHarry Wentland struct dc *dc, 1777ed4e635SHarry Wentland struct _vcs_dpi_soc_bounding_box_st *bb); 1787ed4e635SHarry Wentland void dcn20_cap_soc_clocks( 1797ed4e635SHarry Wentland struct _vcs_dpi_soc_bounding_box_st *bb, 1807ed4e635SHarry Wentland struct pp_smu_nv_clock_table max_clocks); 1817ed4e635SHarry Wentland 1827ed4e635SHarry Wentland #endif /* __DC_RESOURCE_DCN20_H__ */ 1837ed4e635SHarry Wentland 184