Skip to content

Commit fc5da5c

Browse files
Gabe Teegeralexdeucher
authored andcommitted
drm/amd/display: fix graphics hang in multi-display mst case
[what] Graphics hang observed with 3 displays connected to DP2.0 mst dock. [why] There's a mismatch in dml and dc between the assignments of hpo link encoders. [how] Add a new array in dml that tracks the current mapping of HPO stream encoders to HPO link encoders in dc. Reviewed-by: Sung joon Kim <sungjoon.kim@amd.com> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Gabe Teeger <Gabe.Teeger@amd.com> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent efaf157 commit fc5da5c

4 files changed

Lines changed: 34 additions & 49 deletions

File tree

drivers/gpu/drm/amd/display/dc/dml2/dml2_internal_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ struct dml2_wrapper_scratch {
101101
struct dml2_dml_to_dc_pipe_mapping dml_to_dc_pipe_mapping;
102102
bool enable_flexible_pipe_mapping;
103103
bool plane_duplicate_exists;
104-
unsigned int dp2_mst_stream_count;
104+
int hpo_stream_to_link_encoder_mapping[MAX_HPO_DP2_ENCODERS];
105105
};
106106

107107
struct dml2_helper_det_policy_scratch {

drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@ static void populate_dml_timing_cfg_from_stream_state(struct dml_timing_cfg_st *
733733
}
734734

735735
static void populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st *out, unsigned int location,
736-
const struct dc_stream_state *in, const struct pipe_ctx *pipe,
737-
unsigned int dp2_mst_stream_count)
736+
const struct dc_stream_state *in, const struct pipe_ctx *pipe, struct dml2_context *dml2)
738737
{
739738
unsigned int output_bpc;
740739

@@ -747,8 +746,8 @@ static void populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st *
747746
case SIGNAL_TYPE_DISPLAY_PORT_MST:
748747
case SIGNAL_TYPE_DISPLAY_PORT:
749748
out->OutputEncoder[location] = dml_dp;
750-
if (is_dp2p0_output_encoder(pipe, dp2_mst_stream_count))
751-
out->OutputEncoder[location] = dml_dp2p0;
749+
if (dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location] != -1)
750+
out->OutputEncoder[dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location]] = dml_dp2p0;
752751
break;
753752
case SIGNAL_TYPE_EDP:
754753
out->OutputEncoder[location] = dml_edp;
@@ -1199,36 +1198,6 @@ static void dml2_populate_pipe_to_plane_index_mapping(struct dml2_context *dml2,
11991198
}
12001199
}
12011200

1202-
static unsigned int calculate_dp2_mst_stream_count(struct dc_state *context)
1203-
{
1204-
int i, j;
1205-
unsigned int dp2_mst_stream_count = 0;
1206-
1207-
for (i = 0; i < context->stream_count; i++) {
1208-
struct dc_stream_state *stream = context->streams[i];
1209-
1210-
if (!stream || stream->signal != SIGNAL_TYPE_DISPLAY_PORT_MST)
1211-
continue;
1212-
1213-
for (j = 0; j < MAX_PIPES; j++) {
1214-
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
1215-
1216-
if (!pipe_ctx || !pipe_ctx->stream)
1217-
continue;
1218-
1219-
if (stream != pipe_ctx->stream)
1220-
continue;
1221-
1222-
if (pipe_ctx->stream_res.hpo_dp_stream_enc && pipe_ctx->link_res.hpo_dp_link_enc) {
1223-
dp2_mst_stream_count++;
1224-
break;
1225-
}
1226-
}
1227-
}
1228-
1229-
return dp2_mst_stream_count;
1230-
}
1231-
12321201
static void populate_dml_writeback_cfg_from_stream_state(struct dml_writeback_cfg_st *out,
12331202
unsigned int location, const struct dc_stream_state *in)
12341203
{
@@ -1269,6 +1238,30 @@ static void populate_dml_writeback_cfg_from_stream_state(struct dml_writeback_cf
12691238
}
12701239
}
12711240
}
1241+
1242+
static void dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(struct dml2_context *dml2, struct dc_state *context)
1243+
{
1244+
int i;
1245+
struct pipe_ctx *current_pipe_context;
1246+
1247+
/* Scratch gets reset to zero in dml, but link encoder instance can be zero, so reset to -1 */
1248+
for (i = 0; i < MAX_HPO_DP2_ENCODERS; i++) {
1249+
dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[i] = -1;
1250+
}
1251+
1252+
/* If an HPO stream encoder is allocated to a pipe, get the instance of it's allocated HPO Link encoder */
1253+
for (i = 0; i < MAX_PIPES; i++) {
1254+
current_pipe_context = &context->res_ctx.pipe_ctx[i];
1255+
if (current_pipe_context->stream &&
1256+
current_pipe_context->stream_res.hpo_dp_stream_enc &&
1257+
current_pipe_context->link_res.hpo_dp_link_enc &&
1258+
dc_is_dp_signal(current_pipe_context->stream->signal)) {
1259+
dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[current_pipe_context->stream_res.hpo_dp_stream_enc->inst] =
1260+
current_pipe_context->link_res.hpo_dp_link_enc->inst;
1261+
}
1262+
}
1263+
}
1264+
12721265
void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_state *context, struct dml_display_cfg_st *dml_dispcfg)
12731266
{
12741267
int i = 0, j = 0, k = 0;
@@ -1291,8 +1284,8 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_stat
12911284
if (dml2->v20.dml_core_ctx.ip.hostvm_enable)
12921285
dml2->v20.dml_core_ctx.policy.AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter;
12931286

1294-
dml2->v20.scratch.dp2_mst_stream_count = calculate_dp2_mst_stream_count(context);
12951287
dml2_populate_pipe_to_plane_index_mapping(dml2, context);
1288+
dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(dml2, context);
12961289

12971290
for (i = 0; i < context->stream_count; i++) {
12981291
current_pipe_context = NULL;
@@ -1313,7 +1306,7 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_stat
13131306
ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
13141307

13151308
populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_stream_location, context->streams[i]);
1316-
populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_stream_location, context->streams[i], current_pipe_context, dml2->v20.scratch.dp2_mst_stream_count);
1309+
populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_stream_location, context->streams[i], current_pipe_context, dml2);
13171310
/*Call site for populate_dml_writeback_cfg_from_stream_state*/
13181311
populate_dml_writeback_cfg_from_stream_state(&dml_dispcfg->writeback,
13191312
disp_cfg_stream_location, context->streams[i]);
@@ -1378,7 +1371,7 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_stat
13781371

