overlay: 8994: De-prioritize DMA pipe in line mode

De-prioritize DMA pipes in line mode on 8994. If DMA pipes need to be
used in block mode for downscale, there could be cases where
consecutive rounds need separate modes, which cannot be supported
since we at least need 1 round in between where the DMA is unused

Change-Id: I9cdcb5c699ddb34b6730ff32ff5e17c457c0fa12
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index de880c6..26c8845 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -160,6 +160,8 @@
         return getPipe_8x16(pipeSpecs);
     } else if(MDPVersion::getInstance().is8x39()) {
         return getPipe_8x39(pipeSpecs);
+    } else if(MDPVersion::getInstance().is8994()) {
+        return getPipe_8994(pipeSpecs);
     }
 
     eDest dest = OV_INVALID;
@@ -254,6 +256,26 @@
     return getPipe_8x16(pipeSpecs);
 }
 
+utils::eDest Overlay::getPipe_8994(const PipeSpecs& pipeSpecs) {
+    //If DMA pipes need to be used in block mode for downscale, there could be
+    //cases where consecutive rounds need separate modes, which cannot be
+    //supported since we at least need 1 round in between where the DMA is
+    //unused
+    eDest dest = OV_INVALID;
+    if(pipeSpecs.formatClass == FORMAT_YUV) {
+        return nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
+    } else {
+        dest = nextPipe(OV_MDP_PIPE_RGB, pipeSpecs.dpy, pipeSpecs.mixer);
+        if(dest == OV_INVALID) {
+            dest = nextPipe(OV_MDP_PIPE_VG, pipeSpecs.dpy, pipeSpecs.mixer);
+        }
+        if(dest == OV_INVALID and not pipeSpecs.needsScaling) {
+            dest = nextPipe(OV_MDP_PIPE_DMA, pipeSpecs.dpy, pipeSpecs.mixer);
+        }
+    }
+    return dest;
+}
+
 void Overlay::endAllSessions() {
     for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
         if(mPipeBook[i].valid() && mPipeBook[i].mSession==PipeBook::START)
diff --git a/liboverlay/overlay.h b/liboverlay/overlay.h
index c8f68b0..4f5d56d 100644
--- a/liboverlay/overlay.h
+++ b/liboverlay/overlay.h
@@ -172,6 +172,7 @@
     utils::eDest getPipe_8x26(const PipeSpecs& pipeSpecs);
     utils::eDest getPipe_8x16(const PipeSpecs& pipeSpecs);
     utils::eDest getPipe_8x39(const PipeSpecs& pipeSpecs);
+    utils::eDest getPipe_8994(const PipeSpecs& pipeSpecs);
 
     /* Returns the handle to libscale.so's programScale function */
     static int (*getFnProgramScale())(struct mdp_overlay_list *);