[SF] Adds callback from the VsyncPredictor
Hooks up the NotifyExpectedPresentIfRequired with
expectedPresentTime
BUG: 296636253
BUG: 284845445
Test: atest HWComposerTest
Change-Id: Idfd30929a0f4931b1a9f943340932c655ddd5903
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 62eb17d..b1d8db5 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4036,6 +4036,21 @@
}
}
+void SurfaceFlinger::onVsyncGenerated(PhysicalDisplayId displayId, TimePoint expectedPresentTime,
+ const scheduler::DisplayModeData& displayModeData,
+ Period vsyncPeriod) {
+ const auto status =
+ getHwComposer()
+ .notifyExpectedPresentIfRequired(displayId, vsyncPeriod, expectedPresentTime,
+ displayModeData.renderRate,
+ displayModeData
+ .notifyExpectedPresentTimeoutOpt);
+ if (status != NO_ERROR) {
+ ALOGE("%s failed to notifyExpectedPresentHint for display %" PRId64, __func__,
+ displayId.value);
+ }
+}
+
void SurfaceFlinger::initScheduler(const sp<const DisplayDevice>& display) {
using namespace scheduler;
@@ -4074,8 +4089,12 @@
mScheduler = std::make_unique<Scheduler>(static_cast<ICompositor&>(*this),
static_cast<ISchedulerCallback&>(*this), features,
- std::move(modulatorPtr));
+ std::move(modulatorPtr),
+ static_cast<IVsyncTrackerCallback&>(*this));
mScheduler->registerDisplay(display->getPhysicalId(), display->holdRefreshRateSelector());
+ if (FlagManager::getInstance().vrr_config()) {
+ mScheduler->setRenderRate(display->getPhysicalId(), activeMode.fps);
+ }
mScheduler->startTimers();
const auto configs = mVsyncConfiguration->getCurrentConfigs();