SF should use display fps and not vsync rate as refresh rate
Test: `adb shell dumpsys SurfaceFlinger | grep -E "VSYNC period|refresh-rate"`
BUG: 334740737
Change-Id: I77354db6351125f96cbb37e6e75877f533879952
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 14dfdf5..e28804d 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6876,24 +6876,23 @@
StringAppendF(&result, " transaction-flags : %08x\n", mTransactionFlags.load());
if (const auto display = getDefaultDisplayDeviceLocked()) {
- std::string fps, xDpi, yDpi;
- if (const auto activeModePtr =
- display->refreshRateSelector().getActiveMode().modePtr.get()) {
- fps = to_string(activeModePtr->getVsyncRate());
-
+ std::string peakFps, xDpi, yDpi;
+ const auto activeMode = display->refreshRateSelector().getActiveMode();
+ if (const auto activeModePtr = activeMode.modePtr.get()) {
+ peakFps = to_string(activeMode.modePtr->getPeakFps());
const auto dpi = activeModePtr->getDpi();
xDpi = base::StringPrintf("%.2f", dpi.x);
yDpi = base::StringPrintf("%.2f", dpi.y);
} else {
- fps = "unknown";
+ peakFps = "unknown";
xDpi = "unknown";
yDpi = "unknown";
}
StringAppendF(&result,
- " refresh-rate : %s\n"
+ " peak-refresh-rate : %s\n"
" x-dpi : %s\n"
" y-dpi : %s\n",
- fps.c_str(), xDpi.c_str(), yDpi.c_str());
+ peakFps.c_str(), xDpi.c_str(), yDpi.c_str());
}
StringAppendF(&result, " transaction time: %f us\n", inTransactionDuration / 1000.0);