diff options
author | alk3pInjection <webmaster@raspii.tech> | 2022-08-05 20:43:06 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-08-05 20:43:06 +0800 |
commit | f8da3173ba698387d6fc339ddf1b6acddba8f95d (patch) | |
tree | 481feb058d05580685f08c2de569825d5262f7fd /services/surfaceflinger/SurfaceFlinger.cpp | |
parent | 8b4d40e8e1b00fe7c2701ebf23a9f4e7a532669c (diff) | |
parent | 0ed64a10f0ae2adb736cea5b43940d225479e283 (diff) |
Merge tag 'LA.QSSI.12.0.r1-08300-qssi.0' into sugisawa-mr1HEADsugisawa-mr1
"LA.QSSI.12.0.r1-08300-qssi.0"
Change-Id: Ib5fe7bc85b384f41d021ab589bcbe766e1530d02
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rwxr-xr-x | services/surfaceflinger/SurfaceFlinger.cpp | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 630997cd3a..23c994ce61 100755 --- 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); @@ -4863,7 +4864,7 @@ status_t SurfaceFlinger::setTransactionState( const int64_t postTime = systemTime(); - if (mAsyncVdsCreationSupported) { + if (mAsyncVdsCreationSupported && std::this_thread::get_id() != mMainThreadId) { checkVirtualDisplayHint(displays); } @@ -5045,7 +5046,8 @@ void SurfaceFlinger::checkVirtualDisplayHint(const Vector<DisplayState>& display if (what & DisplayState::eSurfaceChanged) { if (IInterface::asBinder(state.surface) != IInterface::asBinder(s.surface)) { if (state.isVirtual() && s.surface != nullptr && - mVirtualDisplayIdGenerators.hal) { + mVirtualDisplayIdGenerators.hal && + getHwComposer().getMaxVirtualDisplayCount() > 0) { width = 0; int status = s.surface->query(NATIVE_WINDOW_WIDTH, &width); ALOGE_IF(status != NO_ERROR, "Unable to query width (%d)", status); @@ -9000,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) { @@ -9009,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 } |