Merge remote-tracking branch 'quic/display.lnx.5.0' into tip

2/7/2019 FF

Change-Id: I78cdd49ab0f4da7ec24e9009ee5dd2cf0cb94ada
CRs-Fixed: 2395201
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 74fce80..6031a32 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -2,5 +2,36 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.graphics.composer@2.1-service)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.graphics.composer@2.1-service.rc)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/android.hardware.graphics.composer@2.1-impl.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.graphics.composer@2.2-service)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.graphics.composer@2.2-service.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/android.hardware.graphics.composer@2.2-impl.so)
+
+
+# Clean old target objs
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/hwcomposer.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/hwcomposer.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/gralloc.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/gralloc.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/lights.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/lights.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/memtrack.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/memtrack.msmnile.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/hwcomposer.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/hwcomposer.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/gralloc.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/gralloc.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/lights.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/lights.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/memtrack.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/memtrack.trinket.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/hwcomposer.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/hwcomposer.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/gralloc.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/gralloc.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/lights.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/lights.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/memtrack.talos.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/memtrack.talos.so)
+
 #Clean display includes
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/include/qcom/display)
diff --git a/config/display-board.mk b/config/display-board.mk
new file mode 100644
index 0000000..2abdd00
--- /dev/null
+++ b/config/display-board.mk
@@ -0,0 +1,16 @@
+#Display target definitions for msmnile
+
+#Enable Charging Icon
+TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
+TARGET_USES_GRALLOC1 := true
+TARGET_USES_DRM_PP := true
+TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
+MAX_VIRTUAL_DISPLAY_DIMENSION := 4096
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
+TARGET_USES_HWC2 := true
+TARGET_USES_QCOM_DISPLAY_BSP := true
+TARGET_USES_COLOR_METADATA := true
+TARGET_HAS_WIDE_COLOR_DISPLAY := true
+TARGET_HAS_HDR_DISPLAY := true
+TARGET_USES_DISPLAY_RENDER_INTENTS := true
+
diff --git a/config/display-product.mk b/config/display-product.mk
new file mode 100644
index 0000000..855ff51
--- /dev/null
+++ b/config/display-product.mk
@@ -0,0 +1,69 @@
+# Display product definitions
+PRODUCT_PACKAGES += \
+    android.hardware.graphics.composer@2.3-impl \
+    android.hardware.graphics.composer@2.3-service \
+    android.hardware.graphics.mapper@2.0-impl-qti-display \
+    vendor.qti.hardware.display.allocator@1.0-service \
+    android.hardware.memtrack@1.0-impl \
+    android.hardware.memtrack@1.0-service \
+    android.hardware.light@2.0-impl \
+    android.hardware.light@2.0-service \
+    gralloc.qcom \
+    lights.qcom \
+    hwcomposer.qcom \
+    memtrack.qcom \
+    libqdMetaData.vendor \
+    vendor.display.config@1.0.vendor \
+    vendor.display.config@1.1.vendor \
+    vendor.display.config@1.2.vendor \
+    vendor.display.config@1.3.vendor \
+    vendor.display.config@1.4.vendor \
+    vendor.display.config@1.5.vendor \
+    modetest
+
+#QDCM calibration xml file for 2k panel
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_nt35597_cmd_mode_dsi_truly_panel_with_DSC.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_nt35597_cmd_mode_dsi_truly_panel_with_DSC.xml
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_nt35597_cmd_mode_dsi_truly_panel_with_DSC.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_nt35597_video_mode_dsi_truly_panel_with_DSC.xml
+#QDCM calibration xml file for 4k panel
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_Sharp_4k_cmd_mode_dsc_dsi_panel.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_Sharp_4k_cmd_mode_dsc_dsi_panel.xml
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_Sharp_4k_cmd_mode_dsc_dsi_panel.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_Sharp_4k_video_mode_dsc_dsi_panel.xml
+#QDCM calibration xml file for amoled panel
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_sw43404_amoled_cmd_mode_dsi_boe_panel_with_DSC.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_sw43404_amoled_cmd_mode_dsi_boe_panel_with_DSC.xml
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_sw43404_amoled_cmd_mode_dsi_boe_panel_with_DSC.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_sw43404_amoled_video_mode_dsi_boe_panel_with_DSC.xml
+
+PRODUCT_PROPERTY_OVERRIDES += \
+    persist.demo.hdmirotationlock=false \
+    persist.sys.sf.color_saturation=1.0 \
+    debug.sf.hw=0 \
+    debug.egl.hw=0 \
+    debug.sf.latch_unsignaled=1 \
+    debug.mdpcomp.logs=0 \
+    ro.vendor.display.cabl=2 \
+    vendor.gralloc.disable_ubwc=0 \
+    vendor.display.disable_scaler=0 \
+    vendor.display.disable_inline_rotator=1 \
+    vendor.display.disable_decimation=1 \
+    vendor.display.enable_null_display=0 \
+    vendor.display.disable_excl_rect=0 \
+    vendor.display.comp_mask=0 \
+    vendor.display.enable_default_color_mode=1
+
+ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
+# Recovery is enabled, logging is enabled
+PRODUCT_PROPERTY_OVERRIDES += \
+    vendor.display.disable_hw_recovery_dump=0
+else
+# Recovery is enabled, logging is disabled
+PRODUCT_PROPERTY_OVERRIDES += \
+    vendor.display.disable_hw_recovery_dump=1
+endif
+
+# Properties using default value:
+#    vendor.display.disable_hw_recovery=0
+
+# This matrix should be in column major order, per SurfaceFlinger requirement
+#  1.0   0.0   0.0
+#  0.0   1.0   0.0
+#  0.0   0.0   1.0
+PRODUCT_PROPERTY_OVERRIDES += \
+    vendor.display.dataspace_saturation_matrix=1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0
diff --git a/config/msmnile.mk b/config/msmnile.mk
index 381b1dd..70e755d 100644
--- a/config/msmnile.mk
+++ b/config/msmnile.mk
@@ -1,18 +1,18 @@
 #Display related packages and configuration
 
 PRODUCT_PACKAGES += \
