Skip to content

Commit 53f3288

Browse files
Wenjing Liualexdeucher
authored andcommitted
drm/amd/display: implement pipe type definition and adding accessors
[why] There is a lack of encapsulation of pipe connection representation in pipe context. This has caused many challenging bugs and coding errors with repeated logic to identify the same pipe type. [how] Formally define pipe types and provide getters to identify a pipe type and find a pipe based on specific requirements. Update existing logic in non dcn specific files and dcn32 and future versions to use the new accessors. Reviewed-by: Jun Lei <jun.lei@amd.com> Acked-by: Stylon Wang <stylon.wang@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 133fe0d commit 53f3288

19 files changed

Lines changed: 375 additions & 185 deletions

File tree

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

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -586,18 +586,15 @@ dc_stream_forward_crc_window(struct dc_stream_state *stream,
586586
bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream,
587587
struct crc_params *crc_window, bool enable, bool continuous)
588588
{
589-
int i;
590589
struct pipe_ctx *pipe;
591590
struct crc_params param;
592591
struct timing_generator *tg;
593592

594-
for (i = 0; i < MAX_PIPES; i++) {
595-
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
596-
if (pipe->stream == stream && !pipe->top_pipe && !pipe->prev_odm_pipe)
597-
break;
598-
}
593+
pipe = resource_get_otg_master_for_stream(
594+
&dc->current_state->res_ctx, stream);
595+
599596
/* Stream not found */
600-
if (i == MAX_PIPES)
597+
if (pipe == NULL)
601598
return false;
602599

603600
/* By default, capture the full frame */
@@ -1064,7 +1061,7 @@ static void apply_ctx_interdependent_lock(struct dc *dc,
10641061

10651062
// Copied conditions that were previously in dce110_apply_ctx_for_surface
10661063
if (stream == pipe_ctx->stream) {
1067-
if (!pipe_ctx->top_pipe &&
1064+
if (resource_is_pipe_type(pipe_ctx, OPP_HEAD) &&
10681065
(pipe_ctx->plane_state || old_pipe_ctx->plane_state))
10691066
dc->hwss.pipe_control_lock(dc, pipe_ctx, lock);
10701067
}
@@ -3164,7 +3161,7 @@ static void commit_planes_do_stream_update(struct dc *dc,
31643161
for (j = 0; j < dc->res_pool->pipe_count; j++) {
31653162
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
31663163

3167-
if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) {
3164+
if (resource_is_pipe_type(pipe_ctx, OTG_MASTER) && pipe_ctx->stream == stream) {
31683165

31693166
if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt)
31703167
dc->hwss.setup_periodic_interrupt(dc, pipe_ctx);
@@ -3446,16 +3443,9 @@ static void commit_planes_for_stream_fast(struct dc *dc,
34463443
struct pipe_ctx *top_pipe_to_program = NULL;
34473444
dc_z10_restore(dc);
34483445

3449-
for (j = 0; j < dc->res_pool->pipe_count; j++) {
3450-
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
3451-
3452-
if (!pipe_ctx->top_pipe &&
3453-
!pipe_ctx->prev_odm_pipe &&
3454-
pipe_ctx->stream &&
3455-
pipe_ctx->stream == stream) {
3456-
top_pipe_to_program = pipe_ctx;
3457-
}
3458-
}
3446+
top_pipe_to_program = resource_get_otg_master_for_stream(
3447+
&context->res_ctx,
3448+
stream);
34593449

34603450
if (dc->debug.visual_confirm) {
34613451
for (i = 0; i < dc->res_pool->pipe_count; i++) {
@@ -3560,16 +3550,9 @@ static void commit_planes_for_stream(struct dc *dc,
35603550
context_clock_trace(dc, context);
35613551
}
35623552

3563-
for (j = 0; j < dc->res_pool->pipe_count; j++) {
3564-
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
3565-
3566-
if (!pipe_ctx->top_pipe &&
3567-
!pipe_ctx->prev_odm_pipe &&
3568-
pipe_ctx->stream &&
3569-
pipe_ctx->stream == stream) {
3570-
top_pipe_to_program = pipe_ctx;
3571-
}
3572-
}
3553+
top_pipe_to_program = resource_get_otg_master_for_stream(
3554+
&context->res_ctx,
3555+
stream);
35733556

35743557
for (i = 0; i < dc->res_pool->pipe_count; i++) {
35753558
struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];

0 commit comments

Comments
 (0)