author | Ao Xu <ao.xu@amlogic.com> | 2020-01-01 09:05:00 (GMT) |
---|---|---|
committer | sky zhou <sky.zhou@amlogic.com> | 2020-05-21 11:41:54 (GMT) |
commit | 8ec4575aa27e8595a171724c7085e039327d5b5b (patch) | |
tree | 3c44558b2b0c89754aa6435dc4cd6d27f8fcca0f | |
parent | 83defda9eb1311702d41c3330a56a980a3e408f6 (diff) | |
download | hwcomposer-8ec4575aa27e8595a171724c7085e039327d5b5b.zip hwcomposer-8ec4575aa27e8595a171724c7085e039327d5b5b.tar.gz hwcomposer-8ec4575aa27e8595a171724c7085e039327d5b5b.tar.bz2 |
hwc: drop the two sideband layers [1/1]
PD#SWPL-19231
Problem:
When app change the omx sideband to tv sideband, there will
exist two sideband at same time. The second sideband will display
the last frame of prev sideband.
Solution:
When two sideband was commited, drop them and wait for one sideband
commiting.
Verify:
ac214
Change-Id: I13c5223de41b972ba579c5709acbc0f3914e24b8
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
4 files changed, 41 insertions, 9 deletions
diff --git a/common/base/include/DrmTypes.h b/common/base/include/DrmTypes.h index 1900610..6787e63 100644 --- a/common/base/include/DrmTypes.h +++ b/common/base/include/DrmTypes.h @@ -54,7 +54,7 @@ typedef enum drm_fb_type { DRM_FB_VIDEO_OVERLAY, /*special handle for video, no image data*/ DRM_FB_VIDEO_SIDEBAND, - /* TV sidebande handle */ + /* TV sideband handle */ DRM_FB_VIDEO_SIDEBAND_TV, DRM_FB_VIDEO_SIDEBAND_SECOND, /*no image data, but with pts.*/ diff --git a/common/display/HwcVideoPlane.cpp b/common/display/HwcVideoPlane.cpp index 82e11e7..a699839 100644 --- a/common/display/HwcVideoPlane.cpp +++ b/common/display/HwcVideoPlane.cpp @@ -83,7 +83,8 @@ int32_t HwcVideoPlane::setComposePlane( vFrameInfo->fd = am_gralloc_get_buffer_fd(buf); vFrameInfo->type = 1; } else if (fb->mFbType == DRM_FB_VIDEO_SIDEBAND || - fb->mFbType == DRM_FB_VIDEO_SIDEBAND_SECOND) { + fb->mFbType == DRM_FB_VIDEO_SIDEBAND_SECOND || + fb->mFbType == DRM_FB_VIDEO_SIDEBAND_TV) { vFrameInfo->type = 2; } diff --git a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp index d512db5..d851105 100644 --- a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp +++ b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.cpp @@ -111,6 +111,8 @@ int MultiplanesWithDiComposition::handleVideoComposition() { MESON_COMPOSITION_PLANE_DI_VIDEO}, {DRM_FB_VIDEO_SIDEBAND_SECOND, HWC_VIDEO_PLANE, MESON_COMPOSITION_PLANE_DI_VIDEO}, + {DRM_FB_VIDEO_SIDEBAND_TV, HWC_VIDEO_PLANE, + MESON_COMPOSITION_PLANE_DI_VIDEO}, {DRM_FB_VIDEO_OMX_PTS_SECOND, LEGACY_EXT_VIDEO_PLANE, MESON_COMPOSITION_PLANE_AMVIDEO}, {DRM_FB_VIDEO_OMX_V4L, HWC_VIDEO_PLANE, @@ -832,7 +834,8 @@ zorder: 8 -- osd --------- | 8 -- osd --------- void MultiplanesWithDiComposition::handleDiComposition() { - std::shared_ptr<DrmFramebuffer> fb, fb1, large_fb, sideband_fb; + std::shared_ptr<DrmFramebuffer> fb, fb1, large_fb; + std::vector<std::shared_ptr<DrmFramebuffer>> sideband_fbs; uint32_t zorder; std::multimap<int, std::shared_ptr<DrmFramebuffer>> video_type_maps; std::vector<std::shared_ptr<DrmFramebuffer>> no_overlap_fbs; @@ -849,6 +852,7 @@ void MultiplanesWithDiComposition::handleDiComposition() DiComposerPair diComposerPair; drm_rect_t dispFrame, dispFrame1; bool is_overlap; + bool sideband_switch = false; composefbs0.clear(); composefbs1.clear(); hwcVideoPlane0 = std::static_pointer_cast<HwcVideoPlane>(mHwcVideoPlanes[0]); @@ -862,9 +866,14 @@ void MultiplanesWithDiComposition::handleDiComposition() if (!large_fb) large_fb = fb; + if (fb->mFbType == DRM_FB_VIDEO_SIDEBAND_TV) { + sideband_fbs.insert(sideband_fbs.begin(), fb); + continue; + } + if (fb->mFbType == DRM_FB_VIDEO_SIDEBAND || fb->mFbType == DRM_FB_VIDEO_SIDEBAND_SECOND) { - sideband_fb = fb; + sideband_fbs.push_back(fb); continue; } @@ -913,8 +922,25 @@ void MultiplanesWithDiComposition::handleDiComposition() } } - if (sideband_fb) - composefbs0.insert(composefbs0.begin(), sideband_fb); + if (sideband_fbs.size() == 1) { + composefbs0.insert(composefbs0.begin(), *sideband_fbs.begin()); + fb = *sideband_fbs.begin(); + + sideband_switch = (mSidebandType != fb->mFbType); + mSidebandType = fb->mFbType; + } else if (sideband_fbs.size() > 1) { + hwcVideoPlane0->setPlane(NULL, HWC_PLANE_FAKE_ZORDER, BLANK_FOR_NO_CONTENT); + + for (auto it = mDIComposerFbs.begin(); it != mDIComposerFbs.end(); ) { + fb1 = *it; + if ((fb1->mFbType == DRM_FB_VIDEO_SIDEBAND || + fb1->mFbType == DRM_FB_VIDEO_SIDEBAND_SECOND || + fb1->mFbType == DRM_FB_VIDEO_SIDEBAND_TV)) { + it = mDIComposerFbs.erase(it); + } else + ++it; + } + } if (composefbs0.size() == 0) { /* find the biggest window and it can't overlap with other window. @@ -950,7 +976,10 @@ void MultiplanesWithDiComposition::handleDiComposition() else if (composefbs1.size() > 1) diComposerPair.zorder = zorder; - MESON_LOGE("commit %d layers to video.composer0.\n", diComposerPair.num_composefbs); + if (sideband_switch) { + MESON_LOGD("sideband_switch.\n"); + hwcVideoPlane0->setPlane(NULL, HWC_PLANE_FAKE_ZORDER, BLANK_FOR_NO_CONTENT); + } hwcVideoPlane0->setComposePlane(&diComposerPair, UNBLANK); hwcPlane = hwcVideoPlane0; @@ -975,7 +1004,6 @@ void MultiplanesWithDiComposition::handleDiComposition() else if (composefbs1.size() > 1) diComposerPair.zorder = 0; - MESON_LOGE("commit %d layers to video.composer1.\n", diComposerPair.num_composefbs); hwcVideoPlane1->setComposePlane(&diComposerPair, UNBLANK); hwcPlane = hwcVideoPlane1; @@ -1196,8 +1224,10 @@ int MultiplanesWithDiComposition::commit() { auto diIt = mHwcVideoPlanes.begin(); for (; diIt != mHwcVideoPlanes.end(); ++diIt) { - if ((*diIt).get()) + if ((*diIt).get()) { (*diIt)->setPlane(NULL, HWC_PLANE_FAKE_ZORDER, BLANK_FOR_NO_CONTENT); + dumpUnusedPlane(*diIt, BLANK_FOR_NO_CONTENT); + } } /*set crtc info.*/ diff --git a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h index c8d259b..4e8853e 100644 --- a/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h +++ b/composition/simplestrategy/MultiplanesWithDiComposition/MultiplanesWithDiComposition.h @@ -127,6 +127,7 @@ protected: std::vector<std::shared_ptr<DrmFramebuffer>> mComposerFbs; // Save Fbs that should be composered std::vector<std::shared_ptr<DrmFramebuffer>> mDIComposerFbs; std::list<DisplayPair> mDisplayPairs; + int mSidebandType; bool mHaveClient; bool mInsideVideoFbsFlag; // Has VIDEO between different OSD ui layers. |