-    android.hardware.graphics.composer@2.2-impl \
-    android.hardware.graphics.composer@2.2-service \
+    android.hardware.graphics.composer@2.3-impl \
+    android.hardware.graphics.composer@2.3-service \
     android.hardware.graphics.mapper@2.0-impl-qti-display \
     vendor.qti.hardware.display.allocator@1.0-service \
     android.hardware.memtrack@1.0-impl \
     android.hardware.memtrack@1.0-service \
     android.hardware.light@2.0-impl \
     android.hardware.light@2.0-service \
-    gralloc.msmnile \
-    lights.msmnile \
-    hwcomposer.msmnile \
-    memtrack.msmnile \
+    gralloc.qcom \
+    lights.qcom \
+    hwcomposer.qcom \
+    memtrack.qcom \
     libqdutils \
     libqdMetaData \
     libqdMetaData.system \
diff --git a/config/talos.mk b/config/talos.mk
index cc99d1f..ba69f37 100644
--- a/config/talos.mk
+++ b/config/talos.mk
@@ -9,10 +9,10 @@
     android.hardware.memtrack@1.0-service \
     android.hardware.light@2.0-impl \
     android.hardware.light@2.0-service \
-    gralloc.talos \
-    lights.talos \
-    hwcomposer.talos \
-    memtrack.talos \
+    gralloc.qcom \
+    lights.qcom \
+    hwcomposer.qcom \
+    memtrack.qcom \
     libqdutils \
     libqdMetaData \
     libqdMetaData.system \
diff --git a/config/trinket.mk b/config/trinket.mk
index fe48ba4..d56de38 100644
--- a/config/trinket.mk
+++ b/config/trinket.mk
@@ -9,10 +9,10 @@
     android.hardware.memtrack@1.0-service \
     android.hardware.light@2.0-impl \
     android.hardware.light@2.0-service \
