overlay: Fix pipe type related priority checks
In case of one pipe having a new request and pipe types being
different, a condition check for comparison was missing. This
change adds that.
Change-Id: Ie58e297405a5ba911485d3f1e2e34cfbf538d2d7
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index ca599ed..a34e599 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -306,14 +306,20 @@
if(leftType == rightType) {
//Safe. Onus on driver to assign correct pipes within same type
return false;
- } else if(leftType == OV_MDP_PIPE_DMA or rightType == OV_MDP_PIPE_VG) {
- //If we are here, right is definitely a higher prio type.
+ } else {
//This check takes advantage of having only 3 types and avoids 3
//different failure combination checks.
- return true;
- } else {
- //Types are correct priority-wise
- return false;
+ // Swap IF:
+ // ----------------
+ // | Left | Right |
+ // ================
+ // | DMA | ViG |
+ // ----------------
+ // | DMA | RGB |
+ // ----------------
+ // | RGB | ViG |
+ // ----------------
+ return (leftType == OV_MDP_PIPE_DMA or rightType == OV_MDP_PIPE_VG);
}
} else if(pipe1Id < 0) {
//LEFT needs new allocation.
@@ -321,8 +327,7 @@
// If RIGHT has highest priority(lowest id), swap it.
return (pipe2Id == PipeBook::pipeMinID[leftType]);
} else {
- // Swap if needs lowest priority type pipe.
- return (leftType == OV_MDP_PIPE_DMA);
+ return (leftType == OV_MDP_PIPE_DMA or rightType == OV_MDP_PIPE_VG);
}
} else { /* if (pipe2Id < 0) */
// RIGHT needs new allocation.
@@ -330,8 +335,7 @@
// If LEFT has lowest priority(highest id), swap it.
return (pipe1Id == PipeBook::pipeMaxID[leftType]);
} else {
- // Swap if needs highest priority type pipe.
- return (rightType == OV_MDP_PIPE_VG);
+ return (leftType == OV_MDP_PIPE_DMA or rightType == OV_MDP_PIPE_VG);
}
}
}