blob: 646e7a676ac53c6cafafdec0ef69df3715e556d4 [file] [log] [blame]
Naseer Ahmed1589dee2012-07-21 12:17:13 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Arun Kumar K.R56e7f262013-02-28 18:47:36 -08003 * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
Naseer Ahmed1589dee2012-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 Shahbbee5b12012-08-07 15:27:06 -070024#include <linux/fb.h>
Naseer Ahmed080cfca2012-07-31 18:56:23 -070025
Naseer Ahmed1589dee2012-07-21 12:17:13 -070026struct hwc_context_t;
Arun Kumar K.R56e7f262013-02-28 18:47:36 -080027struct msm_hdmi_mode_timing_info;
Naseer Ahmed1589dee2012-07-21 12:17:13 -070028
29namespace qhwc {
30
Arun Kumar K.R0ae34e32013-02-01 02:53:13 -080031//Type of scanning of EDID(Video Capability Data Block)
32enum external_scansupport_type {
33 EXT_SCAN_NOT_SUPPORTED = 0,
34 EXT_SCAN_ALWAYS_OVERSCANED = 1,
35 EXT_SCAN_ALWAYS_UNDERSCANED = 2,
36 EXT_SCAN_BOTH_SUPPORTED = 3
37};
Amara Venkata Mastan Manoj Kumar620fc1f2012-12-03 12:08:48 -080038
Naseer Ahmed1589dee2012-07-21 12:17:13 -070039class ExternalDisplay
40{
Saurabh Shahbbee5b12012-08-07 15:27:06 -070041public:
Naseer Ahmed1589dee2012-07-21 12:17:13 -070042 ExternalDisplay(hwc_context_t* ctx);
43 ~ExternalDisplay();
Saurabh Shahbbee5b12012-08-07 15:27:06 -070044 void setHPD(uint32_t startEnd);
Saurabh Shahbbee5b12012-08-07 15:27:06 -070045 void setActionSafeDimension(int w, int h);
Jeykumar Sankaran361900d2013-08-01 17:09:54 -070046 bool isCEUnderscanSupported() { return mUnderscanSupported; }
47 int configure();
Amara Venkata Mastan Manoj Kumarfea63d62013-03-13 19:18:47 -070048 void getAttributes(int& width, int& height);
Jeykumar Sankaran361900d2013-08-01 17:09:54 -070049 int teardown();
50 bool isConnected() {
51 return mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].connected;
52 }
Naseer Ahmed1589dee2012-07-21 12:17:13 -070053
Saurabh Shahbbee5b12012-08-07 15:27:06 -070054private:
Jeykumar Sankaran361900d2013-08-01 17:09:54 -070055 int getModeCount() const;
56 void getEDIDModes(int *out) const;
57 void setEDIDMode(int resMode);
Arun Kumar K.R9d2cf702013-02-11 19:17:05 -080058 void setSPDInfo(const char* node, const char* property);
Arun Kumar K.R0ae34e32013-02-01 02:53:13 -080059 void readCEUnderscanInfo();
Naseer Ahmed1589dee2012-07-21 12:17:13 -070060 bool readResolution();
Amara Venkata Mastan Manoj Kumar620fc1f2012-12-03 12:08:48 -080061 int parseResolution(char* edidStr, int* edidModes);
Naseer Ahmed1589dee2012-07-21 12:17:13 -070062 void setResolution(int ID);
Jeykumar Sankaran361900d2013-08-01 17:09:54 -070063 bool openFrameBuffer();
Naseer Ahmed080cfca2012-07-31 18:56:23 -070064 bool closeFrameBuffer();
Naseer Ahmed1589dee2012-07-21 12:17:13 -070065 bool writeHPDOption(int userOption) const;
66 bool isValidMode(int ID);
Amara Venkata Mastan Manoj Kumar620fc1f2012-12-03 12:08:48 -080067 int getModeOrder(int mode);
Arun Kumar K.Rc5bb51f2012-12-10 12:47:18 -080068 int getUserMode();
Amara Venkata Mastan Manoj Kumar620fc1f2012-12-03 12:08:48 -080069 int getBestMode();
Arun Kumar K.Rc5bb51f2012-12-10 12:47:18 -080070 bool isInterlacedMode(int mode);
Naseer Ahmed080cfca2012-07-31 18:56:23 -070071 void resetInfo();
Jeykumar Sankaran361900d2013-08-01 17:09:54 -070072 void setAttributes();
Saurabh Shah2e449282012-09-17 16:53:21 -070073 void getAttrForMode(int& width, int& height, int& fps);
Naseer Ahmed1589dee2012-07-21 12:17:13 -070074
Naseer Ahmed080cfca2012-07-31 18:56:23 -070075 int mFd;
Jeykumar Sankaran361900d2013-08-01 17:09:54 -070076 int mFbNum;
Naseer Ahmed080cfca2012-07-31 18:56:23 -070077 int mCurrentMode;
Naseer Ahmed1589dee2012-07-21 12:17:13 -070078 int mEDIDModes[64];
79 int mModeCount;
Arun Kumar K.R0ae34e32013-02-01 02:53:13 -080080 bool mUnderscanSupported;
Naseer Ahmed1589dee2012-07-21 12:17:13 -070081 hwc_context_t *mHwcContext;
Naseer Ahmed080cfca2012-07-31 18:56:23 -070082 fb_var_screeninfo mVInfo;
Arun Kumar K.R56e7f262013-02-28 18:47:36 -080083 // Holds all the HDMI modes and timing info supported by driver
84 msm_hdmi_mode_timing_info* supported_video_mode_lut;
Naseer Ahmed1589dee2012-07-21 12:17:13 -070085};
86
87}; //qhwc
88// ---------------------------------------------------------------------------
89#endif //HWC_EXTERNAL_DISPLAY_H