-    gralloc.trinket \
-    lights.trinket \
-    hwcomposer.trinket \
-    memtrack.trinket \
+    gralloc.qcom \
+    lights.qcom \
+    hwcomposer.qcom \
+    memtrack.qcom \
     libqdutils \
     libqdMetaData \
     libqdMetaData.system \
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 0e648fe..2ae5778 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -3,7 +3,7 @@
 include $(LOCAL_PATH)/../common.mk
 include $(CLEAR_VARS)
 
-LOCAL_MODULE                  := gralloc.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE                  := gralloc.qcom
 LOCAL_VENDOR_MODULE           := true
 LOCAL_MODULE_RELATIVE_PATH    := hw
 LOCAL_MODULE_TAGS             := optional
diff --git a/hdmi_cec/Android.mk b/hdmi_cec/Android.mk
index a333654..45bc9f7 100644
--- a/hdmi_cec/Android.mk
+++ b/hdmi_cec/Android.mk
@@ -2,7 +2,7 @@
 include $(LOCAL_PATH)/../common.mk
 include $(CLEAR_VARS)
 
-LOCAL_MODULE                  := hdmi_cec.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE                  := hdmi_cec.qcom
 LOCAL_VENDOR_MODULE           := true
 LOCAL_MODULE_RELATIVE_PATH    := hw
 LOCAL_MODULE_TAGS             := optional
diff --git a/include/display_properties.h b/include/display_properties.h
index 3fd4599..7eddc3b 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -113,6 +113,7 @@
 #define QDCM_MODE_COMBINE_PROP               DISPLAY_PROP("qdcm.mode_combine")
 #define PREFER_MULTIRECT_PROP                DISPLAY_PROP("prefer_multirect")
 #define DROP_SKEWED_VSYNC                    DISPLAY_PROP("drop_skewed_vsync")
+#define DISABLE_FAST_PATH                    DISPLAY_PROP("disable_fast_path")
 
 #define ZERO_SWAP_INTERVAL                   "vendor.debug.egl.swapinterval"
 
diff --git a/liblight/Android.mk b/liblight/Android.mk
index d7060c8..cefd9fd 100644
--- a/liblight/Android.mk
+++ b/liblight/Android.mk
@@ -26,7 +26,7 @@
     LOCAL_CFLAGS += --compile-and-analyze --analyzer-perf --analyzer-Werror
 endif
 LOCAL_CLANG  := true
-LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE := lights.qcom
 LOCAL_MODULE_TAGS := optional
 LOCAL_VENDOR_MODULE := true
 
diff --git a/libmemtrack/Android.mk b/libmemtrack/Android.mk
index 10fd40a..683666b 100644
--- a/libmemtrack/Android.mk
+++ b/libmemtrack/Android.mk
@@ -26,5 +26,5 @@
 LOCAL_SHARED_LIBRARIES := liblog
 LOCAL_HEADER_LIBRARIES := libhardware_headers
 LOCAL_SRC_FILES := memtrack_msm.c kgsl.c
-LOCAL_MODULE := memtrack.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE := memtrack.qcom
 include $(BUILD_SHARED_LIBRARY)
diff --git a/sdm/include/core/layer_stack.h b/sdm/include/core/layer_stack.h
index b0e042f..24d4f80 100644
--- a/sdm/include/core/layer_stack.h
+++ b/sdm/include/core/layer_stack.h
@@ -262,6 +262,8 @@
                                            // This applies only to primary displays currently
 
       uint32_t hdr_present : 1;  //!< Set if stack has HDR content
+
+      uint32_t fast_path : 1;    //!< Preference for fast/slow path draw-cycle, set by client.
     };
 
     uint32_t flags = 0;               //!< For initialization purpose only.
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 2fcae89..21948d5 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -650,6 +650,7 @@
   LayerRect partial_fb_roi = {};   // Damaged area in framebuffer.
   bool roi_split = false;          // Indicates separated left and right ROI
   bool async_cursor_updates = false;  // Cursor layer allowed to have async updates
