• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  * Copyright (C) 2012, 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 
29 namespace qhwc {
30 
31 class ExternalDisplay
32 {
33 public:
34     ExternalDisplay(hwc_context_t* ctx);
35     ~ExternalDisplay();
36     int getModeCount() const;
37     void getEDIDModes(int *out) const;
38     void setExternalDisplay(int connected);
39     bool post();
40     void setHPD(uint32_t startEnd);
41     void setEDIDMode(int resMode);
42     void setActionSafeDimension(int w, int h);
43 
44 private:
45     bool readResolution();
46     int parseResolution(char* edidStr, int* edidModes);
47     void setResolution(int ID);
48     bool openFramebuffer();
49     bool closeFrameBuffer();
50     bool writeHPDOption(int userOption) const;
51     bool isValidMode(int ID);
52     void handleUEvent(char* str, int len);
53     int getModeOrder(int mode);
54     int getBestMode();
55     void resetInfo();
56     void setDpyAttr();
57     void getAttrForMode(int& width, int& height, int& fps);
58 
59     mutable android::Mutex mExtDispLock;
60     int mFd;
61     int mCurrentMode;
62     int mExternalDisplay;
63     int mResolutionMode;
64     char mEDIDs[128];
65     int mEDIDModes[64];
66     int mModeCount;
67     hwc_context_t *mHwcContext;
68     fb_var_screeninfo mVInfo;
69 };
70 
71 }; //qhwc
72 // ---------------------------------------------------------------------------
73 #endif //HWC_EXTERNAL_DISPLAY_H
74