hwc2: Use floating value refresh rate
Matches corresponding changes in metadata on hwc1
Change-Id: I305a4d1f47cf3854f79456584ac013d15b57e9bc
CRs-Fixed: 1023652
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index ada1cac..2591898 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -474,19 +474,20 @@
return kErrorNone;
}
-uint32_t HWCLayer::RoundToStandardFPS(uint32_t fps) {
- static const uint32_t standard_fps[4] = {30, 24, 48, 60};
+uint32_t HWCLayer::RoundToStandardFPS(float fps) {
+ static const uint32_t standard_fps[4] = {24, 30, 48, 60};
+ uint32_t frame_rate = (uint32_t)(fps);
int count = INT(sizeof(standard_fps) / sizeof(standard_fps[0]));
for (int i = 0; i < count; i++) {
- if ((standard_fps[i] - fps) < 2) {
+ if ((standard_fps[i] - frame_rate) < 2) {
// Most likely used for video, the fps can fluctuate
// Ex: b/w 29 and 30 for 30 fps clip
return standard_fps[i];
}
}
- return fps;
+ return frame_rate;
}
void HWCLayer::SetComposition(const LayerComposition &source) {
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index b756c38..1026ff2 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -96,7 +96,7 @@
DisplayError SetMetaData(const private_handle_t *pvt_handle, Layer *layer);
DisplayError SetCSC(ColorSpace_t source, LayerCSC *target);
DisplayError SetIGC(IGC_t source, LayerIGC *target);
- uint32_t RoundToStandardFPS(uint32_t fps);
+ uint32_t RoundToStandardFPS(float fps);
};
struct SortLayersByZ {