1 /* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef RENDER_SERVICE_CORE_PIPELINE_RS_UNI_RENDER_VISITOR_H 16 #define RENDER_SERVICE_CORE_PIPELINE_RS_UNI_RENDER_VISITOR_H 17 18 #include <cstdint> 19 #include <list> 20 #include <memory> 21 #include <mutex> 22 #include <parameters.h> 23 #include <set> 24 25 #include "pipeline/render_thread/rs_base_render_engine.h" 26 #include "system/rs_system_parameters.h" 27 28 #include "feature/hwc/rs_uni_hwc_prevalidate_util.h" 29 #include "feature/window_keyframe/rs_window_keyframe_node_info.h" 30 #include "common/rs_special_layer_manager.h" 31 #include "params/rs_render_thread_params.h" 32 #include "pipeline/hwc/rs_uni_hwc_visitor.h" 33 #include "pipeline/rs_dirty_region_manager.h" 34 #include "pipeline/main_thread/rs_main_thread.h" 35 #include "pipeline/rs_pointer_window_manager.h" 36 #include "pipeline/rs_render_node.h" 37 #include "platform/ohos/overdraw/rs_overdraw_controller.h" 38 #include "screen_manager/rs_screen_manager.h" 39 #include "visitor/rs_node_visitor.h" 40 #include "info_collection/rs_hdr_collection.h" 41 42 namespace OHOS { 43 namespace Rosen { 44 class RSPaintFilterCanvas; 45 class RSUniHwcVisitor; 46 class RSUniRenderVisitor : public RSNodeVisitor { 47 public: 48 using SurfaceDirtyMgrPair = std::pair<std::shared_ptr<RSSurfaceRenderNode>, std::shared_ptr<RSSurfaceRenderNode>>; 49 RSUniRenderVisitor(); 50 explicit RSUniRenderVisitor(const RSUniRenderVisitor& visitor); 51 ~RSUniRenderVisitor() override; 52 53 // To prepare nodes between displayRenderNode and app nodes. 54 void QuickPrepareEffectRenderNode(RSEffectRenderNode& node) override; 55 void QuickPrepareCanvasRenderNode(RSCanvasRenderNode& node) override; 56 void QuickPrepareDisplayRenderNode(RSDisplayRenderNode& node) override; 57 void QuickPrepareSurfaceRenderNode(RSSurfaceRenderNode& node) override; 58 void QuickPrepareChildren(RSRenderNode& node) override; 59 PrepareChildren(RSRenderNode & node)60 void PrepareChildren(RSRenderNode& node) override {}; PrepareCanvasRenderNode(RSCanvasRenderNode & node)61 void PrepareCanvasRenderNode(RSCanvasRenderNode& node) override {}; PrepareDisplayRenderNode(RSDisplayRenderNode & node)62 void PrepareDisplayRenderNode(RSDisplayRenderNode& node) override {}; PrepareProxyRenderNode(RSProxyRenderNode & node)63 void PrepareProxyRenderNode(RSProxyRenderNode& node) override {}; 64 // prepareroot also used for quickprepare 65 void PrepareRootRenderNode(RSRootRenderNode& node) override; PrepareSurfaceRenderNode(RSSurfaceRenderNode & node)66 void PrepareSurfaceRenderNode(RSSurfaceRenderNode& node) override {}; PrepareEffectRenderNode(RSEffectRenderNode & node)67 void PrepareEffectRenderNode(RSEffectRenderNode& node) override {}; 68 ProcessChildren(RSRenderNode & node)69 void ProcessChildren(RSRenderNode& node) override {}; ProcessCanvasRenderNode(RSCanvasRenderNode & node)70 void ProcessCanvasRenderNode(RSCanvasRenderNode& node) override {}; ProcessDisplayRenderNode(RSDisplayRenderNode & node)71 void ProcessDisplayRenderNode(RSDisplayRenderNode& node) override {}; ProcessProxyRenderNode(RSProxyRenderNode & node)72 void ProcessProxyRenderNode(RSProxyRenderNode& node) override {}; ProcessRootRenderNode(RSRootRenderNode & node)73 void ProcessRootRenderNode(RSRootRenderNode& node) override {}; ProcessSurfaceRenderNode(RSSurfaceRenderNode & node)74 void ProcessSurfaceRenderNode(RSSurfaceRenderNode& node) override {}; ProcessEffectRenderNode(RSEffectRenderNode & node)75 void ProcessEffectRenderNode(RSEffectRenderNode& node) override {}; 76 SetProcessorRenderEngine(std::shared_ptr<RSBaseRenderEngine> renderEngine)77 void SetProcessorRenderEngine(std::shared_ptr<RSBaseRenderEngine> renderEngine) 78 { 79 renderEngine_ = renderEngine; 80 } 81 SetAnimateState(bool doAnimate)82 void SetAnimateState(bool doAnimate) 83 { 84 doAnimate_ = doAnimate; 85 } 86 SetDirtyFlag(bool isDirty)87 void SetDirtyFlag(bool isDirty) 88 { 89 isDirty_ = isDirty; 90 } 91 SetFocusedNodeId(uint64_t nodeId,uint64_t leashId)92 void SetFocusedNodeId(uint64_t nodeId, uint64_t leashId) 93 { 94 currentFocusedNodeId_ = nodeId; 95 focusedLeashWindowId_ = leashId; 96 } 97 SetSubThreadConfig(uint32_t threadIndex)98 void SetSubThreadConfig(uint32_t threadIndex) 99 { 100 isHardwareForcedDisabled_ = true; 101 threadIndex_ = threadIndex; 102 } 103 GetAnimateState()104 bool GetAnimateState() const 105 { 106 return doAnimate_; 107 } 108 MarkHardwareForcedDisabled()109 void MarkHardwareForcedDisabled() 110 { 111 isHardwareForcedDisabled_ = true; 112 } 113 114 void SetUniRenderThreadParam(std::unique_ptr<RSRenderThreadParams>& renderThreadParams); 115 GetIsPartialRenderEnabled()116 bool GetIsPartialRenderEnabled() const 117 { 118 return isPartialRenderEnabled_; 119 } GetIsOpDropped()120 bool GetIsOpDropped() const 121 { 122 return isOpDropped_; 123 } GetIsRegionDebugEnabled()124 bool GetIsRegionDebugEnabled() const 125 { 126 return isRegionDebugEnabled_; 127 } 128 GetLayerNum()129 uint32_t GetLayerNum() const 130 { 131 return layerNum_; 132 } 133 SetScreenInfo(ScreenInfo screenInfo)134 void SetScreenInfo(ScreenInfo screenInfo) 135 { 136 screenInfo_ = screenInfo; 137 } 138 139 bool IsStencilPixelOcclusionCullingEnable() const; 140 141 // Use in updating hwcnode hardware state with background alpha 142 void UpdateHardwareStateByHwcNodeBackgroundAlpha(const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& hwcNodes); 143 144 bool IsNodeAboveInsideOfNodeBelow(const RectI& rectAbove, std::list<RectI>& hwcNodeRectList); 145 // Use end 146 147 void UpdateTransparentHwcNodeEnable(const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& hwcNodes); 148 149 void SurfaceOcclusionCallbackToWMS(); 150 151 using RenderParam = std::tuple<std::shared_ptr<RSRenderNode>, RSPaintFilterCanvas::CanvasStatus>; 152 GetDumpRsTreeDetailEnabled()153 bool GetDumpRsTreeDetailEnabled() { return isDumpRsTreeDetailEnabled_; } 154 IncreasePrepareSeq()155 uint32_t IncreasePrepareSeq() { return ++nodePreparedSeqNum_; } 156 IncreasePostPrepareSeq()157 uint32_t IncreasePostPrepareSeq() { return ++nodePostPreparedSeqNum_; } 158 159 void UpdateCurFrameInfoDetail(RSRenderNode& node, bool subTreeSkipped = false, bool isPostPrepare = false); 160 161 private: 162 /* Prepare relevant calculation */ 163 // considering occlusion info for app surface as well as widget 164 bool IsSubTreeOccluded(RSRenderNode& node) const; 165 // restore node's flag and filter dirty collection 166 void PostPrepare(RSRenderNode& node, bool subTreeSkipped = false); 167 void UpdateNodeVisibleRegion(RSSurfaceRenderNode& node); 168 void CalculateOpaqueAndTransparentRegion(RSSurfaceRenderNode& node); 169 170 void CheckFilterCacheNeedForceClearOrSave(RSRenderNode& node); 171 void CollectTopOcclusionSurfacesInfo(RSSurfaceRenderNode& node, bool isParticipateInOcclusion); 172 void UpdateOccludedStatusWithFilterNode(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode) const; 173 void PartialRenderOptionInit(); 174 RSVisibleLevel GetRegionVisibleLevel(const Occlusion::Region& visibleRegion, 175 const Occlusion::Region& selfDrawRegion); 176 void UpdateSurfaceOcclusionInfo(); 177 enum class RSPaintStyle { 178 FILL, 179 STROKE 180 }; 181 // check if surface name is in UIFirst dfx target list CheckIfSurfaceForUIFirstDFX(std::string nodeName)182 inline bool CheckIfSurfaceForUIFirstDFX(std::string nodeName) 183 { 184 return std::find_if(dfxUIFirstSurfaceNames_.begin(), dfxUIFirstSurfaceNames_.end(), 185 [&](const std::string& str) { 186 return nodeName.find(str) != std::string::npos; 187 }) != dfxUIFirstSurfaceNames_.end(); 188 } 189 bool InitDisplayInfo(RSDisplayRenderNode& node); 190 191 bool BeforeUpdateSurfaceDirtyCalc(RSSurfaceRenderNode& node); 192 bool NeedPrepareChindrenInReverseOrder(RSRenderNode& node) const; 193 bool IsLeashAndHasMainSubNode(RSRenderNode& node) const; 194 bool AfterUpdateSurfaceDirtyCalc(RSSurfaceRenderNode& node); 195 void UpdateLeashWindowVisibleRegionEmpty(RSSurfaceRenderNode& node); 196 void UpdateSurfaceRenderNodeRotate(RSSurfaceRenderNode& node); 197 void UpdateSurfaceDirtyAndGlobalDirty(); 198 // should be removed due to rcd node will be handled by RS tree in OH 6.0 rcd refactoring 199 void UpdateDisplayRcdRenderNode(); 200 // should ensure that the surface size of dirty region manager has been set 201 void ResetDisplayDirtyRegion(); 202 bool CheckScreenPowerChange() const; 203 bool CheckCurtainScreenUsingStatusChange() const; 204 bool CheckLuminanceStatusChange(ScreenId id); 205 bool CheckSkipCrossNode(RSSurfaceRenderNode& node); 206 bool CheckSkipAndPrepareForCrossNode(RSSurfaceRenderNode& node); 207 bool IsFirstFrameOfPartialRender() const; 208 bool IsFirstFrameOfOverdrawSwitch() const; 209 bool IsFirstFrameOfDrawingCacheDfxSwitch() const; 210 bool IsAccessibilityConfigChanged() const; 211 bool IsWatermarkFlagChanged() const; 212 void UpdateDisplayZoomState(); 213 void CollectFilterInfoAndUpdateDirty(RSRenderNode& node, 214 RSDirtyRegionManager& dirtyManager, const RectI& globalFilterRect, const RectI& globalHwcFilterRect); 215 RectI GetVisibleEffectDirty(RSRenderNode& node) const; 216 RectI GetHwcVisibleEffectDirty(RSRenderNode& node, const RectI globalFilterRect) const; 217 void UpdateHwcNodeEnableByGlobalFilter(std::shared_ptr<RSSurfaceRenderNode>& node); 218 void UpdateHwcNodeEnableByGlobalCleanFilter(const std::vector<std::pair<NodeId, RectI>>& cleanFilter, 219 RSSurfaceRenderNode& hwcNodePtr); 220 void UpdateHwcNodeEnableByFilterRect( 221 std::shared_ptr<RSSurfaceRenderNode>& node, 222 const RectI& filterRect, const NodeId filterNodeId, bool isReverseOrder = false, int32_t filterZorder = 0); 223 void CalcHwcNodeEnableByFilterRect( 224 std::shared_ptr<RSSurfaceRenderNode>& node, 225 const RectI& filterRect, const NodeId filterNodeId, bool isReverseOrder = false, int32_t filterZorder = 0); 226 // This function is used for solving display problems caused by dirty blurfilter node half-obscured. 227 void UpdateDisplayDirtyAndExtendVisibleRegion(); 228 // This function is used to update global dirty and visibleRegion 229 // by processing dirty blurfilter node obscured. 230 void ProcessFilterNodeObscured(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, 231 Occlusion::Region& extendRegion, const RSRenderNodeMap& nodeMap); 232 void UpdateHwcNodeEnableByBackgroundAlpha(RSSurfaceRenderNode& node); 233 void UpdateHwcNodeEnableBySrcRect(RSSurfaceRenderNode& node); 234 void UpdateHwcNodeEnableByBufferSize(RSSurfaceRenderNode& node); 235 void UpdateHwcNodeInfoForAppNode(RSSurfaceRenderNode& node); 236 void UpdateSrcRect(RSSurfaceRenderNode& node, 237 const Drawing::Matrix& absMatrix, const RectI& clipRect); 238 void UpdateDstRect(RSSurfaceRenderNode& node, const RectI& absRect, const RectI& clipRect); 239 void UpdateHwcNodeByTransform(RSSurfaceRenderNode& node, const Drawing::Matrix& totalMatrix); 240 void UpdateHwcNodeEnableByRotateAndAlpha(std::shared_ptr<RSSurfaceRenderNode>& node); 241 void ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr, bool& ancoHasGpu); 242 void UpdateAncoNodeHWCDisabledState(std::unordered_set<std::shared_ptr<RSSurfaceRenderNode>>& ancoNodes); 243 void UpdateChildHwcNodeEnableByHwcNodeBelow(std::vector<RectI>& hwcRects, 244 std::shared_ptr<RSSurfaceRenderNode>& appNode); 245 void UpdateHwcNodeEnableByHwcNodeBelowSelf(std::vector<RectI>& hwcRects, 246 std::shared_ptr<RSSurfaceRenderNode>& hwcNode, bool isIntersectWithRoundCorner); 247 void UpdateHwcNodeDirtyRegionAndCreateLayer(std::shared_ptr<RSSurfaceRenderNode>& node); 248 void AllSurfacesDrawnInUniRender(const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& hwcNodes); 249 void UpdatePointWindowDirtyStatus(std::shared_ptr<RSSurfaceRenderNode>& pointWindow); 250 void UpdateTopLayersDirtyStatus(const std::vector<std::shared_ptr<RSSurfaceRenderNode>>& topLayers); 251 void UpdateCornerRadiusInfoForDRM(std::shared_ptr<RSSurfaceRenderNode> hwcNode, std::vector<RectI>& hwcRects); 252 bool CheckIfRoundCornerIntersectDRM(const float& ratio, std::vector<float>& ratioVector, 253 const Vector4f& instanceCornerRadius, const RectI& instanceAbsRect, const RectI& hwcAbsRect); 254 void UpdateHwcNodeEnable(); 255 void UpdateHwcNodeEnableByNodeBelow(); 256 void PrevalidateHwcNode(); 257 bool PrepareForCloneNode(RSSurfaceRenderNode& node); 258 void PrepareForCrossNode(RSSurfaceRenderNode& node); 259 260 // use in QuickPrepareSurfaceRenderNode, update SurfaceRenderNode's uiFirst status 261 void PrepareForUIFirstNode(RSSurfaceRenderNode& node); 262 263 void PrepareForMultiScreenViewSurfaceNode(RSSurfaceRenderNode& node); 264 void PrepareForMultiScreenViewDisplayNode(RSDisplayRenderNode& node); 265 266 void UpdateHwcNodeDirtyRegionForApp(std::shared_ptr<RSSurfaceRenderNode>& appNode, 267 std::shared_ptr<RSSurfaceRenderNode>& hwcNode); 268 269 void UpdatePrepareClip(RSRenderNode& node); 270 271 void AccumulateSurfaceDirtyRegion( 272 std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, Occlusion::Region& accumulatedDirtyRegion) const; 273 void CheckMergeDisplayDirtyByCrossDisplayWindow(RSSurfaceRenderNode& surfaceNode) const; 274 void PrepareForSkippedCrossNode(RSSurfaceRenderNode& surfaceNode); 275 void CollectFilterInCrossDisplayWindow( 276 std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, Occlusion::Region& accumulatedDirtyRegion); 277 void CheckMergeDisplayDirtyByTransparent(RSSurfaceRenderNode& surfaceNode) const; 278 void CheckMergeDisplayDirtyByZorderChanged(RSSurfaceRenderNode& surfaceNode) const; 279 void CheckMergeDisplayDirtyByPosChanged(RSSurfaceRenderNode& surfaceNode) const; 280 void CheckMergeDisplayDirtyByShadowChanged(RSSurfaceRenderNode& surfaceNode) const; 281 void CheckMergeDisplayDirtyBySurfaceChanged() const; 282 void CheckMergeDisplayDirtyByAttraction(RSSurfaceRenderNode& surfaceNode) const; 283 void CheckMergeSurfaceDirtysForDisplay(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode) const; 284 void CheckMergeDisplayDirtyByTransparentRegions(RSSurfaceRenderNode& surfaceNode) const; 285 void CheckMergeFilterDirtyByIntersectWithDirty(OcclusionRectISet& filterSet, bool isGlobalDirty); 286 287 void CheckMergeDisplayDirtyByTransparentFilter(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, 288 Occlusion::Region& accumulatedDirtyRegion); 289 void CheckMergeGlobalFilterForDisplay(Occlusion::Region& accumulatedDirtyRegion); 290 void CheckMergeDebugRectforRefreshRate(std::vector<RSBaseRenderNode::SharedPtr>& surfaces); 291 void CheckMergeDisplayDirtyByRoundCornerDisplay() const; 292 293 // merge last childRect as dirty if any child has been removed 294 void MergeRemovedChildDirtyRegion(RSRenderNode& node, bool needMap = false); 295 // Reset curSurface info as upper surfaceParent in case surfaceParent has multi children 296 void ResetCurSurfaceInfoAsUpperSurfaceParent(RSSurfaceRenderNode& node); 297 298 void CheckColorSpace(RSSurfaceRenderNode& node); 299 void CheckColorSpaceWithSelfDrawingNode(RSSurfaceRenderNode& node, GraphicColorGamut& newColorSpace); 300 void UpdateColorSpaceAfterHwcCalc(RSDisplayRenderNode& node); 301 void HandleColorGamuts(RSDisplayRenderNode& node, const sptr<RSScreenManager>& screenManager); 302 void CheckPixelFormat(RSSurfaceRenderNode& node); 303 void HandlePixelFormat(RSDisplayRenderNode& node, const sptr<RSScreenManager>& screenManager); 304 305 bool IsHardwareComposerEnabled(); 306 void UpdateSpecialLayersRecord(RSSurfaceRenderNode& node); 307 void SendRcdMessage(RSDisplayRenderNode& node); 308 ForcePrepareSubTree()309 bool ForcePrepareSubTree() 310 { 311 return (curSurfaceNode_ && curSurfaceNode_->GetNeedCollectHwcNode()) || IsAccessibilityConfigChanged(); 312 } 313 IsValidInVirtualScreen(const RSSurfaceRenderNode & node)314 inline bool IsValidInVirtualScreen(const RSSurfaceRenderNode& node) const 315 { 316 const auto& specialLayerMgr = node.GetSpecialLayerMgr(); 317 if (specialLayerMgr.Find(IS_GENERAL_SPECIAL)) { 318 return false; // surface is special layer 319 } 320 if (!allWhiteList_.empty() || allBlackList_.count(node.GetId()) != 0) { 321 return false; // white list is not empty, or surface is in black list 322 } 323 return true; 324 } 325 326 void UpdateRotationStatusForEffectNode(RSEffectRenderNode& node); 327 void CheckFilterNodeInSkippedSubTreeNeedClearCache(const RSRenderNode& node, RSDirtyRegionManager& dirtyManager); 328 void UpdateHwcNodeRectInSkippedSubTree(const RSRenderNode& node); 329 bool FindRootAndUpdateMatrix(std::shared_ptr<RSRenderNode>& parent, Drawing::Matrix& matrix, 330 const RSRenderNode& rootNode); 331 void UpdateHWCNodeClipRect(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr, RectI& clipRect, 332 const RSRenderNode& rootNode); 333 void UpdateSubSurfaceNodeRectInSkippedSubTree(const RSRenderNode& rootNode); 334 void CollectOcclusionInfoForWMS(RSSurfaceRenderNode& node); 335 void CollectEffectInfo(RSRenderNode& node); 336 337 void UpdateVirtualScreenInfo(RSDisplayRenderNode& node); 338 void UpdateVirtualScreenSecurityExemption(RSDisplayRenderNode& node, RSDisplayRenderNode& mirrorNode); 339 void UpdateVirtualScreenVisibleRectSecurity(RSDisplayRenderNode& node, RSDisplayRenderNode& mirrorNode); 340 341 /* Check whether gpu overdraw buffer feature can be enabled on the RenderNode 342 * 1. is leash window 343 * 2. window has scale, radius, no transparency and no animation 344 * 3. find the child background node, which is no transparency and completely filling the window 345 */ 346 void CheckIsGpuOverDrawBufferOptimizeNode(RSSurfaceRenderNode& node); 347 void MarkBlurIntersectWithDRM(std::shared_ptr<RSRenderNode> node) const; 348 349 // Used for closing HDR in PC multidisplay becauseof performance and open when singledisplay 350 void SetHdrWhenMultiDisplayChange(); 351 352 void TryNotifyUIBufferAvailable(); 353 bool IsHdrUseUnirender(bool hasUniRenderHdrSurface, std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr); 354 355 void CollectSelfDrawingNodeRectInfo(RSSurfaceRenderNode& node); 356 357 friend class RSUniHwcVisitor; 358 std::unique_ptr<RSUniHwcVisitor> rsUniHwcVisitor_; 359 std::vector<std::shared_ptr<RSSurfaceRenderNode>> hardwareEnabledNodes_; 360 bool isCompleteRenderEnabled_ = false; 361 std::shared_ptr<RSBaseRenderEngine> renderEngine_; 362 bool doAnimate_ = false; 363 bool isDirty_ = false; 364 bool dirtyFlag_ { false }; 365 bool isPartialRenderEnabled_ = false; 366 bool isAdvancedDirtyRegionEnabled_ = false; 367 bool isRegionDebugEnabled_ = false; 368 bool ancestorNodeHasAnimation_ = false; 369 bool curDirty_ = false; 370 uint64_t currentFocusedNodeId_ = 0; 371 uint64_t focusedLeashWindowId_ = 0; 372 std::shared_ptr<RSDirtyRegionManager> curSurfaceDirtyManager_; 373 std::shared_ptr<RSDirtyRegionManager> curDisplayDirtyManager_; 374 std::shared_ptr<RSSurfaceRenderNode> curSurfaceNode_; 375 ScreenId currentVisitDisplay_ = INVALID_SCREEN_ID; 376 RSSpecialLayerManager specialLayerManager_; 377 std::map<ScreenId, bool> displaySpecailSurfaceChanged_; 378 std::map<ScreenId, bool> hasCaptureWindow_; 379 std::map<ScreenId, bool> hasFingerprint_; 380 std::shared_ptr<RSDisplayRenderNode> curDisplayNode_; 381 // record nodes which has transparent clean filter 382 std::unordered_map<NodeId, std::vector<std::pair<NodeId, RectI>>> transparentCleanFilter_; 383 // record nodes which has transparent dirty filter 384 std::unordered_map<NodeId, std::vector<std::pair<NodeId, RectI>>> transparentDirtyFilter_; 385 // record nodes which has transparent clean filter 386 std::unordered_map<NodeId, std::vector<std::pair<NodeId, RectI>>> transparentHwcCleanFilter_; 387 // record nodes which has transparent dirty filter 388 std::unordered_map<NodeId, std::vector<std::pair<NodeId, RectI>>> transparentHwcDirtyFilter_; 389 // record DRM nodes 390 std::vector<std::weak_ptr<RSSurfaceRenderNode>> drmNodes_; 391 int16_t occlusionSurfaceOrder_ = -1; 392 sptr<RSScreenManager> screenManager_; 393 ScreenInfo screenInfo_; 394 RectI screenRect_; 395 std::unordered_set<NodeId> allBlackList_; // The collection of blacklist for all screens 396 std::unordered_set<NodeId> allWhiteList_; // The collection of whitelist for all screens 397 Occlusion::Region accumulatedOcclusionRegion_; 398 Occlusion::Region occlusionRegionWithoutSkipLayer_; 399 // variable for occlusion 400 bool needRecalculateOcclusion_ = false; 401 bool displayNodeRotationChanged_ = false; 402 bool hasAccumulatedClip_ = false; 403 // if display node has skip layer except capsule window 404 bool hasSkipLayer_ = false; 405 float curAlpha_ = 1.f; 406 float globalZOrder_ = 0.0f; 407 bool isOffscreen_ = false; 408 bool isScreenRotationAnimating_ = false; 409 // added for judge if drawing cache changes 410 bool isDrawingCacheEnabled_ = false; 411 bool unchangeMarkEnable_ = false; 412 bool unchangeMarkInApp_ = false; 413 // vector of Appwindow nodes ids not contain subAppWindow nodes ids in current frame 414 std::queue<NodeId> curMainAndLeashWindowNodesIds_; 415 RectI prepareClipRect_{0, 0, 0, 0}; // renderNode clip rect used in Prepare 416 Vector4f curCornerRadius_{ 0.f, 0.f, 0.f, 0.f }; 417 Drawing::Matrix parentSurfaceNodeMatrix_; 418 bool isSwitchToSourceCrossNodePrepare_ = false; 419 // visible filter in transparent surface or display must prepare 420 bool filterInGlobal_ = true; 421 // opinc feature 422 bool autoCacheEnable_ = false; 423 bool isHardwareForcedDisabled_ = false; // indicates if hardware composer is totally disabled 424 // to record and pass container node dirty to leash node. 425 bool curContainerDirty_ = false; 426 bool isOcclusionEnabled_ = false; 427 bool hasMirrorDisplay_ = false; 428 Drawing::Rect boundsRect_ {}; 429 Gravity frameGravity_ = Gravity::DEFAULT; 430 // vector of current displaynode mainwindow surface visible info 431 VisibleData dstCurVisVec_; 432 // record container nodes which need filter 433 FilterRectISet containerFilter_; 434 // record nodes in surface which has filter may influence globalDirty 435 OcclusionRectISet globalFilter_; 436 // record filter in current surface when there is no below dirty 437 OcclusionRectISet curSurfaceNoBelowDirtyFilter_; 438 // vector of current frame mainwindow surface visible info 439 VisibleData allDstCurVisVec_; 440 bool hasDisplayHdrOn_ = false; 441 bool hasVisitCrossNode_ = false; 442 bool isDirtyRegionDfxEnabled_ = false; // dirtyRegion DFX visualization 443 bool isTargetDirtyRegionDfxEnabled_ = false; 444 bool isOpaqueRegionDfxEnabled_ = false; 445 bool isVisibleRegionDfxEnabled_ = false; 446 bool isAllSurfaceVisibleDebugEnabled_ = false; 447 bool isDisplayDirtyDfxEnabled_ = false; 448 bool isOpDropped_ = false; 449 bool isDirtyAlignEnabled_ = false; 450 bool isStencilPixelOcclusionCullingEnabled_ = false; 451 bool isUIFirstDebugEnable_ = false; 452 bool isVirtualDirtyEnabled_ = false; 453 bool isVirtualDirtyDfxEnabled_ = false; 454 bool isExpandScreenDirtyEnabled_ = false; 455 bool needRequestNextVsync_ = true; 456 CrossNodeOffScreenRenderDebugType isCrossNodeOffscreenOn_ = CrossNodeOffScreenRenderDebugType::ENABLE; 457 DirtyRegionDebugType dirtyRegionDebugType_; 458 AdvancedDirtyRegionType advancedDirtyType_; 459 std::vector<std::string> dfxTargetSurfaceNames_; 460 461 std::stack<std::shared_ptr<RSDirtyRegionManager>> surfaceDirtyManager_; 462 int32_t offsetX_ { 0 }; 463 int32_t offsetY_ { 0 }; 464 bool isTargetUIFirstDfxEnabled_ = false; 465 std::vector<std::string> dfxUIFirstSurfaceNames_; 466 std::vector<NodeId> uiBufferAvailableId_; 467 PartialRenderType partialRenderType_; 468 SurfaceRegionDebugType surfaceRegionDebugType_; 469 uint32_t threadIndex_ = UNI_MAIN_THREAD_INDEX; 470 // vector of Appwindow nodes ids not contain subAppWindow nodes ids in last frame 471 static inline std::queue<NodeId> preMainAndLeashWindowNodesIds_; 472 // vector of last frame mainwindow surface visible info 473 static inline VisibleData allLastVisVec_; 474 std::mutex occlusionMutex_; 475 static void ProcessUnpairedSharedTransitionNode(); 476 NodeId FindInstanceChildOfDisplay(std::shared_ptr<RSRenderNode> node); 477 void UpdateSurfaceRenderNodeScale(RSSurfaceRenderNode& node); 478 // use for hardware compose disabled reason collection 479 HwcDisabledReasonCollection& hwcDisabledReasonCollection_ = HwcDisabledReasonCollection::GetInstance(); 480 std::shared_ptr<RsHdrCollection> rsHdrCollection_ = RsHdrCollection::GetInstance(); 481 482 bool zoomStateChange_ = false; 483 484 // anco RSSurfaceNode process 485 bool ancoHasGpu_ = false; 486 std::unordered_set<std::shared_ptr<RSSurfaceRenderNode>> ancoNodes_; 487 uint32_t layerNum_ = 0; 488 489 NodeId clonedSourceNodeId_ = INVALID_NODEID; 490 491 bool isDumpRsTreeDetailEnabled_ = false; 492 uint32_t nodePreparedSeqNum_ = 0; 493 uint32_t nodePostPreparedSeqNum_ = 0; 494 // used to check if hwc should enable for selfdraw-surface 495 int32_t curZorderForCalcHwcNodeEnableByFilter_ = 0; 496 // Used for PC window resize scene 497 RSWindowKeyframeNodeInfo windowKeyFrameNodeInf_; 498 499 // used in uifirst for checking whether leashwindow or its parent should paint or not 500 bool globalShouldPaint_ = true; 501 502 int32_t appWindowZOrder_ = 0; 503 }; 504 } // namespace Rosen 505 } // namespace OHOS 506 507 #endif // RENDER_SERVICE_CORE_PIPELINE_RS_UNI_RENDER_VISITOR_H 508