hwc: Simplify vsync code
Handle the wait properly in the kernel and remove unnecessary
thread signaling.
Change-Id: Iff05825a7a85d0353f3feb64e7f9a06cedab7869
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 7398295..c5a864e 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -233,23 +233,20 @@
{
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
- pthread_mutex_lock(&ctx->vstate.lock);
+ Locker::Autolock _l(ctx->mBlankLock);
switch(event) {
case HWC_EVENT_VSYNC:
if (ctx->vstate.enable == enable)
break;
ret = hwc_vsync_control(ctx, dpy, enable);
- if(ret == 0) {
+ if(ret == 0)
ctx->vstate.enable = !!enable;
- pthread_cond_signal(&ctx->vstate.cond);
- }
ALOGD_IF (VSYNC_DEBUG, "VSYNC state changed to %s",
(enable)?"ENABLED":"DISABLED");
break;
default:
ret = -EINVAL;
}
- pthread_mutex_unlock(&ctx->vstate.lock);
return ret;
}