blob: 9e5f4556f68f6cf65daf3b607432cc46a693dbe8 [file] [log] [blame]
Naseer Ahmed72cf9762012-07-21 12:17:13 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 * Copyright (C) 2012, Code Aurora Forum. 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
24struct hwc_context_t;
25
26namespace qhwc {
27
28class ExternalDisplay
29{
30 //Type of external display - OFF, HDMI, WFD
31 enum external_display_type {
32 EXT_TYPE_NONE,
33 EXT_TYPE_HDMI,
34 EXT_TYPE_WIFI
35 };
36
37 // Mirroring state
38 enum external_mirroring_state {
39 EXT_MIRRORING_OFF,
40 EXT_MIRRORING_ON,
41 };
42 public:
43 ExternalDisplay(hwc_context_t* ctx);
44 ~ExternalDisplay();
45 int getExternalDisplay() const;
46 void setExternalDisplayStatus(int connected);
47
48 private:
49 bool readResolution();
50 int parseResolution(char* edidStr, int* edidModes, int len);
51 void setResolution(int ID);
52 bool openFramebuffer();
53 bool writeHPDOption(int userOption) const;
54 bool isValidMode(int ID);
55 void handleUEvent(char* str, int len);
56 int getModeOrder(int mode);
57 int getBestMode();
58
59 int fd;
60 int mExternalDisplay;
61 int mCurrentID;
62 char mEDIDs[128];
63 int mEDIDModes[64];
64 int mModeCount;
65 hwc_context_t *mHwcContext;
66};
67
68}; //qhwc
69// ---------------------------------------------------------------------------
70#endif //HWC_EXTERNAL_DISPLAY_H