hwc: avoid composition for static screen use-cases

pp-daemon may trigger screen-refresh for several times to LUT convergence.
For these cases we are re-compositing same frame for every screen-refresh,
which is not necessary is being avoided in this change.

Change-Id: Ifde013a2d6148f905d70d48da858159cc4187bfe
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 5a9caec..d7b6278 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -174,11 +174,20 @@
     //dirty rect for same layer at least equal of number of
     //framebuffers
 
-    if ( updatingLayerCount ==  1 ) {
-       hwc_rect_t dirtyRect = list->hwLayers[changingLayerIndex].displayFrame;
+    if ( updatingLayerCount <=  1 ) {
+        hwc_rect_t dirtyRect;
+        if (updatingLayerCount == 0) {
+            dirtyRect.left = INVALID_DIMENSION;
+            dirtyRect.top = INVALID_DIMENSION;
+            dirtyRect.right = INVALID_DIMENSION;
+            dirtyRect.bottom = INVALID_DIMENSION;
+            changingLayerIndex = NO_UPDATING_LAYER;
+        } else {
+            dirtyRect = list->hwLayers[changingLayerIndex].displayFrame;
 #ifdef QCOM_BSP
-       dirtyRect = list->hwLayers[changingLayerIndex].dirtyRect;
+            dirtyRect = list->hwLayers[changingLayerIndex].dirtyRect;
 #endif
+        }
 
        for (int k = ctx->listStats[dpy].numAppLayers-1; k >= 0 ; k--) {
            //disable swap rect in case of scaling and video .
@@ -553,6 +562,12 @@
     mDirtyLayerIndex =  checkDirtyRect(ctx, list, dpy);
     ALOGD_IF (DEBUG_COPYBIT, "%s:Dirty Layer Index: %d",
                                        __FUNCTION__, mDirtyLayerIndex);
+    // repetitive frame will have mDirtyLayerIndex as NO_UPDATING_LAYER
+    if (mDirtyLayerIndex == NO_UPDATING_LAYER) {
+        ALOGD_IF (DEBUG_COPYBIT, "%s: No Updating Layers", __FUNCTION__);
+        return true;
+    }
+
     hwc_rect_t clearRegion = {0,0,0,0};
     mDirtyRect = list->hwLayers[last].displayFrame;
 
diff --git a/libhwcomposer/hwc_copybit.h b/libhwcomposer/hwc_copybit.h
index eaf015f..b67e1b8 100644
--- a/libhwcomposer/hwc_copybit.h
+++ b/libhwcomposer/hwc_copybit.h
@@ -28,6 +28,8 @@
 #define MAX_SCALE_FACTOR 16
 #define MIN_SCALE_FACTOR 0.0625
 #define MAX_LAYERS_FOR_ABC 2
+#define INVALID_DIMENSION -1
+#define NO_UPDATING_LAYER -2
 namespace qhwc {
 
 class CopyBit {