sdm: hwc2: Support Skip Validate feature

1. Set HWC2_CAPABILITY_SKIP_VALIDATE cap in GetCapabilities api.
2. If HWC2_CAPABILITY_SKIP_VALIDATE cap is exposed by HWC HAL, then
   SF just calls PresentDisplay api. It is the responsibility of HWC
   HAL to request for ValidateDisplay, if it is required. If the cap
   is not exposed by HWC HAL, then there will be ValidateDisplay call
   followed by PresentDisplay.
3. In case of Surface Damage update on a layer, SDM needs a Validate
   call to program SDE driver for Partial Update feature.
4. SDM needs Validate call to enter in safe Mode for use cases like
   Idle / Thermal fallback, HDMI and Virtual Connect/Disconnet, etc.
5. In case of layer buffer geometry, metadata or secure attributes
   change, SDM needs Validate call to program the SDE driver.
6. SDM needs Validate call if GPU tonemapping is required on a layer
   during HDR Video playback.
7. Read user defined underscan width and height, when the External
   display gets created and initialized.
8. SDM needs Validate call for few APIs which are exposed by the Binder
   Interface or by HWComposer APIs, since they need re-configuration of
   SDE driver or they modify Panel / LayerMixer / Display configuration.
9. The feature is enabled by default. "sdm.debug.disable_skip_validate"
   system property can be set to '1' to disable the feature.

CRs-Fixed: 2071632
Change-Id: I68f0db3af16afa4ad4eb789cd1f6b12caf6381e4
diff --git a/sdm/libs/hwc2/hwc_display_primary.cpp b/sdm/libs/hwc2/hwc_display_primary.cpp
index 1094100..4079cbc 100644
--- a/sdm/libs/hwc2/hwc_display_primary.cpp
+++ b/sdm/libs/hwc2/hwc_display_primary.cpp
@@ -217,6 +217,7 @@
     // If we do not handle the frame set retireFenceFd to outbufAcquireFenceFd
     // Revisit this when validating display_paused
     DisplayError error = display_intf_->Flush();
+    validated_.reset();
     if (error != kErrorNone) {
       DLOGE("Flush failed. Error = %d", error);
     }
@@ -252,6 +253,7 @@
   }
 
   callbacks_->Refresh(HWC_DISPLAY_PRIMARY);
+  validated_.reset();
 
   return status;
 }
@@ -264,6 +266,7 @@
   }
 
   callbacks_->Refresh(HWC_DISPLAY_PRIMARY);
+  validated_.reset();
 
   return status;
 }
@@ -283,6 +286,7 @@
 
   callbacks_->Refresh(HWC_DISPLAY_PRIMARY);
   color_tranform_failed_ = false;
+  validated_.reset();
 
   return status;
 }
@@ -324,6 +328,7 @@
       return -EINVAL;
   }
   va_end(args);
+  validated_.reset();
 
   return 0;
 }
@@ -410,6 +415,7 @@
 
 void HWCDisplayPrimary::SetIdleTimeoutMs(uint32_t timeout_ms) {
   display_intf_->SetIdleTimeoutMs(timeout_ms);
+  validated_.reset();
 }
 
 static void SetLayerBuffer(const BufferInfo &output_buffer_info, LayerBuffer *output_buffer) {
@@ -509,6 +515,7 @@
   output_buffer_base_ = buffer;
   post_processed_output_ = true;
   DisablePartialUpdateOneFrame();
+  validated_.reset();
 }
 
 int HWCDisplayPrimary::FrameCaptureAsync(const BufferInfo &output_buffer_info,
@@ -553,6 +560,7 @@
 
   if (display_intf_) {
     error = display_intf_->SetDetailEnhancerData(de_data);
+    validated_.reset();
   }
   return error;
 }
@@ -562,6 +570,7 @@
 
   if (display_intf_) {
     error = display_intf_->ControlPartialUpdate(enable, pending);
+    validated_.reset();
   }
 
   return error;
@@ -572,6 +581,7 @@
 
   if (display_intf_) {
     error = display_intf_->DisablePartialUpdateOneFrame();
+    validated_.reset();
   }
 
   return error;
@@ -579,7 +589,9 @@
 
 
 DisplayError HWCDisplayPrimary::SetMixerResolution(uint32_t width, uint32_t height) {
-  return display_intf_->SetMixerResolution(width, height);
+  DisplayError error = display_intf_->SetMixerResolution(width, height);
+  validated_.reset();
+  return error;
 }
 
 DisplayError HWCDisplayPrimary::GetMixerResolution(uint32_t *width, uint32_t *height) {