blob: b08c0c1db7410fb0e8098fc235cf7ac73d15a06c [file] [log] [blame]
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Arun Kumar K.R25187572013-02-28 18:47:36 -08003 * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
Naseer Ahmed0c8b7b52012-07-20 09:06: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
Naseer Ahmed72cf9762012-07-21 12:17:13 -070021#define DEBUG 0
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070022#include <ctype.h>
Naseer Ahmed72cf9762012-07-21 12:17:13 -070023#include <fcntl.h>
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070024#include <utils/threads.h>
25#include <utils/Errors.h>
26#include <utils/Log.h>
27
28#include <linux/msm_mdp.h>
Arun Kumar K.R25187572013-02-28 18:47:36 -080029#include <video/msm_hdmi_modes.h>
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070030#include <linux/fb.h>
31#include <sys/ioctl.h>
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070032#include <cutils/properties.h>
33#include "hwc_utils.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070034#include "external.h"
35#include "overlayUtils.h"
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080036#include "overlay.h"
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -070037#include "mdp_version.h"
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -080038#include "qd_utils.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070039
40using namespace android;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070041
42namespace qhwc {
Arun Kumar K.R26808f32013-02-11 19:17:05 -080043#define MAX_SYSFS_FILE_PATH 255
44#define UNKNOWN_STRING "unknown"
45#define SPD_NAME_LENGTH 16
Arun Kumar K.Rfcf2fe12013-11-27 17:38:18 -080046/* Max. resolution assignable to when downscale */
47#define SUPPORTED_DOWNSCALE_EXT_AREA (1920*1080)
48
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070049
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070050int ExternalDisplay::configure() {
51 if(!openFrameBuffer()) {
52 ALOGE("%s: Failed to open FB: %d", __FUNCTION__, mFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080053 return -1;
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070054 }
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -080055 readCEUnderscanInfo();
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080056 readResolution();
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080057 // TODO: Move this to activate
Arun Kumar K.R37552c52012-12-10 12:47:18 -080058 /* Used for changing the resolution
59 * getUserMode will get the preferred
60 * mode set thru adb shell */
61 int mode = getUserMode();
62 if (mode == -1) {
63 //Get the best mode and set
64 mode = getBestMode();
65 }
66 setResolution(mode);
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070067 setAttributes();
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -080068 // set system property
69 property_set("hw.hdmiON", "1");
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080070 return 0;
71}
72
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -070073void ExternalDisplay::getAttributes(int& width, int& height) {
74 int fps = 0;
75 getAttrForMode(width, height, fps);
76}
77
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070078int ExternalDisplay::teardown() {
79 closeFrameBuffer();
80 resetInfo();
81 // unset system property
82 property_set("hw.hdmiON", "0");
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080083 return 0;
84}
85
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070086ExternalDisplay::ExternalDisplay(hwc_context_t* ctx):mFd(-1),
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070087 mCurrentMode(-1), mModeCount(0),
88 mUnderscanSupported(false), mHwcContext(ctx)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070089{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070090 memset(&mVInfo, 0, sizeof(mVInfo));
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070091 mFbNum = overlay::Overlay::getInstance()->getFbForDpy(HWC_DISPLAY_EXTERNAL);
Arun Kumar K.Re746ac52013-03-20 15:56:15 -070092 // disable HPD at start, it will be enabled later
93 // when the display powers on
94 // This helps for framework reboot or adb shell stop/start
95 writeHPDOption(0);
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -080096
Arun Kumar K.R25187572013-02-28 18:47:36 -080097 // for HDMI - retreive all the modes supported by the driver
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070098 if(mFbNum != -1) {
Arun Kumar K.R25187572013-02-28 18:47:36 -080099 supported_video_mode_lut =
100 new msm_hdmi_mode_timing_info[HDMI_VFRMT_MAX];
101 // Populate the mode table for supported modes
102 MSM_HDMI_MODES_INIT_TIMINGS(supported_video_mode_lut);
103 MSM_HDMI_MODES_SET_SUPP_TIMINGS(supported_video_mode_lut,
104 MSM_HDMI_MODES_ALL);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800105 // Update the Source Product Information
106 // Vendor Name
107 setSPDInfo("vendor_name", "ro.product.manufacturer");
108 // Product Description
109 setSPDInfo("product_description", "ro.product.name");
110 }
111}
112/* gets the product manufacturer and product name and writes it
113 * to the sysfs node, so that the driver can get that information
114 * Used to show QCOM 8974 instead of Input 1 for example
115 */
116void ExternalDisplay::setSPDInfo(const char* node, const char* property) {
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530117 ssize_t err = -1;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800118 char info[PROPERTY_VALUE_MAX];
119 char sysFsSPDFilePath[MAX_SYSFS_FILE_PATH];
120 memset(sysFsSPDFilePath, 0, sizeof(sysFsSPDFilePath));
121 snprintf(sysFsSPDFilePath , sizeof(sysFsSPDFilePath),
122 "/sys/devices/virtual/graphics/fb%d/%s",
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700123 mFbNum, node);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800124 int spdFile = open(sysFsSPDFilePath, O_RDWR, 0);
125 if (spdFile < 0) {
126 ALOGE("%s: file '%s' not found : ret = %d"
127 "err str: %s", __FUNCTION__, sysFsSPDFilePath,
128 spdFile, strerror(errno));
129 } else {
130 memset(info, 0, sizeof(info));
131 property_get(property, info, UNKNOWN_STRING);
132 ALOGD_IF(DEBUG, "In %s: %s = %s", __FUNCTION__, property, info);
133 if (strncmp(info, UNKNOWN_STRING, SPD_NAME_LENGTH)) {
134 err = write(spdFile, info, strlen(info));
135 if (err <= 0) {
136 ALOGE("%s: file write failed for '%s'"
137 "err no = %d", __FUNCTION__, sysFsSPDFilePath, errno);
138 }
139 } else {
140 ALOGD_IF(DEBUG, "%s: property_get failed for SPD %s",
141 __FUNCTION__, node);
142 }
143 close(spdFile);
Arun Kumar K.R25187572013-02-28 18:47:36 -0800144 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700145}
146
Saurabh Shah56f610d2012-08-07 15:27:06 -0700147void ExternalDisplay::setHPD(uint32_t startEnd) {
148 ALOGD_IF(DEBUG,"HPD enabled=%d", startEnd);
149 writeHPDOption(startEnd);
150}
151
152void ExternalDisplay::setActionSafeDimension(int w, int h) {
153 ALOGD_IF(DEBUG,"ActionSafe w=%d h=%d", w, h);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800154 char actionsafeWidth[PROPERTY_VALUE_MAX];
155 char actionsafeHeight[PROPERTY_VALUE_MAX];
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800156 snprintf(actionsafeWidth, sizeof(actionsafeWidth), "%d", w);
Arun Kumar K.R4d73d642013-04-10 17:06:39 -0700157 property_set("persist.sys.actionsafe.width", actionsafeWidth);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800158 snprintf(actionsafeHeight, sizeof(actionsafeHeight), "%d", h);
Arun Kumar K.R4d73d642013-04-10 17:06:39 -0700159 property_set("persist.sys.actionsafe.height", actionsafeHeight);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700160}
161
162int ExternalDisplay::getModeCount() const {
163 ALOGD_IF(DEBUG,"HPD mModeCount=%d", mModeCount);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700164 return mModeCount;
165}
166
167void ExternalDisplay::getEDIDModes(int *out) const {
Saurabh Shah56f610d2012-08-07 15:27:06 -0700168 for(int i = 0;i < mModeCount;i++) {
169 out[i] = mEDIDModes[i];
170 }
171}
172
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800173void ExternalDisplay::readCEUnderscanInfo()
174{
175 int hdmiScanInfoFile = -1;
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530176 ssize_t len = -1;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800177 char scanInfo[17];
178 char *ce_info_str = NULL;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800179 char *save_ptr;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800180 const char token[] = ", \n";
181 int ce_info = -1;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800182 char sysFsScanInfoFilePath[MAX_SYSFS_FILE_PATH];
183 snprintf(sysFsScanInfoFilePath, sizeof(sysFsScanInfoFilePath),
184 "/sys/devices/virtual/graphics/fb%d/"
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700185 "scan_info", mFbNum);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800186
187 memset(scanInfo, 0, sizeof(scanInfo));
188 hdmiScanInfoFile = open(sysFsScanInfoFilePath, O_RDONLY, 0);
189 if (hdmiScanInfoFile < 0) {
190 ALOGD_IF(DEBUG, "%s: scan_info file '%s' not found",
191 __FUNCTION__, sysFsScanInfoFilePath);
192 return;
193 } else {
194 len = read(hdmiScanInfoFile, scanInfo, sizeof(scanInfo)-1);
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530195 ALOGD("%s: Scan Info string: %s length = %zu",
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800196 __FUNCTION__, scanInfo, len);
197 if (len <= 0) {
198 close(hdmiScanInfoFile);
199 ALOGE("%s: Scan Info file empty '%s'",
200 __FUNCTION__, sysFsScanInfoFilePath);
201 return;
202 }
203 scanInfo[len] = '\0'; /* null terminate the string */
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530204 close(hdmiScanInfoFile);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800205 }
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800206
207 /*
208 * The scan_info contains the three fields
209 * PT - preferred video format
210 * IT - video format
211 * CE video format - containing the underscan support information
212 */
213
214 /* PT */
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800215 ce_info_str = strtok_r(scanInfo, token, &save_ptr);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800216 if (ce_info_str) {
217 /* IT */
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800218 ce_info_str = strtok_r(NULL, token, &save_ptr);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800219 if (ce_info_str) {
220 /* CE */
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800221 ce_info_str = strtok_r(NULL, token, &save_ptr);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800222 if (ce_info_str)
223 ce_info = atoi(ce_info_str);
224 }
225 }
226
227 if (ce_info_str) {
228 // ce_info contains the underscan information
229 if (ce_info == EXT_SCAN_ALWAYS_UNDERSCANED ||
230 ce_info == EXT_SCAN_BOTH_SUPPORTED)
231 // if TV supported underscan, then driver will always underscan
232 // hence no need to apply action safe rectangle
233 mUnderscanSupported = true;
234 } else {
235 ALOGE("%s: scan_info string error", __FUNCTION__);
236 }
237
238 // Store underscan support info in a system property
239 const char* prop = (mUnderscanSupported) ? "1" : "0";
240 property_set("hw.underscan_supported", prop);
241 return;
242}
243
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700244ExternalDisplay::~ExternalDisplay()
245{
Arun Kumar K.R25187572013-02-28 18:47:36 -0800246 delete [] supported_video_mode_lut;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700247 closeFrameBuffer();
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700248}
249
Arun Kumar K.R25187572013-02-28 18:47:36 -0800250/*
251 * sets the fb_var_screeninfo from the hdmi_mode_timing_info
252 */
253void setDisplayTiming(struct fb_var_screeninfo &info,
254 const msm_hdmi_mode_timing_info* mode)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700255{
256 info.reserved[0] = 0;
257 info.reserved[1] = 0;
258 info.reserved[2] = 0;
Ken Zhang7b03a952013-01-16 13:23:48 -0500259#ifndef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
Arun Kumar K.R25187572013-02-28 18:47:36 -0800260 info.reserved[3] = (info.reserved[3] & 0xFFFF) |
261 (mode->video_format << 16);
Ken Zhang7b03a952013-01-16 13:23:48 -0500262#endif
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700263 info.xoffset = 0;
264 info.yoffset = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800265 info.xres = mode->active_h;
266 info.yres = mode->active_v;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700267
Arun Kumar K.R25187572013-02-28 18:47:36 -0800268 info.pixclock = (mode->pixel_freq)*1000;
269 info.vmode = mode->interlaced ?
270 FB_VMODE_INTERLACED : FB_VMODE_NONINTERLACED;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700271
Arun Kumar K.R25187572013-02-28 18:47:36 -0800272 info.right_margin = mode->front_porch_h;
273 info.hsync_len = mode->pulse_width_h;
274 info.left_margin = mode->back_porch_h;
275 info.lower_margin = mode->front_porch_v;
276 info.vsync_len = mode->pulse_width_v;
277 info.upper_margin = mode->back_porch_v;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700278}
279
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700280int ExternalDisplay::parseResolution(char* edidStr, int* edidModes)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700281{
282 char delim = ',';
283 int count = 0;
284 char *start, *end;
285 // EDIDs are string delimited by ','
286 // Ex: 16,4,5,3,32,34,1
287 // Parse this string to get mode(int)
288 start = (char*) edidStr;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700289 end = &delim;
290 while(*end == delim) {
291 edidModes[count] = (int) strtol(start, &end, 10);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700292 start = end+1;
293 count++;
294 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700295 ALOGD_IF(DEBUG, "In %s: count = %d", __FUNCTION__, count);
296 for (int i = 0; i < count; i++)
297 ALOGD_IF(DEBUG, "Mode[%d] = %d", i, edidModes[i]);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700298 return count;
299}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700300
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700301bool ExternalDisplay::readResolution()
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700302{
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800303 char sysFsEDIDFilePath[MAX_SYSFS_FILE_PATH];
304 snprintf(sysFsEDIDFilePath , sizeof(sysFsEDIDFilePath),
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700305 "/sys/devices/virtual/graphics/fb%d/edid_modes", mFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800306
307 int hdmiEDIDFile = open(sysFsEDIDFilePath, O_RDONLY, 0);
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530308 ssize_t len = -1;
Arun Kumar K.R83812342013-09-24 17:30:36 -0700309 char edidStr[128] = {'\0'};
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700310
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700311 if (hdmiEDIDFile < 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700312 ALOGE("%s: edid_modes file '%s' not found",
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800313 __FUNCTION__, sysFsEDIDFilePath);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700314 return false;
315 } else {
Arun Kumar K.R83812342013-09-24 17:30:36 -0700316 len = read(hdmiEDIDFile, edidStr, sizeof(edidStr)-1);
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530317 ALOGD_IF(DEBUG, "%s: EDID string: %s length = %zu",
Arun Kumar K.R83812342013-09-24 17:30:36 -0700318 __FUNCTION__, edidStr, len);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700319 if ( len <= 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700320 ALOGE("%s: edid_modes file empty '%s'",
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800321 __FUNCTION__, sysFsEDIDFilePath);
Arun Kumar K.R83812342013-09-24 17:30:36 -0700322 edidStr[0] = '\0';
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700323 }
324 else {
Arun Kumar K.R83812342013-09-24 17:30:36 -0700325 while (len > 1 && isspace(edidStr[len-1])) {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700326 --len;
Arun Kumar K.R83812342013-09-24 17:30:36 -0700327 }
328 edidStr[len] = '\0';
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700329 }
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530330 close(hdmiEDIDFile);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700331 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700332 if(len > 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800333 // Get EDID modes from the EDID strings
Arun Kumar K.R83812342013-09-24 17:30:36 -0700334 mModeCount = parseResolution(edidStr, mEDIDModes);
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700335 ALOGD_IF(DEBUG, "%s: mModeCount = %d", __FUNCTION__,
336 mModeCount);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700337 }
338
Arun Kumar K.R83812342013-09-24 17:30:36 -0700339 return (len > 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700340}
341
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700342bool ExternalDisplay::openFrameBuffer()
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700343{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700344 if (mFd == -1) {
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700345 char strDevPath[MAX_SYSFS_FILE_PATH];
346 snprintf(strDevPath, MAX_SYSFS_FILE_PATH, "/dev/graphics/fb%d", mFbNum);
347 mFd = open(strDevPath, O_RDWR);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700348 if (mFd < 0)
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700349 ALOGE("%s: %s is not available", __FUNCTION__, strDevPath);
350 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].fd = mFd;
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700351 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700352 return (mFd > 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700353}
354
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700355bool ExternalDisplay::closeFrameBuffer()
356{
357 int ret = 0;
Naseer Ahmedf53b3772013-02-15 19:13:50 -0500358 if(mFd >= 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700359 ret = close(mFd);
360 mFd = -1;
361 }
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700362 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].fd = mFd;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700363 return (ret == 0);
364}
365
366// clears the vinfo, edid, best modes
367void ExternalDisplay::resetInfo()
368{
369 memset(&mVInfo, 0, sizeof(mVInfo));
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700370 memset(mEDIDModes, 0, sizeof(mEDIDModes));
371 mModeCount = 0;
372 mCurrentMode = -1;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800373 mUnderscanSupported = false;
374 // Reset the underscan supported system property
375 const char* prop = "0";
376 property_set("hw.underscan_supported", prop);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700377}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700378
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700379int ExternalDisplay::getModeOrder(int mode)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700380{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800381 // XXX: We dont support interlaced modes but having
Arun Kumar K.R25187572013-02-28 18:47:36 -0800382 // it here for future
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700383 switch (mode) {
384 default:
Arun Kumar K.R25187572013-02-28 18:47:36 -0800385 case HDMI_VFRMT_1440x480i60_4_3:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700386 return 1; // 480i 4:3
Arun Kumar K.R25187572013-02-28 18:47:36 -0800387 case HDMI_VFRMT_1440x480i60_16_9:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700388 return 2; // 480i 16:9
Arun Kumar K.R25187572013-02-28 18:47:36 -0800389 case HDMI_VFRMT_1440x576i50_4_3:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700390 return 3; // i576i 4:3
Arun Kumar K.R25187572013-02-28 18:47:36 -0800391 case HDMI_VFRMT_1440x576i50_16_9:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700392 return 4; // 576i 16:9
Arun Kumar K.R25187572013-02-28 18:47:36 -0800393 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800394 return 5; // 1080i 16:9
395 case HDMI_VFRMT_640x480p60_4_3:
396 return 6; // 640x480 4:3
397 case HDMI_VFRMT_720x480p60_4_3:
398 return 7; // 480p 4:3
399 case HDMI_VFRMT_720x480p60_16_9:
400 return 8; // 480p 16:9
401 case HDMI_VFRMT_720x576p50_4_3:
402 return 9; // 576p 4:3
403 case HDMI_VFRMT_720x576p50_16_9:
404 return 10; // 576p 16:9
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700405 case HDMI_VFRMT_1024x768p60_4_3:
406 return 11; // 768p 4:3 Vesa format
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800407 case HDMI_VFRMT_1280x1024p60_5_4:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700408 return 12; // 1024p Vesa format
Arun Kumar K.R25187572013-02-28 18:47:36 -0800409 case HDMI_VFRMT_1280x720p50_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700410 return 13; // 720p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800411 case HDMI_VFRMT_1280x720p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700412 return 14; // 720p@60Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800413 case HDMI_VFRMT_1920x1080p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700414 return 15; //1080p@24Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800415 case HDMI_VFRMT_1920x1080p25_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700416 return 16; //108-p@25Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800417 case HDMI_VFRMT_1920x1080p30_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700418 return 17; //1080p@30Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800419 case HDMI_VFRMT_1920x1080p50_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700420 return 18; //1080p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800421 case HDMI_VFRMT_1920x1080p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700422 return 19; //1080p@60Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800423 case HDMI_VFRMT_2560x1600p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700424 return 20; //WQXGA@60Hz541
Ujwal Patelb9430d22012-11-15 18:10:19 -0800425 case HDMI_VFRMT_3840x2160p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700426 return 21;//2160@24Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800427 case HDMI_VFRMT_3840x2160p25_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700428 return 22;//2160@25Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800429 case HDMI_VFRMT_3840x2160p30_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700430 return 23; //2160@30Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800431 case HDMI_VFRMT_4096x2160p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700432 return 24; //4kx2k@24Hz
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700433 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700434}
435
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800436/// Returns the user mode set(if any) using adb shell
437int ExternalDisplay::getUserMode() {
438 /* Based on the property set the resolution */
439 char property_value[PROPERTY_VALUE_MAX];
Arun Kumar K.Rc31bdcb2013-02-25 17:47:42 -0800440 property_get("hw.hdmi.resolution", property_value, "-1");
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800441 int mode = atoi(property_value);
442 // We dont support interlaced modes
443 if(isValidMode(mode) && !isInterlacedMode(mode)) {
Naseer Ahmed74214722013-02-09 08:11:36 -0500444 ALOGD_IF(DEBUG, "%s: setting the HDMI mode = %d", __FUNCTION__, mode);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800445 return mode;
446 }
447 return -1;
448}
449
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700450// Get the best mode for the current HD TV
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700451int ExternalDisplay::getBestMode() {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700452 int bestOrder = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800453 int bestMode = HDMI_VFRMT_640x480p60_4_3;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700454 // for all the edid read, get the best mode
455 for(int i = 0; i < mModeCount; i++) {
456 int mode = mEDIDModes[i];
457 int order = getModeOrder(mode);
458 if (order > bestOrder) {
459 bestOrder = order;
460 bestMode = mode;
461 }
462 }
463 return bestMode;
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700464}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700465
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700466inline bool ExternalDisplay::isValidMode(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700467{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800468 bool valid = false;
469 for (int i = 0; i < mModeCount; i++) {
470 if(ID == mEDIDModes[i]) {
471 valid = true;
472 break;
473 }
474 }
475 return valid;
476}
477
478// returns true if the mode(ID) is interlaced mode format
479bool ExternalDisplay::isInterlacedMode(int ID) {
480 bool interlaced = false;
481 switch(ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800482 case HDMI_VFRMT_1440x480i60_4_3:
483 case HDMI_VFRMT_1440x480i60_16_9:
484 case HDMI_VFRMT_1440x576i50_4_3:
485 case HDMI_VFRMT_1440x576i50_16_9:
486 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800487 interlaced = true;
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700488 break;
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800489 default:
490 interlaced = false;
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700491 break;
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800492 }
493 return interlaced;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700494}
495
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700496void ExternalDisplay::setResolution(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700497{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700498 int ret = 0;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700499 ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo);
500 if(ret < 0) {
501 ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__,
502 strerror(errno));
503 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700504 ALOGD_IF(DEBUG, "%s: GET Info<ID=%d %dx%d (%d,%d,%d),"
505 "(%d,%d,%d) %dMHz>", __FUNCTION__,
506 mVInfo.reserved[3], mVInfo.xres, mVInfo.yres,
507 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
508 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
509 mVInfo.pixclock/1000/1000);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800510 //If its a new ID - update var_screeninfo
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700511 if ((isValidMode(ID)) && mCurrentMode != ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800512 const struct msm_hdmi_mode_timing_info *mode =
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700513 &supported_video_mode_lut[0];
Arun Kumar K.R25187572013-02-28 18:47:36 -0800514 for (unsigned int i = 0; i < HDMI_VFRMT_MAX; ++i) {
515 const struct msm_hdmi_mode_timing_info *cur =
516 &supported_video_mode_lut[i];
517 if (cur->video_format == (uint32_t)ID) {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700518 mode = cur;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800519 break;
520 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700521 }
Arun Kumar K.R25187572013-02-28 18:47:36 -0800522 setDisplayTiming(mVInfo, mode);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700523 ALOGD_IF(DEBUG, "%s: SET Info<ID=%d => Info<ID=%d %dx %d"
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700524 "(%d,%d,%d), (%d,%d,%d) %dMHz>", __FUNCTION__, ID,
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800525 mode->video_format, mVInfo.xres, mVInfo.yres,
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700526 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
527 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
528 mVInfo.pixclock/1000/1000);
Ken Zhang7b03a952013-01-16 13:23:48 -0500529#ifdef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
530 struct msmfb_metadata metadata;
531 memset(&metadata, 0 , sizeof(metadata));
532 metadata.op = metadata_op_vic;
533 metadata.data.video_info_code = mode->video_format;
534 if (ioctl(mFd, MSMFB_METADATA_SET, &metadata) == -1) {
535 ALOGD("In %s: MSMFB_METADATA_SET failed Err Str = %s",
536 __FUNCTION__, strerror(errno));
537 }
538#endif
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800539 mVInfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_ALL | FB_ACTIVATE_FORCE;
540 ret = ioctl(mFd, FBIOPUT_VSCREENINFO, &mVInfo);
541 if(ret < 0) {
542 ALOGD("In %s: FBIOPUT_VSCREENINFO failed Err Str = %s",
543 __FUNCTION__, strerror(errno));
544 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700545 mCurrentMode = ID;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700546 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700547}
548
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700549bool ExternalDisplay::writeHPDOption(int userOption) const
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700550{
551 bool ret = true;
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700552 if(mFbNum != -1) {
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700553 char sysFsHPDFilePath[MAX_SYSFS_FILE_PATH];
554 snprintf(sysFsHPDFilePath ,sizeof(sysFsHPDFilePath),
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700555 "/sys/devices/virtual/graphics/fb%d/hpd", mFbNum);
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700556 int hdmiHPDFile = open(sysFsHPDFilePath,O_RDWR, 0);
557 if (hdmiHPDFile < 0) {
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700558 ALOGE("%s: state file '%s' not found : ret%d err str: %s",
559 __FUNCTION__, sysFsHPDFilePath, hdmiHPDFile, strerror(errno));
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700560 ret = false;
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700561 } else {
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530562 ssize_t err = -1;
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700563 ALOGD_IF(DEBUG, "%s: option = %d", __FUNCTION__, userOption);
564 if(userOption)
565 err = write(hdmiHPDFile, "1", 2);
566 else
567 err = write(hdmiHPDFile, "0" , 2);
568 if (err <= 0) {
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700569 ALOGE("%s: file write failed '%s'", __FUNCTION__,
570 sysFsHPDFilePath);
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700571 ret = false;
572 }
573 close(hdmiHPDFile);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700574 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700575 }
576 return ret;
577}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700578
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700579
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700580void ExternalDisplay::setAttributes() {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700581 int width = 0, height = 0, fps = 0;
582 getAttrForMode(width, height, fps);
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700583 ALOGD("ExtDisplay setting xres = %d, yres = %d", width, height);
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700584 if(mHwcContext) {
585 // Always set dpyAttr res to mVInfo res
586 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
587 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
588 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode = false;
Tatenda Chipeperekwa5d14c712014-02-20 19:07:01 -0800589 if(!qdutils::MDPVersion::getInstance().is8x26()
590 && mHwcContext->mMDPDownscaleEnabled) {
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700591 int priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
592 int priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
593 // if primary resolution is more than the hdmi resolution
594 // configure dpy attr to primary resolution and set
595 // downscale mode
Manoj Kumar AVM82a3ac12013-10-23 11:46:07 -0700596 // Restrict this upto 1080p resolution max
597 if(((priW * priH) > (width * height)) &&
Arun Kumar K.Rfcf2fe12013-11-27 17:38:18 -0800598 ((priW * priH) <= SUPPORTED_DOWNSCALE_EXT_AREA)) {
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800599 // tmpW and tmpH will hold the primary dimensions before we
600 // update the aspect ratio if necessary.
601 int tmpW = priW;
602 int tmpH = priH;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700603 // HDMI is always in landscape, so always assign the higher
604 // dimension to hdmi's xres
605 if(priH > priW) {
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800606 tmpW = priH;
607 tmpH = priW;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700608 }
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800609 // The aspect ratios of the external and primary displays
610 // can be different. As a result, directly assigning primary
611 // resolution could lead to an incorrect final image.
612 // We get around this by calculating a new resolution by
613 // keeping aspect ratio intact.
614 hwc_rect r = {0, 0, 0, 0};
615 getAspectRatioPosition(tmpW, tmpH, width, height, r);
616 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres =
617 r.right - r.left;
618 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres =
619 r.bottom - r.top;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700620 // Set External Display MDP Downscale mode indicator
621 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode =true;
622 }
623 }
624 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530625 (int) 1000000000l / fps;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700626 }
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700627}
628
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800629void ExternalDisplay::getAttrForMode(int& width, int& height, int& fps) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700630 switch (mCurrentMode) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800631 case HDMI_VFRMT_640x480p60_4_3:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700632 width = 640;
633 height = 480;
634 fps = 60;
635 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800636 case HDMI_VFRMT_720x480p60_4_3:
637 case HDMI_VFRMT_720x480p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700638 width = 720;
639 height = 480;
640 fps = 60;
641 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800642 case HDMI_VFRMT_720x576p50_4_3:
643 case HDMI_VFRMT_720x576p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700644 width = 720;
645 height = 576;
646 fps = 50;
647 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800648 case HDMI_VFRMT_1280x720p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700649 width = 1280;
650 height = 720;
651 fps = 50;
652 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800653 case HDMI_VFRMT_1280x720p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700654 width = 1280;
655 height = 720;
656 fps = 60;
657 break;
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800658 case HDMI_VFRMT_1280x1024p60_5_4:
659 width = 1280;
660 height = 1024;
661 fps = 60;
662 break;
Manoj Rao564ee922013-05-07 21:32:57 -0700663 case HDMI_VFRMT_1024x768p60_4_3:
664 width = 1024;
665 height = 768;
666 fps = 60;
667 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800668 case HDMI_VFRMT_1920x1080p24_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700669 width = 1920;
670 height = 1080;
671 fps = 24;
672 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800673 case HDMI_VFRMT_1920x1080p25_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700674 width = 1920;
675 height = 1080;
676 fps = 25;
677 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800678 case HDMI_VFRMT_1920x1080p30_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700679 width = 1920;
680 height = 1080;
681 fps = 30;
682 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800683 case HDMI_VFRMT_1920x1080p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700684 width = 1920;
685 height = 1080;
686 fps = 50;
687 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800688 case HDMI_VFRMT_1920x1080p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700689 width = 1920;
690 height = 1080;
691 fps = 60;
692 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800693 case HDMI_VFRMT_2560x1600p60_16_9:
694 width = 2560;
695 height = 1600;
696 fps = 60;
697 break;
698 case HDMI_VFRMT_3840x2160p24_16_9:
699 width = 3840;
700 height = 2160;
701 fps = 24;
702 break;
Arun Kumar K.R92ebf9d2013-04-09 19:23:14 -0700703 case HDMI_VFRMT_3840x2160p25_16_9:
704 width = 3840;
705 height = 2160;
706 fps = 25;
707 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800708 case HDMI_VFRMT_3840x2160p30_16_9:
709 width = 3840;
710 height = 2160;
711 fps = 30;
712 break;
713 case HDMI_VFRMT_4096x2160p24_16_9:
714 width = 4096;
715 height = 2160;
716 fps = 24;
717 break;
718
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700719 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700720}
721
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700722};