sdm: Move blit/hybrid property check to HWCDisplay

- Check the property in HWCDisplay rather than BlitEngine
  to enable/disable hybrid/blit composition.
- Helps in having one point to control the feature

Change-Id: I94d62e96fba4b7bdcdcd86c8f729119a4c53dd95
Crs-fixed: 1006185
diff --git a/sdm/libs/hwc/blit_engine_c2d.cpp b/sdm/libs/hwc/blit_engine_c2d.cpp
index e855524..2896f33 100644
--- a/sdm/libs/hwc/blit_engine_c2d.cpp
+++ b/sdm/libs/hwc/blit_engine_c2d.cpp
@@ -101,8 +101,6 @@
     blit_target_buffer_[i] = NULL;
     release_fence_fd_[i] = -1;
   }
-
-  HWCDebugHandler::Get()->GetProperty("persist.hwc.blit.comp", &blit_supported_);
 }
 
 BlitEngineC2d::~BlitEngineC2d() {
@@ -114,10 +112,6 @@
 }
 
 int BlitEngineC2d::Init() {
-  if (!blit_supported_) {
-    return -1;
-  }
-
   hw_module_t const *module;
   if (hw_get_module("copybit", &module) == 0) {
     if (copybit_open(module, &blit_engine_c2d_) < 0) {
@@ -263,9 +257,6 @@
 
   for (i = 0; i < layer_stack->layer_count; i++) {
     Layer &layer = layer_stack->layers[i];
-    if (!blit_supported_) {
-      return -1;
-    }
 
     // No 10 bit support for C2D
     if (Is10BitFormat(layer.input_buffer->format)) {
diff --git a/sdm/libs/hwc/blit_engine_c2d.h b/sdm/libs/hwc/blit_engine_c2d.h
index 69b7299..6536d44 100644
--- a/sdm/libs/hwc/blit_engine_c2d.h
+++ b/sdm/libs/hwc/blit_engine_c2d.h
@@ -114,7 +114,6 @@
   bool blit_active_ = false;
   uint32_t dump_frame_count_ = 0;
   uint32_t dump_frame_index_ = 0;
-  int blit_supported_ = 0;
 };
 
 }  // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index 5dd0e6b..3a40d22 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -101,7 +101,9 @@
     return -EINVAL;
   }
 
-  if (needs_blit_) {
+  int blit_enabled = 0;
+  HWCDebugHandler::Get()->GetProperty("persist.hwc.blit.comp", &blit_enabled);
+  if (needs_blit_ && blit_enabled) {
     blit_engine_ = new BlitEngineC2d();
     if (!blit_engine_) {
       DLOGI("Create Blit Engine C2D failed");
@@ -326,7 +328,7 @@
   size_t num_hw_layers = content_list->numHwLayers;
   uint32_t blit_target_count = 0;
 
-  if (needs_blit_ && blit_engine_) {
+  if (blit_engine_) {
     blit_target_count = kMaxBlitTargetLayers;
   }
 
@@ -608,6 +610,8 @@
 
   // Prepare the Blit Target
   if (blit_engine_) {
+  // TODO(user): Fix this to enable BLIT
+#if 0
     int ret = blit_engine_->Prepare(&layer_stack_);
     if (ret) {
       // Blit engine cannot handle this layer stack, hence set the layer stack
@@ -616,6 +620,7 @@
     } else {
       use_blit_comp_ = true;
     }
+#endif
   }
 
   // Configure layer stack
@@ -839,7 +844,8 @@
         return true;
     }
 
-    if (layer.composition == kCompositionGPUTarget) {
+    if (layer.composition == kCompositionGPUTarget ||
+        layer.composition == kCompositionBlitTarget) {
       continue;
     }
 
diff --git a/sdm/libs/hwc/hwc_display.h b/sdm/libs/hwc/hwc_display.h
index 8a4d5b8..2960822 100644
--- a/sdm/libs/hwc/hwc_display.h
+++ b/sdm/libs/hwc/hwc_display.h
@@ -188,7 +188,7 @@
   hwc_procs_t const **hwc_procs_;
   DisplayType type_;
   int id_;
-  bool needs_blit_;
+  bool needs_blit_ = false;
   DisplayInterface *display_intf_ = NULL;
   LayerStackMemory layer_stack_memory_;
   LayerStack layer_stack_;