Loading services/surfaceflinger/Scheduler/Scheduler.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -117,10 +117,10 @@ void Scheduler::startTimers() { } } void Scheduler::setPacesetterDisplay(std::optional<PhysicalDisplayId> pacesetterIdOpt) { void Scheduler::setPacesetterDisplay(PhysicalDisplayId pacesetterId) { demotePacesetterDisplay(); promotePacesetterDisplay(pacesetterIdOpt); promotePacesetterDisplay(pacesetterId); } void Scheduler::registerDisplay(PhysicalDisplayId displayId, RefreshRateSelectorPtr selectorPtr, Loading Loading @@ -917,22 +917,22 @@ bool Scheduler::updateFrameRateOverridesLocked(GlobalSignals consideredSignals, return mFrameRateOverrideMappings.updateFrameRateOverridesByContent(frameRateOverrides); } void Scheduler::promotePacesetterDisplay(std::optional<PhysicalDisplayId> pacesetterIdOpt) { void Scheduler::promotePacesetterDisplay(PhysicalDisplayId pacesetterId) { std::shared_ptr<VsyncSchedule> pacesetterVsyncSchedule; { std::scoped_lock lock(mDisplayLock); pacesetterVsyncSchedule = promotePacesetterDisplayLocked(pacesetterIdOpt); pacesetterVsyncSchedule = promotePacesetterDisplayLocked(pacesetterId); } applyNewVsyncSchedule(std::move(pacesetterVsyncSchedule)); } std::shared_ptr<VsyncSchedule> Scheduler::promotePacesetterDisplayLocked( std::optional<PhysicalDisplayId> pacesetterIdOpt) { // TODO(b/241286431): Choose the pacesetter display. mPacesetterDisplayId = pacesetterIdOpt.value_or(mDisplays.begin()->first); ALOGI("Display %s is the pacesetter", to_string(*mPacesetterDisplayId).c_str()); PhysicalDisplayId pacesetterId) { // TODO: b/241286431 - Choose the pacesetter among mDisplays. mPacesetterDisplayId = pacesetterId; ALOGI("Display %s is the pacesetter", to_string(pacesetterId).c_str()); std::shared_ptr<VsyncSchedule> newVsyncSchedulePtr; if (const auto pacesetterOpt = pacesetterDisplayLocked()) { Loading services/surfaceflinger/Scheduler/Scheduler.h +5 −8 Original line number Diff line number Diff line Loading @@ -92,8 +92,8 @@ public: void startTimers(); // TODO(b/241285191): Remove this API by promoting pacesetter in onScreen{Acquired,Released}. void setPacesetterDisplay(std::optional<PhysicalDisplayId>) REQUIRES(kMainThreadContext) // TODO: b/241285191 - Remove this API by promoting pacesetter in onScreen{Acquired,Released}. void setPacesetterDisplay(PhysicalDisplayId) REQUIRES(kMainThreadContext) EXCLUDES(mDisplayLock); using RefreshRateSelectorPtr = std::shared_ptr<RefreshRateSelector>; Loading Loading @@ -377,10 +377,8 @@ private: void resyncAllToHardwareVsync(bool allowToEnable) EXCLUDES(mDisplayLock); void setVsyncConfig(const VsyncConfig&, Period vsyncPeriod); // Chooses a pacesetter among the registered displays, unless `pacesetterIdOpt` is specified. // The new `mPacesetterDisplayId` is never `std::nullopt`. void promotePacesetterDisplay(std::optional<PhysicalDisplayId> pacesetterIdOpt = std::nullopt) REQUIRES(kMainThreadContext) EXCLUDES(mDisplayLock); void promotePacesetterDisplay(PhysicalDisplayId pacesetterId) REQUIRES(kMainThreadContext) EXCLUDES(mDisplayLock); // Changes to the displays (e.g. registering and unregistering) must be made // while mDisplayLock is locked, and the new pacesetter then must be promoted while Loading @@ -388,8 +386,7 @@ private: // MessageQueue and EventThread need to use the new pacesetter's // VsyncSchedule, and this must happen while mDisplayLock is *not* locked, // or else we may deadlock with EventThread. std::shared_ptr<VsyncSchedule> promotePacesetterDisplayLocked( std::optional<PhysicalDisplayId> pacesetterIdOpt = std::nullopt) std::shared_ptr<VsyncSchedule> promotePacesetterDisplayLocked(PhysicalDisplayId pacesetterId) REQUIRES(kMainThreadContext, mDisplayLock); void applyNewVsyncSchedule(std::shared_ptr<VsyncSchedule>) EXCLUDES(mDisplayLock); Loading Loading
services/surfaceflinger/Scheduler/Scheduler.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -117,10 +117,10 @@ void Scheduler::startTimers() { } } void Scheduler::setPacesetterDisplay(std::optional<PhysicalDisplayId> pacesetterIdOpt) { void Scheduler::setPacesetterDisplay(PhysicalDisplayId pacesetterId) { demotePacesetterDisplay(); promotePacesetterDisplay(pacesetterIdOpt); promotePacesetterDisplay(pacesetterId); } void Scheduler::registerDisplay(PhysicalDisplayId displayId, RefreshRateSelectorPtr selectorPtr, Loading Loading @@ -917,22 +917,22 @@ bool Scheduler::updateFrameRateOverridesLocked(GlobalSignals consideredSignals, return mFrameRateOverrideMappings.updateFrameRateOverridesByContent(frameRateOverrides); } void Scheduler::promotePacesetterDisplay(std::optional<PhysicalDisplayId> pacesetterIdOpt) { void Scheduler::promotePacesetterDisplay(PhysicalDisplayId pacesetterId) { std::shared_ptr<VsyncSchedule> pacesetterVsyncSchedule; { std::scoped_lock lock(mDisplayLock); pacesetterVsyncSchedule = promotePacesetterDisplayLocked(pacesetterIdOpt); pacesetterVsyncSchedule = promotePacesetterDisplayLocked(pacesetterId); } applyNewVsyncSchedule(std::move(pacesetterVsyncSchedule)); } std::shared_ptr<VsyncSchedule> Scheduler::promotePacesetterDisplayLocked( std::optional<PhysicalDisplayId> pacesetterIdOpt) { // TODO(b/241286431): Choose the pacesetter display. mPacesetterDisplayId = pacesetterIdOpt.value_or(mDisplays.begin()->first); ALOGI("Display %s is the pacesetter", to_string(*mPacesetterDisplayId).c_str()); PhysicalDisplayId pacesetterId) { // TODO: b/241286431 - Choose the pacesetter among mDisplays. mPacesetterDisplayId = pacesetterId; ALOGI("Display %s is the pacesetter", to_string(pacesetterId).c_str()); std::shared_ptr<VsyncSchedule> newVsyncSchedulePtr; if (const auto pacesetterOpt = pacesetterDisplayLocked()) { Loading
services/surfaceflinger/Scheduler/Scheduler.h +5 −8 Original line number Diff line number Diff line Loading @@ -92,8 +92,8 @@ public: void startTimers(); // TODO(b/241285191): Remove this API by promoting pacesetter in onScreen{Acquired,Released}. void setPacesetterDisplay(std::optional<PhysicalDisplayId>) REQUIRES(kMainThreadContext) // TODO: b/241285191 - Remove this API by promoting pacesetter in onScreen{Acquired,Released}. void setPacesetterDisplay(PhysicalDisplayId) REQUIRES(kMainThreadContext) EXCLUDES(mDisplayLock); using RefreshRateSelectorPtr = std::shared_ptr<RefreshRateSelector>; Loading Loading @@ -377,10 +377,8 @@ private: void resyncAllToHardwareVsync(bool allowToEnable) EXCLUDES(mDisplayLock); void setVsyncConfig(const VsyncConfig&, Period vsyncPeriod); // Chooses a pacesetter among the registered displays, unless `pacesetterIdOpt` is specified. // The new `mPacesetterDisplayId` is never `std::nullopt`. void promotePacesetterDisplay(std::optional<PhysicalDisplayId> pacesetterIdOpt = std::nullopt) REQUIRES(kMainThreadContext) EXCLUDES(mDisplayLock); void promotePacesetterDisplay(PhysicalDisplayId pacesetterId) REQUIRES(kMainThreadContext) EXCLUDES(mDisplayLock); // Changes to the displays (e.g. registering and unregistering) must be made // while mDisplayLock is locked, and the new pacesetter then must be promoted while Loading @@ -388,8 +386,7 @@ private: // MessageQueue and EventThread need to use the new pacesetter's // VsyncSchedule, and this must happen while mDisplayLock is *not* locked, // or else we may deadlock with EventThread. std::shared_ptr<VsyncSchedule> promotePacesetterDisplayLocked( std::optional<PhysicalDisplayId> pacesetterIdOpt = std::nullopt) std::shared_ptr<VsyncSchedule> promotePacesetterDisplayLocked(PhysicalDisplayId pacesetterId) REQUIRES(kMainThreadContext, mDisplayLock); void applyNewVsyncSchedule(std::shared_ptr<VsyncSchedule>) EXCLUDES(mDisplayLock); Loading