libhwcomposer: Add support for 4 layer MDP Comp

This change extends MDP composition to support
upto 4 layers by making border fill as base pipe and
using all MDP h/w pipes in overlay mode.

Conflicts:

	libhwcomposer/hwc.cpp
	libhwcomposer/hwc_utils.cpp
	libhwcomposer/hwc_utils.h

Bug: 7626586
Change-Id: I01a0e53ddfbcf3ed46734f6f3bb0ef7d912ceac6
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index dea82df..ac9a7dc 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -22,6 +22,7 @@
 #include <fb_priv.h>
 #include <overlay.h>
 #include "hwc_utils.h"
+#include "hwc_mdpcomp.h"
 #include "mdp_version.h"
 #include "external.h"
 #include "QService.h"
@@ -37,6 +38,8 @@
         private_module_t* m = reinterpret_cast<private_module_t*>(
                 ctx->mFbDev->common.module);
         //xres, yres may not be 32 aligned
+        ctx->dpyAttr[HWC_DISPLAY_PRIMARY].stride = m->finfo.line_length /
+                                                (m->info.xres/8);
         ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres = m->info.xres;
         ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres = m->info.yres;
         ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xdpi = ctx->mFbDev->xdpi;
@@ -58,6 +61,7 @@
     ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
     ctx->mExtDisplay = new ExternalDisplay(ctx);
     ctx->mLayerCache = new LayerCache();
+    MDPComp::init(ctx);
 
     pthread_mutex_init(&(ctx->vstate.lock), NULL);
     pthread_cond_init(&(ctx->vstate.cond), NULL);
@@ -151,6 +155,16 @@
     }
 }
 
+bool isSecuring(hwc_context_t* ctx) {
+    if((ctx->mMDP.version < qdutils::MDSS_V5) &&
+       (ctx->mMDP.version > qdutils::MDP_V3_0) &&
+        ctx->mSecuring) {
+        return true;
+    }
+    return false;
+}
+
+
 //Crops source buffer against destination and FB boundaries
 void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
         const int fbWidth, const int fbHeight, int orient) {
@@ -214,8 +228,7 @@
     for(uint32_t i = 0; i < list->numHwLayers; i++) {
         if((list->hwLayers[i].compositionType == HWC_OVERLAY ||
             list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) &&
-            list->hwLayers[i].acquireFenceFd != -1 &&
-            (list->hwLayers[i].flags & HWC_MDPCOMP)) {
+            list->hwLayers[i].acquireFenceFd != -1 ){
             acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
         }
     }