Merge "hwcomposer : Fix cache redraw logic of MDP composition."
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index e65d5e7..bb52728 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -242,10 +242,9 @@
void MDPComp::LayerCache::reset() {
memset(&hnd, 0, sizeof(hnd));
- mdpCount = 0;
- fbCount = 0;
+ memset(&isFBComposed, true, sizeof(isFBComposed));
+ memset(&drop, false, sizeof(drop));
layerCount = 0;
- fbZ = -1;
}
void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) {
@@ -256,10 +255,21 @@
}
void MDPComp::LayerCache::updateCounts(const FrameInfo& curFrame) {
- mdpCount = curFrame.mdpCount;
- fbCount = curFrame.fbCount;
layerCount = curFrame.layerCount;
- fbZ = curFrame.fbZ;
+ memcpy(&isFBComposed, &curFrame.isFBComposed, sizeof(isFBComposed));
+ memcpy(&drop, &curFrame.drop, sizeof(drop));
+}
+
+bool MDPComp::LayerCache::isSameFrame(const FrameInfo& curFrame) {
+ if(layerCount != curFrame.layerCount)
+ return false;
+ for(int i = 0; i < curFrame.layerCount; i++) {
+ if((curFrame.isFBComposed[i] != isFBComposed[i]) ||
+ (curFrame.drop[i] != drop[i])) {
+ return false;
+ }
+ }
+ return true;
}
bool MDPComp::isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer) {
@@ -1167,13 +1177,9 @@
} else { //Success
//Any change in composition types needs an FB refresh
mCurrentFrame.needsRedraw = false;
- if(mCurrentFrame.fbCount &&
- ((mCurrentFrame.mdpCount != mCachedFrame.mdpCount) ||
- (mCurrentFrame.fbCount != mCachedFrame.fbCount) ||
- (mCurrentFrame.fbZ != mCachedFrame.fbZ) ||
- (!mCurrentFrame.mdpCount) ||
+ if(!mCachedFrame.isSameFrame(mCurrentFrame) ||
(list->flags & HWC_GEOMETRY_CHANGED) ||
- isSkipPresent(ctx, mDpy))) {
+ isSkipPresent(ctx, mDpy)) {
mCurrentFrame.needsRedraw = true;
}
}
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 3882bee..1d5d715 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -108,10 +108,9 @@
/* cached data */
struct LayerCache {
int layerCount;
- int mdpCount;
- int fbCount;
- int fbZ;
buffer_handle_t hnd[MAX_NUM_APP_LAYERS];
+ bool isFBComposed[MAX_NUM_APP_LAYERS];
+ bool drop[MAX_NUM_APP_LAYERS];
/* c'tor */
LayerCache();
@@ -119,6 +118,7 @@
void reset();
void cacheAll(hwc_display_contents_1_t* list);
void updateCounts(const FrameInfo&);
+ bool isSameFrame(const FrameInfo& curFrame);
};
/* allocates pipe from pipe book */