Loading services/surfaceflinger/DisplayHardware/HWC2.cpp +0 −14 Original line number Original line Diff line number Diff line Loading @@ -184,7 +184,6 @@ void Device::onHotplug(hwc2_display_t displayId, Connection connection) { auto newDisplay = std::make_unique<Display>( auto newDisplay = std::make_unique<Display>( *mComposer.get(), mPowerAdvisor, mCapabilities, displayId, displayType); *mComposer.get(), mPowerAdvisor, mCapabilities, displayId, displayType); newDisplay->setFrequencyScaleParameters(mFrequencyScaler); newDisplay->setConnected(true); newDisplay->setConnected(true); mDisplays.emplace(displayId, std::move(newDisplay)); mDisplays.emplace(displayId, std::move(newDisplay)); } else if (connection == Connection::Disconnected) { } else if (connection == Connection::Disconnected) { Loading Loading @@ -224,14 +223,6 @@ Error Device::flushCommands() return static_cast<Error>(mComposer->executeCommands()); return static_cast<Error>(mComposer->executeCommands()); } } void Device::setDisplayFrequencyScaleParameters(Device::FrequencyScaler frequencyScaler) { mFrequencyScaler = frequencyScaler; } Device::FrequencyScaler Device::getDisplayFrequencyScaleParameters() { return mFrequencyScaler; } // Display methods // Display methods Display::Display(android::Hwc2::Composer& composer, android::Hwc2::PowerAdvisor& advisor, Display::Display(android::Hwc2::Composer& composer, android::Hwc2::PowerAdvisor& advisor, Loading Loading @@ -271,7 +262,6 @@ Display::Config::Config(Display& display, hwc2_config_t id) mWidth(-1), mWidth(-1), mHeight(-1), mHeight(-1), mVsyncPeriod(-1), mVsyncPeriod(-1), mFrequencyScaler(display.mFrequencyScaler), mDpiX(-1), mDpiX(-1), mDpiY(-1) {} mDpiY(-1) {} Loading Loading @@ -711,10 +701,6 @@ void Display::setConnected(bool connected) { mIsConnected = connected; mIsConnected = connected; } } void Display::setFrequencyScaleParameters(Device::FrequencyScaler frequencyScaler) { mFrequencyScaler = frequencyScaler; } int32_t Display::getAttribute(hwc2_config_t configId, Attribute attribute) int32_t Display::getAttribute(hwc2_config_t configId, Attribute attribute) { { int32_t value = 0; int32_t value = 0; Loading services/surfaceflinger/DisplayHardware/HWC2.h +9 −13 Original line number Original line Diff line number Diff line Loading @@ -85,11 +85,6 @@ class Device public: public: explicit Device(std::unique_ptr<android::Hwc2::Composer> composer); explicit Device(std::unique_ptr<android::Hwc2::Composer> composer); struct FrequencyScaler { int32_t multiplier = 1; int32_t divisor = 1; }; void registerCallback(ComposerCallback* callback, int32_t sequenceId); void registerCallback(ComposerCallback* callback, int32_t sequenceId); // Required by HWC2 // Required by HWC2 Loading Loading @@ -121,9 +116,6 @@ public: // This method provides an explicit way to flush state changes to HWC. // This method provides an explicit way to flush state changes to HWC. Error flushCommands(); Error flushCommands(); void setDisplayFrequencyScaleParameters(FrequencyScaler frequecyScaler); FrequencyScaler getDisplayFrequencyScaleParameters(); private: private: // Initialization methods // Initialization methods Loading @@ -134,7 +126,6 @@ private: std::unordered_set<Capability> mCapabilities; std::unordered_set<Capability> mCapabilities; std::unordered_map<hwc2_display_t, std::unique_ptr<Display>> mDisplays; std::unordered_map<hwc2_display_t, std::unique_ptr<Display>> mDisplays; android::Hwc2::impl::PowerAdvisor mPowerAdvisor; android::Hwc2::impl::PowerAdvisor mPowerAdvisor; FrequencyScaler mFrequencyScaler; bool mRegisteredCallback = false; bool mRegisteredCallback = false; }; }; Loading Loading @@ -170,6 +161,8 @@ public: } } Builder& setVsyncPeriod(int32_t vsyncPeriod) { Builder& setVsyncPeriod(int32_t vsyncPeriod) { mConfig->mVsyncPeriod = vsyncPeriod; mConfig->mVsyncPeriod = vsyncPeriod; mConfig->mPeriodMultiplier = 1; mConfig->mPeriodDivisor = 1; return *this; return *this; } } Builder& setDpiX(int32_t dpiX) { Builder& setDpiX(int32_t dpiX) { Loading Loading @@ -200,7 +193,11 @@ public: int32_t getWidth() const { return mWidth; } int32_t getWidth() const { return mWidth; } int32_t getHeight() const { return mHeight; } int32_t getHeight() const { return mHeight; } nsecs_t getVsyncPeriod() const { nsecs_t getVsyncPeriod() const { return mVsyncPeriod * mFrequencyScaler.multiplier / mFrequencyScaler.divisor; } return mVsyncPeriod * mPeriodMultiplier / mPeriodDivisor; } void scalePanelFrequency(int32_t multiplier, int32_t divisor) const { mPeriodMultiplier = multiplier; mPeriodDivisor = divisor; } float getDpiX() const { return mDpiX; } float getDpiX() const { return mDpiX; } float getDpiY() const { return mDpiY; } float getDpiY() const { return mDpiY; } Loading @@ -213,7 +210,8 @@ public: int32_t mWidth; int32_t mWidth; int32_t mHeight; int32_t mHeight; nsecs_t mVsyncPeriod; nsecs_t mVsyncPeriod; Device::FrequencyScaler mFrequencyScaler; mutable int32_t mPeriodMultiplier; mutable int32_t mPeriodDivisor; float mDpiX; float mDpiX; float mDpiY; float mDpiY; }; }; Loading Loading @@ -281,7 +279,6 @@ public: hwc2_display_t getId() const { return mId; } hwc2_display_t getId() const { return mId; } bool isConnected() const { return mIsConnected; } bool isConnected() const { return mIsConnected; } void setConnected(bool connected); // For use by Device only void setConnected(bool connected); // For use by Device only void setFrequencyScaleParameters(Device::FrequencyScaler frequencyScaler); private: private: int32_t getAttribute(hwc2_config_t configId, Attribute attribute); int32_t getAttribute(hwc2_config_t configId, Attribute attribute); Loading @@ -306,7 +303,6 @@ private: hwc2_display_t mId; hwc2_display_t mId; bool mIsConnected; bool mIsConnected; DisplayType mType; DisplayType mType; Device::FrequencyScaler mFrequencyScaler; std::unordered_map<hwc2_layer_t, std::unique_ptr<Layer>> mLayers; std::unordered_map<hwc2_layer_t, std::unique_ptr<Layer>> mLayers; std::unordered_map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs; std::unordered_map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs; }; }; Loading services/surfaceflinger/DisplayHardware/HWComposer.cpp +0 −11 Original line number Original line Diff line number Diff line Loading @@ -814,15 +814,4 @@ HWComposer::getHwcDisplayId(int32_t displayId) const { return mDisplayData[displayId].hwcDisplay->getId(); return mDisplayData[displayId].hwcDisplay->getId(); } } void HWComposer::setDisplayFrequencyScaleParameters( HWC2::Device::FrequencyScaler frequencyScaler) { mHwcDevice->setDisplayFrequencyScaleParameters(frequencyScaler); } HWC2::Device::FrequencyScaler HWComposer::getDisplayFrequencyScaleParameters() { return mHwcDevice->getDisplayFrequencyScaleParameters(); } } // namespace android } // namespace android services/surfaceflinger/DisplayHardware/HWComposer.h +0 −8 Original line number Original line Diff line number Diff line Loading @@ -186,14 +186,6 @@ public: android::Hwc2::Composer* getComposer() const { return mHwcDevice->getComposer(); } android::Hwc2::Composer* getComposer() const { return mHwcDevice->getComposer(); } std::optional<hwc2_display_t> getHwcDisplayId(int32_t displayId) const; std::optional<hwc2_display_t> getHwcDisplayId(int32_t displayId) const; // ------------------------------------------------------------------------ // These functions set and get the frequencyScaler. The frequencyScaler holds // a multiplier and divisor for virtually scaling the panel frequency in // software. This is used to simulate different panel frequencies when // panel hardware is not available. void setDisplayFrequencyScaleParameters(HWC2::Device::FrequencyScaler frequencyScaler); HWC2::Device::FrequencyScaler getDisplayFrequencyScaleParameters(); private: private: // For unit tests // For unit tests friend TestableSurfaceFlinger; friend TestableSurfaceFlinger; Loading services/surfaceflinger/Scheduler/DispSync.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -526,18 +526,16 @@ void DispSync::setPeriod(nsecs_t period) { mThread->updateModel(mPeriod, mPhase, mReferenceTime); mThread->updateModel(mPeriod, mPhase, mReferenceTime); } } void DispSync::scalePeriod(HWC2::Device::FrequencyScaler frequencyScaler) { void DispSync::scalePeriod(uint32_t multiplier, uint32_t divisor) { Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); // if only 1 of the properties is updated, we will get to this // if only 1 of the properties is updated, we will get to this // point "attempting" to set the scale to 1 when it is already // point "attempting" to set the scale to 1 when it is already // 1. Check that special case so that we don't do a useless // 1. Check that special case so that we don't do a useless // update of the model. // update of the model. if ((frequencyScaler.multiplier == 1) && if ((multiplier == 1) && (divisor == 1) && (mPeriod == mPeriodBase)) return; (frequencyScaler.divisor == 1) && (mPeriod == mPeriodBase)) return; mPeriod = mPeriodBase * frequencyScaler.multiplier / frequencyScaler.divisor; mPeriod = mPeriodBase * multiplier / divisor; mThread->updateModel(mPeriod, mPhase, mReferenceTime); mThread->updateModel(mPeriod, mPhase, mReferenceTime); } } Loading Loading
services/surfaceflinger/DisplayHardware/HWC2.cpp +0 −14 Original line number Original line Diff line number Diff line Loading @@ -184,7 +184,6 @@ void Device::onHotplug(hwc2_display_t displayId, Connection connection) { auto newDisplay = std::make_unique<Display>( auto newDisplay = std::make_unique<Display>( *mComposer.get(), mPowerAdvisor, mCapabilities, displayId, displayType); *mComposer.get(), mPowerAdvisor, mCapabilities, displayId, displayType); newDisplay->setFrequencyScaleParameters(mFrequencyScaler); newDisplay->setConnected(true); newDisplay->setConnected(true); mDisplays.emplace(displayId, std::move(newDisplay)); mDisplays.emplace(displayId, std::move(newDisplay)); } else if (connection == Connection::Disconnected) { } else if (connection == Connection::Disconnected) { Loading Loading @@ -224,14 +223,6 @@ Error Device::flushCommands() return static_cast<Error>(mComposer->executeCommands()); return static_cast<Error>(mComposer->executeCommands()); } } void Device::setDisplayFrequencyScaleParameters(Device::FrequencyScaler frequencyScaler) { mFrequencyScaler = frequencyScaler; } Device::FrequencyScaler Device::getDisplayFrequencyScaleParameters() { return mFrequencyScaler; } // Display methods // Display methods Display::Display(android::Hwc2::Composer& composer, android::Hwc2::PowerAdvisor& advisor, Display::Display(android::Hwc2::Composer& composer, android::Hwc2::PowerAdvisor& advisor, Loading Loading @@ -271,7 +262,6 @@ Display::Config::Config(Display& display, hwc2_config_t id) mWidth(-1), mWidth(-1), mHeight(-1), mHeight(-1), mVsyncPeriod(-1), mVsyncPeriod(-1), mFrequencyScaler(display.mFrequencyScaler), mDpiX(-1), mDpiX(-1), mDpiY(-1) {} mDpiY(-1) {} Loading Loading @@ -711,10 +701,6 @@ void Display::setConnected(bool connected) { mIsConnected = connected; mIsConnected = connected; } } void Display::setFrequencyScaleParameters(Device::FrequencyScaler frequencyScaler) { mFrequencyScaler = frequencyScaler; } int32_t Display::getAttribute(hwc2_config_t configId, Attribute attribute) int32_t Display::getAttribute(hwc2_config_t configId, Attribute attribute) { { int32_t value = 0; int32_t value = 0; Loading
services/surfaceflinger/DisplayHardware/HWC2.h +9 −13 Original line number Original line Diff line number Diff line Loading @@ -85,11 +85,6 @@ class Device public: public: explicit Device(std::unique_ptr<android::Hwc2::Composer> composer); explicit Device(std::unique_ptr<android::Hwc2::Composer> composer); struct FrequencyScaler { int32_t multiplier = 1; int32_t divisor = 1; }; void registerCallback(ComposerCallback* callback, int32_t sequenceId); void registerCallback(ComposerCallback* callback, int32_t sequenceId); // Required by HWC2 // Required by HWC2 Loading Loading @@ -121,9 +116,6 @@ public: // This method provides an explicit way to flush state changes to HWC. // This method provides an explicit way to flush state changes to HWC. Error flushCommands(); Error flushCommands(); void setDisplayFrequencyScaleParameters(FrequencyScaler frequecyScaler); FrequencyScaler getDisplayFrequencyScaleParameters(); private: private: // Initialization methods // Initialization methods Loading @@ -134,7 +126,6 @@ private: std::unordered_set<Capability> mCapabilities; std::unordered_set<Capability> mCapabilities; std::unordered_map<hwc2_display_t, std::unique_ptr<Display>> mDisplays; std::unordered_map<hwc2_display_t, std::unique_ptr<Display>> mDisplays; android::Hwc2::impl::PowerAdvisor mPowerAdvisor; android::Hwc2::impl::PowerAdvisor mPowerAdvisor; FrequencyScaler mFrequencyScaler; bool mRegisteredCallback = false; bool mRegisteredCallback = false; }; }; Loading Loading @@ -170,6 +161,8 @@ public: } } Builder& setVsyncPeriod(int32_t vsyncPeriod) { Builder& setVsyncPeriod(int32_t vsyncPeriod) { mConfig->mVsyncPeriod = vsyncPeriod; mConfig->mVsyncPeriod = vsyncPeriod; mConfig->mPeriodMultiplier = 1; mConfig->mPeriodDivisor = 1; return *this; return *this; } } Builder& setDpiX(int32_t dpiX) { Builder& setDpiX(int32_t dpiX) { Loading Loading @@ -200,7 +193,11 @@ public: int32_t getWidth() const { return mWidth; } int32_t getWidth() const { return mWidth; } int32_t getHeight() const { return mHeight; } int32_t getHeight() const { return mHeight; } nsecs_t getVsyncPeriod() const { nsecs_t getVsyncPeriod() const { return mVsyncPeriod * mFrequencyScaler.multiplier / mFrequencyScaler.divisor; } return mVsyncPeriod * mPeriodMultiplier / mPeriodDivisor; } void scalePanelFrequency(int32_t multiplier, int32_t divisor) const { mPeriodMultiplier = multiplier; mPeriodDivisor = divisor; } float getDpiX() const { return mDpiX; } float getDpiX() const { return mDpiX; } float getDpiY() const { return mDpiY; } float getDpiY() const { return mDpiY; } Loading @@ -213,7 +210,8 @@ public: int32_t mWidth; int32_t mWidth; int32_t mHeight; int32_t mHeight; nsecs_t mVsyncPeriod; nsecs_t mVsyncPeriod; Device::FrequencyScaler mFrequencyScaler; mutable int32_t mPeriodMultiplier; mutable int32_t mPeriodDivisor; float mDpiX; float mDpiX; float mDpiY; float mDpiY; }; }; Loading Loading @@ -281,7 +279,6 @@ public: hwc2_display_t getId() const { return mId; } hwc2_display_t getId() const { return mId; } bool isConnected() const { return mIsConnected; } bool isConnected() const { return mIsConnected; } void setConnected(bool connected); // For use by Device only void setConnected(bool connected); // For use by Device only void setFrequencyScaleParameters(Device::FrequencyScaler frequencyScaler); private: private: int32_t getAttribute(hwc2_config_t configId, Attribute attribute); int32_t getAttribute(hwc2_config_t configId, Attribute attribute); Loading @@ -306,7 +303,6 @@ private: hwc2_display_t mId; hwc2_display_t mId; bool mIsConnected; bool mIsConnected; DisplayType mType; DisplayType mType; Device::FrequencyScaler mFrequencyScaler; std::unordered_map<hwc2_layer_t, std::unique_ptr<Layer>> mLayers; std::unordered_map<hwc2_layer_t, std::unique_ptr<Layer>> mLayers; std::unordered_map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs; std::unordered_map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs; }; }; Loading
services/surfaceflinger/DisplayHardware/HWComposer.cpp +0 −11 Original line number Original line Diff line number Diff line Loading @@ -814,15 +814,4 @@ HWComposer::getHwcDisplayId(int32_t displayId) const { return mDisplayData[displayId].hwcDisplay->getId(); return mDisplayData[displayId].hwcDisplay->getId(); } } void HWComposer::setDisplayFrequencyScaleParameters( HWC2::Device::FrequencyScaler frequencyScaler) { mHwcDevice->setDisplayFrequencyScaleParameters(frequencyScaler); } HWC2::Device::FrequencyScaler HWComposer::getDisplayFrequencyScaleParameters() { return mHwcDevice->getDisplayFrequencyScaleParameters(); } } // namespace android } // namespace android
services/surfaceflinger/DisplayHardware/HWComposer.h +0 −8 Original line number Original line Diff line number Diff line Loading @@ -186,14 +186,6 @@ public: android::Hwc2::Composer* getComposer() const { return mHwcDevice->getComposer(); } android::Hwc2::Composer* getComposer() const { return mHwcDevice->getComposer(); } std::optional<hwc2_display_t> getHwcDisplayId(int32_t displayId) const; std::optional<hwc2_display_t> getHwcDisplayId(int32_t displayId) const; // ------------------------------------------------------------------------ // These functions set and get the frequencyScaler. The frequencyScaler holds // a multiplier and divisor for virtually scaling the panel frequency in // software. This is used to simulate different panel frequencies when // panel hardware is not available. void setDisplayFrequencyScaleParameters(HWC2::Device::FrequencyScaler frequencyScaler); HWC2::Device::FrequencyScaler getDisplayFrequencyScaleParameters(); private: private: // For unit tests // For unit tests friend TestableSurfaceFlinger; friend TestableSurfaceFlinger; Loading
services/surfaceflinger/Scheduler/DispSync.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -526,18 +526,16 @@ void DispSync::setPeriod(nsecs_t period) { mThread->updateModel(mPeriod, mPhase, mReferenceTime); mThread->updateModel(mPeriod, mPhase, mReferenceTime); } } void DispSync::scalePeriod(HWC2::Device::FrequencyScaler frequencyScaler) { void DispSync::scalePeriod(uint32_t multiplier, uint32_t divisor) { Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); // if only 1 of the properties is updated, we will get to this // if only 1 of the properties is updated, we will get to this // point "attempting" to set the scale to 1 when it is already // point "attempting" to set the scale to 1 when it is already // 1. Check that special case so that we don't do a useless // 1. Check that special case so that we don't do a useless // update of the model. // update of the model. if ((frequencyScaler.multiplier == 1) && if ((multiplier == 1) && (divisor == 1) && (mPeriod == mPeriodBase)) return; (frequencyScaler.divisor == 1) && (mPeriod == mPeriodBase)) return; mPeriod = mPeriodBase * frequencyScaler.multiplier / frequencyScaler.divisor; mPeriod = mPeriodBase * multiplier / divisor; mThread->updateModel(mPeriod, mPhase, mReferenceTime); mThread->updateModel(mPeriod, mPhase, mReferenceTime); } } Loading