2019-02-22 21:52:08 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: AMD
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DC_RESOURCE_DCN20_H__
|
|
|
|
#define __DC_RESOURCE_DCN20_H__
|
|
|
|
|
|
|
|
#include "core_types.h"
|
|
|
|
|
|
|
|
#define TO_DCN20_RES_POOL(pool)\
|
|
|
|
container_of(pool, struct dcn20_resource_pool, base)
|
|
|
|
|
|
|
|
struct dc;
|
|
|
|
struct resource_pool;
|
|
|
|
struct _vcs_dpi_display_pipe_params_st;
|
|
|
|
|
|
|
|
struct dcn20_resource_pool {
|
|
|
|
struct resource_pool base;
|
|
|
|
};
|
|
|
|
struct resource_pool *dcn20_create_resource_pool(
|
|
|
|
const struct dc_init_data *init_data,
|
|
|
|
struct dc *dc);
|
|
|
|
|
|
|
|
struct link_encoder *dcn20_link_encoder_create(
|
|
|
|
const struct encoder_init_data *enc_init_data);
|
|
|
|
|
|
|
|
unsigned int dcn20_calc_max_scaled_time(
|
|
|
|
unsigned int time_per_pixel,
|
|
|
|
enum mmhubbub_wbif_mode mode,
|
|
|
|
unsigned int urgent_watermark);
|
|
|
|
int dcn20_populate_dml_pipes_from_context(
|
2019-10-24 19:45:44 +00:00
|
|
|
struct dc *dc, struct dc_state *context, display_e2e_pipe_params_st *pipes);
|
2019-02-22 21:52:08 +00:00
|
|
|
struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer(
|
|
|
|
struct dc_state *state,
|
|
|
|
const struct resource_pool *pool,
|
|
|
|
struct dc_stream_state *stream);
|
|
|
|
void dcn20_populate_dml_writeback_from_context(
|
|
|
|
struct dc *dc, struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes);
|
|
|
|
|
|
|
|
struct stream_encoder *dcn20_stream_encoder_create(
|
|
|
|
enum engine_id eng_id,
|
|
|
|
struct dc_context *ctx);
|
|
|
|
|
|
|
|
struct dce_hwseq *dcn20_hwseq_create(
|
|
|
|
struct dc_context *ctx);
|
|
|
|
|
|
|
|
bool dcn20_get_dcc_compression_cap(const struct dc *dc,
|
|
|
|
const struct dc_dcc_surface_param *input,
|
|
|
|
struct dc_surface_dcc_cap *output);
|
|
|
|
|
|
|
|
void dcn20_dpp_destroy(struct dpp **dpp);
|
|
|
|
|
|
|
|
struct dpp *dcn20_dpp_create(
|
|
|
|
struct dc_context *ctx,
|
|
|
|
uint32_t inst);
|
|
|
|
|
|
|
|
struct input_pixel_processor *dcn20_ipp_create(
|
|
|
|
struct dc_context *ctx, uint32_t inst);
|
|
|
|
|
|
|
|
|
|
|
|
struct output_pixel_processor *dcn20_opp_create(
|
|
|
|
struct dc_context *ctx, uint32_t inst);
|
|
|
|
|
|
|
|
struct dce_aux *dcn20_aux_engine_create(
|
|
|
|
struct dc_context *ctx, uint32_t inst);
|
|
|
|
|
|
|
|
struct dce_i2c_hw *dcn20_i2c_hw_create(
|
|
|
|
struct dc_context *ctx,
|
|
|
|
uint32_t inst);
|
|
|
|
|
|
|
|
void dcn20_clock_source_destroy(struct clock_source **clk_src);
|
|
|
|
|
|
|
|
struct display_stream_compressor *dcn20_dsc_create(
|
|
|
|
struct dc_context *ctx, uint32_t inst);
|
|
|
|
void dcn20_dsc_destroy(struct display_stream_compressor **dsc);
|
|
|
|
|
2019-09-25 21:12:10 +00:00
|
|
|
void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb);
|
|
|
|
void dcn20_cap_soc_clocks(
|
|
|
|
struct _vcs_dpi_soc_bounding_box_st *bb,
|
|
|
|
struct pp_smu_nv_clock_table max_clocks);
|
|
|
|
void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb,
|
|
|
|
struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states);
|
2019-02-22 21:52:08 +00:00
|
|
|
struct hubp *dcn20_hubp_create(
|
|
|
|
struct dc_context *ctx,
|
|
|
|
uint32_t inst);
|
|
|
|
struct timing_generator *dcn20_timing_generator_create(
|
|
|
|
struct dc_context *ctx,
|
|
|
|
uint32_t instance);
|
|
|
|
struct mpc *dcn20_mpc_create(struct dc_context *ctx);
|
|
|
|
struct hubbub *dcn20_hubbub_create(struct dc_context *ctx);
|
|
|
|
|
|
|
|
bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool);
|
|
|
|
bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool);
|
|
|
|
|
|
|
|
void dcn20_set_mcif_arb_params(
|
|
|
|
struct dc *dc,
|
|
|
|
struct dc_state *context,
|
|
|
|
display_e2e_pipe_params_st *pipes,
|
|
|
|
int pipe_cnt);
|
2019-04-22 21:38:24 +00:00
|
|
|
bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate);
|
2019-09-23 16:56:20 +00:00
|
|
|
int dcn20_validate_apply_pipe_split_flags(
|
|
|
|
struct dc *dc,
|
|
|
|
struct dc_state *context,
|
|
|
|
int vlevel,
|
2020-04-20 19:21:10 +00:00
|
|
|
int *split,
|
2020-01-29 17:16:57 +00:00
|
|
|
bool *merge);
|
|
|
|
void dcn20_release_dsc(struct resource_context *res_ctx,
|
|
|
|
const struct resource_pool *pool,
|
|
|
|
struct display_stream_compressor **dsc);
|
2019-09-23 16:56:20 +00:00
|
|
|
bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx);
|
2020-04-20 19:21:10 +00:00
|
|
|
void dcn20_split_stream_for_mpc(
|
2019-09-23 16:56:20 +00:00
|
|
|
struct resource_context *res_ctx,
|
|
|
|
const struct resource_pool *pool,
|
|
|
|
struct pipe_ctx *primary_pipe,
|
|
|
|
struct pipe_ctx *secondary_pipe);
|
|
|
|
bool dcn20_split_stream_for_odm(
|
2019-11-28 19:14:56 +00:00
|
|
|
const struct dc *dc,
|
2019-09-23 16:56:20 +00:00
|
|
|
struct resource_context *res_ctx,
|
|
|
|
struct pipe_ctx *prev_odm_pipe,
|
|
|
|
struct pipe_ctx *next_odm_pipe);
|
2020-04-27 18:55:08 +00:00
|
|
|
void dcn20_acquire_dsc(const struct dc *dc,
|
|
|
|
struct resource_context *res_ctx,
|
|
|
|
struct display_stream_compressor **dsc,
|
|
|
|
int pipe_idx);
|
2019-09-23 16:56:20 +00:00
|
|
|
struct pipe_ctx *dcn20_find_secondary_pipe(struct dc *dc,
|
|
|
|
struct resource_context *res_ctx,
|
|
|
|
const struct resource_pool *pool,
|
|
|
|
const struct pipe_ctx *primary_pipe);
|
2019-05-22 18:24:40 +00:00
|
|
|
bool dcn20_fast_validate_bw(
|
|
|
|
struct dc *dc,
|
|
|
|
struct dc_state *context,
|
|
|
|
display_e2e_pipe_params_st *pipes,
|
2019-06-04 22:14:43 +00:00
|
|
|
int *pipe_cnt_out,
|
2019-05-22 18:24:40 +00:00
|
|
|
int *pipe_split_from,
|
|
|
|
int *vlevel_out);
|
|
|
|
void dcn20_calculate_dlg_params(
|
|
|
|
struct dc *dc, struct dc_state *context,
|
|
|
|
display_e2e_pipe_params_st *pipes,
|
|
|
|
int pipe_cnt,
|
|
|
|
int vlevel);
|
2019-02-22 21:52:08 +00:00
|
|
|
|
|
|
|
enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream);
|
|
|
|
enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream);
|
drm/amd/display: MST DSC compute fair share
If there is limited link bandwidth on a MST network,
it must be divided fairly between the streams on that network
Implement an algorithm to determine the correct DSC config
for each stream
The algorithm:
This
[ ] ( )
represents the range of bandwidths possible for a given stream.
The [] area represents the range of DSC configs, and the ()
represents no DSC. The bandwidth used increases from left to right.
First, try disabling DSC on all streams
[ ] (|)
[ ] (|)
Check this against the bandwidth limits of the link and each branch
(including each endpoint). If it passes, the job is done
Second, try maximum DSC compression on all streams
that support DSC
[| ] ( )
[| ] ( )
If this does not pass, then enabling this combination of streams
is impossible
Otherwise, divide the remaining bandwidth evenly amongst the streams
[ | ] ( )
[ | ] ( )
If one or more of the streams reach minimum compression, evenly
divide the reamining bandwidth amongst the remaining streams
[ |] ( )
[ |] ( )
[ | ] ( )
[ | ] ( )
If all streams can reach minimum compression, disable compression
greedily
[ |] ( )
[ |] ( )
[ ] (|)
Perform this algorithm on each full update, on each MST link
with at least one DSC stream on it
After the configs are computed, call
dcn20_add_dsc_to_stream_resource on each stream with DSC enabled.
It is only after all streams are created that we can know which
of them will need DSC.
Do all of this at the end of amdgpu atomic check. If it fails,
fail check; This combination of timings cannot be supported.
v2: Use drm_dp_mst_atomic_check to validate bw for certain dsc
configurations
v3: Use dc_dsc_policy structure to get min and max bpp rate
for DSC configuration
Acked-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-06-19 18:49:19 +00:00
|
|
|
enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct dc_state *dc_ctx, struct dc_stream_state *dc_stream);
|
2019-02-22 21:52:08 +00:00
|
|
|
enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream);
|
2020-02-14 22:53:47 +00:00
|
|
|
enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_state);
|
2019-02-22 21:52:08 +00:00
|
|
|
|
|
|
|
void dcn20_patch_bounding_box(
|
|
|
|
struct dc *dc,
|
|
|
|
struct _vcs_dpi_soc_bounding_box_st *bb);
|
|
|
|
void dcn20_cap_soc_clocks(
|
|
|
|
struct _vcs_dpi_soc_bounding_box_st *bb,
|
|
|
|
struct pp_smu_nv_clock_table max_clocks);
|
|
|
|
|
|
|
|
#endif /* __DC_RESOURCE_DCN20_H__ */
|
|
|
|
|