hwc: fix shaking issue due to swap rect in mdp3
we should count the same dirtyRect and displayRect
min 3 times before enabling sawpRect feature.
Change-Id: I58524f0d1b9265e052a796f649e737765a1f8404
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 744195f..1cfcd6a 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -189,9 +189,10 @@
return -1;
}
}
- if(mFbCache.getUnchangedFbDRCount(dirtyRect) <
+ hwc_rect_t displayRect = list->hwLayers[changingLayerIndex].displayFrame;
+ if(mFbCache.getUnchangedFbDRCount(dirtyRect, displayRect) <
NUM_RENDER_BUFFERS) {
- mFbCache.insertAndUpdateFbCache(dirtyRect);
+ mFbCache.insertAndUpdateFbCache(dirtyRect, displayRect);
changingLayerIndex = -1;
}
} else {
@@ -1260,19 +1261,24 @@
}
void CopyBit::FbCache::reset() {
memset(&FbdirtyRect, 0, sizeof(FbdirtyRect));
+ memset(&FbdisplayRect, 0, sizeof(FbdisplayRect));
FbIndex =0;
}
-void CopyBit::FbCache::insertAndUpdateFbCache(hwc_rect_t dirtyRect) {
+void CopyBit::FbCache::insertAndUpdateFbCache(hwc_rect_t dirtyRect,
+ hwc_rect_t displayRect) {
FbIndex = FbIndex % NUM_RENDER_BUFFERS;
FbdirtyRect[FbIndex] = dirtyRect;
+ FbdisplayRect[FbIndex] = displayRect;
FbIndex++;
}
-int CopyBit::FbCache::getUnchangedFbDRCount(hwc_rect_t dirtyRect){
+int CopyBit::FbCache::getUnchangedFbDRCount(hwc_rect_t dirtyRect,
+ hwc_rect_t displayRect){
int sameDirtyCount = 0;
for (int i = 0 ; i < NUM_RENDER_BUFFERS ; i++ ){
- if( FbdirtyRect[i] == dirtyRect)
+ if( FbdirtyRect[i] == dirtyRect &&
+ FbdisplayRect[i] == displayRect)
sameDirtyCount++;
}
return sameDirtyCount;
diff --git a/libhwcomposer/hwc_copybit.h b/libhwcomposer/hwc_copybit.h
index 4442afc..eaf015f 100644
--- a/libhwcomposer/hwc_copybit.h
+++ b/libhwcomposer/hwc_copybit.h
@@ -72,11 +72,14 @@
/* framebuffer cache*/
struct FbCache {
hwc_rect_t FbdirtyRect[NUM_RENDER_BUFFERS];
+ hwc_rect_t FbdisplayRect[NUM_RENDER_BUFFERS];
int FbIndex;
FbCache();
void reset();
- void insertAndUpdateFbCache(hwc_rect_t dirtyRect);
- int getUnchangedFbDRCount(hwc_rect_t dirtyRect);
+ void insertAndUpdateFbCache(hwc_rect_t dirtyRect,
+ hwc_rect_t displayRect);
+ int getUnchangedFbDRCount(hwc_rect_t dirtyRect,
+ hwc_rect_t displayRect);
};
// holds the copybit device