hwc: Release DrawLock before calling invalidate
Release Drawlock before calling invalidate to avoid
deadlock between caller thread and the draw thread.
Change-Id: Iddf9c3a554016d6493b336ec654f6f32bf57506a
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index ba7793e..fc9600e 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -214,17 +214,21 @@
ALOGE("%s: received empty data in timer callback", __FUNCTION__);
return;
}
- Locker::Autolock _l(ctx->mDrawLock);
+
+ ctx->mDrawLock.lock();
// Handle timeout event only if the previous composition is MDP or MIXED.
if(!sHandleTimeout) {
ALOGD_IF(isDebug(), "%s:Do not handle this timeout", __FUNCTION__);
+ ctx->mDrawLock.unlock();
return;
}
if(!ctx->proc) {
ALOGE("%s: HWC proc not registered", __FUNCTION__);
+ ctx->mDrawLock.unlock();
return;
}
sIdleFallBack = true;
+ ctx->mDrawLock.unlock();
/* Trigger SF to redraw the current frame */
ctx->proc->invalidate(ctx->proc);
}