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_SURFACE_RENDER_NODE_H 16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_SURFACE_RENDER_NODE_H 17 18 #include <climits> 19 #include <functional> 20 #include <limits> 21 #include <memory> 22 #include <tuple> 23 24 #include "memory/rs_memory_track.h" 25 26 #include "common/rs_macros.h" 27 #include "common/rs_occlusion_region.h" 28 #include "common/rs_vector4.h" 29 #include "ipc_callbacks/buffer_available_callback.h" 30 #include "ipc_callbacks/buffer_clear_callback.h" 31 #include "pipeline/rs_paint_filter_canvas.h" 32 #include "pipeline/rs_render_node.h" 33 #include "pipeline/rs_surface_handler.h" 34 #include "pipeline/rs_uni_render_judgement.h" 35 #include "platform/common/rs_system_properties.h" 36 #include "platform/common/rs_surface_ext.h" 37 #include "property/rs_properties_painter.h" 38 #include "screen_manager/screen_types.h" 39 #include "surface_type.h" 40 #include "transaction/rs_occlusion_data.h" 41 42 #ifndef USE_ROSEN_DRAWING 43 #include "include/core/SkRect.h" 44 #include "include/core/SkRefCnt.h" 45 #ifdef NEW_SKIA 46 #include "include/gpu/GrDirectContext.h" 47 #else 48 #include "include/gpu/GrContext.h" 49 #include "refbase.h" 50 #endif 51 #endif 52 53 namespace OHOS { 54 namespace Rosen { 55 class RSCommand; 56 class RSDirtyRegionManager; 57 class RSB_EXPORT RSSurfaceRenderNode : public RSRenderNode, public RSSurfaceHandler { 58 public: 59 using WeakPtr = std::weak_ptr<RSSurfaceRenderNode>; 60 using SharedPtr = std::shared_ptr<RSSurfaceRenderNode>; 61 static inline constexpr RSRenderNodeType Type = RSRenderNodeType::SURFACE_NODE; GetType()62 RSRenderNodeType GetType() const override 63 { 64 return Type; 65 } 66 67 explicit RSSurfaceRenderNode(NodeId id, const std::weak_ptr<RSContext>& context = {}, 68 bool isTextureExportNode = false); 69 explicit RSSurfaceRenderNode(const RSSurfaceRenderNodeConfig& config, const std::weak_ptr<RSContext>& context = {}); 70 ~RSSurfaceRenderNode() override; 71 72 void PrepareRenderBeforeChildren(RSPaintFilterCanvas& canvas); 73 void PrepareRenderAfterChildren(RSPaintFilterCanvas& canvas); 74 75 void SetIsOnTheTree(bool flag, NodeId instanceRootNodeId = INVALID_NODEID, 76 NodeId firstLevelNodeId = INVALID_NODEID, NodeId cacheNodeId = INVALID_NODEID) override; IsAppWindow()77 bool IsAppWindow() const 78 { 79 return nodeType_ == RSSurfaceNodeType::APP_WINDOW_NODE; 80 } 81 IsStartingWindow()82 bool IsStartingWindow() const 83 { 84 return nodeType_ == RSSurfaceNodeType::STARTING_WINDOW_NODE; 85 } 86 IsAbilityComponent()87 bool IsAbilityComponent() const 88 { 89 return nodeType_ == RSSurfaceNodeType::ABILITY_COMPONENT_NODE; 90 } 91 IsLeashWindow()92 bool IsLeashWindow() const 93 { 94 return nodeType_ == RSSurfaceNodeType::LEASH_WINDOW_NODE; 95 } 96 IsRosenWeb()97 bool IsRosenWeb() const 98 { 99 return GetName().find("RosenWeb") != std::string::npos; 100 } 101 IsScbScreen()102 bool IsScbScreen() const 103 { 104 return nodeType_ == RSSurfaceNodeType::SCB_SCREEN_NODE; 105 } 106 SetNodeDirty(bool isNodeDirty)107 void SetNodeDirty(bool isNodeDirty) 108 { 109 isNodeDirty_ = isNodeDirty || isNodeDirtyInLastFrame_; 110 isNodeDirtyInLastFrame_ = isNodeDirty; 111 } 112 IsNodeDirty()113 bool IsNodeDirty() const 114 { 115 return isNodeDirty_; 116 } 117 IsHardwareEnabledTopSurface()118 bool IsHardwareEnabledTopSurface() const 119 { 120 return nodeType_ == RSSurfaceNodeType::SELF_DRAWING_WINDOW_NODE && GetName() == "pointer window"; 121 } 122 123 // indicate if this node type can enable hardware composer IsHardwareEnabledType()124 bool IsHardwareEnabledType() const 125 { 126 if (IsRosenWeb() && !RSSystemProperties::IsPhoneType()) { 127 return false; 128 } 129 return (nodeType_ == RSSurfaceNodeType::SELF_DRAWING_NODE && isHardwareEnabledNode_) || 130 IsHardwareEnabledTopSurface(); 131 } 132 133 void SetHardwareEnabled(bool isEnabled, SelfDrawingNodeType selfDrawingType = SelfDrawingNodeType::DEFAULT) 134 { 135 isHardwareEnabledNode_ = isEnabled; 136 selfDrawingType_ = selfDrawingType; 137 } 138 GetSelfDrawingNodeType()139 SelfDrawingNodeType GetSelfDrawingNodeType() const 140 { 141 return selfDrawingType_; 142 } 143 NeedBilinearInterpolation()144 bool NeedBilinearInterpolation() const 145 { 146 return nodeType_ == RSSurfaceNodeType::SELF_DRAWING_NODE && isHardwareEnabledNode_ && 147 name_ == "SceneViewer Model0"; 148 } 149 SetSubNodeShouldPaint()150 void SetSubNodeShouldPaint() 151 { 152 hasSubNodeShouldPaint_ = true; 153 } 154 ResetSubNodeShouldPaint()155 void ResetSubNodeShouldPaint() 156 { 157 hasSubNodeShouldPaint_ = false; 158 } 159 HasSubNodeShouldPaint()160 bool HasSubNodeShouldPaint() const 161 { 162 return hasSubNodeShouldPaint_; 163 } 164 IsLastFrameHardwareEnabled()165 bool IsLastFrameHardwareEnabled() const 166 { 167 return isLastFrameHardwareEnabled_; 168 } 169 IsCurrentFrameHardwareEnabled()170 bool IsCurrentFrameHardwareEnabled() const 171 { 172 return isCurrentFrameHardwareEnabled_; 173 } 174 MarkCurrentFrameHardwareEnabled()175 void MarkCurrentFrameHardwareEnabled() 176 { 177 isCurrentFrameHardwareEnabled_ = true; 178 } 179 ResetCurrentFrameHardwareEnabledState()180 void ResetCurrentFrameHardwareEnabledState() 181 { 182 isLastFrameHardwareEnabled_ = isCurrentFrameHardwareEnabled_; 183 isCurrentFrameHardwareEnabled_ = false; 184 } 185 ResetHardwareEnabledStates()186 void ResetHardwareEnabledStates() 187 { 188 isLastFrameHardwareEnabled_ = false; 189 isCurrentFrameHardwareEnabled_ = false; 190 } 191 SetHardwareForcedDisabledState(bool forcesDisabled)192 void SetHardwareForcedDisabledState(bool forcesDisabled) 193 { 194 isHardwareForcedDisabled_ = forcesDisabled; 195 } 196 SetHardwareDisabledByCache(bool disabledByCache)197 void SetHardwareDisabledByCache(bool disabledByCache) 198 { 199 isHardwareDisabledByCache_ = disabledByCache; 200 } 201 SetHardwareForcedDisabledStateByFilter(bool forcesDisabled)202 void SetHardwareForcedDisabledStateByFilter(bool forcesDisabled) 203 { 204 isHardwareForcedDisabledByFilter_ = forcesDisabled; 205 } 206 IsHardwareForcedDisabledByFilter()207 bool IsHardwareForcedDisabledByFilter() const 208 { 209 return isHardwareForcedDisabledByFilter_; 210 } 211 ResetHardwareForcedDisabledBySrcRect()212 void ResetHardwareForcedDisabledBySrcRect() 213 { 214 isHardwareForcedDisabledBySrcRect_ = false; 215 } 216 IsHardwareForcedDisabled()217 bool IsHardwareForcedDisabled() const 218 { 219 return isHardwareForcedDisabled_ || isHardwareDisabledByCache_ || isHardwareForcedDisabledBySrcRect_ || 220 GetDstRect().GetWidth() <= 1 || GetDstRect().GetHeight() <= 1; // avoid fallback by composer 221 } 222 IsMainWindowType()223 bool IsMainWindowType() const 224 { 225 // a mainWindowType surfacenode will not mounted under another mainWindowType surfacenode 226 // including app main window, starting window, and selfdrawing window 227 return nodeType_ == RSSurfaceNodeType::APP_WINDOW_NODE || 228 nodeType_ == RSSurfaceNodeType::DEFAULT || 229 nodeType_ == RSSurfaceNodeType::STARTING_WINDOW_NODE || 230 nodeType_ == RSSurfaceNodeType::SELF_DRAWING_WINDOW_NODE; 231 } 232 IsSelfDrawingType()233 bool IsSelfDrawingType() const 234 { 235 // self drawing surfacenode has its own buffer, and rendered in its own progress/thread 236 // such as surfaceview (web/videos) and self draw windows (such as mouse pointer and boot animation) 237 return nodeType_ == RSSurfaceNodeType::SELF_DRAWING_NODE || 238 nodeType_ == RSSurfaceNodeType::SELF_DRAWING_WINDOW_NODE; 239 } 240 241 bool IsUIFirstSelfDrawCheck(); 242 bool IsVisibleDirtyEmpty(DeviceType deviceType); 243 bool IsCurFrameStatic(DeviceType deviceType); 244 void UpdateCacheSurfaceDirtyManager(int bufferAge = 2); 245 GetNeedSubmitSubThread()246 bool GetNeedSubmitSubThread() const 247 { 248 return isNeedSubmitSubThread_; 249 } 250 SetNeedSubmitSubThread(bool needSubmitSubThread)251 void SetNeedSubmitSubThread(bool needSubmitSubThread) 252 { 253 isNeedSubmitSubThread_ = needSubmitSubThread; 254 } 255 GetSurfaceNodeType()256 RSSurfaceNodeType GetSurfaceNodeType() const 257 { 258 return nodeType_; 259 } 260 SetSurfaceNodeType(RSSurfaceNodeType nodeType)261 void SetSurfaceNodeType(RSSurfaceNodeType nodeType) 262 { 263 if (nodeType_ != RSSurfaceNodeType::ABILITY_COMPONENT_NODE) { 264 nodeType_ = nodeType; 265 } 266 } 267 268 void MarkUIHidden(bool isHidden); 269 bool IsUIHidden() const; 270 GetName()271 const std::string& GetName() const 272 { 273 return name_; 274 } 275 GetBundleName()276 const std::string& GetBundleName() const 277 { 278 return bundleName_; 279 } 280 SetOffSetX(int32_t offset)281 void SetOffSetX(int32_t offset) 282 { 283 offsetX_ = offset; 284 } 285 GetOffSetX()286 int32_t GetOffSetX() 287 { 288 return offsetX_; 289 } 290 SetOffSetY(int32_t offset)291 void SetOffSetY(int32_t offset) 292 { 293 offsetY_ = offset; 294 } 295 GetOffSetY()296 int32_t GetOffSetY() 297 { 298 return offsetY_; 299 } 300 SetOffset(int32_t offsetX,int32_t offsetY)301 void SetOffset(int32_t offsetX, int32_t offsetY) 302 { 303 offsetX_ = offsetX; 304 offsetY_ = offsetY; 305 } 306 307 void CollectSurface(const std::shared_ptr<RSBaseRenderNode>& node, std::vector<RSBaseRenderNode::SharedPtr>& vec, 308 bool isUniRender, bool onlyFirstLevel) override; 309 void CollectSurfaceForUIFirstSwitch(uint32_t& leashWindowCount, uint32_t minNodeNum) override; 310 void Prepare(const std::shared_ptr<RSNodeVisitor>& visitor) override; 311 void Process(const std::shared_ptr<RSNodeVisitor>& visitor) override; 312 ProcessTransitionBeforeChildren(RSPaintFilterCanvas & canvas)313 void ProcessTransitionBeforeChildren(RSPaintFilterCanvas& canvas) override {} 314 void ProcessAnimatePropertyBeforeChildren(RSPaintFilterCanvas& canvas, bool includeProperty) override; 315 void ProcessRenderBeforeChildren(RSPaintFilterCanvas& canvas) override; 316 ProcessTransitionAfterChildren(RSPaintFilterCanvas & canvas)317 void ProcessTransitionAfterChildren(RSPaintFilterCanvas& canvas) override {} 318 void ProcessAnimatePropertyAfterChildren(RSPaintFilterCanvas& canvas) override; 319 void ProcessRenderAfterChildren(RSPaintFilterCanvas& canvas) override; 320 bool IsNeedSetVSync(); 321 322 void SetContextBounds(const Vector4f bounds); 323 324 void OnApplyModifiers() override; 325 326 #ifndef USE_ROSEN_DRAWING SetTotalMatrix(const SkMatrix & totalMatrix)327 void SetTotalMatrix(const SkMatrix& totalMatrix) 328 #else 329 void SetTotalMatrix(const Drawing::Matrix& totalMatrix) 330 #endif 331 { 332 totalMatrix_ = totalMatrix; 333 } 334 #ifndef USE_ROSEN_DRAWING GetTotalMatrix()335 const SkMatrix& GetTotalMatrix() const 336 #else 337 const Drawing::Matrix& GetTotalMatrix() const 338 #endif 339 { 340 return totalMatrix_; 341 } 342 343 // Transfer the rendering context variables (matrix, alpha, and clipRegion) from the 344 // source node (in the render thread) to the 345 // target node (in the render service). Note that: 346 // - All three variables are relative to their parent node. 347 // - Alpha can be processed as an absolute value, as its parent (surface) node's alpha should always be 1.0f. 348 // - The matrix and clipRegion should be applied according to the parent node's matrix. 349 #ifndef USE_ROSEN_DRAWING 350 void SetContextMatrix(const std::optional<SkMatrix>& transform, bool sendMsg = true); 351 void SetContextAlpha(float alpha, bool sendMsg = true); 352 void SetContextClipRegion(const std::optional<SkRect>& clipRegion, bool sendMsg = true); 353 std::optional<SkRect> GetContextClipRegion() const override; 354 #else 355 void SetContextMatrix(const std::optional<Drawing::Matrix>& transform, bool sendMsg = true); 356 void SetContextAlpha(float alpha, bool sendMsg = true); 357 void SetContextClipRegion(const std::optional<Drawing::Rect>& clipRegion, bool sendMsg = true); 358 std::optional<Drawing::Rect> GetContextClipRegion() const override; 359 #endif 360 361 void SetBootAnimation(bool isBootAnimation) override; 362 bool GetBootAnimation() const override; 363 364 void SetSecurityLayer(bool isSecurityLayer); 365 bool GetSecurityLayer() const; 366 367 void SetSkipLayer(bool isSkipLayer); 368 bool GetSkipLayer() const; 369 370 void SetFingerprint(bool hasFingerprint); 371 bool GetFingerprint() const; 372 373 void SetForceUIFirst(bool forceUIFirst); 374 bool GetForceUIFirst() const; 375 376 void SetForceUIFirstChanged(bool forceUIFirstChanged); 377 bool GetForceUIFirstChanged(); 378 379 std::shared_ptr<RSDirtyRegionManager> GetDirtyManager() const; 380 std::shared_ptr<RSDirtyRegionManager> GetCacheSurfaceDirtyManager() const; 381 SetSrcRect(const RectI & rect)382 void SetSrcRect(const RectI& rect) 383 { 384 srcRect_ = rect; 385 } 386 GetSrcRect()387 const RectI& GetSrcRect() const 388 { 389 return srcRect_; 390 } 391 SetDstRect(const RectI & dstRect)392 void SetDstRect(const RectI& dstRect) 393 { 394 if (dstRect_ != dstRect) { 395 dstRectChanged_ = true; 396 } 397 dstRect_ = dstRect; 398 } 399 GetDstRect()400 const RectI& GetDstRect() const 401 { 402 return dstRect_; 403 } 404 GetTransparentRegion()405 Occlusion::Region& GetTransparentRegion() 406 { 407 return transparentRegion_; 408 } 409 GetOpaqueRegion()410 const Occlusion::Region& GetOpaqueRegion() const 411 { 412 return opaqueRegion_; 413 } 414 GetOpaqueRegion()415 Occlusion::Region& GetOpaqueRegion() 416 { 417 return opaqueRegion_; 418 } 419 GetContainerRegion()420 Occlusion::Region& GetContainerRegion() 421 { 422 return containerRegion_; 423 } 424 OnAlphaChanged()425 void OnAlphaChanged() override { 426 alphaChanged_ = true; 427 } 428 SetOcclusionVisible(bool visible)429 void SetOcclusionVisible(bool visible) 430 { 431 isOcclusionVisible_ = visible; 432 } 433 GetOcclusionVisible()434 bool GetOcclusionVisible() const 435 { 436 return isOcclusionVisible_; 437 } 438 SetOcclusionVisibleWithoutFilter(bool visible)439 void SetOcclusionVisibleWithoutFilter(bool visible) 440 { 441 isOcclusionVisibleWithoutFilter_ = visible; 442 } 443 SetOcclusionInSpecificScenes(bool isOcclusionInSpecificScenes)444 void SetOcclusionInSpecificScenes(bool isOcclusionInSpecificScenes) 445 { 446 isOcclusionInSpecificScenes_ = isOcclusionInSpecificScenes; 447 } 448 GetVisibleRegion()449 const Occlusion::Region& GetVisibleRegion() const 450 { 451 return visibleRegion_; 452 } 453 GetVisibleRegionForCallBack()454 const Occlusion::Region& GetVisibleRegionForCallBack() const 455 { 456 return visibleRegionForCallBack_; 457 } 458 SetAbilityBGAlpha(uint8_t alpha)459 void SetAbilityBGAlpha(uint8_t alpha) 460 { 461 alphaChanged_ = (alpha == 255 && abilityBgAlpha_ != 255) || 462 (alpha != 255 && abilityBgAlpha_ == 255); 463 abilityBgAlpha_ = alpha; 464 } 465 GetAbilityBgAlpha()466 uint8_t GetAbilityBgAlpha() const 467 { 468 return abilityBgAlpha_; 469 } 470 setQosCal(bool qosPidCal)471 void setQosCal(bool qosPidCal) 472 { 473 qosPidCal_ = qosPidCal; 474 } 475 476 bool IsSurfaceInStartingWindowStage() const; 477 478 WINDOW_LAYER_INFO_TYPE GetVisibleLevelForWMS(RSVisibleLevel visibleLevel); 479 480 void SetVisibleRegionRecursive( 481 const Occlusion::Region& region, 482 VisibleData& visibleVec, 483 std::map<uint32_t, RSVisibleLevel>& pidVisMap, 484 bool needSetVisibleRegion = true, 485 RSVisibleLevel visibleLevel = RSVisibleLevel::RS_UNKNOW_VISIBLE_LEVEL, 486 bool isSystemAnimatedScenes = false); 487 GetVisibleDirtyRegion()488 const Occlusion::Region& GetVisibleDirtyRegion() const 489 { 490 return visibleDirtyRegion_; 491 } 492 SetVisibleDirtyRegion(const Occlusion::Region & region)493 void SetVisibleDirtyRegion(const Occlusion::Region& region) 494 { 495 visibleDirtyRegion_ = region; 496 } 497 SetAlignedVisibleDirtyRegion(const Occlusion::Region & alignedRegion)498 void SetAlignedVisibleDirtyRegion(const Occlusion::Region& alignedRegion) 499 { 500 alignedVisibleDirtyRegion_ = alignedRegion; 501 } 502 GetAlignedVisibleDirtyRegion()503 const Occlusion::Region& GetAlignedVisibleDirtyRegion() 504 { 505 return alignedVisibleDirtyRegion_; 506 } 507 SetExtraDirtyRegionAfterAlignment(const Occlusion::Region & region)508 void SetExtraDirtyRegionAfterAlignment(const Occlusion::Region& region) 509 { 510 extraDirtyRegionAfterAlignment_ = region; 511 extraDirtyRegionAfterAlignmentIsEmpty_ = extraDirtyRegionAfterAlignment_.IsEmpty(); 512 } 513 SetDirtyRegionAlignedEnable(bool enable)514 void SetDirtyRegionAlignedEnable(bool enable) 515 { 516 isDirtyRegionAlignedEnable_ = enable; 517 } 518 GetDirtyRegionBelowCurrentLayer()519 const Occlusion::Region& GetDirtyRegionBelowCurrentLayer() const 520 { 521 return dirtyRegionBelowCurrentLayer_; 522 } 523 SetDirtyRegionBelowCurrentLayer(Occlusion::Region & region)524 void SetDirtyRegionBelowCurrentLayer(Occlusion::Region& region) 525 { 526 #ifndef ROSEN_CROSS_PLATFORM 527 Occlusion::Rect dirtyRect { GetOldDirtyInSurface() }; 528 Occlusion::Region dirtyRegion { dirtyRect }; 529 dirtyRegionBelowCurrentLayer_ = dirtyRegion.And(region); 530 dirtyRegionBelowCurrentLayerIsEmpty_ = dirtyRegionBelowCurrentLayer_.IsEmpty(); 531 #endif 532 } 533 GetDstRectChanged()534 bool GetDstRectChanged() const 535 { 536 return dstRectChanged_; 537 } 538 CleanDstRectChanged()539 void CleanDstRectChanged() 540 { 541 dstRectChanged_ = false; 542 } 543 GetAlphaChanged()544 bool GetAlphaChanged() const 545 { 546 return alphaChanged_; 547 } 548 CleanAlphaChanged()549 void CleanAlphaChanged() 550 { 551 alphaChanged_ = false; 552 } 553 SetGlobalDirtyRegion(const RectI & rect)554 void SetGlobalDirtyRegion(const RectI& rect) 555 { 556 Occlusion::Rect tmpRect { rect.left_, rect.top_, rect.GetRight(), rect.GetBottom() }; 557 Occlusion::Region region { tmpRect }; 558 globalDirtyRegion_ = visibleRegion_.And(region); 559 globalDirtyRegionIsEmpty_ = globalDirtyRegion_.IsEmpty(); 560 } 561 GetGlobalDirtyRegion()562 const Occlusion::Region& GetGlobalDirtyRegion() const 563 { 564 return globalDirtyRegion_; 565 } 566 567 void SetLocalZOrder(float localZOrder); 568 float GetLocalZOrder() const; 569 570 void SetColorSpace(GraphicColorGamut colorSpace); 571 GraphicColorGamut GetColorSpace() const; 572 #ifndef ROSEN_CROSS_PLATFORM 573 void SetConsumer(const sptr<IConsumerSurface>& consumer); 574 void SetBlendType(GraphicBlendType blendType); 575 GraphicBlendType GetBlendType(); 576 #endif 577 578 void UpdateSurfaceDefaultSize(float width, float height); 579 580 // Only SurfaceNode in RS calls "RegisterBufferAvailableListener" 581 // to save callback method sent by RT or UI which depends on the value of "isFromRenderThread". 582 void RegisterBufferAvailableListener(sptr<RSIBufferAvailableCallback> callback, bool isFromRenderThread); 583 584 void RegisterBufferClearListener(sptr<RSIBufferClearCallback> callback); 585 586 // Only SurfaceNode in RT calls "ConnectToNodeInRenderService" to send callback method to RS 587 void ConnectToNodeInRenderService(); 588 589 void NotifyRTBufferAvailable(bool isTextureExportNode = false); 590 bool IsNotifyRTBufferAvailable() const; 591 bool IsNotifyRTBufferAvailablePre() const; 592 593 void NotifyUIBufferAvailable(); 594 bool IsNotifyUIBufferAvailable() const; 595 void SetIsNotifyUIBufferAvailable(bool available); 596 597 // UI Thread would not be notified when SurfaceNode created by Video/Camera in RenderService has available buffer. 598 // And RenderThread does not call mainFunc_ if nothing in UI thread is changed 599 // which would cause callback for "clip" on parent SurfaceNode cannot be triggered 600 // for "clip" is executed in RenderThreadVisitor::ProcessSurfaceRenderNode. 601 // To fix this bug, we set callback which would call RSRenderThread::RequestNextVSync() to forcedly "refresh" 602 // RenderThread when SurfaceNode in RenderService has available buffer and execute RSIBufferAvailableCallback. 603 void SetCallbackForRenderThreadRefresh(bool isRefresh); 604 bool NeedSetCallbackForRenderThreadRefresh(); 605 ParallelVisitLock()606 void ParallelVisitLock() 607 { 608 parallelVisitMutex_.lock(); 609 } 610 ParallelVisitUnlock()611 void ParallelVisitUnlock() 612 { 613 parallelVisitMutex_.unlock(); 614 } 615 SubNodeVisible(const RectI & r)616 bool SubNodeVisible(const RectI& r) const 617 { 618 Occlusion::Rect nodeRect { r.left_, r.top_, r.GetRight(), r.GetBottom() }; 619 // if current node is in occluded region of the surface, it could be skipped in process step 620 return visibleRegion_.IsIntersectWith(nodeRect); 621 } 622 IsEmptyAppWindow()623 inline bool IsEmptyAppWindow() const 624 { 625 return IsAppWindow() && (GetChildrenCount() == 0 || HasOnlyOneRootNode()); 626 } 627 IsTransparent()628 inline bool IsTransparent() const 629 { 630 const uint8_t opacity = 255; 631 return !(GetAbilityBgAlpha() == opacity && ROSEN_EQ(GetGlobalAlpha(), 1.0f)) || 632 (IsEmptyAppWindow() && RSUniRenderJudgement::IsUniRender()); 633 } 634 IsCurrentNodeInTransparentRegion(const Occlusion::Rect & nodeRect)635 inline bool IsCurrentNodeInTransparentRegion(const Occlusion::Rect& nodeRect) const 636 { 637 return transparentRegion_.IsIntersectWith(nodeRect); 638 } 639 640 // Used when the node is opaque, but not calculate in occlusion SetTreatedAsTransparent(bool isOcclusion)641 void SetTreatedAsTransparent(bool isOcclusion) 642 { 643 isTreatedAsTransparent_ = isOcclusion; 644 } 645 IsTreatedAsTransparent()646 bool IsTreatedAsTransparent() const 647 { 648 return isTreatedAsTransparent_; 649 } 650 651 bool SubNodeIntersectWithDirty(const RectI& r) const; 652 653 // judge if a rect r is intersect with existing dirtyregion, include current surfacenode's dirtyregion, display 654 // dirtyregion, and dirtyregion from other surfacenode because of 32/64 bits alignment. 655 bool SubNodeNeedDraw(const RectI& r, PartialRenderType opDropType) const; 656 GetZorderChanged()657 bool GetZorderChanged() const 658 { 659 return zOrderChanged_; 660 } 661 IsZOrderPromoted()662 bool IsZOrderPromoted() const 663 { 664 return GetRenderProperties().GetPositionZ() > positionZ_; 665 } 666 UpdatePositionZ()667 void UpdatePositionZ() 668 { 669 zOrderChanged_ = !ROSEN_EQ(GetRenderProperties().GetPositionZ(), positionZ_); 670 positionZ_ = GetRenderProperties().GetPositionZ(); 671 } 672 HasContainerWindow()673 inline bool HasContainerWindow() const 674 { 675 return containerConfig_.hasContainerWindow_; 676 } 677 SetContainerWindow(bool hasContainerWindow,float density)678 void SetContainerWindow(bool hasContainerWindow, float density) 679 { 680 containerConfig_.Update(hasContainerWindow, density); 681 } 682 IsOpaqueRegionChanged()683 bool IsOpaqueRegionChanged() const 684 { 685 return opaqueRegionChanged_; 686 } 687 CleanOpaqueRegionChanged()688 void CleanOpaqueRegionChanged() 689 { 690 opaqueRegionChanged_ = false; 691 } 692 693 // [planning] Remove this after skia is upgraded, the clipRegion is supported 694 void ResetChildrenFilterRects(); 695 void UpdateChildrenFilterRects(std::shared_ptr<RSRenderNode> filternode, const RectI& rect, bool cacheValid); 696 const std::vector<RectI>& GetChildrenNeedFilterRects() const; 697 const std::vector<bool>& GetChildrenNeedFilterRectsCacheValid() const; 698 const std::vector<std::shared_ptr<RSRenderNode>>& GetChildrenFilterNodes() const; 699 700 // manage abilities' nodeid info 701 void UpdateAbilityNodeIds(NodeId id, bool isAdded); 702 const std::unordered_set<NodeId>& GetAbilityNodeIds() const; 703 void AddAbilityComponentNodeIds(std::unordered_set<NodeId> nodeIds); 704 void ResetAbilityNodeIds(); 705 706 // manage appWindowNode's child hardware enabled nodes info 707 void ResetChildHardwareEnabledNodes(); 708 void AddChildHardwareEnabledNode(WeakPtr childNode); 709 const std::vector<WeakPtr>& GetChildHardwareEnabledNodes() const; 710 IsFocusedNode(uint64_t focusedNodeId)711 bool IsFocusedNode(uint64_t focusedNodeId) 712 { 713 return GetNodeId() == focusedNodeId; 714 } 715 716 void ResetSurfaceOpaqueRegion(const RectI& screeninfo, const RectI& absRect, const ScreenRotation screenRotation, 717 const bool isFocusWindow, const Vector4<int>& cornerRadius); 718 Occlusion::Region ResetOpaqueRegion( 719 const RectI& absRect, const ScreenRotation screenRotation, const bool isFocusWindow) const; 720 Occlusion::Region SetUnfocusedWindowOpaqueRegion(const RectI& absRect, const ScreenRotation screenRotation) const; 721 Occlusion::Region SetFocusedWindowOpaqueRegion(const RectI& absRect, const ScreenRotation screenRotation) const; 722 Occlusion::Region SetCornerRadiusOpaqueRegion(const RectI& absRect, const Vector4<int>& cornerRadius) const; 723 void ResetSurfaceContainerRegion(const RectI& screeninfo, const RectI& absRect, 724 const ScreenRotation screenRotation); 725 bool CheckOpaqueRegionBaseInfo(const RectI& screeninfo, const RectI& absRect, const ScreenRotation screenRotation, 726 const bool isFocusWindow, const Vector4<int>& cornerRadius); 727 void SetOpaqueRegionBaseInfo(const RectI& screeninfo, const RectI& absRect, const ScreenRotation screenRotation, 728 const bool isFocusWindow, const Vector4<int>& cornerRadius); 729 730 bool IsStartAnimationFinished() const; 731 void SetStartAnimationFinished(); 732 // if surfacenode's buffer has been consumed, it should be set dirty 733 bool UpdateDirtyIfFrameBufferConsumed(); 734 735 #ifndef USE_ROSEN_DRAWING 736 void UpdateSrcRect(const RSPaintFilterCanvas& canvas, const SkIRect& dstRect, bool hasRotation = false); 737 #else 738 void UpdateSrcRect(const RSPaintFilterCanvas& canvas, const Drawing::RectI& dstRect, bool hasRotation = false); 739 #endif 740 741 // if a surfacenode's dstrect is empty, its subnodes' prepare stage can be skipped 742 bool ShouldPrepareSubnodes(); 743 void StoreMustRenewedInfo() override; 744 SetNodeCost(int32_t cost)745 void SetNodeCost(int32_t cost) 746 { 747 nodeCost_ = cost; 748 } 749 GetNodeCost()750 int32_t GetNodeCost() const 751 { 752 return nodeCost_; 753 } 754 755 std::string DirtyRegionDump() const; SetAnimateState()756 void SetAnimateState() { 757 animateState_ = true; 758 } ResetAnimateState()759 void ResetAnimateState() { 760 animateState_ = false; 761 } GetAnimateState()762 bool GetAnimateState() const 763 { 764 return animateState_; 765 } 766 bool IsParentLeashWindowInScale() const; 767 768 Occlusion::Rect GetSurfaceOcclusionRect(bool isUniRender); 769 770 void AccumulateOcclusionRegion(Occlusion::Region& accumulatedRegion, 771 Occlusion::Region& curRegion, 772 bool& hasFilterCacheOcclusion, 773 bool isUniRender, 774 bool filterCacheOcclusionEnabled); 775 776 bool LeashWindowRelatedAppWindowOccluded(std::shared_ptr<RSSurfaceRenderNode>& appNode); 777 778 void OnTreeStateChanged() override; 779 780 #ifndef USE_ROSEN_DRAWING 781 #ifdef NEW_SKIA SetGrContext(GrDirectContext * grContext)782 void SetGrContext(GrDirectContext* grContext) 783 #else 784 void SetGrContext(GrContext* grContext) 785 #endif 786 #else 787 void SetDrawingGPUContext(Drawing::GPUContext* grContext) 788 #endif 789 { 790 grContext_ = grContext; 791 } 792 // UIFirst SetSubmittedSubThreadIndex(uint32_t index)793 void SetSubmittedSubThreadIndex(uint32_t index) 794 { 795 submittedSubThreadIndex_ = index; 796 } 797 GetSubmittedSubThreadIndex()798 uint32_t GetSubmittedSubThreadIndex() const 799 { 800 return submittedSubThreadIndex_; 801 } 802 803 void SetCacheSurfaceProcessedStatus(CacheProcessStatus cacheProcessStatus); 804 CacheProcessStatus GetCacheSurfaceProcessedStatus() const; 805 GetFilterCacheFullyCovered()806 bool GetFilterCacheFullyCovered() const 807 { 808 return isFilterCacheFullyCovered_; 809 } 810 SetFilterCacheFullyCovered(bool val)811 void SetFilterCacheFullyCovered(bool val) 812 { 813 isFilterCacheFullyCovered_ = val; 814 } 815 GetFilterCacheValidForOcclusion()816 bool GetFilterCacheValidForOcclusion() const 817 { 818 return isFilterCacheValidForOcclusion_; 819 } 820 821 void CalcFilterCacheValidForOcclusion(); 822 IsFilterCacheStatusChanged()823 bool IsFilterCacheStatusChanged() const 824 { 825 return isFilterCacheStatusChanged_; 826 } 827 ResetFilterNodes()828 void ResetFilterNodes() 829 { 830 filterNodes_.clear(); 831 } 832 void UpdateFilterNodes(const std::shared_ptr<RSRenderNode>& nodePtr); 833 // update static node's back&front-ground filter cache status 834 void UpdateFilterCacheStatusWithVisible(bool visible); 835 void UpdateFilterCacheStatusIfNodeStatic(const RectI& clipRect, bool isRotationChanged); 836 void UpdateDrawingCacheNodes(const std::shared_ptr<RSRenderNode>& nodePtr); 837 // reset static node's drawing cache status as not changed and get filter rects 838 void ResetDrawingCacheStatusIfNodeStatic(std::unordered_map<NodeId, std::unordered_set<NodeId>>& allRects); 839 840 void SetNotifyRTBufferAvailable(bool isNotifyRTBufferAvailable); 841 842 // whether the subtree has only one root node 843 bool HasOnlyOneRootNode() const; 844 GetHasSecurityLayer()845 bool GetHasSecurityLayer() 846 { 847 return hasSecurityLayer_; 848 } 849 SetHasSecurityLayer(bool hasSecurityLayer)850 void SetHasSecurityLayer(bool hasSecurityLayer) 851 { 852 hasSecurityLayer_ = hasSecurityLayer; 853 } GetHasSkipLayer()854 bool GetHasSkipLayer() 855 { 856 return hasSkipLayer_; 857 } 858 SetHasSkipLayer(bool hasSkipLayer)859 void SetHasSkipLayer(bool hasSkipLayer) 860 { 861 hasSkipLayer_ = hasSkipLayer; 862 } 863 GetHwcDelayDirtyFlag()864 bool GetHwcDelayDirtyFlag() const noexcept 865 { 866 return hwcDelayDirtyFlag_; 867 } 868 SetHwcDelayDirtyFlag(bool hwcDelayDirtyFlag)869 void SetHwcDelayDirtyFlag(bool hwcDelayDirtyFlag) 870 { 871 hwcDelayDirtyFlag_ = hwcDelayDirtyFlag; 872 } 873 GetSurfaceCacheContentStatic()874 bool GetSurfaceCacheContentStatic() 875 { 876 return surfaceCacheContentStatic_; 877 } 878 879 void UpdateSurfaceCacheContentStatic( 880 const std::unordered_map<NodeId, std::weak_ptr<RSRenderNode>>& activeNodeIds); 881 // temperory limit situation: 882 // subtree no drawingcache and geodirty 883 // contentdirty 1 specifically for buffer update IsContentDirtyNodeLimited()884 bool IsContentDirtyNodeLimited() const 885 { 886 return drawingCacheNodes_.empty() && dirtyGeoNodeNum_ == 0 && dirtyContentNodeNum_ <= 1; 887 } 888 GetLastFrameChildrenCnt()889 size_t GetLastFrameChildrenCnt() 890 { 891 return lastFrameChildrenCnt_; 892 } 893 SetLastFrameChildrenCnt(size_t childrenCnt)894 void SetLastFrameChildrenCnt(size_t childrenCnt) 895 { 896 lastFrameChildrenCnt_ = childrenCnt; 897 } 898 899 bool IsUIFirstCacheReusable(DeviceType deviceType); 900 901 #ifdef USE_SURFACE_TEXTURE GetSurfaceTexture()902 std::shared_ptr<RSSurfaceTexture> GetSurfaceTexture() const { return surfaceTexture_; }; SetSurfaceTexture(const std::shared_ptr<RSSurfaceTexture> & texture)903 void SetSurfaceTexture(const std::shared_ptr<RSSurfaceTexture> &texture) { surfaceTexture_ = texture; } 904 #endif 905 SetForeground(bool isForeground)906 void SetForeground(bool isForeground) 907 { 908 isForeground_ = isForeground; 909 } 910 SetSurfaceId(SurfaceId surfaceId)911 void SetSurfaceId(SurfaceId surfaceId) 912 { 913 surfaceId_ = surfaceId; 914 } 915 GetSurfaceId()916 SurfaceId GetSurfaceId() const 917 { 918 return surfaceId_; 919 } 920 GetIsForeground()921 bool GetIsForeground() const 922 { 923 return isForeground_; 924 } 925 bool GetNodeIsSingleFrameComposer() const override; 926 SetAncestorDisplayNode(const RSBaseRenderNode::WeakPtr & ancestorDisplayNode)927 void SetAncestorDisplayNode(const RSBaseRenderNode::WeakPtr& ancestorDisplayNode) 928 { 929 ancestorDisplayNode_ = ancestorDisplayNode; 930 } 931 GetAncestorDisplayNode()932 RSBaseRenderNode::WeakPtr GetAncestorDisplayNode() const 933 { 934 return ancestorDisplayNode_; 935 } 936 bool QuerySubAssignable(bool isRotation); 937 bool QueryIfAllHwcChildrenForceDisabledByFilter(); 938 bool GetHasSharedTransitionNode() const; 939 void SetHasSharedTransitionNode(bool hasSharedTransitionNode); 940 Vector2f GetGravityTranslate(float imgWidth, float imgHeight); 941 bool GetHasTransparentSurface() const; 942 HasWindowCorner()943 bool HasWindowCorner() 944 { 945 Vector4f cornerRadius; 946 Vector4f::Max(GetWindowCornerRadius(), GetGlobalCornerRadius(), cornerRadius); 947 return !cornerRadius.IsZero(); 948 } 949 950 private: 951 void OnResetParent() override; 952 void ClearChildrenCache(); 953 bool SubNodeIntersectWithExtraDirtyRegion(const RectI& r) const; 954 Vector4f GetWindowCornerRadius(); 955 std::vector<std::shared_ptr<RSSurfaceRenderNode>> GetLeashWindowNestedSurfaces(); 956 bool IsHistoryOccludedDirtyRegionNeedSubmit(); 957 void ClearHistoryUnSubmittedDirtyInfo(); 958 void UpdateHistoryUnsubmittedDirtyInfo(); 959 bool IsHardwareDisabledBySrcRect() const; 960 bool IsYUVBufferFormat() const; 961 962 std::mutex mutexRT_; 963 std::mutex mutexUI_; 964 std::mutex mutexClear_; 965 std::mutex mutex_; 966 #ifndef USE_ROSEN_DRAWING 967 #ifdef NEW_SKIA 968 GrDirectContext* grContext_ = nullptr; 969 #else 970 GrContext* grContext_ = nullptr; 971 #endif 972 #else 973 Drawing::GPUContext* grContext_ = nullptr; 974 #endif 975 std::mutex parallelVisitMutex_; 976 977 float contextAlpha_ = 1.0f; 978 #ifndef USE_ROSEN_DRAWING 979 std::optional<SkMatrix> contextMatrix_; 980 std::optional<SkRect> contextClipRect_; 981 #else 982 std::optional<Drawing::Matrix> contextMatrix_; 983 std::optional<Drawing::Rect> contextClipRect_; 984 #endif 985 986 bool isSecurityLayer_ = false; 987 bool isSkipLayer_ = false; 988 bool hasFingerprint_ = false; 989 RectI srcRect_; 990 #ifndef USE_ROSEN_DRAWING 991 SkMatrix totalMatrix_; 992 #else 993 Drawing::Matrix totalMatrix_; 994 #endif 995 int32_t offsetX_ = 0; 996 int32_t offsetY_ = 0; 997 float positionZ_ = 0.0f; 998 bool zOrderChanged_ = false; 999 bool qosPidCal_ = false; 1000 SurfaceId surfaceId_ = 0; 1001 1002 std::string name_; 1003 std::string bundleName_; 1004 RSSurfaceNodeType nodeType_ = RSSurfaceNodeType::DEFAULT; 1005 GraphicColorGamut colorSpace_ = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB; 1006 #ifndef ROSEN_CROSS_PLATFORM 1007 GraphicBlendType blendType_ = GraphicBlendType::GRAPHIC_BLEND_SRCOVER; 1008 #endif 1009 bool isNotifyRTBufferAvailablePre_ = false; 1010 std::atomic<bool> isNotifyRTBufferAvailable_ = false; 1011 std::atomic<bool> isNotifyUIBufferAvailable_ = true; 1012 std::atomic_bool isBufferAvailable_ = false; 1013 sptr<RSIBufferAvailableCallback> callbackFromRT_; 1014 sptr<RSIBufferAvailableCallback> callbackFromUI_; 1015 sptr<RSIBufferClearCallback> clearBufferCallback_; 1016 bool isRefresh_ = false; 1017 std::vector<NodeId> childSurfaceNodeIds_; 1018 friend class RSRenderThreadVisitor; 1019 RectI clipRegionFromParent_; 1020 /* 1021 visibleRegion: appwindow visible region after occlusion, used for rs opdrop and other optimization. 1022 visibleRegionForCallBack: appwindow visible region after occlusion (no filtercache occlusion), used in 1023 windowmanager, qos, and web surfacenode visibility callback. 1024 These two values are the same in most cases. If there are filter cache occlusion, this two values will be 1025 different under filter cache surfacenode layer. 1026 */ 1027 Occlusion::Region visibleRegion_; 1028 Occlusion::Region visibleRegionForCallBack_; 1029 Occlusion::Region visibleDirtyRegion_; 1030 bool isDirtyRegionAlignedEnable_ = false; 1031 Occlusion::Region alignedVisibleDirtyRegion_; 1032 bool isOcclusionVisible_ = true; 1033 bool isOcclusionVisibleWithoutFilter_ = true; 1034 bool isOcclusionInSpecificScenes_ = false; 1035 std::shared_ptr<RSDirtyRegionManager> dirtyManager_ = nullptr; 1036 std::shared_ptr<RSDirtyRegionManager> cacheSurfaceDirtyManager_ = nullptr; 1037 RectI dstRect_; 1038 bool dstRectChanged_ = false; 1039 uint8_t abilityBgAlpha_ = 0; 1040 bool alphaChanged_ = false; 1041 bool isUIHidden_ = false; 1042 Occlusion::Region globalDirtyRegion_; 1043 // dirtyRegion caused by surfaceNode visible region after alignment 1044 Occlusion::Region extraDirtyRegionAfterAlignment_; 1045 bool extraDirtyRegionAfterAlignmentIsEmpty_ = true; 1046 1047 bool globalDirtyRegionIsEmpty_ = false; 1048 // if a there a dirty layer under transparent clean layer, transparent layer should refreshed 1049 Occlusion::Region dirtyRegionBelowCurrentLayer_; 1050 bool dirtyRegionBelowCurrentLayerIsEmpty_ = false; 1051 1052 // opaque region of the surface 1053 Occlusion::Region opaqueRegion_; 1054 bool opaqueRegionChanged_ = false; 1055 // [planning] Remove this after skia is upgraded, the clipRegion is supported 1056 std::vector<RectI> childrenFilterRects_; 1057 std::vector<bool> childrenFilterRectsCacheValid_; 1058 std::vector<std::shared_ptr<RSRenderNode>> childrenFilterNodes_; 1059 std::unordered_set<NodeId> abilityNodeIds_; 1060 size_t dirtyContentNodeNum_ = 0; 1061 size_t dirtyGeoNodeNum_ = 0; 1062 size_t dirtynodeNum_ = 0; 1063 // transparent region of the surface, floating window's container window is always treated as transparent 1064 Occlusion::Region transparentRegion_; 1065 1066 Occlusion::Region containerRegion_; 1067 bool isFilterCacheFullyCovered_ = false; 1068 bool isFilterCacheValidForOcclusion_ = false; 1069 bool isFilterCacheStatusChanged_ = false; 1070 bool isTreatedAsTransparent_ = false; 1071 // valid filter nodes within, including itself 1072 std::vector<std::shared_ptr<RSRenderNode>> filterNodes_; 1073 std::unordered_map<NodeId, std::weak_ptr<RSRenderNode>> drawingCacheNodes_; 1074 1075 struct OpaqueRegionBaseInfo 1076 { 1077 RectI screenRect_; 1078 RectI absRect_; 1079 ScreenRotation screenRotation_; 1080 bool isFocusWindow_; 1081 bool isTransparent_; 1082 bool hasContainerWindow_; 1083 Vector4<int> cornerRadius_; 1084 }; 1085 1086 //<screenRect, absRect, screenRotation, isFocusWindow, isTransparent, hasContainerWindow> 1087 OpaqueRegionBaseInfo opaqueRegionBaseInfo_; 1088 1089 /* 1090 ContainerWindow configs acquired from arkui, including container window state, screen density, container border 1091 width, padding width, inner/outer radius, etc. 1092 */ 1093 class ContainerConfig { 1094 public: 1095 void Update(bool hasContainer, float density); 1096 private: RoundFloor(float length)1097 inline int RoundFloor(float length) 1098 { 1099 // if a float value is very close to a integer (< 0.05f), return round value 1100 return std::abs(length - std::round(length)) < 0.05f ? std::round(length) : std::floor(length); 1101 } 1102 public: 1103 // temporary const value from ACE container_modal_constants.h, will be replaced by uniform interface 1104 const static int CONTAINER_TITLE_HEIGHT = 37; // container title height = 37 vp 1105 const static int CONTENT_PADDING = 4; // container <--> content distance 4 vp 1106 const static int CONTAINER_BORDER_WIDTH = 1; // container border width 2 vp 1107 const static int CONTAINER_OUTER_RADIUS = 16; // container outer radius 16 vp 1108 const static int CONTAINER_INNER_RADIUS = 14; // container inner radius 14 vp 1109 1110 bool hasContainerWindow_ = false; // set to false as default, set by arkui 1111 float density = 2.0f; // The density default value is 2 1112 int outR = 32; // outer radius (int value) 1113 int inR = 28; // inner radius (int value) 1114 int bp = 10; // border width + padding (int value) 1115 int bt = 76; // border width + title (int value) 1116 }; 1117 1118 ContainerConfig containerConfig_; 1119 1120 bool startAnimationFinished_ = false; 1121 1122 // only used in hardware enabled pointer window, when gpu -> hardware composer 1123 bool isNodeDirtyInLastFrame_ = true; 1124 bool isNodeDirty_ = true; 1125 // used for hardware enabled nodes 1126 bool isHardwareEnabledNode_ = false; 1127 SelfDrawingNodeType selfDrawingType_ = SelfDrawingNodeType::DEFAULT; 1128 bool isCurrentFrameHardwareEnabled_ = false; 1129 bool isLastFrameHardwareEnabled_ = false; 1130 bool hasSubNodeShouldPaint_ = false; 1131 // mark if this self-drawing node is forced not to use hardware composer 1132 // in case where this node's parent window node is occluded or is appFreeze, this variable will be marked true 1133 bool isHardwareForcedDisabled_ = false; 1134 bool isHardwareForcedDisabledByFilter_ = false; 1135 // For certain buffer format(YUV), dss restriction on src : srcRect % 2 == 0 1136 // To avoid switch between gpu and dss during sliding, we disable dss when srcHeight != bufferHeight 1137 bool isHardwareForcedDisabledBySrcRect_ = false; 1138 bool isHardwareDisabledByCache_ = false; 1139 float localZOrder_ = 0.0f; 1140 std::vector<WeakPtr> childHardwareEnabledNodes_; 1141 int32_t nodeCost_ = 0; 1142 1143 bool animateState_ = false; 1144 1145 bool needDrawAnimateProperty_ = false; 1146 bool prevVisible_ = false; 1147 bool hasSecurityLayer_ = false; 1148 bool hasSkipLayer_ = false; 1149 1150 uint32_t processZOrder_ = -1; 1151 1152 // mark if this self-drawing node do not consume buffer when gpu -> hwc 1153 bool hwcDelayDirtyFlag_ = false; 1154 1155 // UIFirst 1156 uint32_t submittedSubThreadIndex_ = INT_MAX; 1157 std::atomic<CacheProcessStatus> cacheProcessStatus_ = CacheProcessStatus::WAITING; 1158 std::atomic<bool> isNeedSubmitSubThread_ = true; 1159 #ifdef USE_SURFACE_TEXTURE 1160 std::shared_ptr<RSSurfaceTexture> surfaceTexture_ {}; 1161 #endif 1162 bool isForeground_ = false; 1163 1164 RSBaseRenderNode::WeakPtr ancestorDisplayNode_; 1165 bool hasSharedTransitionNode_ = false; 1166 size_t lastFrameChildrenCnt_ = 0; 1167 // node only have translate and scale changes 1168 bool surfaceCacheContentStatic_ = false; 1169 1170 std::atomic<bool> hasUnSubmittedOccludedDirtyRegion_ = false; 1171 RectI historyUnSubmittedOccludedDirtyRegion_; 1172 bool hasTransparentSurface_ = false; 1173 bool forceUIFirst_ = false; 1174 bool forceUIFirstChanged_ = false; 1175 1176 friend class RSUniRenderVisitor; 1177 friend class RSRenderNode; 1178 friend class RSRenderService; 1179 }; 1180 } // namespace Rosen 1181 } // namespace OHOS 1182 1183 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_SURFACE_RENDER_NODE_H 1184