hwc: Add dynamic fps support for PPP

Some apps like camera and video are running on
less fps than panel refresh rate. Hence setting
dynamic fps will help in reducing BW voting for PPP.

Change-Id: I236fe96d5c6547044083774388887638f9e32958
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 68f168a..5b8d05d 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -810,7 +810,13 @@
         ALOGE("%s: Framebuffer handle is NULL", __FUNCTION__);
         return -1;
     }
-
+    uint32_t dynamic_fps = 0;
+#ifdef DYNAMIC_FPS
+    MetaData_t *mdata = hnd ? (MetaData_t *)hnd->base_metadata : NULL;
+    if (mdata && (mdata->operation & UPDATE_REFRESH_RATE)) {
+       dynamic_fps  = roundOff(mdata->refreshrate);
+    }
+#endif
     // Set the copybit source:
     copybit_image_t src;
     src.w = getWidth(hnd);
@@ -1025,6 +1031,7 @@
                                               layerTransform);
     //TODO: once, we are able to read layer alpha, update this
     copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255);
+    copybit->set_parameter(copybit, COPYBIT_DYNAMIC_FPS, dynamic_fps);
     copybit->set_parameter(copybit, COPYBIT_BLEND_MODE,
                                               layer->blending);
     copybit->set_parameter(copybit, COPYBIT_DITHER,