!16670 bugfix anconode gpu

Merge pull request !16670 from jianghongxi/1101
This commit is contained in:
openharmony_ci 2024-11-04 08:49:08 +00:00 committed by Gitee
commit fb3091442e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 30 additions and 15 deletions

View File

@ -1575,13 +1575,12 @@ void RSUniRenderVisitor::UpdateHwcNodeEnableByRotateAndAlpha(std::shared_ptr<RSS
}
}
void RSUniRenderVisitor::ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr,
std::vector<std::shared_ptr<RSSurfaceRenderNode>>& ancoNodes, bool& ancoHasGpu)
void RSUniRenderVisitor::ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr)
{
if ((hwcNodePtr->GetAncoFlags() & static_cast<uint32_t>(AncoFlags::IS_ANCO_NODE)) == 0) {
return;
}
ancoNodes.emplace_back(hwcNodePtr);
ancoNodes_.insert(hwcNodePtr);
auto alpha = hwcNodePtr->GetGlobalAlpha();
RS_LOGD("rs debug: name:%{public}s id:%{public}" PRIu64 "src %{public}s dst %{public}s "
"alpha:%{public}.2f", hwcNodePtr->GetName().c_str(), hwcNodePtr->GetId(),
@ -1596,17 +1595,22 @@ void RSUniRenderVisitor::ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& h
return;
}
ancoHasGpu = (ancoHasGpu || hwcNodePtr->IsHardwareForcedDisabled());
ancoHasGpu_ = (ancoHasGpu_ || hwcNodePtr->IsHardwareForcedDisabled());
}
void RSUniRenderVisitor::InitAncoStatus()
{
ancoHasGpu_ = false;
ancoNodes_.clear();
}
void RSUniRenderVisitor::UpdateHwcNodeEnable()
{
bool ancoHasGpu = false;
std::vector<std::shared_ptr<RSSurfaceRenderNode>> ancoNodes;
InitAncoStatus();
auto& curMainAndLeashSurfaces = curDisplayNode_->GetAllMainAndLeashSurfaces();
std::for_each(curMainAndLeashSurfaces.rbegin(), curMainAndLeashSurfaces.rend(),
[this, &ancoNodes, &ancoHasGpu](RSBaseRenderNode::SharedPtr& nodePtr) {
[this](RSBaseRenderNode::SharedPtr& nodePtr) {
auto surfaceNode = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(nodePtr);
if (!surfaceNode) {
return;
@ -1629,18 +1633,22 @@ void RSUniRenderVisitor::UpdateHwcNodeEnable()
RSUniRenderUtil::UpdateHwcNodeProperty(hwcNodePtr);
UpdateHwcNodeEnableByRotateAndAlpha(hwcNodePtr);
UpdateHwcNodeEnableByHwcNodeBelowSelfInApp(hwcRects, hwcNodePtr);
ProcessAncoNode(hwcNodePtr, ancoNodes, ancoHasGpu);
ProcessAncoNode(hwcNodePtr);
}
});
UpdateAncoNodeHWCDisabledState();
PrevalidateHwcNode();
UpdateHwcNodeEnableByNodeBelow();
}
if (ancoHasGpu) {
for (const auto& hwcNodePtr : ancoNodes) {
void RSUniRenderVisitor::UpdateAncoNodeHWCDisabledState()
{
if (ancoHasGpu_) {
for (const auto& hwcNodePtr : ancoNodes_) {
hwcNodePtr->SetHardwareForcedDisabledState(true);
}
}
PrevalidateHwcNode();
UpdateHwcNodeEnableByNodeBelow();
InitAncoStatus();
}
void RSUniRenderVisitor::PrevalidateHwcNode()
@ -2652,6 +2660,7 @@ void RSUniRenderVisitor::UpdateHwcNodeEnableByGlobalFilter(std::shared_ptr<RSSur
if (cleanFilterFound) {
UpdateHwcNodeEnableByGlobalCleanFilter(cleanFilter->second, *hwcNodePtr);
if (hwcNodePtr->IsHardwareForcedDisabled()) {
ProcessAncoNode(hwcNodePtr);
continue;
}
}
@ -2663,6 +2672,7 @@ void RSUniRenderVisitor::UpdateHwcNodeEnableByGlobalFilter(std::shared_ptr<RSSur
RS_OPTIONAL_TRACE_NAME_FMT("hwc debug: name:%s id:%" PRIu64 " disabled by transparentDirtyFilter",
hwcNodePtr->GetName().c_str(), hwcNodePtr->GetId());
hwcNodePtr->SetHardwareForcedDisabledState(true);
ProcessAncoNode(hwcNodePtr);
hwcDisabledReasonCollection_.UpdateHwcDisabledReasonForDFX(hwcNodePtr->GetId(),
HwcDisabledReasons::DISABLED_BY_TRANSPARENT_DIRTY_FLITER, hwcNodePtr->GetName());
break;

View File

@ -218,8 +218,9 @@ private:
void UpdateDstRect(RSSurfaceRenderNode& node, const RectI& absRect, const RectI& clipRect);
void UpdateHwcNodeByTransform(RSSurfaceRenderNode& node);
void UpdateHwcNodeEnableByRotateAndAlpha(std::shared_ptr<RSSurfaceRenderNode>& node);
void ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr,
std::vector<std::shared_ptr<RSSurfaceRenderNode>>& ancoNodes, bool& ancoHasGpu);
void ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr);
void InitAncoStatus();
void UpdateAncoNodeHWCDisabledState();
void UpdateHwcNodeEnableByHwcNodeBelowSelfInApp(std::vector<RectI>& hwcRects,
std::shared_ptr<RSSurfaceRenderNode>& hwcNode);
void UpdateChildHwcNodeEnableByHwcNodeBelow(std::vector<RectI>& hwcRects,
@ -428,6 +429,10 @@ private:
HwcDisabledReasonCollection& hwcDisabledReasonCollection_ = HwcDisabledReasonCollection::GetInstance();
bool zoomStateChange_ = false;
// anco RSSurfaceNode process
bool ancoHasGpu_ = false;
std::unordered_set<std::shared_ptr<RSSurfaceRenderNode>> ancoNodes_;
};
} // namespace Rosen
} // namespace OHOS