summaryrefslogtreecommitdiff
path: root/services/surfaceflinger
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger')
-rwxr-xr-xservices/surfaceflinger/SurfaceFlinger.cpp42
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h6
2 files changed, 34 insertions, 14 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
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 44394e50fc..e192c3a9d7 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -900,7 +900,7 @@ private:
void onMessageRefresh();
// Check if unified draw supported
- void startUnifiedDraw();
+ void startUnifiedDraw() REQUIRES(mStateLock);
void InitComposerExtn();
void createSmomoInstance(const DisplayDeviceState& state) REQUIRES(mStateLock);
void destroySmomoInstance(const sp<DisplayDevice>& display);
@@ -1334,7 +1334,9 @@ private:
void updateInternalDisplaysPresentationMode();
- void createPhaseOffsetExtn();
+ void createPhaseOffsetExtn() REQUIRES(mStateLock);
+
+ void updateSfPhaseOffsets(const sp<DisplayDevice> &display);
void setupDisplayExtnFeatures();