Commit 68cfc5d8 authored by Wenjing Liu's avatar Wenjing Liu Committed by Alex Deucher
Browse files

drm/amd/display: Try to acquire a free OTG master not used in cur ctx first



[WHY & HOW]
The current otg master pipe allocation logic is not optimized based
current resource context. We should try to acquire a free OTG master not
used in cur cts first to avoid unnecessary pipe switch from current
state.

Acked-by: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarWenjing Liu <wenjing.liu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8b8eed05
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3586,6 +3586,7 @@ static void mark_seamless_boot_stream(
 *       |________|_______________|___________|_____________|
 */
static bool acquire_otg_master_pipe_for_stream(
		const struct dc_state *cur_ctx,
		struct dc_state *new_ctx,
		const struct resource_pool *pool,
		struct dc_stream_state *stream)
@@ -3599,6 +3600,9 @@ static bool acquire_otg_master_pipe_for_stream(
	int pipe_idx;
	struct pipe_ctx *pipe_ctx = NULL;

	pipe_idx = recource_find_free_pipe_not_used_in_cur_res_ctx(
			&cur_ctx->res_ctx, &new_ctx->res_ctx, pool);
	if (pipe_idx == FREE_PIPE_INDEX_NOT_FOUND)
		pipe_idx = resource_find_any_free_pipe(&new_ctx->res_ctx, pool);
	if (pipe_idx != FREE_PIPE_INDEX_NOT_FOUND) {
		pipe_ctx = &new_ctx->res_ctx.pipe_ctx[pipe_idx];
@@ -3659,7 +3663,7 @@ enum dc_status resource_map_pool_resources(

	if (!acquired)
		/* acquire new resources */
		acquired = acquire_otg_master_pipe_for_stream(
		acquired = acquire_otg_master_pipe_for_stream(dc->current_state,
				context, pool, stream);

	pipe_ctx = resource_get_otg_master_for_stream(&context->res_ctx, stream);