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/rs_dirty_region_manager.h" 33 #include "pipeline/main_thread/rs_main_thread.h" 34 #include "pipeline/rs_pointer_window_manager.h" 35 #include "pipeline/rs_render_node.h" 36 #include "platform/ohos/overdraw/rs_overdraw_controller.h" 37 #include "screen_manager/rs_screen_manager.h" 38 #include "visitor/rs_node_visitor.h" 39 #include "info_collection/rs_hdr_collection.h" 40 41 namespace OHOS { 42 namespace Rosen { 43 class RSPaintFilterCanvas; 44 class RSUniHwcVisitor; 45 class RSOcclusionHandler; 46 class RSUniRenderVisitor : public RSNodeVisitor { 47 public: 48 using SurfaceDirtyMgrPair = std::pair<std::shared_ptr<RSSurfaceRenderNode>, std::shared_ptr<RSSurfaceRenderNode>>; 49 RSUniRenderVisitor(); 50 RSUniRenderVisitor(const RSUniRenderVisitor& visitor) = delete; 51 ~RSUniRenderVisitor() override; 52 53 // To prepare nodes between ScreenRenderNode and app nodes. 54 void QuickPrepareEffectRenderNode(RSEffectRenderNode& node) override; 55 void QuickPrepareCanvasRenderNode(RSCanvasRenderNode& node) override; 56 void QuickPrepareScreenRenderNode(RSScreenRenderNode& node) override; 57 void QuickPrepareLogicalDisplayRenderNode(RSLogicalDisplayRenderNode& node) override; 58 void QuickPrepareSurfaceRenderNode(RSSurfaceRenderNode& node) override; 59 void QuickPrepareChildren(RSRenderNode& node) override; 60 PrepareChildren(RSRenderNode & node)61 void PrepareChildren(RSRenderNode& node) override {}; PrepareCanvasRenderNode(RSCanvasRenderNode & node)62 void PrepareCanvasRenderNode(RSCanvasRenderNode& node) override {} PrepareScreenRenderNode(RSScreenRenderNode & node)63 void PrepareScreenRenderNode(RSScreenRenderNode& node) override {} PrepareLogicalDisplayRenderNode(RSLogicalDisplayRenderNode & node)64 void PrepareLogicalDisplayRenderNode(RSLogicalDisplayRenderNode& node) override {} PrepareProxyRenderNode(RSProxyRenderNode & node)65 void PrepareProxyRenderNode(RSProxyRenderNode& node) override {} 66 // prepareroot also used for quickprepare 67 void PrepareRootRenderNode(RSRootRenderNode& node) override; PrepareSurfaceRenderNode(RSSurfaceRenderNode & node)68 void PrepareSurfaceRenderNode(RSSurfaceRenderNode& node) override {} PrepareEffectRenderNode(RSEffectRenderNode & node)69 void PrepareEffectRenderNode(RSEffectRenderNode& node) override {} 70 ProcessChildren(RSRenderNode & node)71 void ProcessChildren(RSRenderNode& node) override {}; ProcessCanvasRenderNode(RSCanvasRenderNode & node)72 void ProcessCanvasRenderNode(RSCanvasRenderNode& node) override {} ProcessScreenRenderNode(RSScreenRenderNode & node)73 void ProcessScreenRenderNode(RSScreenRenderNode& node) override {} ProcessLogicalDisplayRenderNode(RSLogicalDisplayRenderNode & node)74 void ProcessLogicalDisplayRenderNode(RSLogicalDisplayRenderNode& node) override {} ProcessProxyRenderNode(RSProxyRenderNode & node)75 void ProcessProxyRenderNode(RSProxyRenderNode& node) override {} ProcessRootRenderNode(RSRootRenderNode & node)76 void ProcessRootRenderNode(RSRootRenderNode& node) override {} ProcessSurfaceRenderNode(RSSurfaceRenderNode & node)77 void ProcessSurfaceRenderNode(RSSurfaceRenderNode& node) override {} ProcessEffectRenderNode(RSEffectRenderNode & node)78 void ProcessEffectRenderNode(RSEffectRenderNode& node) override {} 79 80 void RegisterHpaeCallback(RSRenderNode& node) override; 81 SetProcessorRenderEngine(std::shared_ptr<RSBaseRenderEngine> renderEngine)82 void SetProcessorRenderEngine(std::shared_ptr<RSBaseRenderEngine> renderEngine) 83 { 84 renderEngine_ = renderEngine; 85 } 86 SetAnimateState(bool doAnimate)87 void SetAnimateState(bool doAnimate) 88 { 89 doAnimate_ = doAnimate; 90 } 91 SetDirtyFlag(bool isDirty)92 void SetDirtyFlag(bool isDirty) 93 { 94 isDirty_ = isDirty; 95 } 96 SetFocusedNodeId(uint64_t nodeId,uint64_t leashId)97 void SetFocusedNodeId(uint64_t nodeId, uint64_t leashId) 98 { 99 currentFocusedNodeId_ = nodeId; 100 focusedLeashWindowId_ = leashId; 101 } 102 GetAnimateState()103 bool GetAnimateState() const 104 { 105 return doAnimate_; 106 } 107 108 // Enable HWCompose 109 void MarkHardwareForcedDisabled(); 110 111 void SetUniRenderThreadParam(std::unique_ptr<RSRenderThreadParams>& renderThreadParams); 112 GetIsPartialRenderEnabled()113 bool GetIsPartialRenderEnabled() const 114 { 115 return isPartialRenderEnabled_; 116 } GetIsOpDropped()117 bool GetIsOpDropped() const 118 { 119 return isOpDropped_; 120 } GetIsRegionDebugEnabled()121 bool GetIsRegionDebugEnabled() const 122 { 123 return isRegionDebugEnabled_; 124 } GetLayerNum()125 uint32_t GetLayerNum() const 126 { 127 return layerNum_; 128 } 129 130 void SurfaceOcclusionCallbackToWMS(); 131 132 using RenderParam = std::tuple<std::shared_ptr<RSRenderNode>, RSPaintFilterCanvas::CanvasStatus>; 133 GetDumpRsTreeDetailEnabled()134 bool GetDumpRsTreeDetailEnabled() { return isDumpRsTreeDetailEnabled_; } 135 IncreasePrepareSeq()136 uint32_t IncreasePrepareSeq() { return ++nodePreparedSeqNum_; } 137 IncreasePostPrepareSeq()138 uint32_t IncreasePostPrepareSeq() { return ++nodePostPreparedSeqNum_; } 139 140 void UpdateCurFrameInfoDetail(RSRenderNode& node, bool subTreeSkipped = false, bool isPostPrepare = false); 141 142 void ResetCrossNodesVisitedStatus(); 143 144 void MarkFilterInForegroundFilterAndCheckNeedForceClearCache(RSRenderNode& node); 145 146 void UpdateDrawingCacheInfoBeforeChildren(RSCanvasRenderNode& node); 147 148 void UpdateOffscreenCanvasNodeId(RSCanvasRenderNode& node); 149 150 private: 151 /* Prepare relevant calculation */ 152 // considering occlusion info for app surface as well as widget 153 bool IsSubTreeOccluded(RSRenderNode& node) const; 154 // restore node's flag and filter dirty collection 155 void PostPrepare(RSRenderNode& node, bool subTreeSkipped = false); 156 void UpdateNodeVisibleRegion(RSSurfaceRenderNode& node); 157 void CalculateOpaqueAndTransparentRegion(RSSurfaceRenderNode& node); 158 159 void CheckFilterCacheNeedForceClearOrSave(RSRenderNode& node); 160 Occlusion::Region GetSurfaceTransparentFilterRegion(const RSSurfaceRenderNode& surfaceNode) const; 161 void CollectTopOcclusionSurfacesInfo(RSSurfaceRenderNode& node, bool isParticipateInOcclusion); 162 void UpdateOccludedStatusWithFilterNode(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode) const; 163 void PartialRenderOptionInit(); 164 RSVisibleLevel GetRegionVisibleLevel(const Occlusion::Region& visibleRegion, 165 const Occlusion::Region& selfDrawRegion); 166 void UpdateSurfaceOcclusionInfo(); 167 enum class RSPaintStyle { 168 FILL, 169 STROKE 170 }; 171 // check if surface name is in UIFirst dfx target list CheckIfSurfaceForUIFirstDFX(std::string nodeName)172 inline bool CheckIfSurfaceForUIFirstDFX(std::string nodeName) 173 { 174 return std::find_if(dfxUIFirstSurfaceNames_.begin(), dfxUIFirstSurfaceNames_.end(), 175 [&](const std::string& str) { 176 return nodeName.find(str) != std::string::npos; 177 }) != dfxUIFirstSurfaceNames_.end(); 178 } 179 bool InitScreenInfo(RSScreenRenderNode& node); 180 bool InitLogicalDisplayInfo(RSLogicalDisplayRenderNode& node); 181 182 void UpdateCompositeType(RSScreenRenderNode& node); 183 bool BeforeUpdateSurfaceDirtyCalc(RSSurfaceRenderNode& node); 184 bool NeedPrepareChindrenInReverseOrder(RSRenderNode& node) const; 185 bool IsLeashAndHasMainSubNode(RSRenderNode& node) const; 186 bool AfterUpdateSurfaceDirtyCalc(RSSurfaceRenderNode& node); 187 void UpdateSurfaceRenderNodeRotate(RSSurfaceRenderNode& node); 188 void UpdateSurfaceDirtyAndGlobalDirty(); 189 // should ensure that the surface size of dirty region manager has been set 190 void ResetDisplayDirtyRegion(); 191 bool CheckScreenPowerChange() const; 192 bool CheckCurtainScreenUsingStatusChange() const; 193 bool CheckLuminanceStatusChange(ScreenId id); 194 bool CheckSkipCrossNode(RSSurfaceRenderNode& node); 195 bool CheckSkipAndPrepareForCrossNode(RSSurfaceRenderNode& node); 196 bool IsFirstFrameOfOverdrawSwitch() const; 197 bool IsFirstFrameOfPartialRender() const; 198 bool IsFirstFrameOfDrawingCacheDfxSwitch() const; 199 bool IsAccessibilityConfigChanged() const; 200 bool IsWatermarkFlagChanged() const; 201 void UpdateDisplayZoomState(); 202 void CollectFilterInfoAndUpdateDirty(RSRenderNode& node, 203 RSDirtyRegionManager& dirtyManager, const RectI& globalFilterRect, const RectI& globalHwcFilterRect); 204 RectI GetVisibleEffectDirty(RSRenderNode& node) const; 205 206 // This function is used for solving display problems caused by dirty blurfilter node half-obscured. 207 void UpdateDisplayDirtyAndExtendVisibleRegion(); 208 // This function is used to update global dirty and visibleRegion 209 // by processing dirty blurfilter node obscured. 210 void ProcessFilterNodeObscured(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, 211 Occlusion::Region& extendRegion, const RSRenderNodeMap& nodeMap); 212 void UpdateHwcNodeInfoForAppNode(RSSurfaceRenderNode& node); 213 void ProcessAncoNode(std::shared_ptr<RSSurfaceRenderNode>& hwcNodePtr, bool& ancoHasGpu); 214 void UpdateAncoNodeHWCDisabledState(std::unordered_set<std::shared_ptr<RSSurfaceRenderNode>>& ancoNodes); 215 void UpdateHwcNodeDirtyRegionAndCreateLayer(std::shared_ptr<RSSurfaceRenderNode>& node); 216 void AllSurfacesDrawnInUniRender(const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& hwcNodes); 217 void UpdatePointWindowDirtyStatus(std::shared_ptr<RSSurfaceRenderNode>& pointWindow); 218 void UpdateTopLayersDirtyStatus(const std::vector<std::shared_ptr<RSSurfaceRenderNode>>& topLayers); 219 void UpdateCornerRadiusInfoForDRM(std::shared_ptr<RSSurfaceRenderNode> hwcNode, std::vector<RectI>& hwcRects); 220 bool CheckIfRoundCornerIntersectDRM(const float& ratio, std::vector<float>& ratioVector, 221 const Vector4f& instanceCornerRadius, const RectI& instanceAbsRect, const RectI& hwcAbsRect); 222 void UpdateIfHwcNodesHaveVisibleRegion(std::vector<RSBaseRenderNode::SharedPtr>& curMainAndLeashSurfaces); 223 void UpdateHwcNodesIfVisibleForApp(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, 224 const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& hwcNodes, 225 bool& hasVisibleHwcNodes, bool& needForceUpdateHwcNodes); 226 void PrevalidateHwcNode(); 227 bool PrepareForCloneNode(RSSurfaceRenderNode& node); 228 void PrepareForCrossNode(RSSurfaceRenderNode& node); 229 230 // use in QuickPrepareSurfaceRenderNode, update SurfaceRenderNode's uiFirst status 231 void PrepareForUIFirstNode(RSSurfaceRenderNode& node); 232 233 void PrepareForMultiScreenViewSurfaceNode(RSSurfaceRenderNode& node); 234 void PrepareForMultiScreenViewDisplayNode(RSScreenRenderNode& node); 235 236 void UpdateHwcNodeDirtyRegionForApp(std::shared_ptr<RSSurfaceRenderNode>& appNode, 237 std::shared_ptr<RSSurfaceRenderNode>& hwcNode); 238 239 void AccumulateSurfaceDirtyRegion( 240 std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, Occlusion::Region& accumulatedDirtyRegion) const; 241 void CheckMergeDisplayDirtyByCrossDisplayWindow(RSSurfaceRenderNode& surfaceNode) const; 242 void PrepareForSkippedCrossNode(RSSurfaceRenderNode& surfaceNode); 243 void CollectFilterInCrossDisplayWindow( 244 std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, Occlusion::Region& accumulatedDirtyRegion); 245 void CheckMergeDisplayDirtyByTransparent(RSSurfaceRenderNode& surfaceNode) const; 246 void CheckMergeDisplayDirtyByZorderChanged(RSSurfaceRenderNode& surfaceNode) const; 247 void CheckMergeDisplayDirtyByPosChanged(RSSurfaceRenderNode& surfaceNode) const; 248 void CheckMergeDisplayDirtyByShadowChanged(RSSurfaceRenderNode& surfaceNode) const; 249 void CheckMergeDisplayDirtyByAttractionChanged(RSSurfaceRenderNode& surfaceNode) const; 250 void CheckMergeDisplayDirtyBySurfaceChanged() const; 251 void CheckMergeDisplayDirtyByAttraction(RSSurfaceRenderNode& surfaceNode) const; 252 void CheckMergeSurfaceDirtysForDisplay(std::shared_ptr<RSSurfaceRenderNode>& surfaceNode) const; 253 void CheckMergeDisplayDirtyByTransparentRegions(RSSurfaceRenderNode& surfaceNode) const; 254 void CheckMergeFilterDirtyWithPreDirty(const std::shared_ptr<RSDirtyRegionManager>& dirtyManager, 255 const Occlusion::Region& accumulatedDirtyRegion, FilterDirtyType filterDirtyType); 256 257 void CheckMergeDebugRectforRefreshRate(std::vector<RSBaseRenderNode::SharedPtr>& surfaces); 258 void CheckMergeScreenDirtyByRoundCornerDisplay() const; 259 260 // merge last childRect as dirty if any child has been removed 261 void MergeRemovedChildDirtyRegion(RSRenderNode& node, bool needMap = false); 262 // Reset curSurface info as upper surfaceParent in case surfaceParent has multi children 263 void ResetCurSurfaceInfoAsUpperSurfaceParent(RSSurfaceRenderNode& node); 264 bool CheckIfSkipDrawInVirtualScreen(RSSurfaceRenderNode& node); 265 266 void CheckColorSpace(RSSurfaceRenderNode& node); 267 void CheckColorSpaceWithSelfDrawingNode(RSSurfaceRenderNode& node); 268 void UpdateColorSpaceAfterHwcCalc(RSScreenRenderNode& node); 269 void HandleColorGamuts(RSScreenRenderNode& node); 270 void CheckPixelFormat(RSSurfaceRenderNode& node); 271 void HandlePixelFormat(RSScreenRenderNode& node); 272 bool IsHardwareComposerEnabled(); 273 274 void UpdateSpecialLayersRecord(RSSurfaceRenderNode& node); 275 void UpdateBlackListRecord(RSSurfaceRenderNode& node); 276 void DealWithSpecialLayer(RSSurfaceRenderNode& node); 277 void SendRcdMessage(RSScreenRenderNode& node); 278 ForcePrepareSubTree()279 bool ForcePrepareSubTree() 280 { 281 return (curSurfaceNode_ && curSurfaceNode_->GetNeedCollectHwcNode()) || IsAccessibilityConfigChanged() || 282 isFirstFrameAfterScreenRotation_; 283 } 284 IsValidInVirtualScreen(const RSSurfaceRenderNode & node)285 inline bool IsValidInVirtualScreen(const RSSurfaceRenderNode& node) const 286 { 287 const auto& specialLayerMgr = node.GetSpecialLayerMgr(); 288 if (specialLayerMgr.Find(IS_GENERAL_SPECIAL) || isSkipDrawInVirtualScreen_) { 289 return false; // surface is special layer 290 } 291 if (!allWhiteList_.empty() || allBlackList_.count(node.GetId()) != 0) { 292 return false; // white list is not empty, or surface is in black list 293 } 294 return true; 295 } 296 297 void UpdateRotationStatusForEffectNode(RSEffectRenderNode& node); 298 void CheckFilterNodeInSkippedSubTreeNeedClearCache(const RSRenderNode& node, RSDirtyRegionManager& dirtyManager); 299 void UpdateSubSurfaceNodeRectInSkippedSubTree(const RSRenderNode& rootNode); 300 void CollectOcclusionInfoForWMS(RSSurfaceRenderNode& node); 301 void CollectEffectInfo(RSRenderNode& node); 302 303 void UpdateVirtualDisplayInfo(RSLogicalDisplayRenderNode& node); 304 void UpdateVirtualDisplaySecurityExemption( 305 RSLogicalDisplayRenderNode& node, RSLogicalDisplayRenderNode& mirrorNode); 306 void UpdateVirtualDisplayVisibleRectSecurity( 307 RSLogicalDisplayRenderNode& node, RSLogicalDisplayRenderNode& mirrorNode); 308 309 /* Check whether gpu overdraw buffer feature can be enabled on the RenderNode 310 * 1. is leash window 311 * 2. window has scale, radius, no transparency and no animation 312 * 3. find the child background node, which is no transparency and completely filling the window 313 */ 314 void CheckIsGpuOverDrawBufferOptimizeNode(RSSurfaceRenderNode& node); 315 316 void MarkBlurIntersectWithDRM(std::shared_ptr<RSRenderNode> node) const; 317 318 // Used for closing HDR in PC multidisplay becauseof performance and open when singledisplay 319 void SetHdrWhenMultiDisplayChange(); 320 321 void TryNotifyUIBufferAvailable(); 322 323 void CollectSelfDrawingNodeRectInfo(RSSurfaceRenderNode& node); 324 325 // Used to collect prepared subtree into the control-level occlusion culling handler. 326 // For the root node, trigger occlusion detection. 327 void CollectSubTreeAndProcessOcclusion(RSRenderNode& node, bool subTreeSkipped); 328 329 // Used to collect prepared node into the control-level occlusion culling handler. 330 void CollectNodeForOcclusion(RSRenderNode& node); 331 332 // Used to initialize the handler of control-level occlusion culling. 333 void InitializeOcclusionHandler(RSSurfaceRenderNode& node); 334 void HandleTunnelLayerId(RSSurfaceRenderNode& node); 335 336 void UpdateChildBlurBehindWindowAbsMatrix(RSRenderNode& node); 337 338 friend class RSUniHwcVisitor; 339 std::unique_ptr<RSUniHwcVisitor> hwcVisitor_; 340 341 bool isCompleteRenderEnabled_ = false; 342 std::shared_ptr<RSBaseRenderEngine> renderEngine_; 343 bool doAnimate_ = false; 344 bool isDirty_ = false; 345 bool dirtyFlag_ { false }; 346 bool isPartialRenderEnabled_ = false; 347 bool isAdvancedDirtyRegionEnabled_ = false; 348 bool isRegionDebugEnabled_ = false; 349 bool ancestorNodeHasAnimation_ = false; 350 bool curDirty_ = false; 351 uint64_t currentFocusedNodeId_ = 0; 352 uint64_t focusedLeashWindowId_ = 0; 353 std::shared_ptr<RSDirtyRegionManager> curSurfaceDirtyManager_; 354 std::shared_ptr<RSDirtyRegionManager> curScreenDirtyManager_; 355 std::shared_ptr<RSSurfaceRenderNode> curSurfaceNode_; 356 RSSpecialLayerManager specialLayerManager_; 357 358 bool hasFingerprint_ = false; 359 std::shared_ptr<RSScreenRenderNode> curScreenNode_; 360 std::shared_ptr<RSLogicalDisplayRenderNode> curLogicalDisplayNode_; 361 // record nodes which ...... 362 std::unordered_map<NodeId, std::vector<std::pair<NodeId, Rect>>> transparntHwcCleanFilter_; 363 // record nodes which ...... 364 std::unordered_map<NodeId, std::vector<std::pair<NodeId, Rect>>> transparntHwcDirtyFilter_; 365 // record DRM nodes 366 std::vector<std::weak_ptr<RSSurfaceRenderNode>> drmNodes_; 367 int16_t occlusionSurfaceOrder_ = DEFAULT_OCCLUSION_SURFACE_ORDER; 368 sptr<RSScreenManager> screenManager_; 369 std::unordered_set<NodeId> allBlackList_; // The collection of blacklist for all screens 370 std::unordered_set<NodeId> allWhiteList_; // The collection of whitelist for all screens 371 // The info of whitelist contains screenId 372 std::unordered_map<ScreenId, std::unordered_set<uint64_t>> screenWhiteList_; 373 374 Occlusion::Region accumulatedOcclusionRegion_; 375 Occlusion::Region accumulatedOcclusionRegionBehindWindow_; // Accumulate transparent area 376 Occlusion::Region occlusionRegionWithoutSkipLayer_; 377 // variable for occlusion 378 bool needRecalculateOcclusion_ = false; 379 bool displayNodeRotationChanged_ = false; 380 bool hasAccumulatedClip_ = false; 381 // if display node has skip layer except capsule window 382 bool hasSkipLayer_ = false; 383 float curAlpha_ = 1.f; 384 float globalZOrder_ = 0.0f; 385 bool isScreenRotationAnimating_ = false; 386 // use for not skip subtree prepare in first frame after screen rotation 387 bool isFirstFrameAfterScreenRotation_ = false; 388 static bool isLastFrameRotating_; 389 // added for judge if drawing cache changes 390 bool isDrawingCacheEnabled_ = false; 391 bool unchangeMarkEnable_ = false; 392 bool unchangeMarkInApp_ = false; 393 // vector of Appwindow nodes ids not contain subAppWindow nodes ids in current frame 394 std::queue<NodeId> curMainAndLeashWindowNodesIds_; 395 RectI prepareClipRect_{0, 0, 0, 0}; // renderNode clip rect used in Prepare 396 Vector4f curCornerRadius_{ 0.f, 0.f, 0.f, 0.f }; 397 Drawing::Matrix parentSurfaceNodeMatrix_; 398 bool isSwitchToSourceCrossNodePrepare_ = false; 399 // visible filter in transparent surface or display must prepare 400 bool filterInGlobal_ = true; 401 // opinc feature 402 bool autoCacheEnable_ = false; 403 // to record and pass container node dirty to leash node. 404 bool curContainerDirty_ = false; 405 bool isOcclusionEnabled_ = false; 406 bool hasMirrorDisplay_ = false; 407 Drawing::Rect boundsRect_ {}; 408 Gravity frameGravity_ = Gravity::DEFAULT; 409 // vector of current displaynode mainwindow surface visible info 410 VisibleData dstCurVisVec_; 411 // vector of current frame mainwindow surface visible info 412 VisibleData allDstCurVisVec_; 413 bool hasDisplayHdrOn_ = false; 414 std::vector<NodeId> hasVisitedCrossNodeIds_; 415 bool isDirtyRegionDfxEnabled_ = false; // dirtyRegion DFX visualization 416 bool isMergedDirtyRegionDfxEnabled_ = false; 417 bool isTargetDirtyRegionDfxEnabled_ = false; 418 bool isOpaqueRegionDfxEnabled_ = false; 419 bool isVisibleRegionDfxEnabled_ = false; 420 bool isAllSurfaceVisibleDebugEnabled_ = false; 421 bool isDisplayDirtyDfxEnabled_ = false; 422 bool isOpDropped_ = false; 423 bool isDirtyAlignEnabled_ = false; 424 bool isStencilPixelOcclusionCullingEnabled_ = false; 425 bool isUIFirstDebugEnable_ = false; 426 bool isVirtualDirtyEnabled_ = false; 427 bool isVirtualDirtyDfxEnabled_ = false; 428 bool isExpandScreenDirtyEnabled_ = false; 429 bool needRequestNextVsync_ = true; 430 bool isTargetUIFirstDfxEnabled_ = false; 431 #ifdef SUBTREE_PARALLEL_ENABLE 432 bool isInFocusSurface_ = false; 433 #endif 434 CrossNodeOffScreenRenderDebugType isCrossNodeOffscreenOn_ = CrossNodeOffScreenRenderDebugType::ENABLE; 435 DirtyRegionDebugType dirtyRegionDebugType_; 436 AdvancedDirtyRegionType advancedDirtyType_; 437 std::vector<std::string> dfxTargetSurfaceNames_; 438 std::vector<std::string> dfxUIFirstSurfaceNames_; 439 std::vector<NodeId> uiBufferAvailableId_; 440 441 std::stack<std::shared_ptr<RSDirtyRegionManager>> surfaceDirtyManager_; 442 int32_t offsetX_ { 0 }; 443 int32_t offsetY_ { 0 }; 444 PartialRenderType partialRenderType_; 445 SurfaceRegionDebugType surfaceRegionDebugType_; 446 // vector of Appwindow nodes ids not contain subAppWindow nodes ids in last frame 447 static inline std::queue<NodeId> preMainAndLeashWindowNodesIds_; 448 449 // vector of last frame mainwindow surface visible info 450 static inline VisibleData allLastVisVec_; 451 std::mutex occlusionMutex_; 452 static void ProcessUnpairedSharedTransitionNode(); 453 void UpdateSurfaceRenderNodeScale(RSSurfaceRenderNode& node); 454 std::shared_ptr<RsHdrCollection> rsHdrCollection_ = RsHdrCollection::GetInstance(); 455 456 bool zoomStateChange_ = false; 457 458 uint32_t layerNum_ = 0; 459 460 NodeId clonedSourceNodeId_ = INVALID_NODEID; 461 462 bool isDumpRsTreeDetailEnabled_ = false; 463 uint32_t nodePreparedSeqNum_ = 0; 464 uint32_t nodePostPreparedSeqNum_ = 0; 465 466 // Used for PC window resize scene 467 RSWindowKeyframeNodeInfo windowKeyFrameNodeInf_; 468 469 // used in uifirst for checking whether leashwindow or its parent should paint or not 470 bool globalShouldPaint_ = true; 471 472 int32_t appWindowZOrder_ = 0; 473 474 // Used for control-level occlusion culling. 475 std::shared_ptr<RSOcclusionHandler> curOcclusionHandler_; 476 477 // record OffscreenCanvas's NodeId 478 NodeId offscreenCanvasNodeId_ = INVALID_NODEID; 479 480 int32_t rsScreenNodeChildNum_ = 0; 481 482 bool isSkipDrawInVirtualScreen_ = false; 483 }; 484 } // namespace Rosen 485 } // namespace OHOS 486 487 #endif // RENDER_SERVICE_CORE_PIPELINE_RS_UNI_RENDER_VISITOR_H 488