blob: d12d9f08033dbc4b7cf748b2719313e98f48ff43 [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"
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -080037#include "qd_utils.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070038
39using namespace android;
Tatenda Chipeperekwace8d5c42014-08-13 10:53:49 -070040using namespace qdutils;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070041
42namespace qhwc {
Arun Kumar K.R26808f32013-02-11 19:17:05 -080043#define UNKNOWN_STRING "unknown"
44#define SPD_NAME_LENGTH 16
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070045
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070046int ExternalDisplay::configure() {
47 if(!openFrameBuffer()) {
48 ALOGE("%s: Failed to open FB: %d", __FUNCTION__, mFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080049 return -1;
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070050 }
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -080051 readCEUnderscanInfo();
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080052 readResolution();
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080053 // TODO: Move this to activate
Arun Kumar K.R37552c52012-12-10 12:47:18 -080054 /* Used for changing the resolution
55 * getUserMode will get the preferred
56 * mode set thru adb shell */
57 int mode = getUserMode();
58 if (mode == -1) {
59 //Get the best mode and set
60 mode = getBestMode();
61 }
62 setResolution(mode);
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070063 setAttributes();
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -080064 // set system property
65 property_set("hw.hdmiON", "1");
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080066 return 0;
67}
68
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -070069void ExternalDisplay::getAttributes(int& width, int& height) {
70 int fps = 0;
71 getAttrForMode(width, height, fps);
72}
73
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070074int ExternalDisplay::teardown() {
75 closeFrameBuffer();
76 resetInfo();
77 // unset system property
78 property_set("hw.hdmiON", "0");
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080079 return 0;
80}
81
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070082ExternalDisplay::ExternalDisplay(hwc_context_t* ctx):mFd(-1),
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070083 mCurrentMode(-1), mModeCount(0),
84 mUnderscanSupported(false), mHwcContext(ctx)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070085{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -070086 memset(&mVInfo, 0, sizeof(mVInfo));
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070087 mFbNum = overlay::Overlay::getInstance()->getFbForDpy(HWC_DISPLAY_EXTERNAL);
Arun Kumar K.Re746ac52013-03-20 15:56:15 -070088 // disable HPD at start, it will be enabled later
89 // when the display powers on
90 // This helps for framework reboot or adb shell stop/start
91 writeHPDOption(0);
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -080092
Arun Kumar K.R25187572013-02-28 18:47:36 -080093 // for HDMI - retreive all the modes supported by the driver
Jeykumar Sankaran27dee262013-08-01 17:09:54 -070094 if(mFbNum != -1) {
Arun Kumar K.R25187572013-02-28 18:47:36 -080095 supported_video_mode_lut =
96 new msm_hdmi_mode_timing_info[HDMI_VFRMT_MAX];
97 // Populate the mode table for supported modes
98 MSM_HDMI_MODES_INIT_TIMINGS(supported_video_mode_lut);
99 MSM_HDMI_MODES_SET_SUPP_TIMINGS(supported_video_mode_lut,
100 MSM_HDMI_MODES_ALL);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800101 // Update the Source Product Information
102 // Vendor Name
103 setSPDInfo("vendor_name", "ro.product.manufacturer");
104 // Product Description
105 setSPDInfo("product_description", "ro.product.name");
106 }
107}
108/* gets the product manufacturer and product name and writes it
109 * to the sysfs node, so that the driver can get that information
110 * Used to show QCOM 8974 instead of Input 1 for example
111 */
112void ExternalDisplay::setSPDInfo(const char* node, const char* property) {
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530113 ssize_t err = -1;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800114 char info[PROPERTY_VALUE_MAX];
115 char sysFsSPDFilePath[MAX_SYSFS_FILE_PATH];
116 memset(sysFsSPDFilePath, 0, sizeof(sysFsSPDFilePath));
117 snprintf(sysFsSPDFilePath , sizeof(sysFsSPDFilePath),
118 "/sys/devices/virtual/graphics/fb%d/%s",
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700119 mFbNum, node);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800120 int spdFile = open(sysFsSPDFilePath, O_RDWR, 0);
121 if (spdFile < 0) {
122 ALOGE("%s: file '%s' not found : ret = %d"
123 "err str: %s", __FUNCTION__, sysFsSPDFilePath,
124 spdFile, strerror(errno));
125 } else {
126 memset(info, 0, sizeof(info));
127 property_get(property, info, UNKNOWN_STRING);
128 ALOGD_IF(DEBUG, "In %s: %s = %s", __FUNCTION__, property, info);
129 if (strncmp(info, UNKNOWN_STRING, SPD_NAME_LENGTH)) {
130 err = write(spdFile, info, strlen(info));
131 if (err <= 0) {
132 ALOGE("%s: file write failed for '%s'"
133 "err no = %d", __FUNCTION__, sysFsSPDFilePath, errno);
134 }
135 } else {
136 ALOGD_IF(DEBUG, "%s: property_get failed for SPD %s",
137 __FUNCTION__, node);
138 }
139 close(spdFile);
Arun Kumar K.R25187572013-02-28 18:47:36 -0800140 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700141}
142
Saurabh Shah56f610d2012-08-07 15:27:06 -0700143void ExternalDisplay::setHPD(uint32_t startEnd) {
144 ALOGD_IF(DEBUG,"HPD enabled=%d", startEnd);
145 writeHPDOption(startEnd);
146}
147
148void ExternalDisplay::setActionSafeDimension(int w, int h) {
149 ALOGD_IF(DEBUG,"ActionSafe w=%d h=%d", w, h);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800150 char actionsafeWidth[PROPERTY_VALUE_MAX];
151 char actionsafeHeight[PROPERTY_VALUE_MAX];
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800152 snprintf(actionsafeWidth, sizeof(actionsafeWidth), "%d", w);
Arun Kumar K.R4d73d642013-04-10 17:06:39 -0700153 property_set("persist.sys.actionsafe.width", actionsafeWidth);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800154 snprintf(actionsafeHeight, sizeof(actionsafeHeight), "%d", h);
Arun Kumar K.R4d73d642013-04-10 17:06:39 -0700155 property_set("persist.sys.actionsafe.height", actionsafeHeight);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700156}
157
158int ExternalDisplay::getModeCount() const {
159 ALOGD_IF(DEBUG,"HPD mModeCount=%d", mModeCount);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700160 return mModeCount;
161}
162
163void ExternalDisplay::getEDIDModes(int *out) const {
Saurabh Shah56f610d2012-08-07 15:27:06 -0700164 for(int i = 0;i < mModeCount;i++) {
165 out[i] = mEDIDModes[i];
166 }
167}
168
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800169void ExternalDisplay::readCEUnderscanInfo()
170{
171 int hdmiScanInfoFile = -1;
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530172 ssize_t len = -1;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800173 char scanInfo[17];
174 char *ce_info_str = NULL;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800175 char *save_ptr;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800176 const char token[] = ", \n";
177 int ce_info = -1;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800178 char sysFsScanInfoFilePath[MAX_SYSFS_FILE_PATH];
179 snprintf(sysFsScanInfoFilePath, sizeof(sysFsScanInfoFilePath),
180 "/sys/devices/virtual/graphics/fb%d/"
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700181 "scan_info", mFbNum);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800182
183 memset(scanInfo, 0, sizeof(scanInfo));
184 hdmiScanInfoFile = open(sysFsScanInfoFilePath, O_RDONLY, 0);
185 if (hdmiScanInfoFile < 0) {
186 ALOGD_IF(DEBUG, "%s: scan_info file '%s' not found",
187 __FUNCTION__, sysFsScanInfoFilePath);
188 return;
189 } else {
190 len = read(hdmiScanInfoFile, scanInfo, sizeof(scanInfo)-1);
Shalaj Jaina70b4352014-06-15 13:47:47 -0700191 ALOGD("%s: Scan Info string: %s length = %zd",
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800192 __FUNCTION__, scanInfo, len);
193 if (len <= 0) {
194 close(hdmiScanInfoFile);
195 ALOGE("%s: Scan Info file empty '%s'",
196 __FUNCTION__, sysFsScanInfoFilePath);
197 return;
198 }
199 scanInfo[len] = '\0'; /* null terminate the string */
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530200 close(hdmiScanInfoFile);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800201 }
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800202
203 /*
204 * The scan_info contains the three fields
205 * PT - preferred video format
206 * IT - video format
207 * CE video format - containing the underscan support information
208 */
209
210 /* PT */
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800211 ce_info_str = strtok_r(scanInfo, token, &save_ptr);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800212 if (ce_info_str) {
213 /* IT */
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800214 ce_info_str = strtok_r(NULL, token, &save_ptr);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800215 if (ce_info_str) {
216 /* CE */
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800217 ce_info_str = strtok_r(NULL, token, &save_ptr);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800218 if (ce_info_str)
219 ce_info = atoi(ce_info_str);
220 }
221 }
222
223 if (ce_info_str) {
224 // ce_info contains the underscan information
225 if (ce_info == EXT_SCAN_ALWAYS_UNDERSCANED ||
226 ce_info == EXT_SCAN_BOTH_SUPPORTED)
227 // if TV supported underscan, then driver will always underscan
228 // hence no need to apply action safe rectangle
229 mUnderscanSupported = true;
230 } else {
231 ALOGE("%s: scan_info string error", __FUNCTION__);
232 }
233
234 // Store underscan support info in a system property
235 const char* prop = (mUnderscanSupported) ? "1" : "0";
236 property_set("hw.underscan_supported", prop);
237 return;
238}
239
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700240ExternalDisplay::~ExternalDisplay()
241{
Arun Kumar K.R25187572013-02-28 18:47:36 -0800242 delete [] supported_video_mode_lut;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700243 closeFrameBuffer();
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700244}
245
Arun Kumar K.R25187572013-02-28 18:47:36 -0800246/*
247 * sets the fb_var_screeninfo from the hdmi_mode_timing_info
248 */
249void setDisplayTiming(struct fb_var_screeninfo &info,
250 const msm_hdmi_mode_timing_info* mode)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700251{
252 info.reserved[0] = 0;
253 info.reserved[1] = 0;
254 info.reserved[2] = 0;
Ken Zhang7b03a952013-01-16 13:23:48 -0500255#ifndef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
Arun Kumar K.R25187572013-02-28 18:47:36 -0800256 info.reserved[3] = (info.reserved[3] & 0xFFFF) |
257 (mode->video_format << 16);
Ken Zhang7b03a952013-01-16 13:23:48 -0500258#endif
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700259 info.xoffset = 0;
260 info.yoffset = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800261 info.xres = mode->active_h;
262 info.yres = mode->active_v;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700263
Arun Kumar K.R25187572013-02-28 18:47:36 -0800264 info.pixclock = (mode->pixel_freq)*1000;
265 info.vmode = mode->interlaced ?
266 FB_VMODE_INTERLACED : FB_VMODE_NONINTERLACED;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700267
Arun Kumar K.R25187572013-02-28 18:47:36 -0800268 info.right_margin = mode->front_porch_h;
269 info.hsync_len = mode->pulse_width_h;
270 info.left_margin = mode->back_porch_h;
271 info.lower_margin = mode->front_porch_v;
272 info.vsync_len = mode->pulse_width_v;
273 info.upper_margin = mode->back_porch_v;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700274}
275
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700276int ExternalDisplay::parseResolution(char* edidStr, int* edidModes)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700277{
278 char delim = ',';
279 int count = 0;
280 char *start, *end;
281 // EDIDs are string delimited by ','
282 // Ex: 16,4,5,3,32,34,1
283 // Parse this string to get mode(int)
284 start = (char*) edidStr;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700285 end = &delim;
286 while(*end == delim) {
287 edidModes[count] = (int) strtol(start, &end, 10);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700288 start = end+1;
289 count++;
290 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700291 ALOGD_IF(DEBUG, "In %s: count = %d", __FUNCTION__, count);
292 for (int i = 0; i < count; i++)
293 ALOGD_IF(DEBUG, "Mode[%d] = %d", i, edidModes[i]);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700294 return count;
295}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700296
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700297bool ExternalDisplay::readResolution()
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700298{
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800299 char sysFsEDIDFilePath[MAX_SYSFS_FILE_PATH];
300 snprintf(sysFsEDIDFilePath , sizeof(sysFsEDIDFilePath),
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700301 "/sys/devices/virtual/graphics/fb%d/edid_modes", mFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800302
303 int hdmiEDIDFile = open(sysFsEDIDFilePath, O_RDONLY, 0);
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530304 ssize_t len = -1;
Arun Kumar K.R83812342013-09-24 17:30:36 -0700305 char edidStr[128] = {'\0'};
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700306
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700307 if (hdmiEDIDFile < 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700308 ALOGE("%s: edid_modes file '%s' not found",
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800309 __FUNCTION__, sysFsEDIDFilePath);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700310 return false;
311 } else {
Arun Kumar K.R83812342013-09-24 17:30:36 -0700312 len = read(hdmiEDIDFile, edidStr, sizeof(edidStr)-1);
Shalaj Jaina70b4352014-06-15 13:47:47 -0700313 ALOGD_IF(DEBUG, "%s: EDID string: %s length = %zd",
Arun Kumar K.R83812342013-09-24 17:30:36 -0700314 __FUNCTION__, edidStr, len);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700315 if ( len <= 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700316 ALOGE("%s: edid_modes file empty '%s'",
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800317 __FUNCTION__, sysFsEDIDFilePath);
Arun Kumar K.R83812342013-09-24 17:30:36 -0700318 edidStr[0] = '\0';
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700319 }
320 else {
Arun Kumar K.R83812342013-09-24 17:30:36 -0700321 while (len > 1 && isspace(edidStr[len-1])) {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700322 --len;
Arun Kumar K.R83812342013-09-24 17:30:36 -0700323 }
324 edidStr[len] = '\0';
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700325 }
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530326 close(hdmiEDIDFile);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700327 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700328 if(len > 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800329 // Get EDID modes from the EDID strings
Arun Kumar K.R83812342013-09-24 17:30:36 -0700330 mModeCount = parseResolution(edidStr, mEDIDModes);
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700331 ALOGD_IF(DEBUG, "%s: mModeCount = %d", __FUNCTION__,
332 mModeCount);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700333 }
334
Arun Kumar K.R83812342013-09-24 17:30:36 -0700335 return (len > 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700336}
337
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700338bool ExternalDisplay::openFrameBuffer()
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700339{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700340 if (mFd == -1) {
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700341 char strDevPath[MAX_SYSFS_FILE_PATH];
342 snprintf(strDevPath, MAX_SYSFS_FILE_PATH, "/dev/graphics/fb%d", mFbNum);
343 mFd = open(strDevPath, O_RDWR);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700344 if (mFd < 0)
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700345 ALOGE("%s: %s is not available", __FUNCTION__, strDevPath);
346 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].fd = mFd;
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700347 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700348 return (mFd > 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700349}
350
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700351bool ExternalDisplay::closeFrameBuffer()
352{
353 int ret = 0;
Naseer Ahmedf53b3772013-02-15 19:13:50 -0500354 if(mFd >= 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700355 ret = close(mFd);
356 mFd = -1;
357 }
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700358 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].fd = mFd;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700359 return (ret == 0);
360}
361
362// clears the vinfo, edid, best modes
363void ExternalDisplay::resetInfo()
364{
365 memset(&mVInfo, 0, sizeof(mVInfo));
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700366 memset(mEDIDModes, 0, sizeof(mEDIDModes));
367 mModeCount = 0;
368 mCurrentMode = -1;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800369 mUnderscanSupported = false;
370 // Reset the underscan supported system property
371 const char* prop = "0";
372 property_set("hw.underscan_supported", prop);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700373}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700374
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700375int ExternalDisplay::getModeOrder(int mode)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700376{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800377 // XXX: We dont support interlaced modes but having
Arun Kumar K.R25187572013-02-28 18:47:36 -0800378 // it here for future
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700379 switch (mode) {
380 default:
Arun Kumar K.R25187572013-02-28 18:47:36 -0800381 case HDMI_VFRMT_1440x480i60_4_3:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700382 return 1; // 480i 4:3
Arun Kumar K.R25187572013-02-28 18:47:36 -0800383 case HDMI_VFRMT_1440x480i60_16_9:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700384 return 2; // 480i 16:9
Arun Kumar K.R25187572013-02-28 18:47:36 -0800385 case HDMI_VFRMT_1440x576i50_4_3:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700386 return 3; // i576i 4:3
Arun Kumar K.R25187572013-02-28 18:47:36 -0800387 case HDMI_VFRMT_1440x576i50_16_9:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700388 return 4; // 576i 16:9
Arun Kumar K.R25187572013-02-28 18:47:36 -0800389 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800390 return 5; // 1080i 16:9
391 case HDMI_VFRMT_640x480p60_4_3:
392 return 6; // 640x480 4:3
393 case HDMI_VFRMT_720x480p60_4_3:
394 return 7; // 480p 4:3
395 case HDMI_VFRMT_720x480p60_16_9:
396 return 8; // 480p 16:9
397 case HDMI_VFRMT_720x576p50_4_3:
398 return 9; // 576p 4:3
399 case HDMI_VFRMT_720x576p50_16_9:
400 return 10; // 576p 16:9
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700401 case HDMI_VFRMT_1024x768p60_4_3:
402 return 11; // 768p 4:3 Vesa format
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800403 case HDMI_VFRMT_1280x1024p60_5_4:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700404 return 12; // 1024p Vesa format
Arun Kumar K.R25187572013-02-28 18:47:36 -0800405 case HDMI_VFRMT_1280x720p50_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700406 return 13; // 720p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800407 case HDMI_VFRMT_1280x720p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700408 return 14; // 720p@60Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800409 case HDMI_VFRMT_1920x1080p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700410 return 15; //1080p@24Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800411 case HDMI_VFRMT_1920x1080p25_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700412 return 16; //108-p@25Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800413 case HDMI_VFRMT_1920x1080p30_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700414 return 17; //1080p@30Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800415 case HDMI_VFRMT_1920x1080p50_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700416 return 18; //1080p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800417 case HDMI_VFRMT_1920x1080p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700418 return 19; //1080p@60Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800419 case HDMI_VFRMT_2560x1600p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700420 return 20; //WQXGA@60Hz541
Ujwal Patelb9430d22012-11-15 18:10:19 -0800421 case HDMI_VFRMT_3840x2160p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700422 return 21;//2160@24Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800423 case HDMI_VFRMT_3840x2160p25_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700424 return 22;//2160@25Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800425 case HDMI_VFRMT_3840x2160p30_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700426 return 23; //2160@30Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800427 case HDMI_VFRMT_4096x2160p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700428 return 24; //4kx2k@24Hz
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700429 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700430}
431
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800432/// Returns the user mode set(if any) using adb shell
433int ExternalDisplay::getUserMode() {
434 /* Based on the property set the resolution */
435 char property_value[PROPERTY_VALUE_MAX];
Arun Kumar K.Rc31bdcb2013-02-25 17:47:42 -0800436 property_get("hw.hdmi.resolution", property_value, "-1");
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800437 int mode = atoi(property_value);
438 // We dont support interlaced modes
439 if(isValidMode(mode) && !isInterlacedMode(mode)) {
Naseer Ahmed74214722013-02-09 08:11:36 -0500440 ALOGD_IF(DEBUG, "%s: setting the HDMI mode = %d", __FUNCTION__, mode);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800441 return mode;
442 }
443 return -1;
444}
445
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700446// Get the best mode for the current HD TV
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700447int ExternalDisplay::getBestMode() {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700448 int bestOrder = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800449 int bestMode = HDMI_VFRMT_640x480p60_4_3;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700450 // for all the edid read, get the best mode
451 for(int i = 0; i < mModeCount; i++) {
452 int mode = mEDIDModes[i];
453 int order = getModeOrder(mode);
454 if (order > bestOrder) {
455 bestOrder = order;
456 bestMode = mode;
457 }
458 }
459 return bestMode;
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700460}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700461
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700462inline bool ExternalDisplay::isValidMode(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700463{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800464 bool valid = false;
465 for (int i = 0; i < mModeCount; i++) {
466 if(ID == mEDIDModes[i]) {
467 valid = true;
468 break;
469 }
470 }
471 return valid;
472}
473
474// returns true if the mode(ID) is interlaced mode format
475bool ExternalDisplay::isInterlacedMode(int ID) {
476 bool interlaced = false;
477 switch(ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800478 case HDMI_VFRMT_1440x480i60_4_3:
479 case HDMI_VFRMT_1440x480i60_16_9:
480 case HDMI_VFRMT_1440x576i50_4_3:
481 case HDMI_VFRMT_1440x576i50_16_9:
482 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800483 interlaced = true;
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700484 break;
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800485 default:
486 interlaced = false;
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700487 break;
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800488 }
489 return interlaced;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700490}
491
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700492void ExternalDisplay::setResolution(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700493{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700494 int ret = 0;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700495 ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo);
496 if(ret < 0) {
497 ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__,
498 strerror(errno));
499 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700500 ALOGD_IF(DEBUG, "%s: GET Info<ID=%d %dx%d (%d,%d,%d),"
501 "(%d,%d,%d) %dMHz>", __FUNCTION__,
502 mVInfo.reserved[3], mVInfo.xres, mVInfo.yres,
503 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
504 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
505 mVInfo.pixclock/1000/1000);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800506 //If its a new ID - update var_screeninfo
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700507 if ((isValidMode(ID)) && mCurrentMode != ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800508 const struct msm_hdmi_mode_timing_info *mode =
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700509 &supported_video_mode_lut[0];
Arun Kumar K.R25187572013-02-28 18:47:36 -0800510 for (unsigned int i = 0; i < HDMI_VFRMT_MAX; ++i) {
511 const struct msm_hdmi_mode_timing_info *cur =
512 &supported_video_mode_lut[i];
513 if (cur->video_format == (uint32_t)ID) {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700514 mode = cur;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800515 break;
516 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700517 }
Arun Kumar K.R25187572013-02-28 18:47:36 -0800518 setDisplayTiming(mVInfo, mode);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700519 ALOGD_IF(DEBUG, "%s: SET Info<ID=%d => Info<ID=%d %dx %d"
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700520 "(%d,%d,%d), (%d,%d,%d) %dMHz>", __FUNCTION__, ID,
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800521 mode->video_format, mVInfo.xres, mVInfo.yres,
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700522 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
523 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
524 mVInfo.pixclock/1000/1000);
Ken Zhang7b03a952013-01-16 13:23:48 -0500525#ifdef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
526 struct msmfb_metadata metadata;
527 memset(&metadata, 0 , sizeof(metadata));
528 metadata.op = metadata_op_vic;
529 metadata.data.video_info_code = mode->video_format;
530 if (ioctl(mFd, MSMFB_METADATA_SET, &metadata) == -1) {
531 ALOGD("In %s: MSMFB_METADATA_SET failed Err Str = %s",
532 __FUNCTION__, strerror(errno));
533 }
534#endif
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800535 mVInfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_ALL | FB_ACTIVATE_FORCE;
536 ret = ioctl(mFd, FBIOPUT_VSCREENINFO, &mVInfo);
537 if(ret < 0) {
538 ALOGD("In %s: FBIOPUT_VSCREENINFO failed Err Str = %s",
539 __FUNCTION__, strerror(errno));
540 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700541 mCurrentMode = ID;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700542 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700543}
544
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700545bool ExternalDisplay::writeHPDOption(int userOption) const
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700546{
547 bool ret = true;
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700548 if(mFbNum != -1) {
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700549 char sysFsHPDFilePath[MAX_SYSFS_FILE_PATH];
550 snprintf(sysFsHPDFilePath ,sizeof(sysFsHPDFilePath),
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700551 "/sys/devices/virtual/graphics/fb%d/hpd", mFbNum);
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700552 int hdmiHPDFile = open(sysFsHPDFilePath,O_RDWR, 0);
553 if (hdmiHPDFile < 0) {
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700554 ALOGE("%s: state file '%s' not found : ret%d err str: %s",
555 __FUNCTION__, sysFsHPDFilePath, hdmiHPDFile, strerror(errno));
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700556 ret = false;
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700557 } else {
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530558 ssize_t err = -1;
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700559 ALOGD_IF(DEBUG, "%s: option = %d", __FUNCTION__, userOption);
560 if(userOption)
561 err = write(hdmiHPDFile, "1", 2);
562 else
563 err = write(hdmiHPDFile, "0" , 2);
564 if (err <= 0) {
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700565 ALOGE("%s: file write failed '%s'", __FUNCTION__,
566 sysFsHPDFilePath);
Arun Kumar K.R47d6b642013-06-26 16:20:30 -0700567 ret = false;
568 }
569 close(hdmiHPDFile);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700570 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700571 }
572 return ret;
573}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700574
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700575
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700576void ExternalDisplay::setAttributes() {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700577 int width = 0, height = 0, fps = 0;
578 getAttrForMode(width, height, fps);
Jeykumar Sankaran27dee262013-08-01 17:09:54 -0700579 ALOGD("ExtDisplay setting xres = %d, yres = %d", width, height);
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700580 if(mHwcContext) {
581 // Always set dpyAttr res to mVInfo res
582 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
583 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
584 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode = false;
Raj Kamal068f4572014-04-14 16:14:06 +0530585 if(mHwcContext->mOverlay->isUIScalingOnExternalSupported()
Tatenda Chipeperekwa5d14c712014-02-20 19:07:01 -0800586 && mHwcContext->mMDPDownscaleEnabled) {
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700587 int priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
588 int priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
589 // if primary resolution is more than the hdmi resolution
590 // configure dpy attr to primary resolution and set
591 // downscale mode
Manoj Kumar AVM82a3ac12013-10-23 11:46:07 -0700592 // Restrict this upto 1080p resolution max
593 if(((priW * priH) > (width * height)) &&
Tatenda Chipeperekwace8d5c42014-08-13 10:53:49 -0700594 ((priW * priH) <= SUPPORTED_DOWNSCALE_AREA)) {
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800595 // tmpW and tmpH will hold the primary dimensions before we
596 // update the aspect ratio if necessary.
597 int tmpW = priW;
598 int tmpH = priH;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700599 // HDMI is always in landscape, so always assign the higher
600 // dimension to hdmi's xres
601 if(priH > priW) {
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800602 tmpW = priH;
603 tmpH = priW;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700604 }
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800605 // The aspect ratios of the external and primary displays
606 // can be different. As a result, directly assigning primary
607 // resolution could lead to an incorrect final image.
608 // We get around this by calculating a new resolution by
609 // keeping aspect ratio intact.
610 hwc_rect r = {0, 0, 0, 0};
Tatenda Chipeperekwace8d5c42014-08-13 10:53:49 -0700611 qdutils::getAspectRatioPosition(tmpW, tmpH, width, height, r);
Tatenda Chipeperekwaf080b792014-03-05 19:32:33 -0800612 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres =
613 r.right - r.left;
614 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres =
615 r.bottom - r.top;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700616 // Set External Display MDP Downscale mode indicator
617 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode =true;
618 }
619 }
Arun Kumar K.Rdb7d83a2014-06-25 00:53:34 -0700620 //Initialize the display viewFrame info
621 mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].left = 0;
622 mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].top = 0;
623 mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].right =
624 (int)mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres;
625 mHwcContext->mViewFrame[HWC_DISPLAY_EXTERNAL].bottom =
626 (int)mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700627 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
Dileep Kumar Reddibf333c72014-02-25 14:32:51 +0530628 (int) 1000000000l / fps;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700629 }
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700630}
631
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800632void ExternalDisplay::getAttrForMode(int& width, int& height, int& fps) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700633 switch (mCurrentMode) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800634 case HDMI_VFRMT_640x480p60_4_3:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700635 width = 640;
636 height = 480;
637 fps = 60;
638 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800639 case HDMI_VFRMT_720x480p60_4_3:
640 case HDMI_VFRMT_720x480p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700641 width = 720;
642 height = 480;
643 fps = 60;
644 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800645 case HDMI_VFRMT_720x576p50_4_3:
646 case HDMI_VFRMT_720x576p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700647 width = 720;
648 height = 576;
649 fps = 50;
650 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800651 case HDMI_VFRMT_1280x720p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700652 width = 1280;
653 height = 720;
654 fps = 50;
655 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800656 case HDMI_VFRMT_1280x720p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700657 width = 1280;
658 height = 720;
659 fps = 60;
660 break;
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800661 case HDMI_VFRMT_1280x1024p60_5_4:
662 width = 1280;
663 height = 1024;
664 fps = 60;
665 break;
Manoj Rao564ee922013-05-07 21:32:57 -0700666 case HDMI_VFRMT_1024x768p60_4_3:
667 width = 1024;
668 height = 768;
669 fps = 60;
670 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800671 case HDMI_VFRMT_1920x1080p24_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700672 width = 1920;
673 height = 1080;
674 fps = 24;
675 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800676 case HDMI_VFRMT_1920x1080p25_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700677 width = 1920;
678 height = 1080;
679 fps = 25;
680 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800681 case HDMI_VFRMT_1920x1080p30_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700682 width = 1920;
683 height = 1080;
684 fps = 30;
685 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800686 case HDMI_VFRMT_1920x1080p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700687 width = 1920;
688 height = 1080;
689 fps = 50;
690 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800691 case HDMI_VFRMT_1920x1080p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700692 width = 1920;
693 height = 1080;
694 fps = 60;
695 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800696 case HDMI_VFRMT_2560x1600p60_16_9:
697 width = 2560;
698 height = 1600;
699 fps = 60;
700 break;
701 case HDMI_VFRMT_3840x2160p24_16_9:
702 width = 3840;
703 height = 2160;
704 fps = 24;
705 break;
Arun Kumar K.R92ebf9d2013-04-09 19:23:14 -0700706 case HDMI_VFRMT_3840x2160p25_16_9:
707 width = 3840;
708 height = 2160;
709 fps = 25;
710 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800711 case HDMI_VFRMT_3840x2160p30_16_9:
712 width = 3840;
713 height = 2160;
714 fps = 30;
715 break;
716 case HDMI_VFRMT_4096x2160p24_16_9:
717 width = 4096;
718 height = 2160;
719 fps = 24;
720 break;
721
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700722 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700723}
724
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700725};