author | baocheng sun <baocheng.sun@amlogic.com> | 2019-11-11 07:01:17 (GMT) |
---|---|---|
committer | sky zhou <sky.zhou@amlogic.com> | 2020-05-21 11:52:20 (GMT) |
commit | c8d6b4104d80cea5ff04966e2a9154e5747192a8 (patch) | |
tree | b861561025058c2338bc0114338e972eae802a41 | |
parent | 97285ba4f268891766a3fcca2b61a19c9fa72790 (diff) | |
download | hwcomposer-c8d6b4104d80cea5ff04966e2a9154e5747192a8.zip hwcomposer-c8d6b4104d80cea5ff04966e2a9154e5747192a8.tar.gz hwcomposer-c8d6b4104d80cea5ff04966e2a9154e5747192a8.tar.bz2 |
HWC: support display dynamic modes [1/4]
PD#SWPL-19399
Problem:
return real display resolution config
Solution:
Add realModeMgr to Support display dynamic modes. Now by default
only return one real mode. If need support mode lists, please
set HWC_SUPPORT_MODES_LIST in BoardConfig.
Verify:
Newton
Change-Id: Ie8dd192e9964a550bda1d802271b2d7ecf83d481
Signed-off-by: baocheng sun <baocheng.sun@amlogic.com>
-rw-r--r-- | hwc2/Hwc2Display.cpp | 19 | ||||
-rw-r--r-- | hwc2/Hwc2Display.h | 2 | ||||
-rw-r--r-- | hwc2/MesonHwc2.cpp | 10 | ||||
-rw-r--r-- | hwc2/RealModeMgr.cpp | 42 |
4 files changed, 37 insertions, 36 deletions
diff --git a/hwc2/Hwc2Display.cpp b/hwc2/Hwc2Display.cpp index f2aea08..45a82d5 100644 --- a/hwc2/Hwc2Display.cpp +++ b/hwc2/Hwc2Display.cpp @@ -318,7 +318,8 @@ void Hwc2Display::onModeChanged(int stage) { } else { /*Workaround: needed for NTS test.*/ if (HwcConfig::primaryHotplugEnabled() - && mModeMgr->getPolicyType() == FIXED_SIZE_POLICY) { + && (mModeMgr->getPolicyType() == FIXED_SIZE_POLICY || + mModeMgr->getPolicyType() == REAL_MODE_POLICY)) { bSendPlugIn = true; } else if (mModeMgr->getPolicyType() == ACTIVE_MODE_POLICY) { bSendPlugIn = true; @@ -1019,6 +1020,21 @@ bool Hwc2Display::isPlaneHideForDebug(int id) { return false; } +hwc2_error_t Hwc2Display::getDisplayCapabilities( + uint32_t* outNumCapabilities, uint32_t* outCapabilities) { + if (outCapabilities == nullptr) { + if (mConnector->isConnected() == false) + *outNumCapabilities = 1; + else + *outNumCapabilities = 0; + } else { + if (mConnector->isConnected() == false && *outNumCapabilities == 1) { + outCapabilities[0] = HWC2_DISPLAY_CAPABILITY_INVALID; + } + } + return HWC2_ERROR_NONE; +} + void Hwc2Display::dumpPresentLayers(String8 & dumpstr) { dumpstr.append("----------------------------------------------------------" "-----------------------------------\n"); @@ -1066,7 +1082,6 @@ void Hwc2Display::dumpHwDisplayPlane(String8 &dumpstr) { std::shared_ptr<HwDisplayPlane> plane = *it; if (!strncmp("OSD", plane->getName(), 3)) { plane->dump(dumpstr); - break; } } dumpstr.append("------------------------------------------------------------" diff --git a/hwc2/Hwc2Display.h b/hwc2/Hwc2Display.h index 5711060..e70c24e 100644 --- a/hwc2/Hwc2Display.h +++ b/hwc2/Hwc2Display.h @@ -96,6 +96,8 @@ public: virtual hwc2_error_t setCalibrateInfo(int32_t caliX,int32_t caliY,int32_t caliW,int32_t caliH); virtual int32_t getDisplayIdentificationData(uint32_t &outPort, std::vector<uint8_t> &outData); + virtual hwc2_error_t getDisplayCapabilities( + uint32_t* outNumCapabilities, uint32_t* outCapabilities); /*HwcDisplay interface*/ public: diff --git a/hwc2/MesonHwc2.cpp b/hwc2/MesonHwc2.cpp index 9b6f476..96142b3 100644 --- a/hwc2/MesonHwc2.cpp +++ b/hwc2/MesonHwc2.cpp @@ -571,15 +571,7 @@ int32_t MesonHwc2::getDisplayIdentificationData(hwc2_display_t display, uint8_t* int32_t MesonHwc2::getDisplayCapabilities(hwc2_display_t display, uint32_t* outNumCapabilities, uint32_t* outCapabilities) { GET_HWC_DISPLAY(display); - if (outCapabilities == nullptr) { - *outNumCapabilities = 1; - } else { - if (*outNumCapabilities != 1) { - return HWC2_ERROR_BAD_PARAMETER; - } - outCapabilities[0] = HWC2_DISPLAY_CAPABILITY_INVALID; - } - return HWC2_ERROR_NONE; + return hwcDisplay->getDisplayCapabilities(outNumCapabilities, outCapabilities); } int32_t MesonHwc2::getDisplayBrightnessSupport(hwc2_display_t display, bool* outSupport) { diff --git a/hwc2/RealModeMgr.cpp b/hwc2/RealModeMgr.cpp index 7bc4d4d..c33b389 100644 --- a/hwc2/RealModeMgr.cpp +++ b/hwc2/RealModeMgr.cpp @@ -20,8 +20,8 @@ static const drm_mode_info_t defaultMode = { .name = "null", .dpiX = DEFUALT_DPI, .dpiY = DEFUALT_DPI, - .pixelW = 1920, - .pixelH = 1080, + .pixelW = 720, + .pixelH = 480, .refreshRate = DEFAULT_REFRESH_RATE, }; @@ -76,6 +76,10 @@ int32_t RealModeMgr::update() { drm_mode_info_t realMode; std::map<uint32_t, drm_mode_info_t> supportModes; +#ifdef HWC_SUPPORT_MODES_LIST + /* reset ModeList */ + reset(); +#endif if (mConnector->isConnected()) { std::lock_guard<std::mutex> lock(mMutex); mConnector->getModes(supportModes); @@ -85,35 +89,23 @@ int32_t RealModeMgr::update() { useFakeMode = false; } } - if (useFakeMode) { - mCurMode = defaultMode; - } #ifdef HWC_SUPPORT_MODES_LIST - reset(); for (auto it = supportModes.begin(); it != supportModes.end(); it++) { - if (!strncmp(mCurMode.name, it->second.name, DRM_DISPLAY_MODE_LEN) - && mCurMode.refreshRate == it->second.refreshRate) { - if (useFakeMode) { - mCurMode.dpiX = it->second.dpiX; - mCurMode.dpiY = it->second.dpiY; - } - mModes.emplace(mModes.size(), mCurMode); - } else { - mModes.emplace(mModes.size(), it->second); - } + mModes.emplace(mModes.size(), it->second); } +#endif + } - if (useFakeMode) { - mModes.emplace(mModes.size(), mCurMode); - } - updateActiveConfig(mCurMode.name); + if (useFakeMode) { + mCurMode = defaultMode; +#ifdef HWC_SUPPORT_MODES_LIST + mModes.emplace(mModes.size(), mCurMode); #endif } -#ifndef HWC_SUPPORT_MODES_LIST - if (useFakeMode) - mCurMode = defaultMode; +#ifdef HWC_SUPPORT_MODES_LIST + updateActiveConfig(mCurMode.name); #endif return HWC2_ERROR_NONE; @@ -161,10 +153,10 @@ int32_t RealModeMgr::getDisplayAttribute( #endif switch (attribute) { case HWC2_ATTRIBUTE_WIDTH: - *outValue = curMode.pixelW > mHwcFbWidth ? mHwcFbWidth : curMode.pixelW; + *outValue = curMode.pixelW; break; case HWC2_ATTRIBUTE_HEIGHT: - *outValue = curMode.pixelH > mHwcFbHeight ? mHwcFbHeight : curMode.pixelH; + *outValue = curMode.pixelH; break; case HWC2_ATTRIBUTE_VSYNC_PERIOD: if (HwcConfig::isHeadlessMode()) { |