drm_hwcomposer: Remove hwc.drm.use_framebuffer_target property

Remove the redundant property hwc.drm.use_framebuffer_target from
drm_hwcomposer. The same can be achieved by using the "Disable HW
overlays" toggle in Developer Options.

Change-Id: I3283a8931d84113d8dc63cc818598a7f9556a171
Signed-off-by: Sean Paul <seanpaul@chromium.org>
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index 31cbada..f1d6fbb 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -130,7 +130,7 @@
   typedef std::map<int, hwc_drm_display_t> DisplayMap;
   typedef DisplayMap::iterator DisplayMapIter;
 
-  hwc_context_t() : procs(NULL), importer(NULL), use_framebuffer_target(false) {
+  hwc_context_t() : procs(NULL), importer(NULL) {
   }
 
   ~hwc_context_t() {
@@ -146,7 +146,6 @@
   Importer *importer;
   const gralloc_module_t *gralloc;
   DummySwSyncTimeline dummy_timeline;
-  bool use_framebuffer_target;
   VirtualCompositorWorker virtual_compositor_worker;
 };
 
@@ -339,19 +338,11 @@
                        hwc_display_contents_1_t **display_contents) {
   struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
 
-  char use_framebuffer_target[PROPERTY_VALUE_MAX];
-  property_get("hwc.drm.use_framebuffer_target", use_framebuffer_target, "0");
-  bool new_use_framebuffer_target = atoi(use_framebuffer_target);
-  if (ctx->use_framebuffer_target != new_use_framebuffer_target)
-    ALOGW("Starting to %s HWC_FRAMEBUFFER_TARGET",
-          new_use_framebuffer_target ? "use" : "not use");
-  ctx->use_framebuffer_target = new_use_framebuffer_target;
-
   for (int i = 0; i < (int)num_displays; ++i) {
     if (!display_contents[i])
       continue;
 
-    bool use_framebuffer_target = ctx->use_framebuffer_target;
+    bool use_framebuffer_target = false;
     if (i == HWC_DISPLAY_VIRTUAL) {
       use_framebuffer_target = true;
     } else {
@@ -449,15 +440,10 @@
       if (sf_layer->flags & HWC_SKIP_LAYER)
         continue;
 
-      if (!ctx->use_framebuffer_target) {
-        if (sf_layer->compositionType == HWC_OVERLAY)
-          indices_to_composite.push_back(j);
-        if (sf_layer->compositionType == HWC_FRAMEBUFFER_TARGET)
-          framebuffer_target_index = j;
-      } else {
-        if (sf_layer->compositionType == HWC_FRAMEBUFFER_TARGET)
-          indices_to_composite.push_back(j);
-      }
+      if (sf_layer->compositionType == HWC_OVERLAY)
+        indices_to_composite.push_back(j);
+      if (sf_layer->compositionType == HWC_FRAMEBUFFER_TARGET)
+        framebuffer_target_index = j;
 
       layer.acquire_fence.Set(sf_layer->acquireFenceFd);
       sf_layer->acquireFenceFd = -1;
@@ -472,23 +458,15 @@
       layer.release_fence = OutputFd(&sf_layer->releaseFenceFd);
     }
 
-    if (ctx->use_framebuffer_target) {
-      if (indices_to_composite.size() != 1) {
-        ALOGE("Expected 1 (got %d) layer with HWC_FRAMEBUFFER_TARGET",
-              indices_to_composite.size());
+    if (indices_to_composite.empty() && framebuffer_target_index >= 0) {
+      hwc_layer_1_t *sf_layer = &dc->hwLayers[framebuffer_target_index];
+      if (!sf_layer->handle || (sf_layer->flags & HWC_SKIP_LAYER)) {
+        ALOGE(
+            "Expected valid layer with HWC_FRAMEBUFFER_TARGET when all "
+            "HWC_OVERLAY layers are skipped.");
         ret = -EINVAL;
       }
-    } else {
-      if (indices_to_composite.empty() && framebuffer_target_index >= 0) {
-        hwc_layer_1_t *sf_layer = &dc->hwLayers[framebuffer_target_index];
-        if (!sf_layer->handle || (sf_layer->flags & HWC_SKIP_LAYER)) {
-          ALOGE(
-              "Expected valid layer with HWC_FRAMEBUFFER_TARGET when all "
-              "HWC_OVERLAY layers are skipped.");
-          ret = -EINVAL;
-        }
-        indices_to_composite.push_back(framebuffer_target_index);
-      }
+      indices_to_composite.push_back(framebuffer_target_index);
     }
   }