sdm: do not update qsync mode if there is a display mode change

CRs-Fixed: 3343485
Change-Id: Ib2fb414a285f286e015f3d14e0eff12572b220e5
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 1d03686..a578bfb 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -1567,6 +1567,7 @@
   PostCommitLayerParams();
 
   rc_prepared_ = false;
+  avoid_qsync_mode_change_ = false;
 
   if (partial_update_control_) {
     comp_manager_->ControlPartialUpdate(display_comp_ctx_, true /* enable */);
@@ -1968,6 +1969,7 @@
     return error;
   }
 
+  avoid_qsync_mode_change_ = true;
   active_refresh_rate_ = display_attributes.fps;
 
   return ReconfigureDisplay();
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index e53c4ca..88138af 100644
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -432,6 +432,7 @@
   uint32_t active_refresh_rate_ = 0;
   bool disable_cwb_idle_fallback_ = false;
   bool allow_tonemap_native_ = false;
+  bool avoid_qsync_mode_change_ = false;
 
  private:
   // Max tolerable power-state-change wait-times in milliseconds.
diff --git a/sdm/libs/core/display_builtin.cpp b/sdm/libs/core/display_builtin.cpp
index 914b0a9..0df68b2 100644
--- a/sdm/libs/core/display_builtin.cpp
+++ b/sdm/libs/core/display_builtin.cpp
@@ -389,7 +389,7 @@
 }
 
 void DisplayBuiltIn::UpdateQsyncMode() {
-  if (!hw_panel_info_.qsync_support) {
+  if (!hw_panel_info_.qsync_support || avoid_qsync_mode_change_) {
     return;
   }
 
@@ -1038,6 +1038,7 @@
       return error;
     }
 
+    avoid_qsync_mode_change_ = true;
     DisplayBase::ReconfigureDisplay();
 
     if (mode == kModeVideo) {
@@ -1990,6 +1991,7 @@
   }
 
   validated_ = false;
+  avoid_qsync_mode_change_ = true;
   DLOGV("Setting new dynamic bit clk value: %" PRIu64, bit_clk_rate);
   return hw_intf_->SetDynamicDSIClock(bit_clk_rate);
 }