Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Copy GSL groups when committing a new context

[Why]
DC configures the GSL group for the pipe when pipe_split is enabled
and we're switching flip types (buffered <-> immediate flip) on DCN2.

In order to record what GSL group the pipe is using DC stores it in
the pipe's stream_res. DM is not aware of this internal grouping, nor
is DC resource.

So when DM creates a dc_state context and passes it to DC the current
GSL group is lost - DM never knew about it in the first place.

After 3 immediate flips we run out of GSL groups and we're no longer
able to correctly perform *any* flip for multi-pipe scenarios.

[How]
The gsl_group needs to be copied to the new context.

DM has no insight into GSL grouping and could even potentially create
a brand new context without referencing current hardware state. So this
makes the most sense to have happen in DC.

There are two places where DC can apply a new context:
- dc_commit_state
- dc_commit_updates_for_stream

But what's shared between both of these is apply_ctx_for_surface.

This logic only matters for DCN2, so it can be placed in
dcn20_apply_ctx_for_surface. Before doing any locking (where the GSL
group is setup) we can copy over the GSL groups before committing the
new context.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Hersen Wu <hersen.wu@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nicholas Kazlauskas and committed by
Alex Deucher
21ffcc94 291ac8fb

+12
+12
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
··· 1364 1364 if (!top_pipe_to_program) 1365 1365 return; 1366 1366 1367 + /* Carry over GSL groups in case the context is changing. */ 1368 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 1369 + struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; 1370 + struct pipe_ctx *old_pipe_ctx = 1371 + &dc->current_state->res_ctx.pipe_ctx[i]; 1372 + 1373 + if (pipe_ctx->stream == stream && 1374 + pipe_ctx->stream == old_pipe_ctx->stream) 1375 + pipe_ctx->stream_res.gsl_group = 1376 + old_pipe_ctx->stream_res.gsl_group; 1377 + } 1378 + 1367 1379 tg = top_pipe_to_program->stream_res.tg; 1368 1380 1369 1381 interdependent_update = top_pipe_to_program->plane_state &&