From 9d12887c02eaedda35ea595a34e563a6e896906f Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Sat, 22 Sep 2012 14:30:29 +0530 Subject: [PATCH] libhwcomposer: Fix UI freeze on 8660 on HDMI cable connect -In 3 layer bypass case on hdmi cable connection, UI freezes. -Overlay state change from OV_BYPASS_3_LAYER to OV_UI_MIRROR directly not possible on 8660 as BF pipe is not available. -Add support to change overlay state via OV_CLOSED to make pipe free OV_BYPASS_3_LAYER-->OV_CLOSED-->OV_UI_MIRROR -Move processUEventOnline to prepare thread. Change-Id: I29c657ab799d1cd4ad52adcf6a8f86d18e76bcf9 CRs-Fixed: 386335 Conflicts: libhwcomposer/hwc_utils.h Conflicts: libhwcomposer/hwc_utils.cpp --- libhwcomposer/hwc.cpp | 10 ++++++++-- libhwcomposer/hwc_mdpcomp.cpp | 2 +- libhwcomposer/hwc_uevents.cpp | 11 ++++++++++- libhwcomposer/hwc_utils.cpp | 2 ++ libhwcomposer/hwc_utils.h | 2 ++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 95be7cc..880becf 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -92,7 +92,14 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) if(ctx->mExtDisplay->getExternalDisplay()) ovutils::setExtType(ctx->mExtDisplay->getExternalDisplay()); - + if (ctx->hdmi_pending == true) { + if ((qdutils::MDPVersion::getInstance().getMDPVersion() >= + qdutils::MDP_V4_2) || (ctx->mOverlay->getState() != + ovutils::OV_BYPASS_3_LAYER)) { + ctx->mExtDisplay->processUEventOnline((const char*)ctx->mHDMIEvent); + ctx->hdmi_pending = false; + } + } if (LIKELY(list)) { //reset for this draw round VideoOverlay::reset(); @@ -128,7 +135,6 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) qdutils::CBUtils::checkforGPULayer(list); } - return 0; } diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp index 191c099..6dc0a0f 100644 --- a/libhwcomposer/hwc_mdpcomp.cpp +++ b/libhwcomposer/hwc_mdpcomp.cpp @@ -353,7 +353,7 @@ bool MDPComp::is_doable(hwc_composer_device_t *dev, hwc_layer_list_t* list) { } //Disable MDPComp when ext display connected - if(ctx->mExtDisplay->getExternalDisplay()) { + if(ctx->mExtDisplay->getExternalDisplay()|| (ctx->hdmi_pending == true)) { ALOGD_IF(isDebug(), "%s: External display connected.", __FUNCTION__); return false; } diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp index 2ebc8f2..f9ac0f2 100644 --- a/libhwcomposer/hwc_uevents.cpp +++ b/libhwcomposer/hwc_uevents.cpp @@ -50,8 +50,17 @@ static void handle_uevent(hwc_context_t* ctx, const char* udata, int len) // for now just parsing onlin/offline info is enough str = udata; if(!(strncmp(str,"online@",strlen("online@")))) { - ctx->mExtDisplay->processUEventOnline(str); + strncpy(ctx->mHDMIEvent,str,strlen(str)); + ctx->hdmi_pending = true; + //Invalidate + hwc_procs* proc = (hwc_procs*)ctx->device.reserved_proc[0]; + if(!proc) { + ALOGE("%s: HWC proc not registered", __FUNCTION__); + } else { + proc->invalidate(proc); + } } else if(!(strncmp(str,"offline@",strlen("offline@")))) { + ctx->hdmi_pending = false; ctx->mExtDisplay->processUEventOffline(str); } } diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp index eaaf9d3..82b6ab5 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -70,6 +70,8 @@ void initContext(hwc_context_t *ctx) pthread_cond_init(&(ctx->vstate.cond), NULL); ctx->vstate.enable = false; + ctx->hdmi_pending = false; + ALOGI("Initializing Qualcomm Hardware Composer"); ALOGI("MDP version: %d", ctx->mMDP.version); ALOGI("DYN composition threshold : %f", ctx->dynThreshold); diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h index b3a9600..683fc1b 100644 --- a/libhwcomposer/hwc_utils.h +++ b/libhwcomposer/hwc_utils.h @@ -180,6 +180,8 @@ struct hwc_context_t { // flag that indicate whether secure/desecure session in progress bool mSecureConfig; + bool hdmi_pending; + char mHDMIEvent[512]; }; #endif //HWC_UTILS_H