int i, j;
        struct dc_state *dangling_context = dc_create_state(dc);
        struct dc_state *current_ctx;
+       struct pipe_ctx *pipe;
 
        if (dangling_context == NULL)
                return;
                }
 
                if (should_disable && old_stream) {
+                       pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+                       /* When disabling plane for a phantom pipe, we must turn on the
+                        * phantom OTG so the disable programming gets the double buffer
+                        * update. Otherwise the pipe will be left in a partially disabled
+                        * state that can result in underflow or hang when enabling it
+                        * again for different use.
+                        */
+                       if (old_stream->mall_stream_config.type == SUBVP_PHANTOM) {
+                               pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
+                       }
                        dc_rem_all_planes_for_stream(dc, old_stream, dangling_context);
                        disable_all_writeback_pipes_for_stream(dc, old_stream, dangling_context);
 
                context->stream_count == 0)
                dc->hwss.prepare_bandwidth(dc, context);
 
+       /* When SubVP is active, all HW programming must be done while
+        * SubVP lock is acquired
+        */
+       if (dc->hwss.subvp_pipe_control_lock)
+               dc->hwss.subvp_pipe_control_lock(dc, context, true, true, NULL, subvp_prev_use);
+
        if (dc->debug.enable_double_buffered_dsc_pg_support)
                dc->hwss.update_dsc_pg(dc, context, false);
 
                dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe);
        }
 
-       if (dc->hwss.subvp_pipe_control_lock)
-               dc->hwss.subvp_pipe_control_lock(dc, context, true, true, NULL, subvp_prev_use);
-
        result = dc->hwss.apply_ctx_to_hw(dc, context);
 
        if (result != DC_OK) {
 
        struct dc_stream_status *cur_stream_status = stream_get_status(dc->current_state, stream);
        bool force_minimal_pipe_splitting = false;
-       uint32_t i;
 
        *is_plane_addition = false;
 
                }
        }
 
-       /* For SubVP pipe split case when adding MPO video
-        * we need to add a minimal transition. In this case
-        * there will be 2 streams (1 main stream, 1 phantom
-        * stream).
+       /* For SubVP when adding MPO video we need to add a minimal transition.
         */
-       if (cur_stream_status &&
-                       dc->current_state->stream_count == 2 &&
-                       stream->mall_stream_config.type == SUBVP_MAIN) {
-               bool is_pipe_split = false;
-
-               for (i = 0; i < dc->res_pool->pipe_count; i++) {
-                       if (dc->current_state->res_ctx.pipe_ctx[i].stream == stream &&
-                                       (dc->current_state->res_ctx.pipe_ctx[i].bottom_pipe ||
-                                       dc->current_state->res_ctx.pipe_ctx[i].next_odm_pipe)) {
-                               is_pipe_split = true;
-                               break;
-                       }
-               }
-
+       if (cur_stream_status && stream->mall_stream_config.type == SUBVP_MAIN) {
                /* determine if minimal transition is required due to SubVP*/
-               if (surface_count > 0 && is_pipe_split) {
+               if (surface_count > 0) {
                        if (cur_stream_status->plane_count > surface_count) {
                                force_minimal_pipe_splitting = true;
                        } else if (cur_stream_status->plane_count < surface_count) {