diff --git a/composer/hwc_layers.cpp b/composer/hwc_layers.cpp
index 842269f..b6bdb21 100644
--- a/composer/hwc_layers.cpp
+++ b/composer/hwc_layers.cpp
@@ -1079,6 +1079,9 @@
   if (gralloc::GetMetaDataValue(handle, qtigralloc::MetadataType_LinearFormat.value,
                                 &linear_format) == gralloc::Error::NONE) {
     layer_buffer->format = GetSDMFormat(INT32(linear_format), 0);
+    if (layer_buffer->format == kFormatInvalid) {
+      return kErrorNotSupported;
+    }
   }
 
   if ((interlace != layer_buffer->flags.interlace) || (frame_rate != layer->frame_rate)) {
@@ -1099,6 +1102,9 @@
       gralloc::Error::NONE) {
     // Only copy top layer for now as only top field for interlaced is used
     GetUBWCStatsFromMetaData(&cr_stats[0], &(layer_buffer->ubwc_crstats[0]));
+    if (cr_stats[0].version < 0 || cr_stats[0].version >= UBWC_MAX_VERSION) {
+      return kErrorNotSupported;
+    }
   }
 
   uint32_t single_buffer = 0;
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp
index d576bb9..f4e8c2b 100644
--- a/composer/hwc_session.cpp
+++ b/composer/hwc_session.cpp
@@ -4116,7 +4116,7 @@
                                       return session->WaitForCommitDone(display, client_id);
                                      }, this, display, client_id);
   auto ret = (commit_done_future_[display].wait_for(span) == std::future_status::timeout) ?
-             -EINVAL : commit_done_future_[display].get();
+             -ETIMEDOUT : commit_done_future_[display].get();
   return ret;
 }
 
@@ -4347,7 +4347,7 @@
         DLOGE("Device unassign failed with error %d", ret);
       }
       TUITransitionUnPrepare(disp_id);
-      return -EINVAL;
+      return 0;
     }
   }
 
@@ -4386,6 +4386,9 @@
   for (auto &info : map_info) {
     bool needs_refresh = false;
     {
+      if (info.client_id == target_display) {
+        continue;
+      }
       SEQUENCE_WAIT_SCOPE_LOCK(locker_[info.client_id]);
       if (hwc_display_[info.client_id]) {
         if (info.disp_type == kPluggable && pending_hotplug_event_ == kHotPlugEvent) {
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index fb843ce..54996f2 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -1327,6 +1327,13 @@
     } else {
       DLOGE("Prepare failed: %d", error);
     }
+    // Clear fences
+    DLOGI("Clearing fences on input layers on display %d-%d", display_id_, display_type_);
+    for (auto &layer : layer_stack->layers) {
+      layer->input_buffer.release_fence = nullptr;
+    }
+    layer_stack->retire_fence = nullptr;
+
     return error;
   }
 
@@ -1415,15 +1422,9 @@
 
   disp_layer_stack_.info.retire_fence_offset = retire_fence_offset_;
   // Regiser for power events on first cycle in unified draw.
-  if (first_cycle_ && display_type_ != kVirtual) {
+  if (first_cycle_ && display_type_ == kBuiltIn) {
     // Register for panel dead since notification is sent at any time
     hw_events_intf_->SetEventState(HWEvent::PANEL_DEAD, true);
-
-    if (draw_method_ != kDrawDefault && !hw_panel_info_.is_primary_panel &&
-        display_type_ != kHDMI) {
-      DLOGI("Registering for power events");
-      hw_events_intf_->SetEventState(HWEvent::POWER_EVENT, true);
-    }
   }
 
   // Allow commit as pending doze/pending_power_on is handled as a part of draw cycle
@@ -1853,10 +1854,6 @@
     break;
 
   case kStateOn:
-    if (display_type_ == kHDMI && first_cycle_) {
-      hw_events_intf_->SetEventState(HWEvent::POWER_EVENT, true);
-    }
-
     cached_qos_data_.clock_hz =
       std::max(cached_qos_data_.clock_hz, disp_layer_stack_.info.qos_data.clock_hz);
     error = hw_intf_->PowerOn(cached_qos_data_, &sync_points);
@@ -1924,7 +1921,7 @@
     return kErrorParameters;
   }
 
-  if ((pending_power_state_ == kPowerStateNone) && (!first_cycle_ || display_type_ == kHDMI)) {
+  if ((pending_power_state_ == kPowerStateNone) && !first_cycle_) {
     CacheRetireFence();
     SyncPoints sync = {};
     sync.retire_fence = retire_fence_;
@@ -3963,32 +3960,6 @@
 
 void DisplayBase::WaitForCompletion(SyncPoints *sync_points) {
   DTRACE_SCOPED();
-  // Wait on current retire fence.
-  if (draw_method_ == kDrawDefault || display_type_ == kVirtual) {
-    DLOGI("Wait for current retire fence");
-    Fence::Wait(sync_points->retire_fence);
-    DLOGI("Received retire fence");
-    return;
-  }
-
-  // Wait for CRTC power event on first cycle.
-  if (first_cycle_) {
-    if (hw_panel_info_.is_primary_panel) {
-      DLOGI("Sync commit on primary");
-      return;
-    }
-    DLOGI("Wait for CRTC power event on first cycle");
-    std::unique_lock<std::mutex> lck(power_mutex_);
-    while (!transition_done_) {
-      cv_.wait(lck);
-    }
-
-    DLOGI("Received CRTC power event on first cycle");
-    // Unregister power events.
-    hw_events_intf_->SetEventState(HWEvent::POWER_EVENT, false);
-    return;
-  }
-
   // For displays in unified draw, wait on cached retire fence in steady state.
   shared_ptr<Fence> retire_fence = sync_points->retire_fence;
   DLOGI("Wait for cached retire fence to be in steady state");
diff --git a/sdm/libs/dal/hw_device_drm.cpp b/sdm/libs/dal/hw_device_drm.cpp
index 5f04967..b5f9987 100644
--- a/sdm/libs/dal/hw_device_drm.cpp
+++ b/sdm/libs/dal/hw_device_drm.cpp
@@ -1158,7 +1158,10 @@
   drm_atomic_intf_->Perform(DRMOps::CRTC_GET_RELEASE_FENCE, token_.crtc_id, &release_fence_fd);
   drm_atomic_intf_->Perform(DRMOps::CONNECTOR_GET_RETIRE_FENCE, token_.conn_id, &retire_fence_fd);
 
-  int ret = NullCommit(false /* synchronous */, true /* retain_planes */);
+  // On the first boot up of the display, make the power call synchronous. This is only applicable
+  // to pluggable displays. Check HWPeripheralDRM::PowerOn. For builtin first power call defered
+  // and handled in commit(synchronous for first cycle).
+  int ret = NullCommit(first_cycle_ /* synchronous */, true /* retain_planes */);
   if (ret) {
     DLOGE("Failed with error: %d", ret);
     return kErrorHardware;
