hwc: Listen fb0 event for panel status
Listen fb0 status change event for panel status. fb0 will receive
"PANEL_ALIVE=0" when panel is not responding to status call.
Call blank and unblank to reset the panel in next hwc_prepare
call.
Change-Id: I941a501a82d9f3b725660ad09631c1d8602b7325
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 5038025..e9f2b31 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -54,6 +54,8 @@
open: hwc_device_open
};
+static void reset_panel(struct hwc_composer_device_1* dev);
+
hwc_module_t HAL_MODULE_INFO_SYM = {
common: {
tag: HARDWARE_MODULE_TAG,
@@ -263,6 +265,12 @@
{
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
+
+ if (ctx->mPanelResetStatus) {
+ ALOGW("%s: panel is in bad state. reset the panel", __FUNCTION__);
+ reset_panel(dev);
+ }
+
//Will be unlocked at the end of set
ctx->mDrawLock.lock();
reset(ctx, numDisplays, displays);
@@ -430,6 +438,33 @@
return ret;
}
+static void reset_panel(struct hwc_composer_device_1* dev)
+{
+ int ret = 0;
+ hwc_context_t* ctx = (hwc_context_t*)(dev);
+
+ if (!ctx->mPanelResetStatus)
+ return;
+
+ ALOGD("%s: calling BLANK DISPLAY", __FUNCTION__);
+ ret = hwc_blank(dev, HWC_DISPLAY_PRIMARY, 1);
+ if (ret < 0) {
+ ALOGE("%s: FBIOBLANK failed to BLANK: %s", __FUNCTION__,
+ strerror(errno));
+ }
+
+ ALOGD("%s: calling UNBLANK DISPLAY and enabling vsync", __FUNCTION__);
+ ret = hwc_blank(dev, HWC_DISPLAY_PRIMARY, 0);
+ if (ret < 0) {
+ ALOGE("%s: FBIOBLANK failed to UNBLANK : %s", __FUNCTION__,
+ strerror(errno));
+ }
+ hwc_vsync_control(ctx, HWC_DISPLAY_PRIMARY, 1);
+
+ ctx->mPanelResetStatus = false;
+}
+
+
static int hwc_query(struct hwc_composer_device_1* dev,
int param, int* value)
{