diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 5c9f2d1f..80e7803a 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -105,7 +105,10 @@ static void hwc_registerProcs(struct hwc_composer_device_1* dev, //Helper static void reset(hwc_context_t *ctx, int numDisplays, hwc_display_contents_1_t** displays) { + ctx->numActiveDisplays = 0; + ctx->isPaddingRound = false; + for(int i = 0; i < numDisplays; i++) { hwc_display_contents_1_t *list = displays[i]; // XXX:SurfaceFlinger no longer guarantees that this @@ -125,6 +128,17 @@ static void reset(hwc_context_t *ctx, int numDisplays, * the display device to be active. */ ctx->numActiveDisplays += 1; + + if((ctx->mPrevHwLayerCount[i] == 1) and (list->numHwLayers > 1)) { + /* If the previous cycle for dpy 'i' has 0 AppLayers and the + * current cycle has atleast 1 AppLayer, padding round needs + * to be invoked on current cycle to free up the resources. + */ + ctx->isPaddingRound = true; + } + ctx->mPrevHwLayerCount[i] = list->numHwLayers; + } else { + ctx->mPrevHwLayerCount[i] = 0; } if(ctx->mFBUpdate[i]) @@ -133,7 +147,6 @@ static void reset(hwc_context_t *ctx, int numDisplays, ctx->mCopyBit[i]->reset(); if(ctx->mLayerRotMap[i]) ctx->mLayerRotMap[i]->reset(); - } ctx->mAD->reset(); diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp index 4f6099ea..53d614fe 100644 --- a/libhwcomposer/hwc_mdpcomp.cpp +++ b/libhwcomposer/hwc_mdpcomp.cpp @@ -419,8 +419,8 @@ bool MDPComp::isFrameDoable(hwc_context_t *ctx) { __FUNCTION__); ret = false; } else if(ctx->isPaddingRound) { - ctx->isPaddingRound = false; - ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__); + ALOGD_IF(isDebug(), "%s: padding round invoked for dpy %d", + __FUNCTION__,mDpy); ret = false; } return ret; @@ -1410,11 +1410,10 @@ int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) { const int numLayers = ctx->listStats[mDpy].numAppLayers; MDPVersion& mdpVersion = qdutils::MDPVersion::getInstance(); - //number of app layers exceeds MAX_NUM_APP_LAYERS fall back to GPU - //do not cache the information for next draw cycle. - if(numLayers > MAX_NUM_APP_LAYERS) { - ALOGI("%s: Number of App layers exceeded the limit ", - __FUNCTION__); + //Do not cache the information for next draw cycle. + if(numLayers > MAX_NUM_APP_LAYERS or (!numLayers)) { + ALOGI("%s: Unsupported layer count for mdp composition", + __FUNCTION__); mCachedFrame.reset(); return -1; } diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp index d30984b4..4ebf6856 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -213,6 +213,10 @@ void initContext(hwc_context_t *ctx) ctx->dpyAttr[i].mAsHeightRatio = 0; } + for (uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) { + ctx->mPrevHwLayerCount[i] = 0; + } + MDPComp::init(ctx); ctx->mAD = new AssertiveDisplay(ctx); @@ -897,6 +901,7 @@ void setListStats(hwc_context_t *ctx, if(prevYuvCount != ctx->listStats[dpy].yuvCount) { ctx->mVideoTransFlag = true; } + if(dpy == HWC_DISPLAY_PRIMARY) { ctx->mAD->markDoable(ctx, list); } diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h index 3393b59e..25d1c219 100644 --- a/libhwcomposer/hwc_utils.h +++ b/libhwcomposer/hwc_utils.h @@ -483,6 +483,10 @@ struct hwc_context_t { eAnimationState mAnimationState[HWC_NUM_DISPLAY_TYPES]; qhwc::HWCVirtualBase *mHWCVirtual; + // stores the #numHwLayers of the previous frame + // for each display device + int mPrevHwLayerCount[HWC_NUM_DISPLAY_TYPES]; + // stores the primary device orientation int deviceOrientation; //Securing in progress indicator