hwc: clean up overlay for external from the draw thread only
Cleanup overlay for external from the draw thread. If done from the uevent
thread, its possible that the object being used by draw thread is deleted by
uevent thread.
This also removes unnecessary side-effects where libexternal sets states in
hwc, whereas, it could be set from hwc itself. There should be no need for
libexternal to modify states in hwc.
Bug: 7335863 (partial fix)
Change-Id: If07483e640abae2ced2418e0d5c8f278f8c6ec33
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp
index 987957a..89b27aa 100644
--- a/libhwcomposer/hwc_uevents.cpp
+++ b/libhwcomposer/hwc_uevents.cpp
@@ -53,14 +53,23 @@
// for now just parsing onlin/offline info is enough
if (hdmi) {
str = udata;
- int connected = 0;
+ int connected = -1; //some event other than online and offline .. e.g
if(!(strncmp(str,"online@",strlen("online@")))) {
+ //Disabled until SF calls unblank
+ ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isActive = false;
connected = 1;
- ctx->mExtDisplay->setExternalDisplay(connected);;
} else if(!(strncmp(str,"offline@",strlen("offline@")))) {
+ //Disabled until SF calls unblank
+ ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isActive = false;
connected = 0;
- Locker::Autolock _l(ctx->mExtSetLock);
- ctx->mExtDisplay->setExternalDisplay(connected);;
+ }
+ if(connected != -1) { //either we got online or offline
+ ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected = connected;
+ ctx->mExtDisplay->setExternalDisplay(connected);
+ ALOGD("%s sending hotplug: connected = %d", __FUNCTION__,connected);
+ Locker::Autolock _l(ctx->mExtSetLock); //hwc comp could be on
+ //TODO ideally should be done on "connected" not "online"
+ ctx->proc->hotplug(ctx->proc, HWC_DISPLAY_EXTERNAL, connected);
}
}
}