hwc: enable dual display on hwc 1.1

Enable dual display on HWC 1.1; video uses overlay.

Bug: 7124159
Change-Id: I8333e46cfc74072f6259fba2b82368f0dd52b6df
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index e198de3..ee9cc54 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -51,7 +51,10 @@
 void initContext(hwc_context_t *ctx)
 {
     openFramebufferDevice(ctx);
-    ctx->mOverlay = overlay::Overlay::getInstance();
+    overlay::Overlay::initOverlay();
+    for(uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
+        ctx->mOverlay[i] = overlay::Overlay::getInstance(i);
+    }
     ctx->mQService = qService::QService::getInstance(ctx);
     ctx->mMDP.version = qdutils::MDPVersion::getInstance().getMDPVersion();
     ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
@@ -69,9 +72,11 @@
 
 void closeContext(hwc_context_t *ctx)
 {
-    if(ctx->mOverlay) {
-        delete ctx->mOverlay;
-        ctx->mOverlay = NULL;
+    for(uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
+        if(ctx->mOverlay[i]) {
+            delete ctx->mOverlay[i];
+            ctx->mOverlay[i] = NULL;
+        }
     }
 
     if(ctx->mFbDev) {
@@ -111,6 +116,9 @@
 
     ctx->listStats[dpy].numAppLayers = list->numHwLayers - 1;
     ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1;
+    ctx->listStats[dpy].yuvCount = 0;
+    ctx->listStats[dpy].yuvIndex = -1;
+    ctx->listStats[dpy].skipCount = 0;
 
     for (size_t i = 0; i < list->numHwLayers; i++) {
         private_handle_t *hnd =
@@ -198,7 +206,7 @@
     int count = 0;
     int releaseFd = -1;
     int fbFd = -1;
-    data.flags = 0;
+    data.flags = MDP_BUF_SYNC_FLAG_WAIT;
     data.acq_fen_fd = acquireFd;
     data.rel_fen_fd = &releaseFd;
     //Accumulate acquireFenceFds