@@ -733,8 +733,7 @@ static void populate_dml_timing_cfg_from_stream_state(struct dml_timing_cfg_st *
733733}
734734
735735static 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-
12321201static 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+
12721265void 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 ;
0 commit comments