DO NOT MERGE display: HAL: FB pipe type select

When disable mdpcomp,it will fail to select pipe type.

For wearable targets, secondary display is not applicable.
Try for DMA pipe for FB first, if FB does not have scaling.

Change-Id: Ib621dca2f383d2dd9a6916bc8ccf6408050f8a5b
Signed-off-by: l00212897 <gang.li@huawei.com>
Signed-off-by: Uday Kishore Pasupuleti <upasupul@codeaurora.org>
diff --git a/msm8226/liboverlay/overlay.cpp b/msm8226/liboverlay/overlay.cpp
index de880c6..987a77f 100644
--- a/msm8226/liboverlay/overlay.cpp
+++ b/msm8226/liboverlay/overlay.cpp
@@ -214,10 +214,17 @@
     } else { //FB layer
         //For 8x26 Secondary we use DMA always for FB for inline rotation
         if(pipeSpecs.dpy == DPY_PRIMARY) {
-            dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
-            if(dest == OV_INVALID) {
-                dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
-            }
+	    /* For wearable targets, secondary display is not applicable
+               Try for DMA pipe for FB first, if FB does not have scaling*/
+		if (not pipeSpecs.needsScaling) {
+			dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
+		} else {
+			dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
+			if (dest == OV_INVALID) {
+				// FB needs scaling, and RGB pipe is not available - try VG
+				dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
+			}
+		}
         }
         if(dest == OV_INVALID and (not pipeSpecs.needsScaling) and
           (not (pipeSpecs.numActiveDisplays > 1 &&
@@ -225,6 +232,9 @@
             dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
         }
     }
+    if (dest == OV_INVALID) {
+		ALOGE("%s - not able to allocate FB pipe", __func__);
+    }
     return dest;
 }