Revert "hwc: Do not re-program H/W, if the frame geometry has not changed"

This reverts commit 5e268fcf56e7f5bd0fc524d50c0a97c9e34010a1.

Reason: Breaking cache based composition strategy and partial
update feature.

Change-Id: I0c881c8e2bc6be2a0b3dc0d5e7d22a388179f8d8
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index a2c7ad3..e4f7f5f 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -260,48 +260,6 @@
     }
 }
 
-static bool optimizePrepare(hwc_context_t *ctx, int numDisplays,
-                            hwc_display_contents_1_t** displays) {
-
-    /* Do not re-program H/W, if frame geometry has not changed.
-     * But honor these exceptions:
-     * 1. Padding round
-     * 2. Idle fallback
-     * 3. Overlay is not configured
-     * 4. External/Virtual display is in Configure state
-     * 5. External/Virtual is Paused OR not connected/active
-     * 6. Non-Overlay device
-     */
-
-    if (ctx->isPaddingRound || MDPComp::isIdleFallback() ||
-        !ctx->mOverlay->isConfigured() || isSecondaryConfiguring(ctx) ||
-        ctx->mMDP.version < qdutils::MDP_V4_0) {
-        return false;
-    }
-
-    bool isOptimized = false;
-    for (uint32_t i = 0; i < numDisplays; i++) {
-        hwc_display_contents_1_t *list = displays[i];
-
-        if (list) {
-            if (list->flags & HWC_GEOMETRY_CHANGED) {
-                return false;
-            }
-            int dpy = getDpyforExternalDisplay(ctx, i);
-            if (dpy && (ctx->dpyAttr[dpy].isPause ||
-                !ctx->dpyAttr[dpy].connected ||
-                !ctx->dpyAttr[dpy].isActive)) {
-                return false;
-            }
-            // Set layer composition type as per last frame
-            ctx->mMDPComp[dpy]->setMDPCompLayerFlags(ctx, list);
-            isOptimized = true;
-        }
-    }
-
-    return isOptimized;
-}
-
 static int hwc_prepare_primary(hwc_composer_device_1 *dev,
         hwc_display_contents_1_t *list) {
     ATRACE_CALL();
@@ -387,12 +345,6 @@
     setPaddingRound(ctx,numDisplays,displays);
     setDMAState(ctx,numDisplays,displays);
     setNumActiveDisplays(ctx,numDisplays,displays);
-
-    if (optimizePrepare(ctx, numDisplays, displays)) {
-        // Do not re-program H/W, if it is not needed
-        return ret;
-    }
-
     reset(ctx, (int)numDisplays, displays);
 
     ctx->mOverlay->configBegin();
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 7d4214a..8186fff 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -54,9 +54,6 @@
     static void resetIdleFallBack() { sIdleFallBack = false; }
     static void reset() { sHandleTimeout = false; };
     static bool isIdleFallback() { return sIdleFallBack; }
-    /* set/reset flags for MDPComp */
-    void setMDPCompLayerFlags(hwc_context_t *ctx,
-                              hwc_display_contents_1_t* list);
 
 protected:
     enum { MAX_SEC_LAYERS = 1 }; //TODO add property support
@@ -145,6 +142,9 @@
     /* configures 4kx2k yuv layer*/
     virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
             PipeLayerPair& PipeLayerPair) = 0;
+    /* set/reset flags for MDPComp */
+    void setMDPCompLayerFlags(hwc_context_t *ctx,
+                              hwc_display_contents_1_t* list);
     void setRedraw(hwc_context_t *ctx,
             hwc_display_contents_1_t* list);
     /* checks for conditions where mdpcomp is not possible */