hwc: Iterative Load based comp

While performing load based mixed composition, iterate from max
stages of mixer to at least 2.
Get rid of modes that preferred GPU or MDP. This new mode will
include both plus the missed out batches.

Change-Id: Ideb06a2332fe2f59968367d28df848be01f4aedc
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 4215881..4e4bea4 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -52,7 +52,7 @@
     /* Initialize MDP comp*/
     static bool init(hwc_context_t *ctx);
     static void resetIdleFallBack() { sIdleFallBack = false; }
-    static void reset() { sBwClaimed = 0.0; sHandleTimeout = false; };
+    static void reset() { sHandleTimeout = false; };
 
 protected:
     enum { MAX_SEC_LAYERS = 1 }; //TODO add property support
@@ -158,16 +158,11 @@
     bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
     /* Partial MDP comp that uses caching to save power as primary goal */
     bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
-    /* Partial MDP comp that prefers GPU perf-wise. Since the GPU's
-     * perf is proportional to the pixels it processes, we use the number of
-     * pixels as a heuristic */
-    bool loadBasedCompPreferGPU(hwc_context_t *ctx,
-            hwc_display_contents_1_t* list);
-    /* Partial MDP comp that prefers MDP perf-wise. Since the MDP's perf is
-     * proportional to the bandwidth, overlaps it sees, we use that as a
-     * heuristic */
-    bool loadBasedCompPreferMDP(hwc_context_t *ctx,
-            hwc_display_contents_1_t* list);
+    /* Partial MDP comp that balances the load between MDP and GPU such that
+     * MDP is loaded to the max of its capacity. The lower z order layers are
+     * fed to MDP, whereas the upper ones to GPU, because the upper ones have
+     * lower number of pixels and can reduce GPU processing time */
+    bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
     /* Checks if its worth doing load based partial comp */
     bool isLoadBasedCompDoable(hwc_context_t *ctx);
     /* checks for conditions where only video can be bypassed */
@@ -176,9 +171,6 @@
             bool secureOnly);
     /* checks for conditions where YUV layers cannot be bypassed */
     bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
-    /* calcs bytes read by MDP in gigs for a given frame */
-    double calcMDPBytesRead(hwc_context_t *ctx,
-            hwc_display_contents_1_t* list);
     /* checks if MDP/MDSS can process current list w.r.to HW limitations
      * All peculiar HW limitations should go here */
     bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
@@ -234,11 +226,6 @@
     /* Handles the timeout event from kernel, if the value is set to true */
     static bool sHandleTimeout;
     static int sMaxPipesPerMixer;
-    //Max bandwidth. Value is in GBPS. For ex: 2.3 means 2.3GBPS
-    static double sMaxBw;
-    //Tracks composition bandwidth claimed. Represented as the total
-    //w*h*bpp*fps (gigabytes-per-second) going to MDP mixers.
-    static double sBwClaimed;
     static IdleInvalidator *idleInvalidator;
     struct FrameInfo mCurrentFrame;
     struct LayerCache mCachedFrame;