Merge "hwc: Add assertive display support."
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index ee06443..a701eb6 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -166,7 +166,10 @@
     private_handle_t *fbHnd = (private_handle_t *)fbLayer->handle;
 
 
-    // Avoid issue with mdp3 and rotation by using gpu composition
+    // Following are MDP3 limitations for which we
+    // need to fallback to GPU composition:
+    // 1. HW issues with mdp3 and rotation.
+    // 2. Plane alpha is not supported by MDP3.
     if (qdutils::MDPVersion::getInstance().getMDPVersion() < 400) {
         for (int i = ctx->listStats[dpy].numAppLayers-1; i >= 0 ; i--) {
             hwc_layer_1_t *layer = (hwc_layer_1_t *) &list->hwLayers[i];
@@ -175,6 +178,8 @@
                    ((layer->displayFrame.bottom - layer->displayFrame.top) % 16 ||
                    (layer->displayFrame.right - layer->displayFrame.left) % 16))
                 return true;
+            if (layer->planeAlpha != 0xFF)
+                return true;
         }
     }
 
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 7ba2ddc..ba3b5d2 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -288,16 +288,8 @@
         hwc_rect_t displayFrame = layer->displayFrame;
 
         const float xres = ctx->dpyAttr[mDpy].xres;
-        //Default even split for all displays with high res
-        float lSplit = xres / 2;
-        if(mDpy == HWC_DISPLAY_PRIMARY &&
-                qdutils::MDPVersion::getInstance().getLeftSplit()) {
-            //Override if split published by driver for primary
-            lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
-        }
-
+        const int lSplit = getLeftSplit(ctx, mDpy);
         const float lSplitRatio = lSplit / xres;
-
         const float lCropWidth =
                 (sourceCrop.right - sourceCrop.left) * lSplitRatio;
 
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 4960505..31b9645 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -993,13 +993,8 @@
         int mixer) {
     int pipesNeeded = 0;
     const int xres = ctx->dpyAttr[mDpy].xres;
-    //Default even split for all displays with high res
-    int lSplit = xres / 2;
-    if(mDpy == HWC_DISPLAY_PRIMARY &&
-            qdutils::MDPVersion::getInstance().getLeftSplit()) {
-        //Override if split published by driver for primary
-        lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
-    }
+
+    const int lSplit = getLeftSplit(ctx, mDpy);
 
     for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
         if(!mCurrentFrame.isFBComposed[i]) {
@@ -1041,13 +1036,7 @@
         MdpPipeInfoHighRes& pipe_info,
         ePipeType type) {
     const int xres = ctx->dpyAttr[mDpy].xres;
-    //Default even split for all displays with high res
-    int lSplit = xres / 2;
-    if(mDpy == HWC_DISPLAY_PRIMARY &&
-            qdutils::MDPVersion::getInstance().getLeftSplit()) {
-        //Override if split published by driver for primary
-        lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
-    }
+    const int lSplit = getLeftSplit(ctx, mDpy);
 
     hwc_rect_t dst = layer->displayFrame;
     pipe_info.lIndex = ovutils::OV_INVALID;
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index c5aba7b..2c02e5b 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1114,7 +1114,8 @@
     hwc_rect_t tmp_cropL, tmp_dstL;
     hwc_rect_t tmp_cropR, tmp_dstR;
 
-    const int lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
+    const int lSplit = getLeftSplit(ctx, dpy);
+
     if(lDest != OV_INVALID) {
         tmp_cropL = crop;
         tmp_dstL = dst;
@@ -1190,6 +1191,16 @@
     return true;
 }
 
+int getLeftSplit(hwc_context_t *ctx, const int& dpy) {
+    //Default even split for all displays with high res
+    int lSplit = ctx->dpyAttr[dpy].xres / 2;
+    if(dpy == HWC_DISPLAY_PRIMARY &&
+            qdutils::MDPVersion::getInstance().getLeftSplit()) {
+        //Override if split published by driver for primary
+        lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
+    }
+    return lSplit;
+}
 
 void BwcPM::setBwc(hwc_context_t *ctx, const hwc_rect_t& crop,
             const hwc_rect_t& dst, const int& transform,
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 6b2d203..c4fd345 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -226,6 +226,8 @@
 //but the variety of scenarios is too high to warrant that.
 bool canUseRotator(hwc_context_t *ctx);
 
+int getLeftSplit(hwc_context_t *ctx, const int& dpy);
+
 // Inline utility functions
 static inline bool isSkipLayer(const hwc_layer_1_t* l) {
     return (UNLIKELY(l && (l->flags & HWC_SKIP_LAYER)));
diff --git a/liblight/lights.c b/liblight/lights.c
index 14a6646..eb71b74 100644
--- a/liblight/lights.c
+++ b/liblight/lights.c
@@ -54,6 +54,12 @@
 char const*const RED_BLINK_FILE
         = "/sys/class/leds/red/blink";
 
+char const*const GREEN_BLINK_FILE
+        = "/sys/class/leds/green/blink";
+
+char const*const BLUE_BLINK_FILE
+        = "/sys/class/leds/blue/blink";
+
 /**
  * device methods
  */
@@ -152,7 +158,12 @@
     }
 
     if (blink) {
-        write_int(RED_BLINK_FILE, blink);
+        if (red)
+            write_int(RED_BLINK_FILE, blink);
+        if (green)
+            write_int(GREEN_BLINK_FILE, blink);
+        if (blue)
+            write_int(BLUE_BLINK_FILE, blink);
     } else {
         write_int(RED_LED_FILE, red);
         write_int(GREEN_LED_FILE, green);