+  bool fast_path_composition = false;  // Indicates frame has fast path composition
   DestScaleInfoMap dest_scale_info_map = {};
   HWHDRLayerInfo hdr_layer_info = {};
   Handle pvt_data = NULL;   // Private data used by sdm extension only.
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 0f92d62..eadb497 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -497,7 +497,7 @@
 }
 
 DisplayError CompManager::SetMaxBandwidthMode(HWBwModes mode) {
-  if ((hw_res_info_.has_dyn_bw_support == false) || (mode >= kBwModeMax)) {
+  if ((!hw_res_info_.has_dyn_bw_support) || (mode >= kBwModeMax)) {
     return kErrorNotSupported;
   }
 
diff --git a/sdm/libs/core/comp_manager.h b/sdm/libs/core/comp_manager.h
index aba0b8b..54cde85 100644
--- a/sdm/libs/core/comp_manager.h
+++ b/sdm/libs/core/comp_manager.h
@@ -82,6 +82,7 @@
                                  const std::vector<PrimariesTransfer> &colormodes_cs);
   DisplayError SetBlendSpace(Handle display_ctx, const PrimariesTransfer &blend_space);
   void HandleSecureEvent(Handle display_ctx, SecureEvent secure_event);
+  void SetSafeMode(bool enable) { safe_mode_ = enable; }
 
  private:
   static const int kMaxThermalLevel = 3;
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 97eb72b..fb88ae3 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -299,7 +299,7 @@
   }
   // TODO(user): Temporary changes, to be removed when DRM driver supports
   // Partial update with Destination scaler enabled.
