Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 3 | * Copyright (C) 2012, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 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 | |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 24 | #include <utils/threads.h> |
| 25 | #include <linux/fb.h> |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 26 | |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 27 | struct hwc_context_t; |
| 28 | |
| 29 | namespace qhwc { |
| 30 | |
| 31 | class ExternalDisplay |
| 32 | { |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 33 | public: |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 34 | ExternalDisplay(hwc_context_t* ctx); |
| 35 | ~ExternalDisplay(); |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 36 | int getModeCount() const; |
| 37 | void getEDIDModes(int *out) const; |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 38 | void setExternalDisplay(int connected); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame^] | 39 | bool post(); |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 40 | void setHPD(uint32_t startEnd); |
| 41 | void setEDIDMode(int resMode); |
| 42 | void setActionSafeDimension(int w, int h); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 43 | |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 44 | private: |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 45 | bool readResolution(); |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 46 | int parseResolution(char* edidStr, int* edidModes); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 47 | void setResolution(int ID); |
| 48 | bool openFramebuffer(); |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 49 | bool closeFrameBuffer(); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 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(); |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 55 | void resetInfo(); |
Saurabh Shah | 3e858eb | 2012-09-17 16:53:21 -0700 | [diff] [blame^] | 56 | void setDpyAttr(); |
| 57 | void getAttrForMode(int& width, int& height, int& fps); |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 58 | |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 59 | mutable android::Mutex mExtDispLock; |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 60 | int mFd; |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 61 | int mCurrentMode; |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 62 | int mExternalDisplay; |
| 63 | int mResolutionMode; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 64 | char mEDIDs[128]; |
| 65 | int mEDIDModes[64]; |
| 66 | int mModeCount; |
| 67 | hwc_context_t *mHwcContext; |
Naseer Ahmed | f8ec162 | 2012-07-31 18:56:23 -0700 | [diff] [blame] | 68 | fb_var_screeninfo mVInfo; |
Naseer Ahmed | 72cf976 | 2012-07-21 12:17:13 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | }; //qhwc |
| 72 | // --------------------------------------------------------------------------- |
| 73 | #endif //HWC_EXTERNAL_DISPLAY_H |