Commit 4176664b authored by Charlene Liu's avatar Charlene Liu Committed by Alex Deucher
Browse files

drm/amd/display: audio dynamic resource acquired related

parent 50d4cfdc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
}
+1 −1
Original line number Diff line number Diff line
@@ -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,
+18 −6
Original line number Diff line number Diff line
@@ -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;
	if (pool->audio_count >=  pool->stream_enc_count) {
		for (i = 0; i < pool->audio_count; i++) {
		if (res_ctx->is_audio_acquired[i] == false) {
			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;
}

+1 −0
Original line number Diff line number Diff line
@@ -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 {
+10 −2
Original line number Diff line number Diff line
@@ -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");
Loading