if (drm_atomic_crtc_needs_modeset(new_crtc_state)
                    && dm_old_crtc_state->stream) {
                        /*
-                        * CRC capture was enabled but not disabled.
-                        * Release the vblank reference.
+                        * If the stream is removed and CRC capture was
+                        * enabled on the CRTC the extra vblank reference
+                        * needs to be dropped since CRC capture will be
+                        * disabled.
                         */
-                       if (dm_new_crtc_state->crc_enabled) {
+                       if (!dm_new_crtc_state->stream
+                           && dm_new_crtc_state->crc_enabled) {
                                drm_crtc_vblank_put(crtc);
                                dm_new_crtc_state->crc_enabled = false;
                        }
                        continue;
 
                manage_dm_interrupts(adev, acrtc, true);
+
+               /* The stream has changed so CRC capture needs to re-enabled. */
+               if (dm_new_crtc_state->crc_enabled)
+                       amdgpu_dm_crtc_set_crc_source(crtc, "auto");
        }
 
        /* update planes when needed per crtc*/
 
 
 int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name)
 {
+       struct amdgpu_device *adev = crtc->dev->dev_private;
        struct dm_crtc_state *crtc_state = to_dm_crtc_state(crtc->state);
        struct dc_stream_state *stream_state = crtc_state->stream;
        bool enable;
 
        enable = (source == AMDGPU_DM_PIPE_CRC_SOURCE_AUTO);
 
+       mutex_lock(&adev->dm.dc_lock);
        if (!dc_stream_configure_crc(stream_state->ctx->dc, stream_state,
-                                    enable, enable))
+                                    enable, enable)) {
+               mutex_unlock(&adev->dm.dc_lock);
                return -EINVAL;
+       }
 
        /* When enabling CRC, we should also disable dithering. */
        dc_stream_set_dither_option(stream_state,
                                    enable ? DITHER_OPTION_TRUN8
                                           : DITHER_OPTION_DEFAULT);
 
+       mutex_unlock(&adev->dm.dc_lock);
+
        /*
         * Reading the CRC requires the vblank interrupt handler to be
         * enabled. Keep a reference until CRC capture stops.