hwc/overlay: Prevent pipes from switching mixers
For split displays, earlier we allowed pipes to switch mixers in
subsequent rounds. This change prevents that and makes sure there
is one composition round where a pipe being transferred to another
mixer of the same display is UNSET
Change-Id: I3c679cc4256363eeb70c5cf8bcaf5047b8a064c2
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index 5115a5b..fac0c49 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -70,8 +70,9 @@
//fds
if(mPipeBook[i].valid()) {
char str[32];
- sprintf(str, "Unset=%s dpy=%d; ",
- PipeBook::getDestStr((eDest)i), mPipeBook[i].mDisplay);
+ sprintf(str, "Unset=%s dpy=%d mix=%d; ",
+ PipeBook::getDestStr((eDest)i),
+ mPipeBook[i].mDisplay, mPipeBook[i].mMixer);
#if PIPE_DEBUG
strncat(mDumpStr, str, strlen(str));
#endif
@@ -83,46 +84,41 @@
PipeBook::save();
}
-eDest Overlay::nextPipe(eMdpPipeType type, int dpy) {
+eDest Overlay::nextPipe(eMdpPipeType type, int dpy, int mixer) {
eDest dest = OV_INVALID;
for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
- //Match requested pipe type
- if(type == OV_MDP_PIPE_ANY || type == PipeBook::getPipeType((eDest)i)) {
- //If the pipe is not allocated to any display or used by the
- //requesting display already in previous round.
- if((mPipeBook[i].mDisplay == DPY_UNUSED ||
- mPipeBook[i].mDisplay == dpy) &&
- PipeBook::isNotAllocated(i)) {
- //In block mode we don't allow line operations
- if(sDMAMode == DMA_BLOCK_MODE &&
- PipeBook::getPipeType((eDest)i) == OV_MDP_PIPE_DMA)
- continue;
-
- dest = (eDest)i;
- PipeBook::setAllocation(i);
- break;
- }
+ if( (type == OV_MDP_PIPE_ANY || //Pipe type match
+ type == PipeBook::getPipeType((eDest)i)) &&
+ (mPipeBook[i].mDisplay == DPY_UNUSED || //Free or same display
+ mPipeBook[i].mDisplay == dpy) &&
+ (mPipeBook[i].mMixer == MIXER_UNUSED || //Free or same mixer
+ mPipeBook[i].mMixer == mixer) &&
+ PipeBook::isNotAllocated(i) && //Free pipe
+ !(sDMAMode == DMA_BLOCK_MODE && //DMA pipe in Line mode
+ PipeBook::getPipeType((eDest)i) == OV_MDP_PIPE_DMA)) {
+ dest = (eDest)i;
+ PipeBook::setAllocation(i);
+ break;
}
}
if(dest != OV_INVALID) {
int index = (int)dest;
- //If the pipe is not registered with any display OR if the pipe is
- //requested again by the same display using it, then go ahead.
mPipeBook[index].mDisplay = dpy;
+ mPipeBook[index].mMixer = mixer;
if(not mPipeBook[index].valid()) {
mPipeBook[index].mPipe = new GenericPipe(dpy);
char str[32];
- snprintf(str, 32, "Set=%s dpy=%d; ",
- PipeBook::getDestStr(dest), dpy);
+ snprintf(str, 32, "Set=%s dpy=%d mix=%d; ",
+ PipeBook::getDestStr(dest), dpy, mixer);
#if PIPE_DEBUG
strncat(mDumpStr, str, strlen(str));
#endif
}
} else {
- ALOGD_IF(PIPE_DEBUG, "Pipe unavailable type=%d display=%d",
- (int)type, dpy);
+ ALOGD_IF(PIPE_DEBUG, "Pipe unavailable type=%d display=%d mixer=%d",
+ (int)type, dpy, mixer);
}
return dest;
@@ -376,6 +372,7 @@
void Overlay::PipeBook::init() {
mPipe = NULL;
mDisplay = DPY_UNUSED;
+ mMixer = MIXER_UNUSED;
}
void Overlay::PipeBook::destroy() {
@@ -384,6 +381,7 @@
mPipe = NULL;
}
mDisplay = DPY_UNUSED;
+ mMixer = MIXER_UNUSED;
}
Overlay* Overlay::sInstance = 0;