summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Kumar K.R <akumarkr@codeaurora.org>2013-06-06 19:43:53 -0700
committerThe Android Automerger <android-build@google.com>2015-10-27 15:22:36 -0700
commit18e0ddd40d4f4140b7b4fc2224095ed1145f510c (patch)
tree477fee607bf561baaffa143cfcfcc8e82b4bdf16
parent9a5a87e98daff3e3b552eb8c131ad6253bfefdf9 (diff)
downloaddisplay-android-cts-6.0_r30.tar.gz
Move the condition for checking maximum number of app layers ourside the isFrameDoable function to avoid heap corruption while updating hnd array in cacheAll function. Bug: 24163261 Acked-by: Ramkumar Radhakrishnan <ramkumar@codeaurora.org> Change-Id: Id4458fcadc7775a2d78b1849de6782857c6ac17f
-rw-r--r--msm8960/libhwcomposer/hwc_mdpcomp.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/msm8960/libhwcomposer/hwc_mdpcomp.cpp b/msm8960/libhwcomposer/hwc_mdpcomp.cpp
index b302943a..939a7869 100644
--- a/msm8960/libhwcomposer/hwc_mdpcomp.cpp
+++ b/msm8960/libhwcomposer/hwc_mdpcomp.cpp
@@ -355,10 +355,6 @@ bool MDPComp::isFrameDoable(hwc_context_t *ctx) {
} else if(ctx->mVideoTransFlag) {
ALOGD_IF(isDebug(), "%s: MDP Comp. video transition padding round",
__FUNCTION__);
- } else if(numAppLayers > MAX_NUM_APP_LAYERS) {
- ALOGD_IF(isDebug(), "%s: Number of App layers exceeded the limit ",
- __FUNCTION__);
- ret = false;
}
return ret;
}
@@ -730,10 +726,19 @@ bool MDPComp::programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
- //reset old data
const int numLayers = ctx->listStats[mDpy].numAppLayers;
+
+ //reset old data
mCurrentFrame.reset(numLayers);
+ //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) {
+ ALOGD_IF(isDebug(), "%s: Number of App layers exceeded the limit ",
+ __FUNCTION__);
+ return 0;
+ }
+
//Hard conditions, if not met, cannot do MDP comp
if(!isFrameDoable(ctx)) {
ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame",