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 RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_H 17 #define RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_H 18 #include <map> 19 #include <unordered_set> 20 21 #include "screen_manager/rs_screen_manager.h" 22 #include "transaction/rs_render_service_stub.h" 23 #include "vsync_controller.h" 24 #include "vsync_distributor.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 class RSMainThread; 29 class RSSyncTask; 30 class RSRenderServiceConnection; 31 32 class RSRenderService : public RSRenderServiceStub { 33 public: 34 RSRenderService(); 35 ~RSRenderService() noexcept; 36 37 RSRenderService(const RSRenderService&) = delete; 38 RSRenderService& operator=(const RSRenderService&) = delete; 39 40 bool Init(); 41 void Run(); 42 43 private: 44 int Dump(int fd, const std::vector<std::u16string>& args) override; 45 void DoDump(std::unordered_set<std::u16string>& argSets, std::string& dumpString) const; 46 void DumpNodesNotOnTheTree(std::string& dumpString) const; 47 void DumpAllNodesMemSize(std::string& dumpString) const; 48 void DumpHelpInfo(std::string& dumpString) const; 49 void DumpRSEvenParam(std::string& dumpString) const; 50 void DumpRenderServiceTree(std::string& dumpString) const; 51 void FPSDUMPProcess(std::unordered_set<std::u16string>& argSets, std::string& dumpString, 52 const std::u16string& arg) const; 53 void FPSDUMPClearProcess(std::unordered_set<std::u16string>& argSets, 54 std::string& dumpString, const std::u16string& arg) const; 55 56 sptr<RSIRenderServiceConnection> CreateConnection(const sptr<RSIConnectionToken>& token) override; 57 void RemoveConnection(sptr<IRemoteObject> token); 58 59 RSMainThread* mainThread_ = nullptr; 60 sptr<RSScreenManager> screenManager_; 61 62 friend class RSRenderServiceConnection; 63 mutable std::mutex mutex_; 64 std::map<sptr<IRemoteObject>, sptr<RSIRenderServiceConnection>> connections_; 65 66 sptr<VSyncController> rsVSyncController_; 67 sptr<VSyncController> appVSyncController_; 68 69 sptr<VSyncDistributor> rsVSyncDistributor_; 70 sptr<VSyncDistributor> appVSyncDistributor_; 71 }; 72 } // Rosen 73 } // OHOS 74 75 #endif // RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_H 76