Skip to content

Commit 7287a67

Browse files
Dmytro Laktyushkinalexdeucher
authored andcommitted
drm/amd/display: add on demand pipe merge logic for dcn2+
Adds logic that will determine if pipes need merging during validation. Signed-off-by: Dmytro Laktyushkin <[email protected]> Reviewed-by: Chris Park <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 2277f01 commit 7287a67

File tree

3 files changed

+56
-16
lines changed

3 files changed

+56
-16
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx)
893893
int vpc_div = (data->format == PIXEL_FORMAT_420BPP8
894894
|| data->format == PIXEL_FORMAT_420BPP10) ? 2 : 1;
895895
bool orthogonal_rotation, flip_vert_scan_dir, flip_horz_scan_dir;
896+
int odm_idx = 0;
896897

897898
/*
898899
* Need to calculate the scan direction for viewport to make adjustments
@@ -924,11 +925,13 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx)
924925
* stream->dst.width / stream->src.width -
925926
src.x * plane_state->dst_rect.width / src.width
926927
* stream->dst.width / stream->src.width);
927-
/*modified recout_skip_h calculation due to odm having no recout offset caused by split*/
928+
/*modified recout_skip_h calculation due to odm having no recout offset*/
928929
while (odm_pipe) {
929-
recout_skip_h += odm_pipe->plane_res.scl_data.recout.width + odm_pipe->plane_res.scl_data.recout.x;
930+
odm_idx++;
930931
odm_pipe = odm_pipe->prev_odm_pipe;
931932
}
933+
if (odm_idx)
934+
recout_skip_h += odm_idx * data->recout.width;
932935

933936
recout_skip_v = data->recout.y - (stream->dst.y + (plane_state->dst_rect.y - stream->src.y)
934937
* stream->dst.height / stream->src.height -

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ static void acquire_dsc(struct resource_context *res_ctx,
16711671
}
16721672
}
16731673

