Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 1 | /* |
| 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 Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 24 | #include <fb_priv.h> |
| 25 | |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 26 | struct hwc_context_t; |
| 27 | |
| 28 | namespace qhwc { |
| 29 | |
| 30 | class 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 Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 48 | void setExternalDisplay(int connected); |
| 49 | bool commit(); |
| 50 | int enableHDMIVsync(int enable); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 51 | |
| 52 | private: |
| 53 | bool readResolution(); |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 54 | int parseResolution(char* edidStr, int* edidModes); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 55 | void setResolution(int ID); |
| 56 | bool openFramebuffer(); |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 57 | bool closeFrameBuffer(); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 58 | 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 Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 63 | void resetInfo(); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 64 | |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 65 | int mFd; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 66 | int mExternalDisplay; |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 67 | int mCurrentMode; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 68 | char mEDIDs[128]; |
| 69 | int mEDIDModes[64]; |
| 70 | int mModeCount; |
| 71 | hwc_context_t *mHwcContext; |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 72 | fb_var_screeninfo mVInfo; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | }; //qhwc |
| 76 | // --------------------------------------------------------------------------- |
| 77 | #endif //HWC_EXTERNAL_DISPLAY_H |