drm/amd/display: audio dynamic resource acquired related
Signed-off-by: Charlene Liu <charlene.liu@amd.com> Reviewed-by: Anthony Koo <Anthony.Koo@amd.com> Acked-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
50d4cfdc11
commit
4176664b1f
@ -2323,14 +2323,14 @@ void core_link_enable_stream(
|
||||
allocate_mst_payload(pipe_ctx);
|
||||
}
|
||||
|
||||
void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
|
||||
void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option)
|
||||
{
|
||||
struct dc *core_dc = pipe_ctx->stream->ctx->dc;
|
||||
|
||||
if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
|
||||
deallocate_mst_payload(pipe_ctx);
|
||||
|
||||
core_dc->hwss.disable_stream(pipe_ctx);
|
||||
core_dc->hwss.disable_stream(pipe_ctx, option);
|
||||
|
||||
disable_link(pipe_ctx->stream->sink->link, pipe_ctx->stream->signal);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ void dp_retrain_link_dp_test(struct dc_link *link,
|
||||
|
||||
dp_receiver_power_ctrl(link, false);
|
||||
|
||||
link->dc->hwss.disable_stream(&pipes[i]);
|
||||
link->dc->hwss.disable_stream(&pipes[i], KEEP_ACQUIRED_RESOURCE);
|
||||
|
||||
link->link_enc->funcs->disable_output(
|
||||
link->link_enc,
|
||||
|
@ -242,7 +242,10 @@ bool resource_construct(
|
||||
pool->stream_enc_count++;
|
||||
}
|
||||
}
|
||||
|
||||
dc->caps.dynamic_audio = false;
|
||||
if (pool->audio_count < pool->stream_enc_count) {
|
||||
dc->caps.dynamic_audio = true;
|
||||
}
|
||||
for (i = 0; i < num_virtual_links; i++) {
|
||||
pool->stream_enc[pool->stream_enc_count] =
|
||||
virtual_stream_encoder_create(
|
||||
@ -1330,7 +1333,7 @@ static void update_stream_engine_usage(
|
||||
}
|
||||
|
||||
/* TODO: release audio object */
|
||||
static void update_audio_usage(
|
||||
void update_audio_usage(
|
||||
struct resource_context *res_ctx,
|
||||
const struct resource_pool *pool,
|
||||
struct audio *audio,
|
||||
@ -1414,12 +1417,21 @@ static struct audio *find_first_free_audio(
|
||||
const struct resource_pool *pool)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < pool->audio_count; i++) {
|
||||
if (res_ctx->is_audio_acquired[i] == false) {
|
||||
return pool->audios[i];
|
||||
if (pool->audio_count >= pool->stream_enc_count) {
|
||||
for (i = 0; i < pool->audio_count; i++) {
|
||||
if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
|
||||
/*we have enough audio endpoint, no need to do dynamic distribution*/
|
||||
return pool->audios[i];
|
||||
}
|
||||
}
|
||||
} else { /*first come first serve*/
|
||||
for (i = 0; i < pool->audio_count; i++) {
|
||||
if (res_ctx->is_audio_acquired[i] == false) {
|
||||
|
||||
return pool->audios[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ struct dc_caps {
|
||||
uint32_t i2c_speed_in_khz;
|
||||
unsigned int max_cursor_size;
|
||||
bool dcc_const_color;
|
||||
bool dynamic_audio;
|
||||
};
|
||||
|
||||
struct dc_dcc_surface_param {
|
||||
|
@ -985,10 +985,11 @@ void hwss_edp_backlight_control(
|
||||
link_transmitter_control(link->dc->ctx->dc_bios, &cntl);
|
||||
}
|
||||
|
||||
void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
|
||||
void dce110_disable_stream(struct pipe_ctx *pipe_ctx, int option)
|
||||
{
|
||||
struct dc_stream_state *stream = pipe_ctx->stream;
|
||||
struct dc_link *link = stream->sink->link;
|
||||
struct dc *dc = pipe_ctx->stream->ctx->dc;
|
||||
|
||||
if (pipe_ctx->stream_res.audio) {
|
||||
pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio);
|
||||
@ -999,6 +1000,13 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
|
||||
else
|
||||
pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_disable(
|
||||
pipe_ctx->stream_res.stream_enc);
|
||||
/*don't free audio if it is from retrain or internal disable stream*/
|
||||
if (option == FREE_ACQUIRED_RESOURCE && dc->caps.dynamic_audio == true) {
|
||||
/*we have to dynamic arbitrate the audio endpoints*/
|
||||
pipe_ctx->stream_res.audio = NULL;
|
||||
/*we free the resource, need reset is_audio_acquired*/
|
||||
update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false);
|
||||
}
|
||||
|
||||
/* TODO: notify audio driver for if audio modes list changed
|
||||
* add audio mode list change flag */
|
||||
@ -1871,7 +1879,7 @@ static void dce110_reset_hw_ctx_wrap(
|
||||
pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
|
||||
struct clock_source *old_clk = pipe_ctx_old->clock_source;
|
||||
|
||||
core_link_disable_stream(pipe_ctx_old);
|
||||
core_link_disable_stream(pipe_ctx_old, FREE_ACQUIRED_RESOURCE);
|
||||
pipe_ctx_old->stream_res.tg->funcs->set_blank(pipe_ctx_old->stream_res.tg, true);
|
||||
if (!hwss_wait_for_blank_complete(pipe_ctx_old->stream_res.tg)) {
|
||||
dm_error("DC: failed to blank crtc!\n");
|
||||
|
@ -47,7 +47,7 @@ void dce110_set_displaymarks(
|
||||
|
||||
void dce110_enable_stream(struct pipe_ctx *pipe_ctx);
|
||||
|
||||
void dce110_disable_stream(struct pipe_ctx *pipe_ctx);
|
||||
void dce110_disable_stream(struct pipe_ctx *pipe_ctx, int option);
|
||||
|
||||
void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
|
||||
struct dc_link_settings *link_settings);
|
||||
|
@ -1025,7 +1025,7 @@ static void reset_back_end_for_pipe(
|
||||
* which is used by otg. Move disable_link after disable_crtc
|
||||
*/
|
||||
if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment))
|
||||
core_link_disable_stream(pipe_ctx);
|
||||
core_link_disable_stream(pipe_ctx, FREE_ACQUIRED_RESOURCE);
|
||||
|
||||
/* by upper caller loop, parent pipe: pipe0, will be reset last.
|
||||
* back end share by all pipes and will be disable only when disable
|
||||
|
@ -58,6 +58,11 @@ struct link_init_data {
|
||||
TODO: remove it when DC is complete. */
|
||||
};
|
||||
|
||||
enum {
|
||||
FREE_ACQUIRED_RESOURCE = 0,
|
||||
KEEP_ACQUIRED_RESOURCE = 1,
|
||||
};
|
||||
|
||||
struct dc_link *link_create(const struct link_init_data *init_params);
|
||||
void link_destroy(struct dc_link **link);
|
||||
|
||||
@ -72,7 +77,7 @@ void core_link_enable_stream(
|
||||
struct dc_state *state,
|
||||
struct pipe_ctx *pipe_ctx);
|
||||
|
||||
void core_link_disable_stream(struct pipe_ctx *pipe_ctx);
|
||||
void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option);
|
||||
|
||||
void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable);
|
||||
/********** DAL Core*********************/
|
||||
|
@ -134,7 +134,8 @@ struct hw_sequencer_funcs {
|
||||
|
||||
void (*enable_stream)(struct pipe_ctx *pipe_ctx);
|
||||
|
||||
void (*disable_stream)(struct pipe_ctx *pipe_ctx);
|
||||
void (*disable_stream)(struct pipe_ctx *pipe_ctx,
|
||||
int option);
|
||||
|
||||
void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
|
||||
struct dc_link_settings *link_settings);
|
||||
|
@ -164,4 +164,9 @@ bool pipe_need_reprogram(
|
||||
void resource_build_bit_depth_reduction_params(struct dc_stream_state *stream,
|
||||
struct bit_depth_reduction_params *fmt_bit_depth);
|
||||
|
||||
void update_audio_usage(
|
||||
struct resource_context *res_ctx,
|
||||
const struct resource_pool *pool,
|
||||
struct audio *audio,
|
||||
bool acquired);
|
||||
#endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user