overlay: Handle new request cases in comparing pipe priorities
In source split, when both the left and right requests are new,
the comparison should be made of pipe types, which could be different
even if it is for the same layer.
Change-Id: I66784ddac80c84d4520af5d195c7ce4ab5a27dc3
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index 96c057f..3a96b71 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -279,8 +279,29 @@
uint8_t pipe2Prio = mPipeBook[(int)pipe2Index].mPipe->getPriority();
if(pipe1Prio > pipe2Prio)
return -1;
- if(pipe1Prio < pipe2Prio)
+ else if(pipe1Prio < pipe2Prio)
return 1;
+ else {
+ // If we are here, Source Split is enabled and both pipes are
+ // new requests. In this case left type should be of higher prio
+ // than right type
+ utils::eMdpPipeType leftType = PipeBook::getPipeType(pipe1Index);
+ utils::eMdpPipeType rightType = PipeBook::getPipeType(pipe2Index);
+
+ if(leftType == rightType) {
+ //Safe. Onus on driver to assign correct pipes within same type
+ return 1;
+ } else if(leftType == OV_MDP_PIPE_DMA or rightType == OV_MDP_PIPE_VG) {
+ //If we are here, right is definitely a higher prio type.
+ //This check takes advantage of having only 3 types and avoids 3
+ //different failure combination checks.
+ return -1;
+ } else {
+ //Types are correct priority-wise
+ return 1;
+ }
+ }
+
return 0;
}