diff options
-rw-r--r-- | msm8960/libhwcomposer/hwc_copybit.cpp | 5 | ||||
-rw-r--r-- | msm8960/libhwcomposer/hwc_mdpcomp.cpp | 17 | ||||
-rw-r--r-- | msm8960/libhwcomposer/hwc_mdpcomp.h | 6 | ||||
-rw-r--r-- | msm8960/libhwcomposer/hwc_utils.cpp | 13 | ||||
-rw-r--r-- | msm8960/libhwcomposer/hwc_utils.h | 4 |
5 files changed, 31 insertions, 14 deletions
diff --git a/msm8960/libhwcomposer/hwc_copybit.cpp b/msm8960/libhwcomposer/hwc_copybit.cpp index 98126bf0e..0839122c8 100644 --- a/msm8960/libhwcomposer/hwc_copybit.cpp +++ b/msm8960/libhwcomposer/hwc_copybit.cpp @@ -159,6 +159,11 @@ bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list, return false; } + if (ctx->listStats[dpy].numAppLayers > MAX_NUM_APP_LAYERS) { + // Reached max layers supported by HWC. + return false; + } + bool useCopybitForYUV = canUseCopybitForYUV(ctx); bool useCopybitForRGB = canUseCopybitForRGB(ctx, list, dpy); LayerProp *layerProp = ctx->layerProp[dpy]; diff --git a/msm8960/libhwcomposer/hwc_mdpcomp.cpp b/msm8960/libhwcomposer/hwc_mdpcomp.cpp index ddf56db11..6fcfba9c3 100644 --- a/msm8960/libhwcomposer/hwc_mdpcomp.cpp +++ b/msm8960/libhwcomposer/hwc_mdpcomp.cpp @@ -344,7 +344,7 @@ ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type) { } bool MDPComp::isFrameDoable(hwc_context_t *ctx) { - int numAppLayers = ctx->listStats[mDpy].numAppLayers; + const int numAppLayers = ctx->listStats[mDpy].numAppLayers; bool ret = true; if(!isEnabled()) { @@ -357,7 +357,6 @@ bool MDPComp::isFrameDoable(hwc_context_t *ctx) { } else if(ctx->mVideoTransFlag) { ALOGD_IF(isDebug(), "%s: MDP Comp. video transition padding round", __FUNCTION__); - ret = false; } return ret; } @@ -729,10 +728,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", @@ -1033,7 +1041,8 @@ bool MDPCompHighRes::allocLayerPipes(hwc_context_t *ctx, if(isYuvBuffer(hnd)) continue; - PipeLayerPair& info = mCurrentFrame.mdpToLayer[index]; + int mdpIndex = mCurrentFrame.layerToMDP[index]; + PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex]; info.pipeInfo = new MdpPipeInfoHighRes; info.rot = NULL; MdpPipeInfoHighRes& pipe_info = *(MdpPipeInfoHighRes*)info.pipeInfo; diff --git a/msm8960/libhwcomposer/hwc_mdpcomp.h b/msm8960/libhwcomposer/hwc_mdpcomp.h index a0255b7e1..e2800d242 100644 --- a/msm8960/libhwcomposer/hwc_mdpcomp.h +++ b/msm8960/libhwcomposer/hwc_mdpcomp.h @@ -78,7 +78,7 @@ protected: struct FrameInfo { /* maps layer list to mdp list */ int layerCount; - int layerToMDP[MAX_NUM_LAYERS]; + int layerToMDP[MAX_NUM_APP_LAYERS]; /* maps mdp list to layer list */ int mdpCount; @@ -86,7 +86,7 @@ protected: /* layer composing on FB? */ int fbCount; - bool isFBComposed[MAX_NUM_LAYERS]; + bool isFBComposed[MAX_NUM_APP_LAYERS]; bool needsRedraw; int fbZ; @@ -104,7 +104,7 @@ protected: int mdpCount; int cacheCount; int fbZ; - buffer_handle_t hnd[MAX_NUM_LAYERS]; + buffer_handle_t hnd[MAX_NUM_APP_LAYERS]; /* c'tor */ LayerCache(); diff --git a/msm8960/libhwcomposer/hwc_utils.cpp b/msm8960/libhwcomposer/hwc_utils.cpp index ce3f28188..c68b77ac2 100644 --- a/msm8960/libhwcomposer/hwc_utils.cpp +++ b/msm8960/libhwcomposer/hwc_utils.cpp @@ -431,12 +431,16 @@ void setListStats(hwc_context_t *ctx, ctx->listStats[dpy].planeAlpha = false; ctx->listStats[dpy].yuvCount = 0; - for (size_t i = 0; i < list->numHwLayers; i++) { + //reset yuv indices + memset(ctx->listStats[dpy].yuvIndices, -1, MAX_NUM_APP_LAYERS); + + for (size_t i = 0; i < (list->numHwLayers - 1); i++) { hwc_layer_1_t const* layer = &list->hwLayers[i]; private_handle_t *hnd = (private_handle_t *)layer->handle; - //reset stored yuv index - ctx->listStats[dpy].yuvIndices[i] = -1; + // continue if i reaches MAX_NUM_APP_LAYERS + if(i >= MAX_NUM_APP_LAYERS) + continue; if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) { continue; @@ -649,8 +653,7 @@ void closeAcquireFds(hwc_display_contents_1_t* list) { int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy, int fd) { int ret = 0; - - int acquireFd[MAX_NUM_LAYERS]; + int acquireFd[MAX_NUM_APP_LAYERS]; int count = 0; int releaseFd = -1; int retireFd = -1; diff --git a/msm8960/libhwcomposer/hwc_utils.h b/msm8960/libhwcomposer/hwc_utils.h index ee1cbe850..aa66f900b 100644 --- a/msm8960/libhwcomposer/hwc_utils.h +++ b/msm8960/libhwcomposer/hwc_utils.h @@ -35,7 +35,7 @@ #define ALIGN_TO(x, align) (((x) + ((align)-1)) & ~((align)-1)) #define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) #define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) -#define MAX_NUM_LAYERS 32 //includes fb layer +#define MAX_NUM_APP_LAYERS 32 #define MAX_DISPLAY_DIM 2048 // For support of virtual displays @@ -91,7 +91,7 @@ struct ListStats { int fbLayerIndex; //Always last for now. = numAppLayers //Video specific int yuvCount; - int yuvIndices[MAX_NUM_LAYERS]; + int yuvIndices[MAX_NUM_APP_LAYERS]; bool needsAlphaScale; bool preMultipliedAlpha; bool planeAlpha; |