hwc: Handle multiple YUV layer use case in low end targets

In low end targets with one VG pipe, when there are more than one
YUV layer in the layer list, configure one YUV layer (bottom most)
to VG pipe, instead of falling back to GPU completely.

Change-Id: I5c78613573c4ebfbda3a729245092cc635ef8b98
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index e2c4677..9160b57 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -1808,6 +1808,14 @@
 void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
         bool secureOnly, FrameInfo& frame) {
     int nYuvCount = ctx->listStats[mDpy].yuvCount;
+    int nVGpipes = qdutils::MDPVersion::getInstance().getVGPipes();
+
+    /* If number of YUV layers in the layer list is more than the number of
+       VG pipes available in the target (non-split), try to program maximum
+       possible number of YUV layers to MDP, instead of falling back to GPU
+       completely.*/
+    nYuvCount = (nYuvCount > nVGpipes) ? nVGpipes : nYuvCount;
+
     for(int index = 0;index < nYuvCount; index++){
         int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index];
         hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];