Commit 198f0e89 authored by Wenjing Liu's avatar Wenjing Liu Committed by Alex Deucher
Browse files

drm/amd/display: rename acquire_idle_pipe_for_layer to acquire_free_pipe_as_sec_dpp_pipe



[why]
Secondary DPP pipes are used for rendering secondary layers of planes.
The name "for layer" doesn't make it obvious. The function is acquiring
a free pipe as secondary dpp pipe only. We rename it so it is more obvious.
In a future follow up change, we want to add functions to acquire free pipe as
opp head pipe or otg master pipe as well. They will have their separate
allocation priority.

Reviewed-by: default avatarJun Lei <jun.lei@amd.com>
Acked-by: default avatarTom Chung <chiahsuan.chung@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 d8e3fcd3
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -1563,7 +1563,7 @@ enum dc_status resource_build_scaling_params_for_context(
	return DC_OK;
}

struct pipe_ctx *find_idle_secondary_pipe_legacy(
struct pipe_ctx *find_free_secondary_pipe_legacy(
		struct resource_context *res_ctx,
		const struct resource_pool *pool,
		const struct pipe_ctx *primary_pipe)
@@ -1623,38 +1623,38 @@ struct pipe_ctx *find_idle_secondary_pipe_legacy(
	return secondary_pipe;
}

int resource_find_idle_pipe_used_in_cur_mpc_blending_tree(
int resource_find_free_pipe_used_in_cur_mpc_blending_tree(
		const struct resource_context *cur_res_ctx,
		struct resource_context *new_res_ctx,
		const struct pipe_ctx *cur_opp_head)
{
	const struct pipe_ctx *cur_sec_dpp = cur_opp_head->bottom_pipe;
	struct pipe_ctx *new_sec_dpp;
	int idle_pipe_idx = IDLE_PIPE_INDEX_NOT_FOUND;
	int free_pipe_idx = FREE_PIPE_INDEX_NOT_FOUND;

	while (cur_sec_dpp) {
		/* find an idle pipe used in current opp blend tree,
		/* find a free pipe used in current opp blend tree,
		 * this is to avoid MPO pipe switching to different opp blending
		 * tree
		 */
		new_sec_dpp = &new_res_ctx->pipe_ctx[cur_sec_dpp->pipe_idx];
		if (new_sec_dpp->plane_state == NULL &&
				new_sec_dpp->stream == NULL) {
			idle_pipe_idx = cur_sec_dpp->pipe_idx;
			free_pipe_idx = cur_sec_dpp->pipe_idx;
			break;
		}
		cur_sec_dpp = cur_sec_dpp->bottom_pipe;
	}

	return idle_pipe_idx;
	return free_pipe_idx;
}

int recource_find_idle_pipe_not_used_in_cur_res_ctx(
int recource_find_free_pipe_not_used_in_cur_res_ctx(
		const struct resource_context *cur_res_ctx,
		struct resource_context *new_res_ctx,
		const struct resource_pool *pool)
{
	int idle_pipe_idx = IDLE_PIPE_INDEX_NOT_FOUND;
	int free_pipe_idx = FREE_PIPE_INDEX_NOT_FOUND;
	const struct pipe_ctx *new_sec_dpp, *cur_sec_dpp;
	int i;

@@ -1666,20 +1666,20 @@ int recource_find_idle_pipe_not_used_in_cur_res_ctx(
				cur_sec_dpp->stream == NULL &&
				new_sec_dpp->plane_state == NULL &&
				new_sec_dpp->stream == NULL) {
			idle_pipe_idx = i;
			free_pipe_idx = i;
			break;
		}
	}

	return idle_pipe_idx;
	return free_pipe_idx;
}

int resource_find_idle_pipe_used_as_cur_sec_dpp_in_mpcc_combine(
int resource_find_free_pipe_used_as_cur_sec_dpp_in_mpcc_combine(
		const struct resource_context *cur_res_ctx,
		struct resource_context *new_res_ctx,
		const struct resource_pool *pool)
{
	int idle_pipe_idx = IDLE_PIPE_INDEX_NOT_FOUND;
	int free_pipe_idx = FREE_PIPE_INDEX_NOT_FOUND;
	const struct pipe_ctx *new_sec_dpp, *cur_sec_dpp;
	int i;

@@ -1692,18 +1692,18 @@ int resource_find_idle_pipe_used_as_cur_sec_dpp_in_mpcc_combine(
				cur_sec_dpp->top_pipe->plane_state == cur_sec_dpp->plane_state &&
				new_sec_dpp->plane_state == NULL &&
				new_sec_dpp->stream == NULL) {
			idle_pipe_idx = i;
			free_pipe_idx = i;
			break;
		}
	}

	return idle_pipe_idx;
	return free_pipe_idx;
}

int resource_find_any_idle_pipe(struct resource_context *new_res_ctx,
int resource_find_any_free_pipe(struct resource_context *new_res_ctx,
		const struct resource_pool *pool)
{
	int idle_pipe_idx = IDLE_PIPE_INDEX_NOT_FOUND;
	int free_pipe_idx = FREE_PIPE_INDEX_NOT_FOUND;
	const struct pipe_ctx *new_sec_dpp;
	int i;

@@ -1712,12 +1712,12 @@ int resource_find_any_idle_pipe(struct resource_context *new_res_ctx,

		if (new_sec_dpp->plane_state == NULL &&
				new_sec_dpp->stream == NULL) {
			idle_pipe_idx = i;
			free_pipe_idx = i;
			break;
		}
	}

	return idle_pipe_idx;
	return free_pipe_idx;
}

/* TODO: Unify the pipe naming convention:
@@ -1855,12 +1855,12 @@ static bool acquire_secondary_dpp_pipes_and_add_plane(
{
	struct pipe_ctx *opp_head_pipe, *sec_pipe;

	if (!pool->funcs->acquire_idle_pipe_for_layer)
	if (!pool->funcs->acquire_free_pipe_as_secondary_dpp_pipe)
		return false;

	opp_head_pipe = otg_master_pipe;
	while (opp_head_pipe) {
		sec_pipe = pool->funcs->acquire_idle_pipe_for_layer(
		sec_pipe = pool->funcs->acquire_free_pipe_as_secondary_dpp_pipe(
				cur_ctx,
				new_ctx,
				pool,
+1 −1
Original line number Diff line number Diff line
@@ -1235,7 +1235,7 @@ static const struct resource_funcs dce110_res_pool_funcs = {
	.panel_cntl_create = dce110_panel_cntl_create,
	.validate_bandwidth = dce110_validate_bandwidth,
	.validate_plane = dce110_validate_plane,
	.acquire_idle_pipe_for_layer = dce110_acquire_underlay,
	.acquire_free_pipe_as_secondary_dpp_pipe = dce110_acquire_underlay,
	.add_stream_to_ctx = dce110_add_stream_to_ctx,
	.validate_global = dce110_validate_global,
	.find_first_free_match_stream_enc_for_link = dce110_find_first_free_match_stream_enc_for_link
+3 −3
Original line number Diff line number Diff line
@@ -1083,7 +1083,7 @@ static enum dc_status dcn10_add_stream_to_ctx(
	return result;
}

static struct pipe_ctx *dcn10_acquire_idle_pipe_for_layer(
static struct pipe_ctx *dcn10_acquire_free_pipe_for_layer(
		const struct dc_state *cur_ctx,
		struct dc_state *new_ctx,
		const struct resource_pool *pool,
@@ -1091,7 +1091,7 @@ static struct pipe_ctx *dcn10_acquire_idle_pipe_for_layer(
{
	struct resource_context *res_ctx = &new_ctx->res_ctx;
	struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, opp_head_pipe->stream);
	struct pipe_ctx *idle_pipe = find_idle_secondary_pipe_legacy(res_ctx, pool, head_pipe);
	struct pipe_ctx *idle_pipe = find_free_secondary_pipe_legacy(res_ctx, pool, head_pipe);

	if (!head_pipe) {
		ASSERT(0);
@@ -1272,7 +1272,7 @@ static const struct resource_funcs dcn10_res_pool_funcs = {
	.link_enc_create = dcn10_link_encoder_create,
	.panel_cntl_create = dcn10_panel_cntl_create,
	.validate_bandwidth = dcn10_validate_bandwidth,
	.acquire_idle_pipe_for_layer = dcn10_acquire_idle_pipe_for_layer,
	.acquire_free_pipe_as_secondary_dpp_pipe = dcn10_acquire_free_pipe_for_layer,
	.validate_plane = dcn10_validate_plane,
	.validate_global = dcn10_validate_global,
	.add_stream_to_ctx = dcn10_add_stream_to_ctx,
+3 −3
Original line number Diff line number Diff line
@@ -2147,7 +2147,7 @@ bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context,
	return voltage_supported;
}

struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer(
struct pipe_ctx *dcn20_acquire_free_pipe_for_layer(
		const struct dc_state *cur_ctx,
		struct dc_state *new_ctx,
		const struct resource_pool *pool,
@@ -2155,7 +2155,7 @@ struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer(
{
	struct resource_context *res_ctx = &new_ctx->res_ctx;
	struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, opp_head_pipe->stream);
	struct pipe_ctx *idle_pipe = find_idle_secondary_pipe_legacy(res_ctx, pool, head_pipe);
	struct pipe_ctx *idle_pipe = find_free_secondary_pipe_legacy(res_ctx, pool, head_pipe);

	if (!head_pipe)
		ASSERT(0);
@@ -2217,7 +2217,7 @@ static const struct resource_funcs dcn20_res_pool_funcs = {
	.link_enc_create = dcn20_link_encoder_create,
	.panel_cntl_create = dcn20_panel_cntl_create,
	.validate_bandwidth = dcn20_validate_bandwidth,
	.acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer,
	.acquire_free_pipe_as_secondary_dpp_pipe = dcn20_acquire_free_pipe_for_layer,
	.add_stream_to_ctx = dcn20_add_stream_to_ctx,
	.add_dsc_to_stream_resource = dcn20_add_dsc_to_stream_resource,
	.remove_stream_from_ctx = dcn20_remove_stream_from_ctx,
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ unsigned int dcn20_calc_max_scaled_time(
		enum mmhubbub_wbif_mode mode,
		unsigned int urgent_watermark);

struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer(
struct pipe_ctx *dcn20_acquire_free_pipe_for_layer(
		const struct dc_state *cur_ctx,
		struct dc_state *new_ctx,
		const struct resource_pool *pool,
Loading