hwc: Fix locking.
Remove the unnecessary blank lock, mdp comp lock, secure lock.
Rename the ext lock to a more appropriate draw lock.
The mdp comp lock is at an incorrect place and causes unwanted
objects to show up in dumpsys, since configDone hasnt cleaned
them up yet.
dump(), blank(), draw() should all acquire a common lock.
draw() includes prepare() and set().
Change-Id: I595547dd5a393a8af6cd8c9297d50793b715e658
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index f90420f..8a16f08 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -257,10 +257,8 @@
{
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
- ctx->mBlankLock.lock();
//Will be unlocked at the end of set
- ctx->mExtLock.lock();
- ctx->mSecureLock.lock();
+ ctx->mDrawLock.lock();
reset(ctx, numDisplays, displays);
ctx->mOverlay->configBegin();
@@ -312,7 +310,7 @@
#ifdef QCOM_BSP
case HWC_EVENT_ORIENTATION:
if(dpy == HWC_DISPLAY_PRIMARY) {
- Locker::Autolock _l(ctx->mBlankLock);
+ Locker::Autolock _l(ctx->mDrawLock);
// store the primary display orientation
// will be used in hwc_video::configure to disable
// rotation animation on external display
@@ -331,7 +329,7 @@
ATRACE_CALL();
hwc_context_t* ctx = (hwc_context_t*)(dev);
- Locker::Autolock _l(ctx->mBlankLock);
+ Locker::Autolock _l(ctx->mDrawLock);
int ret = 0, value = 0;
ALOGD_IF(BLANK_DEBUG, "%s: %s display: %d", __FUNCTION__,
blank==1 ? "Blanking":"Unblanking", dpy);
@@ -615,9 +613,7 @@
MDPComp::resetIdleFallBack();
ctx->mVideoTransFlag = false;
//Was locked at the beginning of prepare
- ctx->mSecureLock.unlock();
- ctx->mExtLock.unlock();
- ctx->mBlankLock.unlock();
+ ctx->mDrawLock.unlock();
return ret;
}
@@ -707,6 +703,7 @@
void hwc_dump(struct hwc_composer_device_1* dev, char *buff, int buff_len)
{
hwc_context_t* ctx = (hwc_context_t*)(dev);
+ Locker::Autolock _l(ctx->mDrawLock);
android::String8 aBuf("");
dumpsys_log(aBuf, "Qualcomm HWC state:\n");
dumpsys_log(aBuf, " MDPVersion=%d\n", ctx->mMDP.version);