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( 532f488884SAlvin Lee struct dc *dc, struct dc_state *context, display_e2e_pipe_params_st *pipes); 547ed4e635SHarry Wentland struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer( 557ed4e635SHarry Wentland struct dc_state *state, 567ed4e635SHarry Wentland const struct resource_pool *pool, 577ed4e635SHarry Wentland struct dc_stream_state *stream); 587ed4e635SHarry Wentland void dcn20_populate_dml_writeback_from_context( 597ed4e635SHarry Wentland struct dc *dc, struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes); 607ed4e635SHarry Wentland 617ed4e635SHarry Wentland struct stream_encoder *dcn20_stream_encoder_create( 627ed4e635SHarry Wentland enum engine_id eng_id, 637ed4e635SHarry Wentland struct dc_context *ctx); 647ed4e635SHarry Wentland 657ed4e635SHarry Wentland struct dce_hwseq *dcn20_hwseq_create( 667ed4e635SHarry Wentland struct dc_context *ctx); 677ed4e635SHarry Wentland 687ed4e635SHarry Wentland bool dcn20_get_dcc_compression_cap(const struct dc *dc, 697ed4e635SHarry Wentland const struct dc_dcc_surface_param *input, 707ed4e635SHarry Wentland struct dc_surface_dcc_cap *output); 717ed4e635SHarry Wentland 727ed4e635SHarry Wentland void dcn20_dpp_destroy(struct dpp **dpp); 737ed4e635SHarry Wentland 747ed4e635SHarry Wentland struct dpp *dcn20_dpp_create( 757ed4e635SHarry Wentland struct dc_context *ctx, 767ed4e635SHarry Wentland uint32_t inst); 777ed4e635SHarry Wentland 787ed4e635SHarry Wentland struct input_pixel_processor *dcn20_ipp_create( 797ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 807ed4e635SHarry Wentland 817ed4e635SHarry Wentland 827ed4e635SHarry Wentland struct output_pixel_processor *dcn20_opp_create( 837ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 847ed4e635SHarry Wentland 857ed4e635SHarry Wentland struct dce_aux *dcn20_aux_engine_create( 867ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 877ed4e635SHarry Wentland 887ed4e635SHarry Wentland struct dce_i2c_hw *dcn20_i2c_hw_create( 897ed4e635SHarry Wentland struct dc_context *ctx, 907ed4e635SHarry Wentland uint32_t inst); 917ed4e635SHarry Wentland 927ed4e635SHarry Wentland void dcn20_clock_source_destroy(struct clock_source **clk_src); 937ed4e635SHarry Wentland 947ed4e635SHarry Wentland struct display_stream_compressor *dcn20_dsc_create( 957ed4e635SHarry Wentland struct dc_context *ctx, uint32_t inst); 967ed4e635SHarry Wentland void dcn20_dsc_destroy(struct display_stream_compressor **dsc); 977ed4e635SHarry Wentland 9844ce0cd3SDmytro Laktyushkin void dcn20_cap_soc_clocks( 9944ce0cd3SDmytro Laktyushkin struct _vcs_dpi_soc_bounding_box_st *bb, 10044ce0cd3SDmytro Laktyushkin struct pp_smu_nv_clock_table max_clocks); 10144ce0cd3SDmytro Laktyushkin void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb, 10244ce0cd3SDmytro Laktyushkin struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states); 1037ed4e635SHarry Wentland struct hubp *dcn20_hubp_create( 1047ed4e635SHarry Wentland struct dc_context *ctx, 1057ed4e635SHarry Wentland uint32_t inst); 1067ed4e635SHarry Wentland struct timing_generator *dcn20_timing_generator_create( 1077ed4e635SHarry Wentland struct dc_context *ctx, 1087ed4e635SHarry Wentland uint32_t instance); 1097ed4e635SHarry Wentland struct mpc *dcn20_mpc_create(struct dc_context *ctx); 1107ed4e635SHarry Wentland struct hubbub *dcn20_hubbub_create(struct dc_context *ctx); 1117ed4e635SHarry Wentland 1127ed4e635SHarry Wentland bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool); 1137ed4e635SHarry Wentland bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool); 1147ed4e635SHarry Wentland 1157ed4e635SHarry Wentland void dcn20_set_mcif_arb_params( 1167ed4e635SHarry Wentland struct dc *dc, 1177ed4e635SHarry Wentland struct dc_state *context, 1187ed4e635SHarry Wentland display_e2e_pipe_params_st *pipes, 1197ed4e635SHarry Wentland int pipe_cnt); 120cb0b554aSAlex Deucher bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate); 121*ea817dd5SDmytro Laktyushkin void dcn20_merge_pipes_for_validate( 122*ea817dd5SDmytro Laktyushkin struct dc *dc, 123*ea817dd5SDmytro Laktyushkin struct dc_state *context); 124b6bfba6cSDmytro Laktyushkin int dcn20_validate_apply_pipe_split_flags( 125b6bfba6cSDmytro Laktyushkin struct dc *dc, 126b6bfba6cSDmytro Laktyushkin struct dc_state *context, 127b6bfba6cSDmytro Laktyushkin int vlevel, 12865d68369SIsabel Zhang int *split, 1297287a675SDmytro Laktyushkin bool *merge); 1307287a675SDmytro Laktyushkin void dcn20_release_dsc(struct resource_context *res_ctx, 1317287a675SDmytro Laktyushkin const struct resource_pool *pool, 1327287a675SDmytro Laktyushkin struct display_stream_compressor **dsc); 133b6bfba6cSDmytro Laktyushkin bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx); 13465d68369SIsabel Zhang void dcn20_split_stream_for_mpc( 135b6bfba6cSDmytro Laktyushkin struct resource_context *res_ctx, 136b6bfba6cSDmytro Laktyushkin const struct resource_pool *pool, 137b6bfba6cSDmytro Laktyushkin struct pipe_ctx *primary_pipe, 138b6bfba6cSDmytro Laktyushkin struct pipe_ctx *secondary_pipe); 139b6bfba6cSDmytro Laktyushkin bool dcn20_split_stream_for_odm( 14014e49bb3SNikola Cornij const struct dc *dc, 141b6bfba6cSDmytro Laktyushkin struct resource_context *res_ctx, 142b6bfba6cSDmytro Laktyushkin struct pipe_ctx *prev_odm_pipe, 143b6bfba6cSDmytro Laktyushkin struct pipe_ctx *next_odm_pipe); 144570bc18cSDmytro Laktyushkin void dcn20_acquire_dsc(const struct dc *dc, 145570bc18cSDmytro Laktyushkin struct resource_context *res_ctx, 146570bc18cSDmytro Laktyushkin struct display_stream_compressor **dsc, 147570bc18cSDmytro Laktyushkin int pipe_idx); 148b6bfba6cSDmytro Laktyushkin struct pipe_ctx *dcn20_find_secondary_pipe(struct dc *dc, 149b6bfba6cSDmytro Laktyushkin struct resource_context *res_ctx, 150b6bfba6cSDmytro Laktyushkin const struct resource_pool *pool, 151b6bfba6cSDmytro Laktyushkin const struct pipe_ctx *primary_pipe); 1526de20237SEric Yang bool dcn20_fast_validate_bw( 1536de20237SEric Yang struct dc *dc, 1546de20237SEric Yang struct dc_state *context, 1556de20237SEric Yang display_e2e_pipe_params_st *pipes, 1565e335addSEric Yang int *pipe_cnt_out, 1576de20237SEric Yang int *pipe_split_from, 1586de20237SEric Yang int *vlevel_out); 1596de20237SEric Yang void dcn20_calculate_dlg_params( 1606de20237SEric Yang struct dc *dc, struct dc_state *context, 1616de20237SEric Yang display_e2e_pipe_params_st *pipes, 1626de20237SEric Yang int pipe_cnt, 1636de20237SEric Yang int vlevel); 1647ed4e635SHarry Wentland 1657ed4e635SHarry Wentland enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream); 1667ed4e635SHarry Wentland enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream); 1678c20a1edSDavid Francis enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct dc_state *dc_ctx, struct dc_stream_state *dc_stream); 1687ed4e635SHarry Wentland enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream); 1698d8c82b6SJoseph Gravenor enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_state); 1707ed4e635SHarry Wentland 1717ed4e635SHarry Wentland void dcn20_patch_bounding_box( 1727ed4e635SHarry Wentland struct dc *dc, 1737ed4e635SHarry Wentland struct _vcs_dpi_soc_bounding_box_st *bb); 1747ed4e635SHarry Wentland void dcn20_cap_soc_clocks( 1757ed4e635SHarry Wentland struct _vcs_dpi_soc_bounding_box_st *bb, 1767ed4e635SHarry Wentland struct pp_smu_nv_clock_table max_clocks); 1777ed4e635SHarry Wentland 1787ed4e635SHarry Wentland #endif /* __DC_RESOURCE_DCN20_H__ */ 1797ed4e635SHarry Wentland 180