Merge "overlay: Do not unset overlay for MSMFB_NEW_REQUEST"
diff --git a/libexternal/external.cpp b/libexternal/external.cpp
index f9ee94c..b9abc31 100644
--- a/libexternal/external.cpp
+++ b/libexternal/external.cpp
@@ -549,7 +549,8 @@
     if(mFd == -1)
         return false;
     struct mdp_display_commit ext_commit;
-    ext_commit.flags |= MDP_DISPLAY_COMMIT_OVERLAY;
+    memset(&ext_commit, 0, sizeof(struct mdp_display_commit));
+    ext_commit.flags = MDP_DISPLAY_COMMIT_OVERLAY;
     if (ioctl(mFd, MSMFB_DISPLAY_COMMIT, &ext_commit) == -1) {
         ALOGE("%s: MSMFB_DISPLAY_COMMIT for external failed, str: %s",
                 __FUNCTION__, strerror(errno));
diff --git a/libgralloc/fb_priv.h b/libgralloc/fb_priv.h
index 8f1a09b..9b08dd5 100644
--- a/libgralloc/fb_priv.h
+++ b/libgralloc/fb_priv.h
@@ -45,7 +45,6 @@
     pthread_mutex_t lock;
     private_handle_t *currentBuffer;
     struct fb_var_screeninfo info;
-    struct mdp_buf_fence fence;
     struct mdp_display_commit commit;
     struct fb_fix_screeninfo finfo;
     float xdpi;
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp
index 57df5b1..ca1840a 100644
--- a/libgralloc/framebuffer.cpp
+++ b/libgralloc/framebuffer.cpp
@@ -154,7 +154,6 @@
     if (fd < 0)
         return -errno;
 
-    memset(&module->fence, 0, sizeof(struct mdp_buf_fence));
     memset(&module->commit, 0, sizeof(struct mdp_display_commit));
 
     struct fb_fix_screeninfo finfo;
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 23ffa42..f21d449 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -127,7 +127,7 @@
             if(!MDPComp::configure(ctx, list)) {
                 VideoOverlay::prepare(ctx, list, HWC_DISPLAY_PRIMARY);
                 FBUpdate::prepare(ctx, fbLayer, HWC_DISPLAY_PRIMARY);
-                ctx->mLayerCache->updateLayerCache(list);
+                ctx->mLayerCache[HWC_DISPLAY_PRIMARY]->updateLayerCache(list);
             }
         }
     }
@@ -150,6 +150,7 @@
 
             VideoOverlay::prepare(ctx, list, HWC_DISPLAY_EXTERNAL);
             FBUpdate::prepare(ctx, fbLayer, HWC_DISPLAY_EXTERNAL);
+            ctx->mLayerCache[HWC_DISPLAY_EXTERNAL]->updateLayerCache(list);
         }
     }
     return 0;
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 0ae64da..2f35567 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -60,7 +60,8 @@
     ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
     ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
     ctx->mExtDisplay = new ExternalDisplay(ctx);
-    ctx->mLayerCache = new LayerCache();
+    for (uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++)
+        ctx->mLayerCache[i] = new LayerCache();
     MDPComp::init(ctx);
 
     pthread_mutex_init(&(ctx->vstate.lock), NULL);
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 256b840..d7200b0 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -220,7 +220,7 @@
     qhwc::MDPInfo mMDP;
     qhwc::DisplayAttributes dpyAttr[HWC_NUM_DISPLAY_TYPES];
     qhwc::ListStats listStats[HWC_NUM_DISPLAY_TYPES];
-    qhwc::LayerCache *mLayerCache;
+    qhwc::LayerCache *mLayerCache[HWC_NUM_DISPLAY_TYPES];
     qhwc::LayerProp *layerProp[HWC_NUM_DISPLAY_TYPES];
 
     //Securing in progress indicator