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 RENDER_SERVICE_BASE_PIPELINE_RS_HWC_RECORDER_H 17 #define RENDER_SERVICE_BASE_PIPELINE_RS_HWC_RECORDER_H 18 19 namespace OHOS { 20 namespace Rosen { 21 22 struct RSHwcRecorder { 23 public: 24 RSHwcRecorder() = default; 25 ~RSHwcRecorder() = default; 26 27 RSHwcRecorder(const RSHwcRecorder&) = delete; 28 RSHwcRecorder(RSHwcRecorder&&) = delete; 29 RSHwcRecorder& operator=(const RSHwcRecorder&) = delete; 30 RSHwcRecorder& operator=(RSHwcRecorder&&) = delete; 31 SetBlendWithBackgroundRSHwcRecorder32 void SetBlendWithBackground(bool isBlendWithBackground) { isBlendWithBackground_ = isBlendWithBackground; } IsBlendWithBackgroundRSHwcRecorder33 bool IsBlendWithBackground() const { return isBlendWithBackground_; } SetForegroundColorValidRSHwcRecorder34 void SetForegroundColorValid(bool isForegroundColorValid) { isForegroundColorValid_ = isForegroundColorValid; } IsForegroundColorValidRSHwcRecorder35 bool IsForegroundColorValid() const { return isForegroundColorValid_; } 36 GetZorderChangedRSHwcRecorder37 bool GetZorderChanged() const { return zOrderChanged_; } 38 UpdatePositionZRSHwcRecorder39 void UpdatePositionZ(float positionZ) 40 { 41 zOrderChanged_ = !ROSEN_EQ(positionZ, positionZ_); 42 positionZ_ = positionZ; 43 } 44 SetZOrderForHwcEnableByFilterRSHwcRecorder45 void SetZOrderForHwcEnableByFilter(uint32_t zOrderForHwcEnableByFilter) 46 { 47 zOrderForHwcEnableByFilter_ = zOrderForHwcEnableByFilter; 48 } GetZOrderForHwcEnableByFilterRSHwcRecorder49 uint32_t GetZOrderForHwcEnableByFilter() const { return zOrderForHwcEnableByFilter_; } 50 51 private: 52 bool isBlendWithBackground_ = false; 53 bool isForegroundColorValid_ = false; 54 uint32_t zOrderForHwcEnableByFilter_ = 0; 55 float positionZ_ = 0.0f; 56 bool zOrderChanged_ = false; 57 }; 58 59 struct RSHwcSurfaceRecorder { 60 public: 61 RSHwcSurfaceRecorder() = default; 62 ~RSHwcSurfaceRecorder() = default; 63 64 RSHwcSurfaceRecorder(const RSHwcSurfaceRecorder&) = delete; 65 RSHwcSurfaceRecorder(RSHwcSurfaceRecorder&&) = delete; 66 RSHwcSurfaceRecorder& operator=(const RSHwcSurfaceRecorder&) = delete; 67 RSHwcSurfaceRecorder& operator=(RSHwcSurfaceRecorder&&) = delete; 68 SetLastFrameHasVisibleRegionRSHwcSurfaceRecorder69 void SetLastFrameHasVisibleRegion(bool lastFrameHasVisibleRegion) 70 { 71 lastFrameHasVisibleRegion_ = lastFrameHasVisibleRegion; 72 } GetLastFrameHasVisibleRegionRSHwcSurfaceRecorder73 bool GetLastFrameHasVisibleRegion() const { return lastFrameHasVisibleRegion_; } SetIntersectWithPreviousFilterRSHwcSurfaceRecorder74 void SetIntersectWithPreviousFilter(bool isIntersectWithPreviousFilter) 75 { 76 isIntersectWithPreviousFilter_ = isIntersectWithPreviousFilter; 77 } IsIntersectWithPreviousFilterRSHwcSurfaceRecorder78 bool IsIntersectWithPreviousFilter() const { return isIntersectWithPreviousFilter_; } 79 80 private: 81 bool lastFrameHasVisibleRegion_ = true; 82 bool isIntersectWithPreviousFilter_ = false; 83 }; 84 85 struct RSHwcDisplayRecorder { 86 RSHwcDisplayRecorder() = default; 87 ~RSHwcDisplayRecorder() = default; 88 89 RSHwcDisplayRecorder(const RSHwcDisplayRecorder&) = delete; 90 RSHwcDisplayRecorder(RSHwcDisplayRecorder&&) = delete; 91 RSHwcDisplayRecorder& operator=(const RSHwcDisplayRecorder&) = delete; 92 RSHwcDisplayRecorder& operator=(RSHwcDisplayRecorder&&) = delete; 93 GetNeedForceUpdateHwcNodesRSHwcDisplayRecorder94 bool GetNeedForceUpdateHwcNodes() const { return needForceUpdateHwcNodes_; } SetNeedForceUpdateHwcNodesRSHwcDisplayRecorder95 void SetNeedForceUpdateHwcNodes(bool needForceUpdateHwcNodes) 96 { 97 needForceUpdateHwcNodes_ = needForceUpdateHwcNodes; 98 } HasVisibleHwcNodesRSHwcDisplayRecorder99 bool HasVisibleHwcNodes() const { return hasVisibleHwcNodes_; } SetHasVisibleHwcNodesRSHwcDisplayRecorder100 void SetHasVisibleHwcNodes(bool hasVisibleHwcNodes) { hasVisibleHwcNodes_ = hasVisibleHwcNodes; } 101 102 bool needForceUpdateHwcNodes_ = false; 103 bool hasVisibleHwcNodes_ = false; 104 }; 105 106 } // namespace Rosen 107 } // namespace OHOS 108 109 #endif