1 /* 2 * Copyright (c) 2021-2022 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_CORE_PIPELINE_PROCESSOR_H 17 #define RS_CORE_PIPELINE_PROCESSOR_H 18 19 #include <memory> 20 21 #include "include/core/SkMatrix.h" 22 23 #include "rs_base_render_engine.h" 24 #include "pipeline/rs_display_render_node.h" 25 #include "pipeline/rs_surface_render_node.h" 26 27 namespace OHOS { 28 namespace Rosen { 29 class RSProcessor { 30 public: 31 RSProcessor() = default; 32 virtual ~RSProcessor() noexcept = default; 33 34 RSProcessor(const RSProcessor&) = delete; 35 void operator=(const RSProcessor&) = delete; 36 37 virtual bool Init(RSDisplayRenderNode& node, int32_t offsetX, int32_t offsetY, ScreenId mirroredId); 38 virtual void ProcessSurface(RSSurfaceRenderNode& node) = 0; 39 virtual void ProcessDisplaySurface(RSDisplayRenderNode& node) = 0; 40 virtual void PostProcess() = 0; 41 42 protected: 43 void CalculateMirrorAdaptiveCoefficient(float curWidth, float curHeight, 44 float mirroredWidth, float mirroredHeight); 45 void CalculateScreenTransformMatrix(const RSDisplayRenderNode& node); 46 void SetMirrorScreenSwap(const RSDisplayRenderNode& node); 47 48 void MultiLayersPerf(size_t layerNum); 49 void RequestPerf(uint32_t layerLevel, bool onOffTag); 50 #ifdef FRAME_AWARE_TRACE 51 bool FrameAwareTraceBoost(size_t layerNum); 52 #endif 53 54 ScreenInfo screenInfo_; 55 int32_t offsetX_ = 0; 56 int32_t offsetY_ = 0; 57 ScreenId mirroredId_ = INVALID_SCREEN_ID; 58 float mirrorAdaptiveCoefficient_ = 1.0f; 59 std::shared_ptr<RSBaseRenderEngine> renderEngine_; 60 SkMatrix screenTransformMatrix_; 61 BufferRequestConfig renderFrameConfig_ {}; 62 }; 63 } // namespace Rosen 64 } // namespace OHOS 65 #endif // RS_CORE_PIPELINE_PROCESSOR_H 66