-  if (partial_update_control_ == false || disable_pu_one_frame_ ||
+  if (!partial_update_control_ || disable_pu_one_frame_ ||
       disable_pu_on_dest_scaler_) {
     comp_manager_->ControlPartialUpdate(display_comp_ctx_, false /* enable */);
     disable_pu_one_frame_ = false;
@@ -312,6 +312,13 @@
       break;
     }
 
+    if (layer_stack->flags.fast_path && hw_layers_.info.fast_path_composition) {
+      // In Fast Path, driver validation happens in COMMIT Phase.
+      DLOGI_IF(kTagDisplay, "Draw cycle qualifies for Fast Path!");
+      needs_validate_ = false;
+      break;
+    }
+
     error = hw_intf_->Validate(&hw_layers_);
     if (error == kErrorNone) {
       // Strategy is successful now, wait for Commit().
@@ -380,6 +387,12 @@
 
   error = hw_intf_->Commit(&hw_layers_);
   if (error != kErrorNone) {
+    if (layer_stack->flags.fast_path && hw_layers_.info.fast_path_composition) {
+      // If COMMIT fails on the Fast Path, set Safe Mode.
+      DLOGE("COMMIT failed in Fast Path, set Safe Mode!");
+      comp_manager_->SetSafeMode(true);
+      error = kErrorNotValidated;
+    }
     return error;
   }
 
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index faee5a3..fdcce3d 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -767,7 +767,7 @@
         }
         break;
       case kDevicePluggable:
-        if (panel_info.is_pluggable == true) {
+        if (panel_info.is_pluggable) {
           if (IsFBNodeConnected(i)) {
             return i;
           }
@@ -1055,7 +1055,7 @@
   for (int i = 0; i < kFBNodeMax; i++) {
     HWPanelInfo panel_info;
     GetHWPanelInfoByNode(i, &panel_info);
-    if (panel_info.is_pluggable == true) {
+    if (panel_info.is_pluggable) {
       snprintf(hpdpath , sizeof(hpdpath), "%s%d/hpd", fb_path_, i);
 
       ssize_t length = SysFsWrite(hpdpath, value, 1);
diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp
index 87bf9e5..1444947 100644
--- a/sdm/libs/core/fb/hw_info.cpp
+++ b/sdm/libs/core/fb/hw_info.cpp
@@ -388,7 +388,7 @@
   const uint32_t kMaxV4L2Nodes = 64;
   bool found = false;
 
-  for (uint32_t i = 0; (i < kMaxV4L2Nodes) && (false == found); i++) {
+  for (uint32_t i = 0; (i < kMaxV4L2Nodes) && (!found); i++) {
     string path = v4l2_path + to_string(i) + "/name";
     Sys::fstream fs(path, fstream::in);
     if (!fs.is_open()) {
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index dfcd80e..a9052e0 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -4,7 +4,7 @@
 
 ifeq ($(use_hwc2),true)
 
-LOCAL_MODULE                  := hwcomposer.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE                  := hwcomposer.qcom
 LOCAL_VENDOR_MODULE           := true
 LOCAL_MODULE_RELATIVE_PATH    := hw
 LOCAL_MODULE_TAGS             := optional
diff --git a/sdm/libs/hwc2/hwc_color_manager.cpp b/sdm/libs/hwc2/hwc_color_manager.cpp
index 59c99ef..5dd6a4b 100644
--- a/sdm/libs/hwc2/hwc_color_manager.cpp
+++ b/sdm/libs/hwc2/hwc_color_manager.cpp
@@ -301,7 +301,7 @@
   DisplayDetailEnhancerData de_data;
 
   PPDETuningCfgData *de_tuning_cfg_data = reinterpret_cast<PPDETuningCfgData*>(params);
-  if (de_tuning_cfg_data->cfg_pending == true) {
+  if (de_tuning_cfg_data->cfg_pending) {
     if (!de_tuning_cfg_data->cfg_en) {
       de_data.enable = 0;
     } else {
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 35c8050..d49da4c 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -553,6 +553,10 @@
   partial_update_enabled_ = fixed_info.partial_update || (!fixed_info.is_cmdmode);
   client_target_->SetPartialUpdate(partial_update_enabled_);
 
+  int disable_fast_path = 0;
+  HWCDebugHandler::Get()->GetProperty(DISABLE_FAST_PATH, &disable_fast_path);
+  fast_path_enabled_ = !(disable_fast_path == 1);
+
   DLOGI("Display created with id: %d", id_);
 
   return 0;
@@ -671,6 +675,7 @@
   display_rect_ = LayerRect();
   metadata_refresh_rate_ = 0;
   layer_stack_.flags.animating = animating_;
+  layer_stack_.flags.fast_path = fast_path_enabled_ && fast_path_composition_;
 
   // Add one layer for fb target
   // TODO(user): Add blit target layers
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index ed0696a..c38c6bb 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -234,6 +234,7 @@
   virtual HWC2::Error SetColorModeFromClientApi(int32_t color_mode_id) {
     return HWC2::Error::Unsupported;
   }
+  void SetFastPathComposition(bool enable) { fast_path_composition_ = enable; }
 
   // HWC2 APIs
   virtual HWC2::Error AcceptDisplayChanges(void);
@@ -399,6 +400,7 @@
   bool partial_update_enabled_ = false;
   std::map<uint32_t, DisplayConfigVariableInfo> variable_config_map_;
   std::vector<uint32_t> hwc_config_map_;
+  bool fast_path_composition_ = false;
 
  private:
   void DumpInputBuffers(void);
@@ -411,6 +413,7 @@
   int null_display_mode_ = 0;
   bool has_client_composition_ = false;
   DisplayValidateState validate_state_ = kNormalValidate;
+  bool fast_path_enabled_ = true;
 };
 
 inline int HWCDisplay::Perform(uint32_t operation, ...) {
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index cececb7..cf52eec 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -1009,6 +1009,7 @@
     if (power_on_pending_[display]) {
       status = HWC2::Error::None;
     } else if (hwc_session->hwc_display_[display]) {
+      hwc_session->hwc_display_[display]->SetFastPathComposition(false);
       status = hwc_session->ValidateDisplayInternal(display, out_num_types, out_num_requests);
     }
   }
@@ -2707,9 +2708,11 @@
   // Validation to optimize for the frames which don't require the Client composition.
   if (hwc_display->IsSkipValidateState() && !hwc_display->CanSkipValidate()) {
     uint32_t out_num_types = 0, out_num_requests = 0;
+    hwc_display->SetFastPathComposition(true);
     HWC2::Error error = ValidateDisplayInternal(display, &out_num_types, &out_num_requests);
     if ((error != HWC2::Error::None) || hwc_display->HWCClientNeedsValidate()) {
       hwc_display->SetValidationState(HWCDisplay::kInternalValidate);
+      hwc_display->SetFastPathComposition(false);
       return HWC2::Error::NotValidated;
     }
   }