1 /*
2  * Copyright (c) 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 HYPER_GRAPHIC_MANAGER_CORE_HGM_SCREEN_INFO_H
17 #define HYPER_GRAPHIC_MANAGER_CORE_HGM_SCREEN_INFO_H
18 
19 #include <string>
20 
21 #include "hgm_command.h"
22 #include "screen_manager/screen_types.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 
27 enum HgmScreenType {
28     LTPS = 0,
29     LTPS1,
30     LTPS2,
31     LTPO = 10,
32     LTPO1, // First-generation LTPO screen
33     LTPO2, // Second-generation LTPO screen
34     LTPO3,
35 };
36 
37 struct HgmPanelInfo {
38     int32_t panelId;
39     HgmScreenType panelType;
40     std::vector<int32_t> supportFps;
41 };
42 
43 using ConvertHandle = void*;
44 using ConvertFuncGet = int (*)(std::string &);
45 
46 class HgmScreenInfo {
47 public:
48     static HgmScreenInfo& GetInstance();
49 
50     HgmScreenType GetScreenType(ScreenId screenId);
51     bool IsLtpoType(HgmScreenType screenType);
52 private:
53     HgmScreenInfo() = default;
54     virtual ~HgmScreenInfo();
55 
56     void Init();
57     int32_t GetPanelInfo(std::string& panelInfo);
58     int32_t InitPanelTypeMap(std::string& panelInfo);
59 
60     // key: panel id
61     std::unordered_map<int32_t, HgmPanelInfo> panelInfo_;
62 
63     static const std::string HGM_EXT_SO_PATH;
64     static const std::string GET_PANEL_INFO_SYMBOL;
65     ConvertHandle handle_ { nullptr };
66     ConvertFuncGet func_ { nullptr };
67 };
68 
69 } // namespace Rosen
70 } // namespace OHOS
71 #endif // HYPER_GRAPHIC_MANAGER_CORE_HGM_SCREEN_INFO_H