Skip to content

Commit fd9978a

Browse files
Alvin Leealexdeucher
authored andcommitted
drm/amd/display: Don't overwrite subvp pipe info in fast updates
[Description] - This is a workaround to avoid concurrency issues -- a fast update creates a shallow copy of the dc current_state, and removes all subvp/phantom related flags. - We want to prevent the fast update thread from removing those flags in case there's another thread running that requires the info for proper programming Reviewed-by: Jun Lei <[email protected]> Acked-by: Jasdeep Dhillon <[email protected]> Signed-off-by: Alvin Lee <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6609141 commit fd9978a

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3061,7 +3061,7 @@ static bool update_planes_and_stream_state(struct dc *dc,
30613061
* Ensures that we have enough pipes for newly added MPO planes
30623062
*/
30633063
if (dc->res_pool->funcs->remove_phantom_pipes)
3064-
dc->res_pool->funcs->remove_phantom_pipes(dc, context);
3064+
dc->res_pool->funcs->remove_phantom_pipes(dc, context, false);
30653065

30663066
/*remove old surfaces from context */
30673067
if (!dc_rem_all_planes_for_stream(dc, stream, context)) {

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ void dcn32_retain_phantom_pipes(struct dc *dc, struct dc_state *context)
17431743
}
17441744

17451745
// return true if removed piped from ctx, false otherwise
1746-
bool dcn32_remove_phantom_pipes(struct dc *dc, struct dc_state *context)
1746+
bool dcn32_remove_phantom_pipes(struct dc *dc, struct dc_state *context, bool fast_update)
17471747
{
17481748
int i;
17491749
bool removed_pipe = false;
@@ -1770,14 +1770,23 @@ bool dcn32_remove_phantom_pipes(struct dc *dc, struct dc_state *context)
17701770
removed_pipe = true;
17711771
}
17721772

1773-
// Clear all phantom stream info
1774-
if (pipe->stream) {
1775-
pipe->stream->mall_stream_config.type = SUBVP_NONE;
1776-
pipe->stream->mall_stream_config.paired_stream = NULL;
1777-
}
1773+
/* For non-full updates, a shallow copy of the current state
1774+
* is created. In this case we don't want to erase the current
1775+
* state (there can be 2 HIRQL threads, one in flip, and one in
1776+
* checkMPO) that can cause a race condition.
1777+
*
1778+
* This is just a workaround, needs a proper fix.
1779+
*/
1780+
if (!fast_update) {
1781+
// Clear all phantom stream info
1782+
if (pipe->stream) {
1783+
pipe->stream->mall_stream_config.type = SUBVP_NONE;
1784+
pipe->stream->mall_stream_config.paired_stream = NULL;
1785+
}
17781786

1779-
if (pipe->plane_state) {
1780-
pipe->plane_state->is_phantom = false;
1787+
if (pipe->plane_state) {
1788+
pipe->plane_state->is_phantom = false;
1789+
}
17811790
}
17821791
}
17831792
return removed_pipe;
@@ -1950,23 +1959,28 @@ int dcn32_populate_dml_pipes_from_context(
19501959
pipes[pipe_cnt].pipe.src.unbounded_req_mode = false;
19511960
pipes[pipe_cnt].pipe.scale_ratio_depth.lb_depth = dm_lb_19;
19521961

1953-
switch (pipe->stream->mall_stream_config.type) {
1954-
case SUBVP_MAIN:
1955-
pipes[pipe_cnt].pipe.src.use_mall_for_pstate_change = dm_use_mall_pstate_change_sub_viewport;
1956-
subvp_in_use = true;
1957-
break;
1958-
case SUBVP_PHANTOM:
1959-
pipes[pipe_cnt].pipe.src.use_mall_for_pstate_change = dm_use_mall_pstate_change_phantom_pipe;
1960-
pipes[pipe_cnt].pipe.src.use_mall_for_static_screen = dm_use_mall_static_screen_disable;
1961-
// Disallow unbounded req for SubVP according to DCHUB programming guide
1962-
pipes[pipe_cnt].pipe.src.unbounded_req_mode = false;
1963-
break;
1964-
case SUBVP_NONE:
1965-
pipes[pipe_cnt].pipe.src.use_mall_for_pstate_change = dm_use_mall_pstate_change_disable;
1966-
pipes[pipe_cnt].pipe.src.use_mall_for_static_screen = dm_use_mall_static_screen_disable;
1967-
break;
1968-
default:
1969-
break;
1962+
/* Only populate DML input with subvp info for full updates.
1963+
* This is just a workaround -- needs a proper fix.
1964+
*/
1965+
if (!fast_validate) {
1966+
switch (pipe->stream->mall_stream_config.type) {
1967+
case SUBVP_MAIN:
1968+
pipes[pipe_cnt].pipe.src.use_mall_for_pstate_change = dm_use_mall_pstate_change_sub_viewport;
1969+
subvp_in_use = true;
1970+
break;
1971+
case SUBVP_PHANTOM:
1972+
pipes[pipe_cnt].pipe.src.use_mall_for_pstate_change = dm_use_mall_pstate_change_phantom_pipe;
1973+
pipes[pipe_cnt].pipe.src.use_mall_for_static_screen = dm_use_mall_static_screen_disable;
1974+
// Disallow unbounded req for SubVP according to DCHUB programming guide
1975+
pipes[pipe_cnt].pipe.src.unbounded_req_mode = false;
1976+
break;
1977+
case SUBVP_NONE:
1978+
pipes[pipe_cnt].pipe.src.use_mall_for_pstate_change = dm_use_mall_pstate_change_disable;
1979+
pipes[pipe_cnt].pipe.src.use_mall_for_static_screen = dm_use_mall_static_screen_disable;
1980+
break;
1981+
default:
1982+
break;
1983+
}
19701984
}
19711985

19721986
pipes[pipe_cnt].dout.dsc_input_bpc = 0;

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool dcn32_release_post_bldn_3dlut(
8181
struct dc_transfer_func **shaper);
8282

8383
bool dcn32_remove_phantom_pipes(struct dc *dc,
84-
struct dc_state *context);
84+
struct dc_state *context, bool fast_update);
8585

8686
void dcn32_retain_phantom_pipes(struct dc *dc,
8787
struct dc_state *context);

drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
12031203
// If SubVP pipe config is unsupported (or cannot be used for UCLK switching)
12041204
// remove phantom pipes and repopulate dml pipes
12051205
if (!found_supported_config) {
1206-
dc->res_pool->funcs->remove_phantom_pipes(dc, context);
1206+
dc->res_pool->funcs->remove_phantom_pipes(dc, context, false);
12071207
vba->DRAMClockChangeSupport[*vlevel][vba->maxMpcComb] = dm_dram_clock_change_unsupported;
12081208
*pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, false);
12091209

@@ -1518,7 +1518,7 @@ bool dcn32_internal_validate_bw(struct dc *dc,
15181518
return false;
15191519

15201520
// For each full update, remove all existing phantom pipes first
1521-
dc->res_pool->funcs->remove_phantom_pipes(dc, context);
1521+
dc->res_pool->funcs->remove_phantom_pipes(dc, context, fast_validate);
15221522

15231523
dc->res_pool->funcs->update_soc_for_wm_a(dc, context);
15241524

drivers/gpu/drm/amd/display/dc/inc/core_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ struct resource_funcs {
240240
unsigned int pipe_cnt,
241241
unsigned int index);
242242

243-
bool (*remove_phantom_pipes)(struct dc *dc, struct dc_state *context);
243+
bool (*remove_phantom_pipes)(struct dc *dc, struct dc_state *context, bool fast_update);
244244
void (*retain_phantom_pipes)(struct dc *dc, struct dc_state *context);
245245
void (*get_panel_config_defaults)(struct dc_panel_config *panel_config);
246246
};

0 commit comments

Comments
 (0)