1 /* 2 * Copyright (c) 2022-2024 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 ROSEN_MODULE_RS_FRAME_REPORT_H 17 #define ROSEN_MODULE_RS_FRAME_REPORT_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace Rosen { 23 using FrameGetEnableFunc = int (*)(); 24 using InitFunc = void (*)(); 25 using ProcessCommandsStartFunc = void(*)(); 26 using AnimateStartFunc = void(*)(); 27 using RenderStartFunc = void(*)(uint64_t); 28 using ParallelRenderStartFunc = void(*)(); 29 using RenderEndFunc = void(*)(); 30 using ParallelRenderEndFunc = void(*)(); 31 using SendCommandsStartFunc = void(*)(); 32 using SetFrameParamFunc = void(*)(int, int, int, int); 33 class RsFrameReport final { 34 public: 35 static RsFrameReport& GetInstance(); 36 void Init(); 37 int GetEnable(); 38 39 void ProcessCommandsStart(); 40 void AnimateStart(); 41 void RenderStart(uint64_t timestamp); 42 void RSRenderStart(); 43 void RenderEnd(); 44 void RSRenderEnd(); 45 void SendCommandsStart(); 46 void SetFrameParam(int requestId, int load, int schedFrameNum, int value); 47 48 private: 49 RsFrameReport(); 50 ~RsFrameReport(); 51 bool LoadLibrary(); 52 void CloseLibrary(); 53 void *LoadSymbol(const char *symName); 54 void *frameSchedHandle_ = nullptr; 55 bool frameSchedSoLoaded_ = false; 56 57 FrameGetEnableFunc frameGetEnableFunc_ = nullptr; 58 InitFunc initFunc_ = nullptr; 59 ProcessCommandsStartFunc processCommandsStartFun_ = nullptr; 60 AnimateStartFunc animateStartFunc_ = nullptr; 61 RenderStartFunc renderStartFunc_ = nullptr; 62 ParallelRenderStartFunc parallelRenderStartFunc_ = nullptr; 63 RenderEndFunc renderEndFunc_ = nullptr; 64 ParallelRenderEndFunc parallelRenderEndFunc_ = nullptr; 65 SendCommandsStartFunc sendCommandsStartFunc_ = nullptr; 66 SetFrameParamFunc setFrameParamFunc_ = nullptr; 67 }; 68 } // namespace Rosen 69 } // namespace OHOS 70 #endif // ROSEN_MODULE_RS_FRAME_REPORT_H 71