1 /* 2 * Copyright (c) 2021-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_CLIENT_CORE_PIPELINE_RS_DISPLAY_RENDER_NODE_H 16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_DISPLAY_RENDER_NODE_H 17 18 #include <memory> 19 #include <mutex> 20 #include "common/rs_common_def.h" 21 #include "platform/common/rs_log.h" 22 23 #ifndef ROSEN_CROSS_PLATFORM 24 #include <ibuffer_consumer_listener.h> 25 #include <iconsumer_surface.h> 26 #include <surface.h> 27 #include "sync_fence.h" 28 #endif 29 30 #include "common/rs_macros.h" 31 #include "common/rs_occlusion_region.h" 32 #include "common/rs_special_layer_manager.h" 33 #include "display_engine/rs_luminance_control.h" 34 #include "memory/rs_memory_track.h" 35 #include "pipeline/rs_render_node.h" 36 #include "pipeline/rs_surface_handler.h" 37 #include <screen_manager/screen_types.h> 38 #include "screen_manager/rs_screen_info.h" 39 #include "platform/drawing/rs_surface.h" 40 41 namespace OHOS { 42 namespace Rosen { 43 class RSSurfaceRenderNode; 44 typedef void (*ReleaseDmaBufferTask)(uint64_t); 45 46 class RSB_EXPORT RSDisplayRenderNode : public RSRenderNode { 47 public: 48 struct ScreenRenderParams { 49 ScreenInfo screenInfo; 50 std::map<ScreenId, bool> displaySpecailSurfaceChanged; 51 std::map<ScreenId, bool> hasCaptureWindow; 52 }; 53 54 enum CompositeType { 55 UNI_RENDER_COMPOSITE = 0, 56 UNI_RENDER_MIRROR_COMPOSITE, 57 UNI_RENDER_EXPAND_COMPOSITE, 58 HARDWARE_COMPOSITE, 59 SOFTWARE_COMPOSITE, 60 UNKNOWN 61 }; 62 using WeakPtr = std::weak_ptr<RSDisplayRenderNode>; 63 using SharedPtr = std::shared_ptr<RSDisplayRenderNode>; 64 static inline constexpr RSRenderNodeType Type = RSRenderNodeType::DISPLAY_NODE; 65 66 ~RSDisplayRenderNode() override; 67 void SetIsOnTheTree(bool flag, NodeId instanceRootNodeId = INVALID_NODEID, 68 NodeId firstLevelNodeId = INVALID_NODEID, NodeId cacheNodeId = INVALID_NODEID, 69 NodeId uifirstRootNodeId = INVALID_NODEID, NodeId displayNodeId = INVALID_NODEID) override; 70 71 void SetScreenId(uint64_t screenId); 72 GetScreenId()73 uint64_t GetScreenId() const 74 { 75 return screenId_; 76 } 77 78 static void SetReleaseTask(ReleaseDmaBufferTask callback); 79 SetRogSize(uint32_t rogWidth,uint32_t rogHeight)80 void SetRogSize(uint32_t rogWidth, uint32_t rogHeight) 81 { 82 rogWidth_ = rogWidth; 83 rogHeight_ = rogHeight; 84 } 85 GetRogWidth()86 uint32_t GetRogWidth() const 87 { 88 return rogWidth_; 89 } 90 GetRogHeight()91 uint32_t GetRogHeight() const 92 { 93 return rogHeight_; 94 } 95 SetDisplayOffset(int32_t offsetX,int32_t offsetY)96 void SetDisplayOffset(int32_t offsetX, int32_t offsetY) 97 { 98 offsetX_ = offsetX; 99 offsetY_ = offsetY; 100 } 101 GetDisplayOffsetX()102 int32_t GetDisplayOffsetX() const 103 { 104 return offsetX_; 105 } 106 HasChildCrossNode()107 bool HasChildCrossNode() const 108 { 109 return hasChildCrossNode_; 110 } 111 SetHasChildCrossNode(bool hasChildCrossNode)112 void SetHasChildCrossNode(bool hasChildCrossNode) 113 { 114 hasChildCrossNode_ = hasChildCrossNode; 115 } 116 IsMirrorScreen()117 bool IsMirrorScreen() const 118 { 119 return isMirrorScreen_; 120 } 121 SetIsMirrorScreen(bool isMirrorScreen)122 void SetIsMirrorScreen(bool isMirrorScreen) 123 { 124 isMirrorScreen_ = isMirrorScreen; 125 } 126 SetIsFirstVisitCrossNodeDisplay(bool isFirstVisitCrossNodeDisplay)127 void SetIsFirstVisitCrossNodeDisplay(bool isFirstVisitCrossNodeDisplay) 128 { 129 isFirstVisitCrossNodeDisplay_ = isFirstVisitCrossNodeDisplay; 130 } 131 IsFirstVisitCrossNodeDisplay()132 bool IsFirstVisitCrossNodeDisplay() const 133 { 134 return isFirstVisitCrossNodeDisplay_; 135 } 136 GetDisplayOffsetY()137 int32_t GetDisplayOffsetY() const 138 { 139 return offsetY_; 140 } 141 GetFingerprint()142 bool GetFingerprint() const 143 { 144 return hasFingerprint_; 145 } 146 147 void SetFingerprint(bool hasFingerprint); 148 SetScreenRotation(const ScreenRotation & screenRotation)149 void SetScreenRotation(const ScreenRotation& screenRotation) 150 { 151 screenRotation_ = screenRotation; 152 } 153 GetScreenRotation()154 ScreenRotation GetScreenRotation() 155 { 156 return screenRotation_; 157 } 158 SetVirtualScreenMuteStatus(bool virtualScreenMuteStatus)159 void SetVirtualScreenMuteStatus(bool virtualScreenMuteStatus) 160 { 161 virtualScreenMuteStatus_ = virtualScreenMuteStatus; 162 } 163 GetVirtualScreenMuteStatus()164 bool GetVirtualScreenMuteStatus() const 165 { 166 return virtualScreenMuteStatus_; 167 } 168 169 void CollectSurface( 170 const std::shared_ptr<RSBaseRenderNode>& node, std::vector<RSBaseRenderNode::SharedPtr>& vec, 171 bool isUniRender, bool onlyFirstLevel) override; 172 void QuickPrepare(const std::shared_ptr<RSNodeVisitor>& visitor) override; 173 void Prepare(const std::shared_ptr<RSNodeVisitor>& visitor) override; 174 void Process(const std::shared_ptr<RSNodeVisitor>& visitor) override; 175 GetType()176 RSRenderNodeType GetType() const override 177 { 178 return RSRenderNodeType::DISPLAY_NODE; 179 } 180 181 bool IsMirrorDisplay() const; 182 HasMirroredDisplayChanged()183 inline bool HasMirroredDisplayChanged() const noexcept 184 { 185 return hasMirroredDisplayChanged_; 186 } 187 ResetMirroredDisplayChangedFlag()188 inline void ResetMirroredDisplayChangedFlag() noexcept 189 { 190 hasMirroredDisplayChanged_ = false; 191 } 192 193 void SetCompositeType(CompositeType type); 194 CompositeType GetCompositeType() const; 195 void SetForceSoftComposite(bool flag); 196 bool IsForceSoftComposite() const; 197 void SetMirrorSource(SharedPtr node); 198 void ResetMirrorSource(); 199 void SetIsMirrorDisplay(bool isMirror); 200 void SetSecurityDisplay(bool isSecurityDisplay); 201 bool GetSecurityDisplay() const; 202 void SetDisplayGlobalZOrder(float zOrder); 203 bool SkipFrame(uint32_t refreshRate, uint32_t skipFrameInterval) override; 204 void SetBootAnimation(bool isBootAnimation) override; 205 bool GetBootAnimation() const override; GetMirrorSource()206 WeakPtr GetMirrorSource() const 207 { 208 return mirrorSource_; 209 } 210 HasDisappearingTransition(bool)211 bool HasDisappearingTransition(bool) const override 212 { 213 return false; 214 } 215 // Use in vulkan parallel rendering SetIsParallelDisplayNode(bool isParallelDisplayNode)216 void SetIsParallelDisplayNode(bool isParallelDisplayNode) 217 { 218 isParallelDisplayNode_ = isParallelDisplayNode; 219 } 220 IsParallelDisplayNode()221 bool IsParallelDisplayNode() const 222 { 223 return isParallelDisplayNode_; 224 } 225 226 ScreenRotation GetRotation() const; 227 GetDirtyManager()228 std::shared_ptr<RSDirtyRegionManager> GetDirtyManager() const 229 { 230 return dirtyManager_; 231 } 232 void UpdateDisplayDirtyManager(int32_t bufferage, bool useAlignedDirtyRegion = false); 233 void ClearCurrentSurfacePos(); UpdateSurfaceNodePos(NodeId id,RectI rect)234 void UpdateSurfaceNodePos(NodeId id, RectI rect) 235 { 236 currentFrameSurfacePos_[id] = rect; 237 } 238 AddSurfaceNodePosByDescZOrder(NodeId id,RectI rect)239 void AddSurfaceNodePosByDescZOrder(NodeId id, RectI rect) 240 { 241 currentFrameSurfacesByDescZOrder_.emplace_back(id, rect); 242 } 243 AddSecurityLayer(NodeId id)244 void AddSecurityLayer(NodeId id) 245 { 246 securityLayerList_.emplace_back(id); 247 } 248 ClearSecurityLayerList()249 void ClearSecurityLayerList() 250 { 251 securityLayerList_.clear(); 252 } 253 GetSecurityLayerList()254 const std::vector<NodeId>& GetSecurityLayerList() 255 { 256 return securityLayerList_; 257 } 258 GetMultableSpecialLayerMgr()259 RSSpecialLayerManager& GetMultableSpecialLayerMgr() 260 { 261 return specialLayerManager_; 262 } 263 GetSpecialLayerMgr()264 const RSSpecialLayerManager& GetSpecialLayerMgr() const 265 { 266 return specialLayerManager_; 267 } 268 SetSecurityExemption(bool isSecurityExemption)269 void SetSecurityExemption(bool isSecurityExemption) 270 { 271 isSecurityExemption_ = isSecurityExemption; 272 } 273 GetSecurityExemption()274 bool GetSecurityExemption() const 275 { 276 return isSecurityExemption_; 277 } 278 AddSecurityVisibleLayer(NodeId id)279 void AddSecurityVisibleLayer(NodeId id) 280 { 281 securityVisibleLayerList_.emplace_back(id); 282 } 283 ClearSecurityVisibleLayerList()284 void ClearSecurityVisibleLayerList() 285 { 286 securityVisibleLayerList_.clear(); 287 } 288 GetSecurityVisibleLayerList()289 const std::vector<NodeId>& GetSecurityVisibleLayerList() 290 { 291 return securityVisibleLayerList_; 292 } 293 SetHasSecLayerInVisibleRect(bool hasSecLayer)294 void SetHasSecLayerInVisibleRect(bool hasSecLayer) { 295 bool lastHasSecLayerInVisibleRect = hasSecLayerInVisibleRect_; 296 hasSecLayerInVisibleRect_ = hasSecLayer; 297 hasSecLayerInVisibleRectChanged_ = 298 lastHasSecLayerInVisibleRect != hasSecLayerInVisibleRect_; 299 } 300 GetLastFrameSurfacePos(NodeId id)301 RectI GetLastFrameSurfacePos(NodeId id) 302 { 303 if (lastFrameSurfacePos_.count(id) == 0) { 304 return {}; 305 } 306 return lastFrameSurfacePos_[id]; 307 } 308 GetCurrentFrameSurfacePos(NodeId id)309 RectI GetCurrentFrameSurfacePos(NodeId id) 310 { 311 if (currentFrameSurfacePos_.count(id) == 0) { 312 return {}; 313 } 314 return currentFrameSurfacePos_[id]; 315 } 316 GetSurfaceChangedRects()317 const std::vector<RectI> GetSurfaceChangedRects() const 318 { 319 std::vector<RectI> rects; 320 for (const auto& lastFrameSurfacePo : lastFrameSurfacePos_) { 321 if (currentFrameSurfacePos_.find(lastFrameSurfacePo.first) == currentFrameSurfacePos_.end()) { 322 rects.emplace_back(lastFrameSurfacePo.second); 323 } 324 } 325 for (const auto& currentFrameSurfacePo : currentFrameSurfacePos_) { 326 if (lastFrameSurfacePos_.find(currentFrameSurfacePo.first) == lastFrameSurfacePos_.end()) { 327 rects.emplace_back(currentFrameSurfacePo.second); 328 } 329 } 330 return rects; 331 } 332 GetCurAllSurfaces()333 std::vector<RSBaseRenderNode::SharedPtr>& GetCurAllSurfaces() 334 { 335 return curAllSurfaces_; 336 } GetCurAllSurfaces(bool onlyFirstLevel)337 std::vector<RSBaseRenderNode::SharedPtr>& GetCurAllSurfaces(bool onlyFirstLevel) 338 { 339 return onlyFirstLevel ? curAllFirstLevelSurfaces_ : curAllSurfaces_; 340 } 341 342 void UpdateRenderParams() override; 343 void UpdatePartialRenderParams(); 344 void UpdateScreenRenderParams(ScreenRenderParams& screenRenderParams); 345 void UpdateOffscreenRenderParams(bool needOffscreen); 346 void RecordTopSurfaceOpaqueRects(Occlusion::Rect rect); 347 void RecordMainAndLeashSurfaces(RSBaseRenderNode::SharedPtr surface); GetAllMainAndLeashSurfaces()348 std::vector<RSBaseRenderNode::SharedPtr>& GetAllMainAndLeashSurfaces() { return curMainAndLeashSurfaceNodes_;} 349 350 void UpdateRotation(); 351 bool IsRotationChanged() const; 352 bool IsRotationFinished() const; IsLastRotationChanged()353 bool IsLastRotationChanged() const { 354 return lastRotationChanged_; 355 } GetPreRotationStatus()356 bool GetPreRotationStatus() const { 357 return preRotationStatus_; 358 } GetCurRotationStatus()359 bool GetCurRotationStatus() const { 360 return curRotationStatus_; 361 } IsFirstTimeToProcessor()362 bool IsFirstTimeToProcessor() const { 363 return isFirstTimeToProcessor_; 364 } 365 SetOriginScreenRotation(const ScreenRotation & rotate)366 void SetOriginScreenRotation(const ScreenRotation& rotate) { 367 originScreenRotation_ = rotate; 368 isFirstTimeToProcessor_ = false; 369 } GetOriginScreenRotation()370 ScreenRotation GetOriginScreenRotation() const { 371 return originScreenRotation_; 372 } 373 SetInitMatrix(const Drawing::Matrix & matrix)374 void SetInitMatrix(const Drawing::Matrix& matrix) { 375 initMatrix_ = matrix; 376 isFirstTimeToProcessor_ = false; 377 } 378 GetInitMatrix()379 const Drawing::Matrix& GetInitMatrix() const { 380 return initMatrix_; 381 } 382 GetOffScreenCacheImgForCapture()383 std::shared_ptr<Drawing::Image> GetOffScreenCacheImgForCapture() { 384 return offScreenCacheImgForCapture_; 385 } SetOffScreenCacheImgForCapture(std::shared_ptr<Drawing::Image> offScreenCacheImgForCapture)386 void SetOffScreenCacheImgForCapture(std::shared_ptr<Drawing::Image> offScreenCacheImgForCapture) { 387 offScreenCacheImgForCapture_ = offScreenCacheImgForCapture; 388 } 389 SetHasUniRenderHdrSurface(bool hasUniRenderHdrSurface)390 void SetHasUniRenderHdrSurface(bool hasUniRenderHdrSurface) 391 { 392 hasUniRenderHdrSurface_ = hasUniRenderHdrSurface; 393 } 394 GetHasUniRenderHdrSurface()395 bool GetHasUniRenderHdrSurface() const 396 { 397 return hasUniRenderHdrSurface_; 398 } 399 SetIsLuminanceStatusChange(bool isLuminanceStatusChange)400 void SetIsLuminanceStatusChange(bool isLuminanceStatusChange) 401 { 402 isLuminanceStatusChange_ = isLuminanceStatusChange; 403 } 404 GetIsLuminanceStatusChange()405 bool GetIsLuminanceStatusChange() const 406 { 407 return isLuminanceStatusChange_; 408 } 409 410 void SetMainAndLeashSurfaceDirty(bool isDirty); 411 412 void SetHDRPresent(bool hdrPresent); 413 414 void SetBrightnessRatio(float brightnessRatio); 415 SetPixelFormat(const GraphicPixelFormat & pixelFormat)416 void SetPixelFormat(const GraphicPixelFormat& pixelFormat) 417 { 418 pixelFormat_ = pixelFormat; 419 } 420 GetPixelFormat()421 GraphicPixelFormat GetPixelFormat() const 422 { 423 return pixelFormat_; 424 } 425 426 void SetColorSpace(const GraphicColorGamut& newColorSpace); 427 GraphicColorGamut GetColorSpace() const; 428 GetDirtySurfaceNodeMap()429 std::map<NodeId, std::shared_ptr<RSSurfaceRenderNode>>& GetDirtySurfaceNodeMap() 430 { 431 return dirtySurfaceNodeMap_; 432 } 433 ClearSurfaceSrcRect()434 void ClearSurfaceSrcRect() 435 { 436 surfaceSrcRects_.clear(); 437 } 438 ClearSurfaceDstRect()439 void ClearSurfaceDstRect() 440 { 441 surfaceDstRects_.clear(); 442 } 443 ClearSurfaceTotalMatrix()444 void ClearSurfaceTotalMatrix() 445 { 446 surfaceTotalMatrix_.clear(); 447 } 448 SetSurfaceSrcRect(NodeId id,RectI rect)449 void SetSurfaceSrcRect(NodeId id, RectI rect) 450 { 451 surfaceSrcRects_[id] = rect; 452 } 453 SetSurfaceDstRect(NodeId id,RectI rect)454 void SetSurfaceDstRect(NodeId id, RectI rect) 455 { 456 surfaceDstRects_[id] = rect; 457 } 458 SetSurfaceTotalMatrix(NodeId id,const Drawing::Matrix & totalMatrix)459 void SetSurfaceTotalMatrix(NodeId id, const Drawing::Matrix& totalMatrix) 460 { 461 surfaceTotalMatrix_[id] = totalMatrix; 462 } 463 GetSurfaceSrcRect(NodeId id)464 RectI GetSurfaceSrcRect(NodeId id) const 465 { 466 auto iter = surfaceSrcRects_.find(id); 467 if (iter == surfaceSrcRects_.cend()) { 468 return RectI(); 469 } 470 471 return iter->second; 472 } 473 GetSurfaceDstRect(NodeId id)474 RectI GetSurfaceDstRect(NodeId id) const 475 { 476 auto iter = surfaceDstRects_.find(id); 477 if (iter == surfaceDstRects_.cend()) { 478 return {}; 479 } 480 481 return iter->second; 482 } 483 GetSurfaceTotalMatrix(NodeId id)484 Drawing::Matrix GetSurfaceTotalMatrix(NodeId id) const 485 { 486 auto iter = surfaceTotalMatrix_.find(id); 487 if (iter == surfaceTotalMatrix_.cend()) { 488 return {}; 489 } 490 491 return iter->second; 492 } 493 494 // Use in MultiLayersPerf GetSurfaceCountForMultiLayersPerf()495 size_t GetSurfaceCountForMultiLayersPerf() const 496 { 497 return surfaceCountForMultiLayersPerf_; 498 } 499 GetLastSurfaceIds()500 const std::vector<NodeId>& GetLastSurfaceIds() const { 501 return lastSurfaceIds_; 502 } 503 SetLastSurfaceIds(std::vector<NodeId> lastSurfaceIds)504 void SetLastSurfaceIds(std::vector<NodeId> lastSurfaceIds) { 505 lastSurfaceIds_ = std::move(lastSurfaceIds); 506 } 507 SetScbNodePid(const std::vector<int32_t> & oldScbPids,int32_t currentScbPid)508 void SetScbNodePid(const std::vector<int32_t>& oldScbPids, int32_t currentScbPid) 509 { 510 oldScbPids_ = oldScbPids; 511 lastScbPid_ = currentScbPid_; 512 currentScbPid_ = currentScbPid; 513 isNeedWaitNewScbPid_ = true; 514 isFullChildrenListValid_ = false; 515 } 516 GetOldScbPids()517 std::vector<int32_t> GetOldScbPids() const 518 { 519 return oldScbPids_; 520 } 521 GetCurrentScbPid()522 int32_t GetCurrentScbPid() const 523 { 524 return currentScbPid_; 525 } 526 527 ChildrenListSharedPtr GetSortedChildren() const override; 528 529 Occlusion::Region GetDisappearedSurfaceRegionBelowCurrent(NodeId currentSurface) const; 530 UpdateZoomState(bool state)531 void UpdateZoomState(bool state) 532 { 533 preZoomState_ = curZoomState_; 534 curZoomState_ = state; 535 } 536 537 bool IsZoomStateChange() const; 538 void HandleCurMainAndLeashSurfaceNodes(); 539 CollectHdrStatus(HdrStatus hdrStatus)540 void CollectHdrStatus(HdrStatus hdrStatus) 541 { 542 displayTotalHdrStatus_ = static_cast<HdrStatus>(displayTotalHdrStatus_ | hdrStatus); 543 } 544 ResetDisplayHdrStatus()545 void ResetDisplayHdrStatus() 546 { 547 displayTotalHdrStatus_ = HdrStatus::NO_HDR; 548 } 549 GetDisplayHdrStatus()550 HdrStatus GetDisplayHdrStatus() const 551 { 552 return displayTotalHdrStatus_; 553 } 554 555 using ScreenStatusNotifyTask = std::function<void(bool)>; 556 557 static void SetScreenStatusNotifyTask(ScreenStatusNotifyTask task); 558 559 void NotifyScreenNotSwitching(); 560 561 // rcd node setter and getter, should be removed in OH 6.0 rcd refactoring SetRcdSurfaceNodeTop(RSBaseRenderNode::SharedPtr node)562 void SetRcdSurfaceNodeTop(RSBaseRenderNode::SharedPtr node) 563 { 564 rcdSurfaceNodeTop_ = node; 565 } 566 SetRcdSurfaceNodeBottom(RSBaseRenderNode::SharedPtr node)567 void SetRcdSurfaceNodeBottom(RSBaseRenderNode::SharedPtr node) 568 { 569 rcdSurfaceNodeBottom_ = node; 570 } 571 GetRcdSurfaceNodeTop()572 RSBaseRenderNode::SharedPtr GetRcdSurfaceNodeTop() 573 { 574 return rcdSurfaceNodeTop_; 575 } 576 GetRcdSurfaceNodeBottom()577 RSBaseRenderNode::SharedPtr GetRcdSurfaceNodeBottom() 578 { 579 return rcdSurfaceNodeBottom_; 580 } 581 582 // Window Container 583 void SetWindowContainer(std::shared_ptr<RSBaseRenderNode> container); 584 std::shared_ptr<RSBaseRenderNode> GetWindowContainer() const; 585 SetTargetSurfaceRenderNodeId(NodeId nodeId)586 void SetTargetSurfaceRenderNodeId(NodeId nodeId) 587 { 588 targetSurfaceRenderNodeId_ = nodeId; 589 } 590 GetTargetSurfaceRenderNodeId()591 NodeId GetTargetSurfaceRenderNodeId() const 592 { 593 return targetSurfaceRenderNodeId_; 594 } 595 596 void SetTargetSurfaceRenderNodeDrawable(DrawableV2::RSRenderNodeDrawableAdapter::WeakPtr drawable); 597 598 protected: 599 void OnSync() override; 600 private: 601 explicit RSDisplayRenderNode( 602 NodeId id, const RSDisplayNodeConfig& config, const std::weak_ptr<RSContext>& context = {}); 603 void InitRenderParams() override; 604 605 bool hasChildCrossNode_ = false; 606 bool isMirrorScreen_ = false; 607 bool isFirstVisitCrossNodeDisplay_ = false; 608 bool forceSoftComposite_ { false }; 609 bool isMirroredDisplay_ = false; 610 bool hasMirroredDisplayChanged_ = false; 611 bool isSecurityDisplay_ = false; 612 bool hasUniRenderHdrSurface_ = false; 613 bool isLuminanceStatusChange_ = false; 614 bool preRotationStatus_ = false; 615 bool curRotationStatus_ = false; 616 bool lastRotationChanged_ = false; 617 bool isFirstTimeToProcessor_ = true; 618 bool hasFingerprint_ = false; 619 bool isSecurityExemption_ = false; 620 bool hasSecLayerInVisibleRect_ = false; 621 bool hasSecLayerInVisibleRectChanged_ = false; 622 // Use in vulkan parallel rendering 623 bool isParallelDisplayNode_ = false; 624 mutable bool isNeedWaitNewScbPid_ = false; 625 bool curZoomState_ = false; 626 bool preZoomState_ = false; 627 bool virtualScreenMuteStatus_ = false; 628 CompositeType compositeType_ { HARDWARE_COMPOSITE }; 629 ScreenRotation screenRotation_ = ScreenRotation::ROTATION_0; 630 ScreenRotation originScreenRotation_ = ScreenRotation::ROTATION_0; 631 int32_t offsetX_ = 0; 632 int32_t offsetY_ = 0; 633 uint32_t rogWidth_ = 0; 634 uint32_t rogHeight_ = 0; 635 float lastRotation_ = 0.f; 636 int32_t currentScbPid_ = -1; 637 int32_t lastScbPid_ = -1; 638 HdrStatus displayTotalHdrStatus_ = HdrStatus::NO_HDR; 639 uint64_t screenId_ = 0; 640 // Use in MultiLayersPerf 641 size_t surfaceCountForMultiLayersPerf_ = 0; 642 int64_t lastRefreshTime_ = 0; 643 static ReleaseDmaBufferTask releaseScreenDmaBufferTask_; 644 std::shared_ptr<RSDirtyRegionManager> dirtyManager_ = nullptr; 645 // Use in screen recording optimization 646 std::shared_ptr<Drawing::Image> offScreenCacheImgForCapture_ = nullptr; 647 mutable std::shared_ptr<std::vector<std::shared_ptr<RSRenderNode>>> currentChildrenList_ = 648 std::make_shared<std::vector<std::shared_ptr<RSRenderNode>>>(); 649 WeakPtr mirrorSource_; 650 // vector of sufacenodes will records dirtyregions by itself 651 std::vector<RSBaseRenderNode::SharedPtr> curMainAndLeashSurfaceNodes_; 652 Drawing::Matrix initMatrix_; 653 GraphicPixelFormat pixelFormat_ = GraphicPixelFormat::GRAPHIC_PIXEL_FMT_RGBA_8888; 654 GraphicColorGamut colorSpace_ = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB; 655 656 std::map<NodeId, RectI> lastFrameSurfacePos_; 657 std::map<NodeId, RectI> currentFrameSurfacePos_; 658 std::vector<Occlusion::Rect> topSurfaceOpaqueRects_; 659 std::vector<std::pair<NodeId, RectI>> lastFrameSurfacesByDescZOrder_; 660 std::vector<std::pair<NodeId, RectI>> currentFrameSurfacesByDescZOrder_; 661 std::vector<std::string> windowsName_; 662 663 // Use in virtual screen security exemption 664 std::vector<NodeId> securityLayerList_; // leashPersistentId and surface node id 665 RSSpecialLayerManager specialLayerManager_; 666 667 // Use in mirror screen visible rect projection 668 std::vector<NodeId> securityVisibleLayerList_; // surface node id 669 670 std::vector<RSBaseRenderNode::SharedPtr> curAllSurfaces_; 671 std::vector<RSBaseRenderNode::SharedPtr> curAllFirstLevelSurfaces_; 672 std::mutex mtx_; 673 674 std::map<NodeId, std::shared_ptr<RSSurfaceRenderNode>> dirtySurfaceNodeMap_; 675 676 // support multiscreen 677 std::map<NodeId, RectI> surfaceSrcRects_; 678 std::map<NodeId, RectI> surfaceDstRects_; 679 std::map<NodeId, Drawing::Matrix> surfaceTotalMatrix_; 680 681 std::vector<NodeId> lastSurfaceIds_; 682 683 std::vector<int32_t> oldScbPids_ {}; 684 685 // Use in round corner display 686 // removed later due to rcd node will be handled by RS tree in OH 6.0 rcd refactoring 687 RSBaseRenderNode::SharedPtr rcdSurfaceNodeTop_ = nullptr; 688 RSBaseRenderNode::SharedPtr rcdSurfaceNodeBottom_ = nullptr; 689 690 NodeId targetSurfaceRenderNodeId_ = INVALID_NODEID; 691 friend class DisplayNodeCommandHelper; 692 static inline ScreenStatusNotifyTask screenStatusNotifyTask_ = nullptr; 693 694 // Window Container 695 std::shared_ptr<RSBaseRenderNode> windowContainer_; 696 }; 697 } // namespace Rosen 698 } // namespace OHOS 699 700 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_DISPLAY_RENDER_NODE_H 701