summaryrefslogtreecommitdiff
path: root/common/hwc/include/RealModeMgr.h (plain)
blob: 4c36b56f10f153f826898bdad2a24a2fe6fd11f0
1/*
2 * Copyright (c) 2019 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 HWC2_REAL_MODE_MGR_H
11#define HWC2_REAL_MODE_MGR_H
12
13#include "HwcModeMgr.h"
14
15/*
16 * RealModeMgr:
17 * This class designed for TV or reference box to support
18 * real active modes. App UI size will be updated when
19 * Display timings changed.
20 */
21
22class RealModeMgr : public HwcModeMgr {
23public:
24 RealModeMgr();
25 ~RealModeMgr();
26
27 hwc_modes_policy_t getPolicyType();
28 const char * getName();
29
30 void setFramebufferSize(uint32_t w, uint32_t h);
31 void setDisplayResources(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(uint32_t * outNumConfigs, uint32_t * outConfigs);
38 int32_t getDisplayAttribute(uint32_t config, int32_t attribute,
39 int32_t* outValue, int32_t caller);
40 int32_t getActiveConfig(uint32_t * outConfig, int32_t caller);
41 int32_t setActiveConfig(uint32_t config);
42 void resetTags();
43 void dump(String8 & dumpstr);
44
45protected:
46 int32_t updateActiveConfig(const char* activeMode);
47 void reset();
48
49 std::shared_ptr<HwDisplayConnector> mConnector;
50 std::shared_ptr<HwDisplayCrtc> mCrtc;
51
52 uint32_t mHwcFbWidth;
53 uint32_t mHwcFbHeight;
54
55 std::map<uint32_t, drm_mode_info_t> mModes;
56 drm_mode_info_t mCurMode;
57 uint32_t mActiveConfigId;
58 bool mCallOnHotPlug;
59
60 // protect mMode and mActiveConfigId
61 std::mutex mMutex;
62};
63
64#endif // REAL_MODE_MGR_H
65