1674-
static void release_dsc(struct resource_context *res_ctx,
1674+
void dcn20_release_dsc(struct resource_context *res_ctx,
16751675
const struct resource_pool *pool,
16761676
struct display_stream_compressor **dsc)
16771677
{
@@ -1731,7 +1731,7 @@ static enum dc_status remove_dsc_from_stream_resource(struct dc *dc,
17311731
pipe_ctx = &new_ctx->res_ctx.pipe_ctx[i];
17321732

17331733
if (pipe_ctx->stream_res.dsc)
1734-
release_dsc(&new_ctx->res_ctx, dc->res_pool, &pipe_ctx->stream_res.dsc);
1734+
dcn20_release_dsc(&new_ctx->res_ctx, dc->res_pool, &pipe_ctx->stream_res.dsc);
17351735
}
17361736
}
17371737

@@ -2502,7 +2502,7 @@ struct pipe_ctx *dcn20_find_secondary_pipe(struct dc *dc,
25022502
return secondary_pipe;
25032503
}
25042504

2505-
void dcn20_merge_pipes_for_validate(
2505+
static void dcn20_merge_pipes_for_validate(
25062506
struct dc *dc,
25072507
struct dc_state *context)
25082508
{
@@ -2527,7 +2527,7 @@ void dcn20_merge_pipes_for_validate(
25272527
odm_pipe->prev_odm_pipe = NULL;
25282528
odm_pipe->next_odm_pipe = NULL;
25292529
if (odm_pipe->stream_res.dsc)
2530-
release_dsc(&context->res_ctx, dc->res_pool, &odm_pipe->stream_res.dsc);
2530+
dcn20_release_dsc(&context->res_ctx, dc->res_pool, &odm_pipe->stream_res.dsc);
25312531
/* Clear plane_res and stream_res */
25322532
memset(&odm_pipe->plane_res, 0, sizeof(odm_pipe->plane_res));
25332533
memset(&odm_pipe->stream_res, 0, sizeof(odm_pipe->stream_res));
@@ -2565,7 +2565,8 @@ int dcn20_validate_apply_pipe_split_flags(
25652565
struct dc *dc,
25662566
struct dc_state *context,
25672567
int vlevel,
2568-
bool *split)
2568+
bool *split,
2569+
bool *merge)
25692570
{
25702571
int i, pipe_idx, vlevel_split;
25712572
int plane_count = 0;
@@ -2609,11 +2610,12 @@ int dcn20_validate_apply_pipe_split_flags(
26092610
/* Split loop sets which pipe should be split based on dml outputs and dc flags */
26102611
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
26112612
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
2613+
int pipe_plane = context->bw_ctx.dml.vba.pipe_plane[pipe_idx];
26122614

26132615
if (!context->res_ctx.pipe_ctx[i].stream)
26142616
continue;
26152617

2616-
if (force_split || context->bw_ctx.dml.vba.NoOfDPP[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] > 1)
2618+
if (force_split || context->bw_ctx.dml.vba.NoOfDPP[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_plane] > 1)
26172619
split[i] = true;
26182620
if ((pipe->stream->view_format ==
26192621
VIEW_3D_FORMAT_SIDE_BY_SIDE ||
@@ -2626,10 +2628,44 @@ int dcn20_validate_apply_pipe_split_flags(
26262628
split[i] = true;
26272629
if (dc->debug.force_odm_combine & (1 << pipe->stream_res.tg->inst)) {
26282630
split[i] = true;
2629-
context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_idx] = dm_odm_combine_mode_2to1;
2631+
context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_plane] = dm_odm_combine_mode_2to1;
26302632
}
2631-
context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_idx] =
2632-
context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_idx];
2633+
context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_plane] =
2634+
context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_plane];
2635+
2636+
if (pipe->prev_odm_pipe && context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_plane] != dm_odm_combine_mode_disabled) {
2637+
/*Already split odm pipe tree, don't try to split again*/
2638+
split[i] = false;
2639+
split[pipe->prev_odm_pipe->pipe_idx] = false;
2640+
} else if (pipe->top_pipe && pipe->plane_state == pipe->top_pipe->plane_state
2641+
&& context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_plane] == dm_odm_combine_mode_disabled) {
2642+
/*Already split mpc tree, don't try to split again, assumes only 2x mpc combine*/
2643+
split[i] = false;
2644+
split[pipe->top_pipe->pipe_idx] = false;
2645+
} else if (pipe->prev_odm_pipe || (pipe->top_pipe && pipe->plane_state == pipe->top_pipe->plane_state)) {
2646+
if (split[i] == false) {
2647+
/*Exiting mpc/odm combine*/
2648+
merge[i] = true;
2649+
if (pipe->prev_odm_pipe) {
2650+
ASSERT(0); /*should not actually happen yet*/
2651+
merge[pipe->prev_odm_pipe->pipe_idx] = true;
2652+
} else
2653+
merge[pipe->top_pipe->pipe_idx] = true;
2654+
} else {
2655+
/*Transition from mpc combine to odm combine or vice versa*/
2656+
ASSERT(0); /*should not actually happen yet*/
2657+
split[i] = true;
2658+
merge[i] = true;
2659+
if (pipe->prev_odm_pipe) {
2660+
split[pipe->prev_odm_pipe->pipe_idx] = true;
2661+
merge[pipe->prev_odm_pipe->pipe_idx] = true;
2662+
} else {
2663+
split[pipe->top_pipe->pipe_idx] = true;
2664+
merge[pipe->top_pipe->pipe_idx] = true;
2665+
}
2666+
}
2667+
}
2668+
26332669
/* Adjust dppclk when split is forced, do not bother with dispclk */
26342670
if (split[i] && context->bw_ctx.dml.vba.NoOfDPP[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] == 1)
26352671
context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] /= 2;
@@ -2671,7 +2707,7 @@ bool dcn20_fast_validate_bw(
26712707
if (vlevel > context->bw_ctx.dml.soc.num_states)
26722708
goto validate_fail;
26732709

2674-
vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split);
2710+
vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, NULL);
26752711

26762712
/*initialize pipe_just_split_from to invalid idx*/
26772713
for (i = 0; i < MAX_PIPES; i++)

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,15 @@ void dcn20_set_mcif_arb_params(
119119
display_e2e_pipe_params_st *pipes,
120120
int pipe_cnt);
121121
bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate);
122-
void dcn20_merge_pipes_for_validate(
123-
struct dc *dc,
124-
struct dc_state *context);
125122
int dcn20_validate_apply_pipe_split_flags(
126123
struct dc *dc,
127124
struct dc_state *context,
128125
int vlevel,
129-
bool *split);
126+
bool *split,
127+
bool *merge);
128+
void dcn20_release_dsc(struct resource_context *res_ctx,
129+
const struct resource_pool *pool,
130+
struct display_stream_compressor **dsc);
130131
bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx);
131132
void dcn20_split_stream_for_mpc(
132133
struct resource_context *res_ctx,

0 commit comments

Comments
 (0)