Loading services/surfaceflinger/Scheduler/Scheduler.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -554,11 +554,12 @@ void Scheduler::onTouchHint() { } } void Scheduler::setDisplayPowerState(bool normal) { void Scheduler::setDisplayPowerMode(hal::PowerMode powerMode) { { std::lock_guard<std::mutex> lock(mPolicyLock); mPolicy.isDisplayPowerStateNormal = normal; mPolicy.displayPowerMode = powerMode; } mVsyncSchedule->getController().setDisplayPowerMode(powerMode); if (mDisplayPowerTimer) { mDisplayPowerTimer->reset(); Loading Loading @@ -706,7 +707,8 @@ auto Scheduler::chooseDisplayMode() -> std::pair<DisplayModePtr, GlobalSignals> // If Display Power is not in normal operation we want to be in performance mode. When coming // back to normal mode, a grace period is given with DisplayPowerTimer. if (mDisplayPowerTimer && (!mPolicy.isDisplayPowerStateNormal || mPolicy.displayPowerTimer == TimerState::Reset)) { (mPolicy.displayPowerMode != hal::PowerMode::ON || mPolicy.displayPowerTimer == TimerState::Reset)) { constexpr GlobalSignals kNoSignals; return {configs->getMaxRefreshRateByPolicy(), kNoSignals}; } Loading services/surfaceflinger/Scheduler/Scheduler.h +2 −2 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ public: // Indicates that touch interaction is taking place. void onTouchHint(); void setDisplayPowerState(bool normal); void setDisplayPowerMode(hal::PowerMode powerMode); VSyncDispatch& getVsyncDispatch() { return mVsyncSchedule->getDispatch(); } Loading Loading @@ -325,7 +325,7 @@ private: TimerState idleTimer = TimerState::Reset; TouchState touch = TouchState::Inactive; TimerState displayPowerTimer = TimerState::Expired; bool isDisplayPowerStateNormal = true; hal::PowerMode displayPowerMode = hal::PowerMode::ON; // Chosen display mode. DisplayModePtr mode; Loading services/surfaceflinger/Scheduler/VSyncReactor.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,11 @@ bool VSyncReactor::periodConfirmed(nsecs_t vsync_timestamp, std::optional<nsecs_ return false; } if (mDisplayPowerMode == hal::PowerMode::DOZE || mDisplayPowerMode == hal::PowerMode::DOZE_SUSPEND) { return true; } if (!mLastHwVsync && !HwcVsyncPeriod) { return false; } Loading Loading @@ -206,6 +211,11 @@ bool VSyncReactor::addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t> return mMoreSamplesNeeded; } void VSyncReactor::setDisplayPowerMode(hal::PowerMode powerMode) { std::scoped_lock lock(mMutex); mDisplayPowerMode = powerMode; } void VSyncReactor::dump(std::string& result) const { std::lock_guard lock(mMutex); StringAppendF(&result, "VsyncReactor in use\n"); Loading services/surfaceflinger/Scheduler/VSyncReactor.h +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public: bool addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod, bool* periodFlushed) final; void setDisplayPowerMode(hal::PowerMode powerMode) final; void dump(std::string& result) const final; private: Loading @@ -73,6 +75,8 @@ private: std::optional<nsecs_t> mPeriodTransitioningTo GUARDED_BY(mMutex); std::optional<nsecs_t> mLastHwVsync GUARDED_BY(mMutex); hal::PowerMode mDisplayPowerMode GUARDED_BY(mMutex) = hal::PowerMode::ON; const bool mSupportKernelIdleTimer = false; }; Loading services/surfaceflinger/Scheduler/VsyncController.h +10 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ #include <cstddef> #include <memory> #include <mutex> #include <DisplayHardware/HWComposer.h> #include <DisplayHardware/Hal.h> #include <ui/FenceTime.h> #include <utils/Mutex.h> #include <utils/RefBase.h> Loading Loading @@ -70,6 +73,13 @@ public: */ virtual void setIgnorePresentFences(bool ignore) = 0; /* * Sets the primary display power mode to the controller. * * \param [in] powerMode */ virtual void setDisplayPowerMode(hal::PowerMode powerMode) = 0; virtual void dump(std::string& result) const = 0; protected: Loading Loading
services/surfaceflinger/Scheduler/Scheduler.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -554,11 +554,12 @@ void Scheduler::onTouchHint() { } } void Scheduler::setDisplayPowerState(bool normal) { void Scheduler::setDisplayPowerMode(hal::PowerMode powerMode) { { std::lock_guard<std::mutex> lock(mPolicyLock); mPolicy.isDisplayPowerStateNormal = normal; mPolicy.displayPowerMode = powerMode; } mVsyncSchedule->getController().setDisplayPowerMode(powerMode); if (mDisplayPowerTimer) { mDisplayPowerTimer->reset(); Loading Loading @@ -706,7 +707,8 @@ auto Scheduler::chooseDisplayMode() -> std::pair<DisplayModePtr, GlobalSignals> // If Display Power is not in normal operation we want to be in performance mode. When coming // back to normal mode, a grace period is given with DisplayPowerTimer. if (mDisplayPowerTimer && (!mPolicy.isDisplayPowerStateNormal || mPolicy.displayPowerTimer == TimerState::Reset)) { (mPolicy.displayPowerMode != hal::PowerMode::ON || mPolicy.displayPowerTimer == TimerState::Reset)) { constexpr GlobalSignals kNoSignals; return {configs->getMaxRefreshRateByPolicy(), kNoSignals}; } Loading
services/surfaceflinger/Scheduler/Scheduler.h +2 −2 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ public: // Indicates that touch interaction is taking place. void onTouchHint(); void setDisplayPowerState(bool normal); void setDisplayPowerMode(hal::PowerMode powerMode); VSyncDispatch& getVsyncDispatch() { return mVsyncSchedule->getDispatch(); } Loading Loading @@ -325,7 +325,7 @@ private: TimerState idleTimer = TimerState::Reset; TouchState touch = TouchState::Inactive; TimerState displayPowerTimer = TimerState::Expired; bool isDisplayPowerStateNormal = true; hal::PowerMode displayPowerMode = hal::PowerMode::ON; // Chosen display mode. DisplayModePtr mode; Loading
services/surfaceflinger/Scheduler/VSyncReactor.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,11 @@ bool VSyncReactor::periodConfirmed(nsecs_t vsync_timestamp, std::optional<nsecs_ return false; } if (mDisplayPowerMode == hal::PowerMode::DOZE || mDisplayPowerMode == hal::PowerMode::DOZE_SUSPEND) { return true; } if (!mLastHwVsync && !HwcVsyncPeriod) { return false; } Loading Loading @@ -206,6 +211,11 @@ bool VSyncReactor::addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t> return mMoreSamplesNeeded; } void VSyncReactor::setDisplayPowerMode(hal::PowerMode powerMode) { std::scoped_lock lock(mMutex); mDisplayPowerMode = powerMode; } void VSyncReactor::dump(std::string& result) const { std::lock_guard lock(mMutex); StringAppendF(&result, "VsyncReactor in use\n"); Loading
services/surfaceflinger/Scheduler/VSyncReactor.h +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public: bool addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod, bool* periodFlushed) final; void setDisplayPowerMode(hal::PowerMode powerMode) final; void dump(std::string& result) const final; private: Loading @@ -73,6 +75,8 @@ private: std::optional<nsecs_t> mPeriodTransitioningTo GUARDED_BY(mMutex); std::optional<nsecs_t> mLastHwVsync GUARDED_BY(mMutex); hal::PowerMode mDisplayPowerMode GUARDED_BY(mMutex) = hal::PowerMode::ON; const bool mSupportKernelIdleTimer = false; }; Loading
services/surfaceflinger/Scheduler/VsyncController.h +10 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ #include <cstddef> #include <memory> #include <mutex> #include <DisplayHardware/HWComposer.h> #include <DisplayHardware/Hal.h> #include <ui/FenceTime.h> #include <utils/Mutex.h> #include <utils/RefBase.h> Loading Loading @@ -70,6 +73,13 @@ public: */ virtual void setIgnorePresentFences(bool ignore) = 0; /* * Sets the primary display power mode to the controller. * * \param [in] powerMode */ virtual void setDisplayPowerMode(hal::PowerMode powerMode) = 0; virtual void dump(std::string& result) const = 0; protected: Loading