for (i = 0; i < stream_count; i++) {
                struct dc_stream_state *stream = streams[i];
 
+               /* skip it if the link is mappable endpoint. */
+               if (stream->link->is_dig_mapping_flexible)
+                       continue;
+
                /* Skip stream if not supported by DIG link encoder. */
                if (!is_dig_link_enc_stream(stream))
                        continue;
 
                /* Physical endpoints have a fixed mapping to DIG link encoders. */
-               if (!stream->link->is_dig_mapping_flexible) {
-                       eng_id = stream->link->eng_id;
-                       add_link_enc_assignment(state, stream, eng_id);
-               }
+               eng_id = stream->link->eng_id;
+               add_link_enc_assignment(state, stream, eng_id);
        }
 
        /* (b) Retain previous assignments for mappable endpoints if encoders still available. */
                for (i = 0; i < stream_count; i++) {
                        struct dc_stream_state *stream = state->streams[i];
 
-                       /* Skip stream if not supported by DIG link encoder. */
-                       if (!is_dig_link_enc_stream(stream))
+                       /* Skip it if the link is NOT mappable endpoint. */
+                       if (!stream->link->is_dig_mapping_flexible)
                                continue;
 
-                       if (!stream->link->is_dig_mapping_flexible)
+                       /* Skip stream if not supported by DIG link encoder. */
+                       if (!is_dig_link_enc_stream(stream))
                                continue;
 
                        for (j = 0; j < prev_state->stream_count; j++) {
                                if (stream == prev_stream && stream->link == prev_stream->link &&
                                                prev_state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[j].valid) {
                                        eng_id = prev_state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[j].eng_id;
+
                                        if (is_avail_link_enc(state, eng_id, stream))
                                                add_link_enc_assignment(state, stream, eng_id);
                                }
 
        for (i = 0; i < stream_count; i++) {
                struct dc_stream_state *stream = streams[i];
+               struct link_encoder *link_enc = NULL;
+
+               /* Skip it if the link is NOT mappable endpoint. */
+               if (!stream->link->is_dig_mapping_flexible)
+                       continue;
+
+               /* Skip if encoder assignment retained in step (b) above. */
+               if (stream->link_enc)
+                       continue;
 
                /* Skip stream if not supported by DIG link encoder. */
                if (!is_dig_link_enc_stream(stream)) {
                }
 
                /* Mappable endpoints have a flexible mapping to DIG link encoders. */
-               if (stream->link->is_dig_mapping_flexible) {
-                       struct link_encoder *link_enc = NULL;
 
-                       /* Skip if encoder assignment retained in step (b) above. */
-                       if (stream->link_enc)
-                               continue;
+               /* For MST, multiple streams will share the same link / display
+                * endpoint. These streams should use the same link encoder
+                * assigned to that endpoint.
+                */
+               link_enc = get_link_enc_used_by_link(state, stream->link);
+               if (link_enc == NULL)
+                       eng_id = find_first_avail_link_enc(stream->ctx, state);
+               else
+                       eng_id =  link_enc->preferred_engine;
 
-                       /* For MST, multiple streams will share the same link / display
-                        * endpoint. These streams should use the same link encoder
-                        * assigned to that endpoint.
-                        */
-                       link_enc = get_link_enc_used_by_link(state, stream->link);
-                       if (link_enc == NULL)
-                               eng_id = find_first_avail_link_enc(stream->ctx, state);
-                       else
-                               eng_id =  link_enc->preferred_engine;
-                       add_link_enc_assignment(state, stream, eng_id);
-               }
+               add_link_enc_assignment(state, stream, eng_id);
        }
 
        link_enc_cfg_validate(dc, state);
 {
        enum engine_id eng_id = ENGINE_ID_UNKNOWN;
 
-       /* Only DIG link encoders. */
-       if (!is_dig_link_enc_stream(stream))
-               return;
-
        if (stream->link_enc)
                eng_id = stream->link_enc->preferred_engine;