Merge "sdm: Don't send layer hint when game feature is not supported"
diff --git a/composer/display_null.h b/composer/display_null.h
index 7222faa..bcc8dbb 100644
--- a/composer/display_null.h
+++ b/composer/display_null.h
@@ -64,6 +64,7 @@
   virtual string Dump() { return ""; }
   virtual bool IsSupportSsppTonemap() { return false; }
   virtual bool CanSkipValidate() { return true; }
+  virtual bool GameEnhanceSupported() { return false; }
 
   MAKE_NO_OP(TeardownConcurrentWriteback(void))
   MAKE_NO_OP(Commit(LayerStack *))
diff --git a/composer/hwc_display.cpp b/composer/hwc_display.cpp
index 94bce1f..be7e039 100644
--- a/composer/hwc_display.cpp
+++ b/composer/hwc_display.cpp
@@ -525,7 +525,9 @@
   HWCDebugHandler::Get()->GetProperty(DISABLE_FAST_PATH, &disable_fast_path);
   fast_path_enabled_ = !(disable_fast_path == 1);
 
-  DLOGI("Display created with id: %d", id_);
+  game_supported_ = display_intf_->GameEnhanceSupported();
+
+  DLOGI("Display created with id: %d, game_supported_: %d", id_, game_supported_);
 
   return 0;
 }
@@ -785,7 +787,7 @@
       layer->update_mask.set(kClientCompRequest);
     }
 
-    if (hwc_layer->GetType() == kLayerGame) {
+    if (game_supported_ && (hwc_layer->GetType() == kLayerGame)) {
       layer->flags.is_game = true;
       layer->input_buffer.flags.game = true;
     }
diff --git a/composer/hwc_display.h b/composer/hwc_display.h
index 6323847..fa09cfa 100644
--- a/composer/hwc_display.h
+++ b/composer/hwc_display.h
@@ -482,6 +482,7 @@
   int fbt_release_fence_ = -1;
   int release_fence_ = -1;
   hwc2_config_t pending_config_index_ = 0;
+  bool game_supported_ = false;
 };
 
 inline int HWCDisplay::Perform(uint32_t operation, ...) {
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index c1dc190..db9d961 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -903,12 +903,19 @@
     @return \link DisplayError \endlink
   */
   virtual DisplayError SetBLScale(uint32_t level) = 0;
+
   /*! @brief Method to check if the Default resources are freed for display
 
     @return \link bool \endlink
   */
   virtual bool CheckResourceState() = 0;
 
+  /*! @brief Method to check if game enhance feature is supported for display
+
+    @return \link bool \endlink
+  */
+  virtual bool GameEnhanceSupported() = 0;
+
  protected:
   virtual ~DisplayInterface() { }
 };
diff --git a/sdm/include/private/color_interface.h b/sdm/include/private/color_interface.h
index 46d1715..b3a744f 100644
--- a/sdm/include/private/color_interface.h
+++ b/sdm/include/private/color_interface.h
@@ -99,6 +99,7 @@
   virtual DisplayError ColorIntfConvertToPPFeature(PPFeaturesConfig *out_features,
                                                   uint32_t disp_id, bool enable,
                                                   const std::string &hw_asset, void *in_data) = 0;
+  virtual DisplayError ColorIntfGameEnhancementSupported(bool *supported) = 0;
 
  protected:
   virtual ~ColorInterface() {}
diff --git a/sdm/libs/core/color_manager.cpp b/sdm/libs/core/color_manager.cpp
index b9a33e8..671fdea 100644
--- a/sdm/libs/core/color_manager.cpp
+++ b/sdm/libs/core/color_manager.cpp
@@ -490,6 +490,16 @@
   return support_stc_tonemap_;
 }
 
+bool ColorManagerProxy::GameEnhanceSupported() {
+  bool supported = false;
+
+  if (color_intf_) {
+    color_intf_->ColorIntfGameEnhancementSupported(&supported);
+  }
+
+  return supported;
+}
+
 DisplayError ColorManagerProxy::ConvertToPPFeatures(HwConfigOutputParams *params,
                                                     PPFeaturesConfig *out_data) {
   if (!params || !out_data) {
diff --git a/sdm/libs/core/color_manager.h b/sdm/libs/core/color_manager.h
index c8f47e9..c8464ad 100644
--- a/sdm/libs/core/color_manager.h
+++ b/sdm/libs/core/color_manager.h
@@ -152,6 +152,7 @@
                                                uint32_t intent);
   DisplayError Validate(HWLayers *hw_layers);
   bool IsSupportStcTonemap();
+  bool GameEnhanceSupported();
 
  protected:
   ColorManagerProxy() {}
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index b355749..f9d33db 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -2063,4 +2063,11 @@
   return comp_manager_->CheckResourceState(display_comp_ctx_);
 }
 
+bool DisplayBase::GameEnhanceSupported() {
+  if (color_mgr_) {
+    return color_mgr_->GameEnhanceSupported();
+  }
+  return false;
+}
+
 }  // namespace sdm
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index 00d1799..691d2b4 100644
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -160,6 +160,7 @@
   virtual bool CanSkipValidate();
   virtual DisplayError SetBLScale(uint32_t level) { return kErrorNotSupported; }
   virtual bool CheckResourceState();
+  virtual bool GameEnhanceSupported();
 
  protected:
   const char *kBt2020Pq = "bt2020_pq";