author | Tianhua Sun <tianhua.sun@amlogic.com> | 2020-03-24 08:09:02 (GMT) |
---|---|---|
committer | sky zhou <sky.zhou@amlogic.com> | 2020-05-21 12:18:04 (GMT) |
commit | 5aeb8d516e28eda315bc128d0e0cb9dcfc8dfd02 (patch) | |
tree | 43f0fd184bd585540649b08248ac1c4838058fd2 | |
parent | 39bbbb460aa4865daad58a92e0ccc1a2438b1cc0 (diff) | |
download | hwcomposer-5aeb8d516e28eda315bc128d0e0cb9dcfc8dfd02.zip hwcomposer-5aeb8d516e28eda315bc128d0e0cb9dcfc8dfd02.tar.gz hwcomposer-5aeb8d516e28eda315bc128d0e0cb9dcfc8dfd02.tar.bz2 |
hwc: fix update hwc active mode list error [1/1]
PD#SWPL-20483
Problem:
hwc active mode list update error, we should
add default/fake active mode to the tail of list.
and we need keep the list unchanged.
Solution:
remove limiting conditions !isFracRate() when
update active mode list.
Verify:
Verify on newton
Change-Id: I1ac6362fbc3b43cc8761c727a217efad546cd7a4
Signed-off-by: Tianhua Sun <tianhua.sun@amlogic.com>
-rw-r--r-- | hwc2/ActiveModeMgr.cpp | 60 | ||||
-rw-r--r-- | hwc2/ActiveModeMgr.h | 6 |
2 files changed, 26 insertions, 40 deletions
diff --git a/hwc2/ActiveModeMgr.cpp b/hwc2/ActiveModeMgr.cpp index c0e7838..2d6cf78 100644 --- a/hwc2/ActiveModeMgr.cpp +++ b/hwc2/ActiveModeMgr.cpp @@ -168,42 +168,37 @@ bool ActiveModeMgr::isFracRate(float refreshRate) { return refreshRate > floor(refreshRate) ? true : false; } -void ActiveModeMgr::getActiveHwcMeta(const char * activeMode) { - for (auto it = mHwcActiveModes.begin(); it != mHwcActiveModes.end(); ++it) { - if (strncmp(activeMode, it->second.name, DRM_DISPLAY_MODE_LEN) == 0 - && !isFracRate(it->second.refreshRate)) { - mActiveHwcH = it->second.pixelH; - mActiveHwcW = it->second.pixelW; - mActiveHwcRate = it->second.refreshRate; - } - } -} - int32_t ActiveModeMgr::updateHwcDispConfigs() { std::map<uint32_t, drm_mode_info_t> supportedModes; drm_mode_info_t activeMode; mHwcActiveModes.clear(); + mHwcActiveConfigId = -1; MESON_LOGD("ActiveModeMgr::updateHwcDispConfigs()"); + mConnector->getModes(supportedModes); if (mCrtc->getMode(activeMode) != 0) { activeMode = mDefaultMode; } mActiveConfigStr = activeMode.name; + for (auto it = supportedModes.begin(); it != supportedModes.end(); ++it) { - // skip default / fake active mode as we add it to the end - if (!strncmp(activeMode.name, it->second.name, DRM_DISPLAY_MODE_LEN) - && activeMode.refreshRate == it->second.refreshRate - && !isFracRate(activeMode.refreshRate)) { + MESON_LOGV("[%s]: add Hwc modes %s.", __func__, it->second.name); + mHwcActiveModes.emplace(mHwcActiveModes.size(), it->second); + + if (!strncmp(activeMode.name, it->second.name, DRM_DISPLAY_MODE_LEN) && + activeMode.refreshRate == it->second.refreshRate) { + mHwcActiveConfigId = mHwcActiveModes.size() - 1; mActiveConfigStr = activeMode.name; - } else { - MESON_LOGV("[%s]: add Hwc modes %s.", __func__, activeMode.name); - mHwcActiveModes.emplace(mHwcActiveModes.size(), it->second); } } - mHwcActiveModes.emplace(mHwcActiveModes.size(), activeMode); mConnector->setMode(activeMode); - mHwcActiveConfigId = mHwcActiveModes.size() - 1; + + if (mHwcActiveModes.empty()) { + mHwcActiveModes.emplace(mHwcActiveModes.size(), mDefaultMode); + mHwcActiveConfigId = mHwcActiveModes.size() - 1; + } + MESON_LOGD("[%s]: updateHwcDispConfigs Hwc active modes %s. refreshRate %f", __func__, activeMode.name, activeMode.refreshRate); return HWC2_ERROR_NONE; @@ -212,6 +207,7 @@ int32_t ActiveModeMgr::updateHwcDispConfigs() { int32_t ActiveModeMgr::updateSfDispConfigs() { // clear display modes mSfActiveModes.clear(); + mSfActiveConfigId = -1; std::map<uint32_t, drm_mode_info_t> mTmpModes; mTmpModes = mHwcActiveModes; @@ -242,25 +238,21 @@ int32_t ActiveModeMgr::updateSfDispConfigs() { } } - getActiveHwcMeta(mActiveConfigStr.c_str()); - for (tmpIt = tmpList.begin(); tmpIt != tmpList.end(); ++tmpIt) { - drm_mode_info_t config = tmpIt->second; - float cRate = config.refreshRate; - //judge whether it is the current display mode and add it to the end of the SF list - if ((cRate != mActiveHwcRate)) { - mSfActiveModes.emplace(mSfActiveModes.size(), tmpIt->second); - } else { - MESON_LOGD("curMode: %s", mActiveConfigStr.c_str()); + mSfActiveModes.emplace(mSfActiveModes.size(), tmpIt->second); + + auto it = mHwcActiveModes.find(mHwcActiveConfigId); + if (it != mHwcActiveModes.end()) { + if (!strncmp(it->second.name, tmpIt->second.name, DRM_DISPLAY_MODE_LEN) + && it->second.refreshRate == tmpIt->second.refreshRate) { + mSfActiveConfigId = mSfActiveModes.size() - 1; + MESON_LOGD("curMode: %s", mActiveConfigStr.c_str()); + } } } - auto it = mHwcActiveModes.find(mHwcActiveConfigId); - if (it != mHwcActiveModes.end()) { - mSfActiveModes.emplace(mSfActiveModes.size(), it->second); - } MESON_LOGD("update Sf list with no default mode done, size (%zu)", mSfActiveModes.size()); - mSfActiveConfigId = mSfActiveModes.size() - 1; + mFakeConfigId = mSfActiveConfigId; return HWC2_ERROR_NONE; } diff --git a/hwc2/ActiveModeMgr.h b/hwc2/ActiveModeMgr.h index cd1c570..fb1c2c7 100644 --- a/hwc2/ActiveModeMgr.h +++ b/hwc2/ActiveModeMgr.h @@ -49,7 +49,6 @@ protected: int32_t updateSfDispConfigs(); int32_t updateHwcActiveConfig(const char * activeMode); int32_t updateSfActiveConfig(uint32_t config, drm_mode_info_t cfg); - void getActiveHwcMeta(const char * activeMode); bool isFracRate(float refreshRate); void reset(); const drm_mode_info_t findMatchedMode( @@ -63,11 +62,6 @@ protected: uint32_t mFbWidth; uint32_t mFbHeight; - //for activeHwc w&h&refresh rate - uint32_t mActiveHwcW; - uint32_t mActiveHwcH; - float mActiveHwcRate; - bool mIsInit; // first boot flag bool mExtModeSet; // setActiveConfig() flag bool mDefaultModeSupport; |