1 /* 2 * Copyright (c) 2025 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 16 #ifndef RS_DRM_UTIL_H 17 #define RS_DRM_UTIL_H 18 19 #include "pipeline/rs_processor.h" 20 21 namespace OHOS { 22 namespace Rosen { 23 24 class RSDrmUtil { 25 public: 26 RSDrmUtil() = default; 27 ~RSDrmUtil() = default; 28 using DrawablesVec = std::vector<std::tuple<NodeId, NodeId, DrawableV2::RSRenderNodeDrawableAdapter::SharedPtr>>; 29 30 static void ClearDrmNodes(); 31 static void CollectDrmNodes(const std::shared_ptr<RSSurfaceRenderNode>& surfaceNode); 32 static void AddDrmCloneCrossNode(const std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, 33 DrawablesVec& hardwareEnabledDrawables); 34 static void DRMCreateLayer(std::shared_ptr<RSProcessor> processor, Drawing::Matrix hwcMatrix); 35 static void PreAllocateProtectedBuffer(const std::shared_ptr<RSSurfaceRenderNode>& surfaceNode, 36 const std::shared_ptr<RSSurfaceHandler>& surfaceHandler); 37 static void MarkBlurIntersectWithDRM(const std::shared_ptr<RSRenderNode>& node, 38 const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& drmNodes, 39 const std::shared_ptr<RSScreenRenderNode>& curScreenNode); 40 private: 41 static void MarkBlurIntersectWithDRMForAllParentFilter(const std::shared_ptr<RSRenderNode>& node, 42 const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& drmNodes, 43 const std::shared_ptr<RSScreenRenderNode>& curScreenNode); 44 static void MarkBlurIntersectWithDRM(const std::shared_ptr<RSRenderNode>& node, 45 const std::vector<std::weak_ptr<RSSurfaceRenderNode>>& drmNodes); 46 static bool IsDRMBelowFilter(const std::shared_ptr<RSScreenRenderNode>& curScreenNode, 47 const std::shared_ptr<RSSurfaceRenderNode>& appWindowNode, 48 const std::shared_ptr<RSSurfaceRenderNode>& drmNode); 49 static bool GetDarkColorMode(const std::shared_ptr<RSRenderNode>& node, 50 const std::shared_ptr<RSSurfaceRenderNode>& appWindowNode); 51 inline static std::unordered_map<NodeId, // map<first level node ID, drm surface node> 52 std::vector<std::shared_ptr<RSSurfaceRenderNode>>> drmNodes_ = {}; 53 }; 54 55 } // namespace Rosen 56 } // namespace OHOS 57 #endif // RS_DRM_UTIL_H