sdm: Do not mandatory enable demura while set power on

SDM add demura dynamic enable and disable supports.
If demura was set to disabled, it should not enable
it after power on. But demura is mandatory to
disable/enable while set power off/on.
Change will not enable demura in power on if it has
been set to disabled dynamically.

Change-Id: I08cd58d038884b8f504ac675ed660aa3571320af
diff --git a/sdm/libs/core/display_builtin.cpp b/sdm/libs/core/display_builtin.cpp
index 3a8d6ee..57e0c15 100644
--- a/sdm/libs/core/display_builtin.cpp
+++ b/sdm/libs/core/display_builtin.cpp
@@ -254,6 +254,7 @@
         DLOGE("Unable to DeInit DemuraTn on Display %d", display_id_);
       }
     }
+    demura_dynamic_enabled_ = true;
 
     DeinitCWBBuffer();
   }
@@ -959,7 +960,7 @@
   }
 
   // Must go in NullCommit
-  if (demura_intended_ &&
+  if (demura_intended_ && demura_dynamic_enabled_ &&
       comp_manager_->GetDemuraStatusForDisplay(display_id_) && (state == kStateOff)) {
     comp_manager_->SetDemuraStatusForDisplay(display_id_, false);
     SetDemuraIntfStatus(false);
@@ -987,7 +988,7 @@
   }
 
   // Must only happen after NullCommit and get applied in next frame
-  if (demura_intended_ &&
+  if (demura_intended_ && demura_dynamic_enabled_ &&
       !comp_manager_->GetDemuraStatusForDisplay(display_id_) && (state == kStateOn)) {
     comp_manager_->SetDemuraStatusForDisplay(display_id_, true);
     SetDemuraIntfStatus(true);
@@ -2953,6 +2954,7 @@
       return kErrorUndefined;
     }
     comp_manager_->SetDemuraStatusForDisplay(display_id_, true);
+    demura_dynamic_enabled_ = true;
   } else if (!state && comp_manager_->GetDemuraStatusForDisplay(display_id_)) {
     ret = SetDemuraIntfStatus(false);
     if (ret) {
@@ -2960,6 +2962,7 @@
       return kErrorUndefined;
     }
     comp_manager_->SetDemuraStatusForDisplay(display_id_, false);
+    demura_dynamic_enabled_ = false;
   }
 
   // Disable Partial Update for one frame.
diff --git a/sdm/libs/core/display_builtin.h b/sdm/libs/core/display_builtin.h
index d4c7e88..7e1d5b2 100644
--- a/sdm/libs/core/display_builtin.h
+++ b/sdm/libs/core/display_builtin.h
@@ -296,6 +296,7 @@
   std::shared_ptr<DemuraTnCoreUvmIntf> demuratn_ = nullptr;
   Layer demura_layer_ = {};
   bool demura_intended_ = false;
+  bool demura_dynamic_enabled_ = true;
   bool enable_dpps_dyn_fps_ = false;
   HWDisplayMode last_panel_mode_ = kModeDefault;
   bool hdr_present_ = false;