hwc: Populate frame rate in rotator set

- Populate frame_rate in rotator set, so that driver
  can vote for honest BW for rotator based on frame rate.
- If metadata contains source fps, frame_rate will be set
  to source fps, else it will be set to primary refresh rate.
- frame_rate will be populated for primary with
  source fps from metada, only when secondary is not active.

Change-Id: Icaacd0ed67ec09591d31868591680d2e86fe54a2
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index e2c4677..1f16416 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -3103,8 +3103,14 @@
             BwcPM::setBwc(ctx, mDpy, hnd, crop, dst, transform, downscale,
                     mdpFlags);
         }
+        uint32_t frame_rate = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].refreshRate;
+        if(!mDpy && !isSecondaryConnected(ctx)) {
+            if(metadata && (metadata->operation & UPDATE_REFRESH_RATE))
+                frame_rate = metadata->refreshrate;
+        }
         //Configure rotator for pre-rotation
-        if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale) < 0) {
+        if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale,
+                    frame_rate) < 0) {
             ALOGE("%s: configRotator failed!", __FUNCTION__);
             return -1;
         }