hwc: Make blank wait for set to complete
Bug: 7217641
Change-Id: Ie25c9caa7a4c6a256c0f35fc40cbae2ef4572f5d
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index f3911cd..4a8d24d 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -176,6 +176,7 @@
switch(dpy) {
case HWC_DISPLAY_PRIMARY:
if(blank) {
+ Locker::Autolock _l(ctx->mBlankLock);
ctx->mOverlay->setState(ovutils::OV_CLOSED);
ret = ioctl(m->framebuffer->fd, FBIOBLANK, FB_BLANK_POWERDOWN);
} else {
@@ -275,6 +276,7 @@
{
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
+ Locker::Autolock _l(ctx->mBlankLock);
if(!ctx->overlayInUse)
ctx->mOverlay->setState(ovutils::OV_CLOSED);
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index db79e7d..07318bd 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -21,6 +21,7 @@
#define HWC_REMOVE_DEPRECATED_VERSIONS 1
#include <fcntl.h>
#include <hardware/hwcomposer.h>
+#include <gr.h>
#include <gralloc_priv.h>
#define ALIGN_TO(x, align) (((x) + ((align)-1)) & ~((align)-1))
@@ -182,6 +183,9 @@
//Display in secure mode indicator
bool mSecureMode;
+
+ //Lock to prevent set from being called while blanking
+ mutable Locker mBlankLock;
};
#endif //HWC_UTILS_H