blob: fb1c2c75b5e4e0a4940aa2fd54da83766af0587c
1 | /* |
2 | * Copyright (c) 2018 Amlogic, Inc. All rights reserved. |
3 | * |
4 | * This source code is subject to the terms and conditions defined in the |
5 | * file 'LICENSE' which is part of this source code package. |
6 | * |
7 | * Description: |
8 | */ |
9 | |
10 | #ifndef ACTIVE_MODE_MGR_H |
11 | #define ACTIVE_MODE_MGR_H |
12 | |
13 | #include "HwcModeMgr.h" |
14 | |
15 | /* |
16 | * ActiveModeMgr: |
17 | * This class designed for removeable device(hdmi, cvbs) |
18 | * to support real activeModes. |
19 | * Config list will changed when device disconnect/connect. |
20 | */ |
21 | class ActiveModeMgr : public HwcModeMgr { |
22 | public: |
23 | ActiveModeMgr(); |
24 | ~ ActiveModeMgr(); |
25 | |
26 | hwc_modes_policy_t getPolicyType(); |
27 | const char * getName(); |
28 | |
29 | void setFramebufferSize(uint32_t w, uint32_t h); |
30 | void setDisplayResources( |
31 | std::shared_ptr<HwDisplayCrtc> & crtc, |
32 | std::shared_ptr<HwDisplayConnector> & connector); |
33 | int32_t update(); |
34 | bool needCallHotPlug(){return mCallOnHotPlug;}; |
35 | int32_t getDisplayMode(drm_mode_info_t & mode); |
36 | |
37 | int32_t getDisplayConfigs( |
38 | uint32_t* outNumConfigs, uint32_t * outConfigs); |
39 | int32_t getDisplayAttribute( |
40 | uint32_t config, int32_t attribute, int32_t* outValue, int32_t caller); |
41 | int32_t getActiveConfig(uint32_t * outConfig, int32_t caller); |
42 | int32_t setActiveConfig(uint32_t configId); |
43 | void resetTags(); |
44 | void dump(String8 & dumpstr); |
45 | |
46 | protected: |
47 | int32_t initDefaultDispResources(); |
48 | int32_t updateHwcDispConfigs(); |
49 | int32_t updateSfDispConfigs(); |
50 | int32_t updateHwcActiveConfig(const char * activeMode); |
51 | int32_t updateSfActiveConfig(uint32_t config, drm_mode_info_t cfg); |
52 | bool isFracRate(float refreshRate); |
53 | void reset(); |
54 | const drm_mode_info_t findMatchedMode( |
55 | uint32_t width, uint32_t height, float refreshrate); |
56 | |
57 | |
58 | protected: |
59 | std::shared_ptr<HwDisplayConnector> mConnector; |
60 | std::shared_ptr<HwDisplayCrtc> mCrtc; |
61 | |
62 | uint32_t mFbWidth; |
63 | uint32_t mFbHeight; |
64 | |
65 | bool mIsInit; // first boot flag |
66 | bool mExtModeSet; // setActiveConfig() flag |
67 | bool mDefaultModeSupport; |
68 | bool mCallOnHotPlug; |
69 | std::string mActiveConfigStr; |
70 | uint32_t mFakeConfigId; |
71 | bool useFakeMode; |
72 | drm_mode_info_t mDefaultMode; |
73 | |
74 | // Used for HWC |
75 | uint32_t mHwcActiveConfigId; |
76 | std::map<uint32_t, drm_mode_info_t> mHwcActiveModes; |
77 | |
78 | // Passed to SF |
79 | uint32_t mSfActiveConfigId; |
80 | std::map<uint32_t, drm_mode_info_t> mSfActiveModes; |
81 | |
82 | }; |
83 | |
84 | #endif/*ACTIVE_MODE_MGR_H*/ |
85 |