hwc: Fix locking in external connect and composition.
The external configuring flag should be set after holding locks.
Before opening FB for HDMI/WFD, composition should give up any
open external FB resources.
Locks should be held by composition for the entire duration.
Change-Id: I703f69f156c665bf422613567c00aae340f3ee12
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 2158611..6dd77b1 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -205,7 +205,8 @@
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
Locker::Autolock _bl(ctx->mBlankLock);
- Locker::Autolock _el(ctx->mExtLock);
+ //Will be unlocked at the end of set
+ ctx->mExtLock.lock();
reset(ctx, numDisplays, displays);
ctx->mOverlay->configBegin();
@@ -477,7 +478,6 @@
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
Locker::Autolock _bl(ctx->mBlankLock);
- Locker::Autolock _el(ctx->mExtLock);
for (uint32_t i = 0; i <= numDisplays; i++) {
hwc_display_contents_1_t* list = displays[i];
switch(i) {
@@ -501,6 +501,8 @@
CALC_FPS();
MDPComp::resetIdleFallBack();
ctx->mVideoTransFlag = false;
+ //Was locked at the beginning of prepare
+ ctx->mExtLock.unlock();
return ret;
}