author | baocheng sun <baocheng.sun@amlogic.com> | 2020-04-27 08:30:11 (GMT) |
---|---|---|
committer | sky zhou <sky.zhou@amlogic.com> | 2020-05-21 12:18:33 (GMT) |
commit | 248ba809554004e5c60db4ccd0800f1884454910 (patch) | |
tree | c1a34a3853c21d2ea4a5cdb1792f9e8700e6763c | |
parent | 5aeb8d516e28eda315bc128d0e0cb9dcfc8dfd02 (diff) | |
download | hwcomposer-248ba809554004e5c60db4ccd0800f1884454910.zip hwcomposer-248ba809554004e5c60db4ccd0800f1884454910.tar.gz hwcomposer-248ba809554004e5c60db4ccd0800f1884454910.tar.bz2 |
hwc: handle vpu scale limit [1/1]
PD#SWPL-24198
Problem:
When enter PIP, there will be a flash line at the bottom of the TV.
Solution:
handle vpu sclae limit.
For non afbc osd layers, VPU only support composed 2 layers.
For afbc layers, when displayFrame_height < expect_height,
and expect_height = sourceFrame_height/3 * 1.1
then VPU only support composed 2 layers.
Verify:
franklin
Change-Id: Icd8ab41b627cd7912891ab1fef99157135a1ab3d
Signed-off-by: baocheng sun <baocheng.sun@amlogic.com>
-rw-r--r-- | composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp | 67 | ||||
-rw-r--r-- | composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h | 1 |
2 files changed, 68 insertions, 0 deletions
diff --git a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp index e6e38a9..8194495 100644 --- a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp +++ b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp @@ -35,6 +35,8 @@ #define OSD_SCALER_INPUT_MAX_WIDTH (1920) #define OSD_SCALER_INPUT_MAX_HEIGH (1080) +#define OSD_SCALER_INPUT_FACTOR (3.0) +#define OSD_SCALER_INPUT_MARGIN (1.1) #define DI_VIDEO_COMPOSE_MAX 2 @@ -645,6 +647,69 @@ void MultiplanesWithDiComposition::handleOverlayVideoZorder() { } /* + * Scale Limitation: + * 1. VPU only support composed 2 non afbc osd layers + * 2. For afbc layers, exp_h = SourceFrame_height * 1/3 * 1.1; + * when DisplayFrame_height < exp_h then only support two layers. + */ +void MultiplanesWithDiComposition::handleVPUScaleLimit() { + uint32_t nonAfbcFbsNumb = 0; + uint32_t limitCount = 0; + + int belowClientNum = 0; + int upClientNum = 0; + int insideClientNum = 0; + + std::shared_ptr<DrmFramebuffer> fb; + for (auto fbIt = mFramebuffers.begin(); fbIt != mFramebuffers.end(); ++fbIt) { + fb = fbIt->second; + float expHeight = (fb->mSourceCrop.bottom - fb->mSourceCrop.top) * + OSD_SCALER_INPUT_MARGIN / OSD_SCALER_INPUT_FACTOR; + float dispHeight = fb->mDisplayFrame.bottom -fb->mDisplayFrame.top; + + /* osdComposed layers */ + if (fb->mZorder < mMinComposerZorder || fb->mZorder > mMaxComposerZorder) { + /* it is non afbc layer */ + if (am_gralloc_get_vpu_afbc_mask(fb->mBufferHandle) == 0) { + nonAfbcFbsNumb++; + } + + if (expHeight > dispHeight) { + limitCount++; + + if (fb->mZorder > mMaxComposerZorder) + upClientNum++; + else + belowClientNum++; + } + } else { + insideClientNum++; + } + } + + /* minus one layer for VPU composer */ + if (limitCount >= 2 || nonAfbcFbsNumb > 2) { + if (upClientNum > 0) { + auto fbIt = mFramebuffers.upper_bound(mMaxComposerZorder); + if (fbIt != mFramebuffers.end()) + mMaxComposerZorder = fbIt->second->mZorder; + } else if (belowClientNum > 0) { + if (mMinComposerZorder == INVALID_ZORDER) { + /* free to select one */ + mMinComposerZorder = mFramebuffers.begin()->second->mZorder; + mMaxComposerZorder = mMinComposerZorder; + } else { + auto fbIt = mFramebuffers.lower_bound(mMinComposerZorder); + if (fbIt != mFramebuffers.begin() && fbIt != mFramebuffers.end()) { + fbIt--; + mMinComposerZorder = fbIt->second->mZorder; + } + } + } + } +} + +/* Limitation: 1. scale input should smaller than 1080P. 2. din0 should input the base fb. @@ -656,6 +721,8 @@ void MultiplanesWithDiComposition::handleVPULimit(bool video) { if (mFramebuffers.size() == 0) return ; + handleVPUScaleLimit(); + if (mMaxComposerZorder != INVALID_ZORDER && mMinComposerZorder != INVALID_ZORDER) { /*will use compose fb as reffb.*/ diff --git a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h index a5e20ae..504d126 100644 --- a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h +++ b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h @@ -80,6 +80,7 @@ protected: int fillComposerFbs(); void handleOverlayVideoZorder(); int checkCommitZorder(); + void handleVPUScaleLimit(); void handleVPULimit(bool video); void handleDispayLayerZorder(); int handleOsdComposition(); |