blob: da3ccd5aff24107b1bb07349dea68109fbceead0 [file] [log] [blame]
Naseer Ahmed72cf9762012-07-21 12:17:13 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Saurabh Shah56f610d2012-08-07 15:27:06 -07003 * Copyright (C) 2012, The Linux Foundation. All rights reserved.
Naseer Ahmed72cf9762012-07-21 12:17:13 -07004 *
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 Shah56f610d2012-08-07 15:27:06 -070024#include <utils/threads.h>
25#include <linux/fb.h>
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070026
Naseer Ahmed72cf9762012-07-21 12:17:13 -070027struct hwc_context_t;
28
29namespace qhwc {
30
31class ExternalDisplay
32{
Saurabh Shah56f610d2012-08-07 15:27:06 -070033public:
Naseer Ahmed72cf9762012-07-21 12:17:13 -070034 ExternalDisplay(hwc_context_t* ctx);
35 ~ExternalDisplay();
Saurabh Shah56f610d2012-08-07 15:27:06 -070036 int getModeCount() const;
37 void getEDIDModes(int *out) const;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070038 void setExternalDisplay(int connected);
Saurabh Shah3e858eb2012-09-17 16:53:21 -070039 bool post();
Saurabh Shah56f610d2012-08-07 15:27:06 -070040 void setHPD(uint32_t startEnd);
41 void setEDIDMode(int resMode);
42 void setActionSafeDimension(int w, int h);
Naseer Ahmed72cf9762012-07-21 12:17:13 -070043
Saurabh Shah56f610d2012-08-07 15:27:06 -070044private:
Naseer Ahmed72cf9762012-07-21 12:17:13 -070045 bool readResolution();
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070046 int parseResolution(char* edidStr, int* edidModes);
Naseer Ahmed72cf9762012-07-21 12:17:13 -070047 void setResolution(int ID);
48 bool openFramebuffer();
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070049 bool closeFrameBuffer();
Naseer Ahmed72cf9762012-07-21 12:17:13 -070050 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 Ahmedf8ec1622012-07-31 18:56:23 -070055 void resetInfo();
Saurabh Shah3e858eb2012-09-17 16:53:21 -070056 void setDpyAttr();
57 void getAttrForMode(int& width, int& height, int& fps);
Naseer Ahmed72cf9762012-07-21 12:17:13 -070058
Saurabh Shah56f610d2012-08-07 15:27:06 -070059 mutable android::Mutex mExtDispLock;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070060 int mFd;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070061 int mCurrentMode;
Saurabh Shah56f610d2012-08-07 15:27:06 -070062 int mExternalDisplay;
63 int mResolutionMode;
Naseer Ahmed72cf9762012-07-21 12:17:13 -070064 char mEDIDs[128];
65 int mEDIDModes[64];
66 int mModeCount;
67 hwc_context_t *mHwcContext;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070068 fb_var_screeninfo mVInfo;
Naseer Ahmed72cf9762012-07-21 12:17:13 -070069};
70
71}; //qhwc
72// ---------------------------------------------------------------------------
73#endif //HWC_EXTERNAL_DISPLAY_H