blob: 55773c02af49e7b98bc9df882abd2d307b34a8cf [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
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070024#include <fb_priv.h>
25
Naseer Ahmed72cf9762012-07-21 12:17:13 -070026struct hwc_context_t;
27
28namespace qhwc {
29
30class ExternalDisplay
31{
32 //Type of external display - OFF, HDMI, WFD
33 enum external_display_type {
34 EXT_TYPE_NONE,
35 EXT_TYPE_HDMI,
36 EXT_TYPE_WIFI
37 };
38
39 // Mirroring state
40 enum external_mirroring_state {
41 EXT_MIRRORING_OFF,
42 EXT_MIRRORING_ON,
43 };
44 public:
45 ExternalDisplay(hwc_context_t* ctx);
46 ~ExternalDisplay();
47 int getExternalDisplay() const;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070048 void setExternalDisplay(int connected);
49 bool commit();
50 int enableHDMIVsync(int enable);
Naseer Ahmed72cf9762012-07-21 12:17:13 -070051
52 private:
53 bool readResolution();
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070054 int parseResolution(char* edidStr, int* edidModes);
Naseer Ahmed72cf9762012-07-21 12:17:13 -070055 void setResolution(int ID);
56 bool openFramebuffer();
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070057 bool closeFrameBuffer();
Naseer Ahmed72cf9762012-07-21 12:17:13 -070058 bool writeHPDOption(int userOption) const;
59 bool isValidMode(int ID);
60 void handleUEvent(char* str, int len);
61 int getModeOrder(int mode);
62 int getBestMode();
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070063 void resetInfo();
Naseer Ahmed72cf9762012-07-21 12:17:13 -070064
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070065 int mFd;
Naseer Ahmed72cf9762012-07-21 12:17:13 -070066 int mExternalDisplay;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070067 int mCurrentMode;
Naseer Ahmed72cf9762012-07-21 12:17:13 -070068 char mEDIDs[128];
69 int mEDIDModes[64];
70 int mModeCount;
71 hwc_context_t *mHwcContext;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070072 fb_var_screeninfo mVInfo;
Naseer Ahmed72cf9762012-07-21 12:17:13 -070073};
74
75}; //qhwc
76// ---------------------------------------------------------------------------
77#endif //HWC_EXTERNAL_DISPLAY_H