From: Alec Mouri Date: Thu, 7 Mar 2019 20:24:05 +0000 (-0800) Subject: SF: fix bad phase offsets. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1c9e82ba29eacaccb4142d6e7da8c3ecad862e17;p=android-x86%2Fframeworks-native.git SF: fix bad phase offsets. Moves the issuance of 60hz/90hz config changes from the boot phase to the message-handling phase in setActiveConfig. Bug: 127782993 Test: dumpsys Change-Id: I5a12e4c5f0744107c6352269a8c6ad75a90c9be0 --- diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index dba1f8e03f..6c3b2ac14c 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -573,12 +573,8 @@ void SurfaceFlinger::bootFinished() mRefreshRateConfigs[*displayId]->getRefreshRate(RefreshRateType::PERFORMANCE); if (isConfigAllowed(*displayId, performanceRefreshRate.configId)) { - mPhaseOffsets->setRefreshRateType( - scheduler::RefreshRateConfigs::RefreshRateType::PERFORMANCE); setRefreshRateTo(RefreshRateType::PERFORMANCE, Scheduler::ConfigEvent::None); } else { - mPhaseOffsets->setRefreshRateType( - scheduler::RefreshRateConfigs::RefreshRateType::DEFAULT); setRefreshRateTo(RefreshRateType::DEFAULT, Scheduler::ConfigEvent::None); } })); @@ -975,6 +971,8 @@ void SurfaceFlinger::setActiveConfigInternal() { display->setActiveConfig(mUpcomingActiveConfig.configId); mScheduler->resyncToHardwareVsync(true, getVsyncPeriod()); + const auto [early, gl, late] = mPhaseOffsets->getCurrentOffsets(); + mVsyncModulator.setPhaseOffsets(early, gl, late); ATRACE_INT("ActiveConfigMode", mUpcomingActiveConfig.configId); if (mUpcomingActiveConfig.event != Scheduler::ConfigEvent::None) { mScheduler->onConfigChanged(mAppConnectionHandle, display->getId()->value, @@ -1418,15 +1416,10 @@ bool SurfaceFlinger::isConfigAllowed(const DisplayId& displayId, int32_t config) } void SurfaceFlinger::setRefreshRateTo(RefreshRateType refreshRate, Scheduler::ConfigEvent event) { - ATRACE_CALL(); - mPhaseOffsets->setRefreshRateType(refreshRate); - - const auto [early, gl, late] = mPhaseOffsets->getCurrentOffsets(); - mVsyncModulator.setPhaseOffsets(early, gl, late); - if (mBootStage != BootStage::FINISHED) { return; } + ATRACE_CALL(); // Don't do any updating if the current fps is the same as the new one. const auto displayId = getInternalDisplayIdLocked(); @@ -1444,6 +1437,7 @@ void SurfaceFlinger::setRefreshRateTo(RefreshRateType refreshRate, Scheduler::Co return; } + mPhaseOffsets->setRefreshRateType(refreshRate); setDesiredActiveConfig(getInternalDisplayTokenLocked(), desiredConfigId, event); } @@ -5671,8 +5665,6 @@ void SurfaceFlinger::setAllowedDisplayConfigsInternal( const auto performanceRefreshRate = mRefreshRateConfigs[*displayId]->getRefreshRate(RefreshRateType::PERFORMANCE); if (isConfigAllowed(*displayId, performanceRefreshRate.configId)) { - mPhaseOffsets->setRefreshRateType( - scheduler::RefreshRateConfigs::RefreshRateType::PERFORMANCE); setRefreshRateTo(RefreshRateType::PERFORMANCE, Scheduler::ConfigEvent::Changed); } }