composer: Request gold core based on the number of app layers

This change introduces a new property, large_comp_hint_threshold,
which defines the minimum number of app layers required to send the
large composition hint to perf hal. This will apply on all use cases
including CWB.

Change-Id: I6c8811ec2fa7bec5ec722354d1814dd2c7c5c219
CRs-Fixed: 3301538
diff --git a/composer/hwc_display_builtin.cpp b/composer/hwc_display_builtin.cpp
index 3d63a29..6107364 100644
--- a/composer/hwc_display_builtin.cpp
+++ b/composer/hwc_display_builtin.cpp
@@ -206,6 +206,11 @@
   DebugHandler::Get()->GetProperty(ENABLE_ROUNDED_CORNER, &value);
   enable_round_corner_ = (value == 1);
 
+  value = 0;
+  if (DebugHandler::Get()->GetProperty(LARGE_COMP_HINT_THRESHOLD, &value) == kErrorNone) {
+    large_comp_hint_threshold_ = value;
+  }
+
   uint32_t config_index = 0;
   GetActiveDisplayConfig(&config_index);
   DisplayConfigVariableInfo attr = {};
@@ -1367,6 +1372,12 @@
     return false;
   }
 
+  if (large_comp_hint_threshold_ > 0 && layer_set_.size() >= large_comp_hint_threshold_) {
+    DLOGV_IF(kTagResources, "Number of app layers %d meet requirement %d. Set perf hint for large "
+             "comp cycle", layer_set_.size(), large_comp_hint_threshold_);
+    return true;
+  }
+
   // Send hints when the device is in multi-display or when a skip layer is present.
   if (layer_stack_.flags.skip_present || is_multi_display_) {
     DLOGV_IF(kTagResources, "Found skip_layer:%d or is_multidisplay:%d. Set perf hint for large "
diff --git a/composer/hwc_display_builtin.h b/composer/hwc_display_builtin.h
index 4a05a96..3547f0e 100644
--- a/composer/hwc_display_builtin.h
+++ b/composer/hwc_display_builtin.h
@@ -225,6 +225,7 @@
   // Long term large composition hint
   int hwc_tid_ = 0;
   uint32_t num_basic_frames_ = 0;
+  uint32_t large_comp_hint_threshold_ = 0;
 };
 
 }  // namespace sdm
diff --git a/include/display_properties.h b/include/display_properties.h
index c9e9366..80197b2 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -162,6 +162,7 @@
 
 // PERF hint properties
 #define ENABLE_PERF_HINT_LARGE_COMP_CYCLE    DISPLAY_PROP("enable_perf_hint_large_comp_cycle")
+#define LARGE_COMP_HINT_THRESHOLD            DISPLAY_PROP("large_comp_hint_threshold")
 #define DISABLE_DYNAMIC_FPS                  DISPLAY_PROP("disable_dynamic_fps")
 #define ENABLE_QSYNC_IDLE                    DISPLAY_PROP("enable_qsync_idle")
 #define ENHANCE_IDLE_TIME                    DISPLAY_PROP("enhance_idle_time")