hwc2: Update layer frame rate from metadata only if it is valid

To compare for Skip Validate feature, update the layer frame rate
from the buffer metadata, only if it is valid.

CRs-Fixed: 2175653
Change-Id: Ia3f6a8e928ded91c26729062e7ed20a687744ad1
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index 0bcffc6..b42eda7 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -728,7 +728,7 @@
   float fps = 0;
   uint32_t frame_rate = layer->frame_rate;
   if (getMetaData(handle, GET_REFRESH_RATE, &fps) == 0) {
-    frame_rate = RoundToStandardFPS(fps);
+    frame_rate = (fps != 0) ? RoundToStandardFPS(fps) : layer->frame_rate;
   }
 
   int32_t interlaced = 0;