13791372
if (j >= 1) {
13801373
populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_plane_location, context->streams[i]);
1381-
populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_plane_location, context->streams[i], current_pipe_context, dml2->v20.scratch.dp2_mst_stream_count);
1374+
populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_plane_location, context->streams[i], current_pipe_context, dml2);
13821375
switch (context->streams[i]->debug.force_odm_combine_segments) {
13831376
case 2:
13841377
dml2->v20.dml_core_ctx.policy.ODMUse[disp_cfg_plane_location] = dml_odm_use_policy_combine_2to1;

drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ void dml2_translate_socbb_params(const struct dc *in_dc, struct soc_bounding_box
3636
void dml2_translate_soc_states(const struct dc *in_dc, struct soc_states_st *out, int num_states);
3737
void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_state *context, struct dml_display_cfg_st *dml_dispcfg);
3838
void dml2_update_pipe_ctx_dchub_regs(struct _vcs_dpi_dml_display_rq_regs_st *rq_regs, struct _vcs_dpi_dml_display_dlg_regs_st *disp_dlg_regs, struct _vcs_dpi_dml_display_ttu_regs_st *disp_ttu_regs, struct pipe_ctx *out);
39-
bool is_dp2p0_output_encoder(const struct pipe_ctx *pipe, unsigned int dp2_mst_stream_count);
39+
bool is_dp2p0_output_encoder(const struct pipe_ctx *pipe);
4040

4141
#endif //__DML2_TRANSLATION_HELPER_H__

drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,22 +153,14 @@ unsigned int dml2_util_get_maximum_odm_combine_for_output(bool force_odm_4to1, e
153153
}
154154
}
155155

156-
bool is_dp2p0_output_encoder(const struct pipe_ctx *pipe_ctx, unsigned int dp2_mst_stream_count)
156+
bool is_dp2p0_output_encoder(const struct pipe_ctx *pipe_ctx)
157157
{
158158
if (pipe_ctx == NULL || pipe_ctx->stream == NULL)
159159
return false;
160160

161161
/* If this assert is hit then we have a link encoder dynamic management issue */
162162
ASSERT(pipe_ctx->stream_res.hpo_dp_stream_enc ? pipe_ctx->link_res.hpo_dp_link_enc != NULL : true);
163163

164-
/* Count MST hubs once by treating only 1st remote sink in topology as an encoder */
165-
if (pipe_ctx->stream->link && pipe_ctx->stream->link->remote_sinks[0] && dp2_mst_stream_count > 1) {
166-
return (pipe_ctx->stream_res.hpo_dp_stream_enc &&
167-
pipe_ctx->link_res.hpo_dp_link_enc &&
168-
dc_is_dp_signal(pipe_ctx->stream->signal) &&
169-
(pipe_ctx->stream->link->remote_sinks[0]->sink_id == pipe_ctx->stream->sink->sink_id));
170-
}
171-
172164
return (pipe_ctx->stream_res.hpo_dp_stream_enc &&
173165
pipe_ctx->link_res.hpo_dp_link_enc &&
174166
dc_is_dp_signal(pipe_ctx->stream->signal));
@@ -181,7 +173,7 @@ bool is_dtbclk_required(const struct dc *dc, struct dc_state *context)
181173
for (i = 0; i < dc->res_pool->pipe_count; i++) {
182174
if (!context->res_ctx.pipe_ctx[i].stream)
183175
continue;
184-
if (is_dp2p0_output_encoder(&context->res_ctx.pipe_ctx[i], context->bw_ctx.dml2->v20.scratch.dp2_mst_stream_count))
176+
if (is_dp2p0_output_encoder(&context->res_ctx.pipe_ctx[i]))
185177
return true;
186178
}
187179
return false;

0 commit comments

Comments
 (0)