• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
4  *
5  * Not a Contribution, Apache license notifications and license are
6  * retained for attribution purposes only.
7 
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef HWC_EXTERNAL_DISPLAY_H
22 #define HWC_EXTERNAL_DISPLAY_H
23 
24 #include <utils/threads.h>
25 #include <linux/fb.h>
26 
27 struct hwc_context_t;
28 struct msm_hdmi_mode_timing_info;
29 
30 namespace qhwc {
31 
32 //Type of scanning of EDID(Video Capability Data Block)
33 enum external_scansupport_type {
34     EXT_SCAN_NOT_SUPPORTED      = 0,
35     EXT_SCAN_ALWAYS_OVERSCANED  = 1,
36     EXT_SCAN_ALWAYS_UNDERSCANED = 2,
37     EXT_SCAN_BOTH_SUPPORTED     = 3
38 };
39 
40 class ExternalDisplay
41 {
42 public:
43     ExternalDisplay(hwc_context_t* ctx);
44     ~ExternalDisplay();
45     int getModeCount() const;
46     void getEDIDModes(int *out) const;
isCEUnderscanSupported()47     bool isCEUnderscanSupported() { return mUnderscanSupported; }
48     void setExternalDisplay(bool connected, int extFbNum = 0);
isExternalConnected()49     bool isExternalConnected() { return mConnected;};
setExtDpyNum(int extDpyNum)50     void  setExtDpyNum(int extDpyNum) { mExtDpyNum = extDpyNum;};
51     void setHPD(uint32_t startEnd);
52     void setEDIDMode(int resMode);
53     void setActionSafeDimension(int w, int h);
54     void processUEventOnline(const char *str);
55     void processUEventOffline(const char *str);
getHDMIIndex()56     int getHDMIIndex() { return mHdmiFbNum; }
57 
58 private:
59     void setSPDInfo(const char* node, const char* property);
60     void readCEUnderscanInfo();
61     bool readResolution();
62     int  parseResolution(char* edidStr, int* edidModes);
63     void setResolution(int ID);
64     bool openFrameBuffer(int fbNum);
65     bool closeFrameBuffer();
66     bool writeHPDOption(int userOption) const;
67     bool isValidMode(int ID);
68     void handleUEvent(char* str, int len);
69     int  getModeOrder(int mode);
70     int  getUserMode();
71     int  getBestMode();
72     bool isInterlacedMode(int mode);
73     void resetInfo();
74     void setDpyHdmiAttr();
75     void setDpyWfdAttr();
76     void getAttrForMode(int& width, int& height, int& fps);
77     void updateExtDispDevFbIndex();
78     int  configureHDMIDisplay();
79     int  configureWFDDisplay();
80     int  teardownHDMIDisplay();
81     int  teardownWFDDisplay();
82     int  getExtFbNum(int &fbNum);
83 
84     mutable android::Mutex mExtDispLock;
85     int mFd;
86     int mCurrentMode;
87     int mConnected;
88     int mConnectedFbNum;
89     int mResolutionMode;
90     char mEDIDs[128];
91     int mEDIDModes[64];
92     int mModeCount;
93     bool mUnderscanSupported;
94     hwc_context_t *mHwcContext;
95     fb_var_screeninfo mVInfo;
96     int mHdmiFbNum;
97     int mWfdFbNum;
98     int mExtDpyNum;
99     // Holds all the HDMI modes and timing info supported by driver
100     msm_hdmi_mode_timing_info* supported_video_mode_lut;
101 };
102 
103 }; //qhwc
104 // ---------------------------------------------------------------------------
105 #endif //HWC_EXTERNAL_DISPLAY_H
106