diff options
author | Treehugger Robot <android-build-prod@system.gserviceaccount.com> | 2022-06-14 10:34:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-06-14 10:34:01 +0000 |
commit | 7d844c38698fe873829983c91122b07bc92be350 (patch) | |
tree | 805e598093d1fab8f478f40c368f219e526cceda /services/surfaceflinger/SurfaceFlinger.cpp | |
parent | 8973353855b9b73e4e84123b6ae282ccfe4d800a (diff) | |
parent | e454a37e464a7c5737814494ba6788f5c725ec5f (diff) |
Merge "sf: update phase offsets with extension values properly" into s-keystone-qcom-dev
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index e385c517ec..1899efe9a0 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3994,6 +3994,7 @@ void SurfaceFlinger::processDisplayChanged(const wp<IBinder>& displayToken, void SurfaceFlinger::updateInternalDisplayVsyncLocked(const sp<DisplayDevice>& activeDisplay) { mVsyncConfiguration->reset(); + updateSfPhaseOffsets(activeDisplay); const Fps refreshRate = activeDisplay->refreshRateConfigs().getCurrentRefreshRate().getFps(); updatePhaseConfiguration(refreshRate); mRefreshRateStats->setRefreshRate(refreshRate); @@ -9001,6 +9002,31 @@ void SurfaceFlinger::updateInternalDisplaysPresentationMode() { } } +void SurfaceFlinger::updateSfPhaseOffsets(const sp<DisplayDevice> &display) { +#ifdef PHASE_OFFSET_EXTN + if (!g_comp_ext_intf_.phaseOffsetExtnIntf) { + return; + } + + // Get the Advanced SF Offsets from Phase Offset Extn + std::unordered_map<float, int64_t> advancedSfOffsets; + g_comp_ext_intf_.phaseOffsetExtnIntf->GetAdvancedSfOffsets(&advancedSfOffsets); + + // Populate the fps supported on device in mOffsetCache + const auto& supportedModes = display->getSupportedModes(); + for (auto mode : supportedModes) { + mVsyncConfiguration->getConfigsForRefreshRate(mode->getFps()); + } + + // Update the Advanced SF Offsets + mVsyncConfiguration->UpdateSfOffsets(advancedSfOffsets); + const auto vsyncConfig = + mVsyncModulator->setVsyncConfigSet(mVsyncConfiguration->getCurrentConfigs()); + ALOGI("VsyncConfig sfOffset %" PRId64 "\n", vsyncConfig.sfOffset); + ALOGI("VsyncConfig appOffset %" PRId64 "\n", vsyncConfig.appOffset); +#endif +} + void SurfaceFlinger::createPhaseOffsetExtn() { #ifdef PHASE_OFFSET_EXTN if (mUseAdvanceSfOffset && mComposerExtnIntf) { @@ -9010,16 +9036,7 @@ void SurfaceFlinger::createPhaseOffsetExtn() { return; } - // Get the Advanced SF Offsets from Phase Offset Extn - std::unordered_map<float, int64_t> advancedSfOffsets; - g_comp_ext_intf_.phaseOffsetExtnIntf->GetAdvancedSfOffsets(&advancedSfOffsets); - - // Update the Advanced SF Offsets - mVsyncConfiguration->UpdateSfOffsets(advancedSfOffsets); - const auto vsyncConfig = - mVsyncModulator->setVsyncConfigSet(mVsyncConfiguration->getCurrentConfigs()); - ALOGI("VsyncConfig sfOffset %" PRId64 "\n", vsyncConfig.sfOffset); - ALOGI("VsyncConfig appOffset %" PRId64 "\n", vsyncConfig.appOffset); + updateSfPhaseOffsets(getDefaultDisplayDeviceLocked()); } #endif } |