Revert "hwc2: Enable HBM based on HDR layer coverage"

This reverts commit 92de28003dd8b2d9da22470251c2d02915713127.

Reason for revert: Breaks aosp_crosshatch and aosp_blueline

Bug: 109762428

Change-Id: Ifeb63df5e00414535fbb0d6be77fd1aec57ea392
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 8292a90..a671c31 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -24,8 +24,7 @@
                                  android.hardware.graphics.mapper@2.1 \
                                  android.hardware.graphics.composer@2.2 \
                                  android.hardware.graphics.allocator@2.0 \
-                                 libdisplaydebug \
-                                 vendor.google.light@1.0
+                                 libdisplaydebug
 
 ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
 LOCAL_SHARED_LIBRARIES        += vendor.display.config@1.1
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index c12ec76..b53610b 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -455,7 +455,6 @@
 
   uint32_t color_mode_count = 0;
   display_intf_->GetColorModeCount(&color_mode_count);
-  hdr_largest_layer_px_ = 0.0f;
 
   // Add one layer for fb target
   // TODO(user): Add blit target layers
@@ -538,11 +537,6 @@
       // In such cases, we should not handle HDR as the HDR mode isn't applied
       layer->input_buffer.flags.hdr = true;
       layer_stack_.flags.hdr_present = true;
-
-      // HDR area
-      auto hdr_layer_area = (layer->dst_rect.right - layer->dst_rect.left) *
-                            (layer->dst_rect.bottom - layer->dst_rect.top);
-      hdr_largest_layer_px_ = std::max(hdr_largest_layer_px_, hdr_layer_area);
     }
 
     if (hwc_layer->IsNonIntegralSourceCrop() && !is_secure && !layer->flags.solid_fill) {
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index f26034d..8cbd6bb 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -341,7 +341,6 @@
   ColorMode current_color_mode_ = ColorMode::NATIVE;
   ColorPrimaries working_primaries_ = ColorPrimaries_BT709_5;
   GammaTransfer working_transfer_ = Transfer_sRGB;
-  float hdr_largest_layer_px_ = 0.0f;
 
  private:
   void DumpInputBuffers(void);
diff --git a/sdm/libs/hwc2/hwc_display_primary.cpp b/sdm/libs/hwc2/hwc_display_primary.cpp
index 6d744f5..f86fbe1 100644
--- a/sdm/libs/hwc2/hwc_display_primary.cpp
+++ b/sdm/libs/hwc2/hwc_display_primary.cpp
@@ -251,33 +251,6 @@
     }
   }
 
-  if (CC_UNLIKELY(!has_init_light_server_)) {
-    using ILight = ::vendor::google::light::V1_0::ILight;
-    vendor_ILight_ = ILight::getService();
-    if (vendor_ILight_ != nullptr) {
-      vendor_ILight_->setHbm(false);
-    } else {
-      DLOGE("failed to get vendor light service");
-    }
-
-    uint32_t panel_x, panel_y;
-    GetPanelResolution(&panel_x, &panel_y);
-    hbm_threshold_px_ = float(panel_x * panel_y) * hbm_threshold_pct_;
-    DLOGI("Configure hbm_threshold_px_ to %f", hbm_threshold_px_);
-
-    has_init_light_server_ = true;
-  }
-
-  const bool enable_hbm(hdr_largest_layer_px_ > hbm_threshold_px_);
-  if (high_brightness_mode_ != enable_hbm && vendor_ILight_ != nullptr) {
-    using ::android::hardware::light::V2_0::Status;
-    if (Status::SUCCESS == vendor_ILight_->setHbm(enable_hbm)) {
-      high_brightness_mode_ = enable_hbm;
-    } else {
-      DLOGE("failed to setHbm to %d", enable_hbm);
-    }
-  }
-
   CloseFd(&output_buffer_.acquire_fence_fd);
   pending_commit_ = false;
   return status;
diff --git a/sdm/libs/hwc2/hwc_display_primary.h b/sdm/libs/hwc2/hwc_display_primary.h
index 0067a4e..7f5e50c 100644
--- a/sdm/libs/hwc2/hwc_display_primary.h
+++ b/sdm/libs/hwc2/hwc_display_primary.h
@@ -30,8 +30,6 @@
 #ifndef __HWC_DISPLAY_PRIMARY_H__
 #define __HWC_DISPLAY_PRIMARY_H__
 
-#include <vendor/google/light/1.0/ILight.h>
-#include <limits>
 #include <string>
 
 #include "cpuhint.h"
@@ -109,13 +107,6 @@
   BufferInfo output_buffer_info_ = {};
   void *output_buffer_base_ = nullptr;
   int default_mode_status_ = 0;
-
-  // Members for HBM feature
-  static constexpr float hbm_threshold_pct_ = 0.5f;
-  float hbm_threshold_px_ = std::numeric_limits<float>::max();
-  android::sp<vendor::google::light::V1_0::ILight> vendor_ILight_ = nullptr;
-  bool has_init_light_server_ = false;
-  bool high_brightness_mode_ = false;
 };
 
 }  // namespace sdm