blob: 73e145f4c86945315382cd17dc7896aaf986967e [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 <media/IAudioPolicyService.h>
25#include <media/AudioSystem.h>
26#include <utils/threads.h>
27#include <utils/Errors.h>
28#include <utils/Log.h>
29
30#include <linux/msm_mdp.h>
Arun Kumar K.R25187572013-02-28 18:47:36 -080031#include <video/msm_hdmi_modes.h>
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070032#include <linux/fb.h>
33#include <sys/ioctl.h>
34#include <sys/poll.h>
Naseer Ahmed72cf9762012-07-21 12:17:13 -070035#include <sys/resource.h>
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070036#include <cutils/properties.h>
37#include "hwc_utils.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070038#include "external.h"
39#include "overlayUtils.h"
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080040#include "overlay.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070041
42using namespace android;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070043
44namespace qhwc {
45
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080046#define MAX_FRAME_BUFFER_NAME_SIZE (80)
47#define MAX_DISPLAY_DEVICES (3)
Arun Kumar K.R26808f32013-02-11 19:17:05 -080048#define MAX_SYSFS_FILE_PATH 255
49#define UNKNOWN_STRING "unknown"
50#define SPD_NAME_LENGTH 16
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070051
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080052const char* msmFbDevicePath[] = { "/dev/graphics/fb1",
53 "/dev/graphics/fb2"};
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070054
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080055/*
56 * Updates extDeviceFbIndex Array with the correct frame buffer indices
57 * of avaiable external devices
58 *
59 */
60void ExternalDisplay::updateExtDispDevFbIndex()
61{
62 FILE *displayDeviceFP = NULL;
63 char fbType[MAX_FRAME_BUFFER_NAME_SIZE];
64 char msmFbTypePath[MAX_FRAME_BUFFER_NAME_SIZE];
65
66 for(int j = 1; j < MAX_DISPLAY_DEVICES; j++) {
Arun Kumar K.R26808f32013-02-11 19:17:05 -080067 snprintf (msmFbTypePath, sizeof(msmFbTypePath),
68 "/sys/class/graphics/fb%d/msm_fb_type", j);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080069 displayDeviceFP = fopen(msmFbTypePath, "r");
70 if(displayDeviceFP){
71 fread(fbType, sizeof(char), MAX_FRAME_BUFFER_NAME_SIZE,
72 displayDeviceFP);
73 if(strncmp(fbType, "dtv panel", strlen("dtv panel")) == 0){
74 ALOGD_IF(DEBUG,"hdmi framebuffer index is %d",j);
75 mHdmiFbNum = j;
76 } else if(strncmp(fbType, "writeback panel",
77 strlen("writeback panel")) == 0){
78 ALOGD_IF(DEBUG,"wfd framebuffer index is %d",j);
79 mWfdFbNum = j;
80 }
81 fclose(displayDeviceFP);
82 }
83 }
84 ALOGD_IF(DEBUG,"%s: mHdmiFbNum: %d mWfdFbNum: %d ",__FUNCTION__,
85 mHdmiFbNum, mWfdFbNum);
86}
87
88int ExternalDisplay::configureHDMIDisplay() {
89 openFrameBuffer(mHdmiFbNum);
90 if(mFd == -1)
91 return -1;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -080092 readCEUnderscanInfo();
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080093 readResolution();
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -080094 // TODO: Move this to activate
Arun Kumar K.R37552c52012-12-10 12:47:18 -080095 /* Used for changing the resolution
96 * getUserMode will get the preferred
97 * mode set thru adb shell */
98 int mode = getUserMode();
99 if (mode == -1) {
100 //Get the best mode and set
101 mode = getBestMode();
102 }
103 setResolution(mode);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800104 setDpyHdmiAttr();
105 setExternalDisplay(true, mHdmiFbNum);
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -0800106 // set system property
107 property_set("hw.hdmiON", "1");
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800108 return 0;
109}
110
111int ExternalDisplay::configureWFDDisplay() {
112 int ret = 0;
113 if(mConnectedFbNum == mHdmiFbNum) {
114 ALOGE("%s: Cannot process WFD connection while HDMI is active",
115 __FUNCTION__);
116 return -1;
117 }
118 openFrameBuffer(mWfdFbNum);
119 if(mFd == -1)
120 return -1;
121 ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo);
122 if(ret < 0) {
123 ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__,
124 strerror(errno));
125 }
126 setDpyWfdAttr();
127 setExternalDisplay(true, mWfdFbNum);
128 return 0;
129}
130
131int ExternalDisplay::teardownHDMIDisplay() {
132 if(mConnectedFbNum == mHdmiFbNum) {
133 // hdmi offline event..!
134 closeFrameBuffer();
135 resetInfo();
136 setExternalDisplay(false);
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -0800137 // unset system property
138 property_set("hw.hdmiON", "0");
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800139 }
140 return 0;
141}
142
143int ExternalDisplay::teardownWFDDisplay() {
144 if(mConnectedFbNum == mWfdFbNum) {
145 // wfd offline event..!
146 closeFrameBuffer();
147 memset(&mVInfo, 0, sizeof(mVInfo));
148 setExternalDisplay(false);
149 }
150 return 0;
151}
152
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -0800153int ExternalDisplay::ignoreRequest(const char *str) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800154 const char *s1 = str + strlen("change@/devices/virtual/switch/");
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -0800155 if(!strncmp(s1,"wfd",strlen(s1))) {
156 if(mConnectedFbNum == mHdmiFbNum) {
157 ALOGE("Ignore wfd event when HDMI is active");
158 return true;
159 }
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800160 }
Amara Venkata Mastan Manoj Kumarb156a2f2013-02-07 16:42:50 -0800161 return false;
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800162}
163
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700164
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700165ExternalDisplay::ExternalDisplay(hwc_context_t* ctx):mFd(-1),
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800166 mCurrentMode(-1), mConnected(0), mConnectedFbNum(0), mModeCount(0),
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800167 mUnderscanSupported(false), mHwcContext(ctx), mHdmiFbNum(-1),
168 mWfdFbNum(-1), mExtDpyNum(HWC_DISPLAY_EXTERNAL)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700169{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700170 memset(&mVInfo, 0, sizeof(mVInfo));
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800171 //Determine the fb index for external display devices.
172 updateExtDispDevFbIndex();
Arun Kumar K.Re746ac52013-03-20 15:56:15 -0700173 // disable HPD at start, it will be enabled later
174 // when the display powers on
175 // This helps for framework reboot or adb shell stop/start
176 writeHPDOption(0);
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800177
Arun Kumar K.R25187572013-02-28 18:47:36 -0800178 // for HDMI - retreive all the modes supported by the driver
179 if(mHdmiFbNum != -1) {
180 supported_video_mode_lut =
181 new msm_hdmi_mode_timing_info[HDMI_VFRMT_MAX];
182 // Populate the mode table for supported modes
183 MSM_HDMI_MODES_INIT_TIMINGS(supported_video_mode_lut);
184 MSM_HDMI_MODES_SET_SUPP_TIMINGS(supported_video_mode_lut,
185 MSM_HDMI_MODES_ALL);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800186 // Update the Source Product Information
187 // Vendor Name
188 setSPDInfo("vendor_name", "ro.product.manufacturer");
189 // Product Description
190 setSPDInfo("product_description", "ro.product.name");
191 }
192}
193/* gets the product manufacturer and product name and writes it
194 * to the sysfs node, so that the driver can get that information
195 * Used to show QCOM 8974 instead of Input 1 for example
196 */
197void ExternalDisplay::setSPDInfo(const char* node, const char* property) {
198 int err = -1;
199 char info[PROPERTY_VALUE_MAX];
200 char sysFsSPDFilePath[MAX_SYSFS_FILE_PATH];
201 memset(sysFsSPDFilePath, 0, sizeof(sysFsSPDFilePath));
202 snprintf(sysFsSPDFilePath , sizeof(sysFsSPDFilePath),
203 "/sys/devices/virtual/graphics/fb%d/%s",
204 mHdmiFbNum, node);
205 int spdFile = open(sysFsSPDFilePath, O_RDWR, 0);
206 if (spdFile < 0) {
207 ALOGE("%s: file '%s' not found : ret = %d"
208 "err str: %s", __FUNCTION__, sysFsSPDFilePath,
209 spdFile, strerror(errno));
210 } else {
211 memset(info, 0, sizeof(info));
212 property_get(property, info, UNKNOWN_STRING);
213 ALOGD_IF(DEBUG, "In %s: %s = %s", __FUNCTION__, property, info);
214 if (strncmp(info, UNKNOWN_STRING, SPD_NAME_LENGTH)) {
215 err = write(spdFile, info, strlen(info));
216 if (err <= 0) {
217 ALOGE("%s: file write failed for '%s'"
218 "err no = %d", __FUNCTION__, sysFsSPDFilePath, errno);
219 }
220 } else {
221 ALOGD_IF(DEBUG, "%s: property_get failed for SPD %s",
222 __FUNCTION__, node);
223 }
224 close(spdFile);
Arun Kumar K.R25187572013-02-28 18:47:36 -0800225 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700226}
227
Saurabh Shah56f610d2012-08-07 15:27:06 -0700228void ExternalDisplay::setEDIDMode(int resMode) {
229 ALOGD_IF(DEBUG,"resMode=%d ", resMode);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700230 {
231 Mutex::Autolock lock(mExtDispLock);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800232 setExternalDisplay(false);
233 openFrameBuffer(mHdmiFbNum);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700234 setResolution(resMode);
235 }
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800236 setExternalDisplay(true, mHdmiFbNum);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700237}
238
239void ExternalDisplay::setHPD(uint32_t startEnd) {
240 ALOGD_IF(DEBUG,"HPD enabled=%d", startEnd);
241 writeHPDOption(startEnd);
242}
243
244void ExternalDisplay::setActionSafeDimension(int w, int h) {
245 ALOGD_IF(DEBUG,"ActionSafe w=%d h=%d", w, h);
246 Mutex::Autolock lock(mExtDispLock);
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800247 char actionsafeWidth[PROPERTY_VALUE_MAX];
248 char actionsafeHeight[PROPERTY_VALUE_MAX];
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800249 snprintf(actionsafeWidth, sizeof(actionsafeWidth), "%d", w);
Arun Kumar K.R4d73d642013-04-10 17:06:39 -0700250 property_set("persist.sys.actionsafe.width", actionsafeWidth);
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800251 snprintf(actionsafeHeight, sizeof(actionsafeHeight), "%d", h);
Arun Kumar K.R4d73d642013-04-10 17:06:39 -0700252 property_set("persist.sys.actionsafe.height", actionsafeHeight);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800253 setExternalDisplay(true, mHdmiFbNum);
Saurabh Shah56f610d2012-08-07 15:27:06 -0700254}
255
256int ExternalDisplay::getModeCount() const {
257 ALOGD_IF(DEBUG,"HPD mModeCount=%d", mModeCount);
258 Mutex::Autolock lock(mExtDispLock);
259 return mModeCount;
260}
261
262void ExternalDisplay::getEDIDModes(int *out) const {
263 Mutex::Autolock lock(mExtDispLock);
264 for(int i = 0;i < mModeCount;i++) {
265 out[i] = mEDIDModes[i];
266 }
267}
268
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800269void ExternalDisplay::readCEUnderscanInfo()
270{
271 int hdmiScanInfoFile = -1;
272 int len = -1;
273 char scanInfo[17];
274 char *ce_info_str = NULL;
275 const char token[] = ", \n";
276 int ce_info = -1;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800277 char sysFsScanInfoFilePath[MAX_SYSFS_FILE_PATH];
278 snprintf(sysFsScanInfoFilePath, sizeof(sysFsScanInfoFilePath),
279 "/sys/devices/virtual/graphics/fb%d/"
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800280 "scan_info", mHdmiFbNum);
281
282 memset(scanInfo, 0, sizeof(scanInfo));
283 hdmiScanInfoFile = open(sysFsScanInfoFilePath, O_RDONLY, 0);
284 if (hdmiScanInfoFile < 0) {
285 ALOGD_IF(DEBUG, "%s: scan_info file '%s' not found",
286 __FUNCTION__, sysFsScanInfoFilePath);
287 return;
288 } else {
289 len = read(hdmiScanInfoFile, scanInfo, sizeof(scanInfo)-1);
290 ALOGD("%s: Scan Info string: %s length = %d",
291 __FUNCTION__, scanInfo, len);
292 if (len <= 0) {
293 close(hdmiScanInfoFile);
294 ALOGE("%s: Scan Info file empty '%s'",
295 __FUNCTION__, sysFsScanInfoFilePath);
296 return;
297 }
298 scanInfo[len] = '\0'; /* null terminate the string */
299 }
300 close(hdmiScanInfoFile);
301
302 /*
303 * The scan_info contains the three fields
304 * PT - preferred video format
305 * IT - video format
306 * CE video format - containing the underscan support information
307 */
308
309 /* PT */
310 ce_info_str = strtok(scanInfo, token);
311 if (ce_info_str) {
312 /* IT */
313 ce_info_str = strtok(NULL, token);
314 if (ce_info_str) {
315 /* CE */
316 ce_info_str = strtok(NULL, token);
317 if (ce_info_str)
318 ce_info = atoi(ce_info_str);
319 }
320 }
321
322 if (ce_info_str) {
323 // ce_info contains the underscan information
324 if (ce_info == EXT_SCAN_ALWAYS_UNDERSCANED ||
325 ce_info == EXT_SCAN_BOTH_SUPPORTED)
326 // if TV supported underscan, then driver will always underscan
327 // hence no need to apply action safe rectangle
328 mUnderscanSupported = true;
329 } else {
330 ALOGE("%s: scan_info string error", __FUNCTION__);
331 }
332
333 // Store underscan support info in a system property
334 const char* prop = (mUnderscanSupported) ? "1" : "0";
335 property_set("hw.underscan_supported", prop);
336 return;
337}
338
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700339ExternalDisplay::~ExternalDisplay()
340{
Arun Kumar K.R25187572013-02-28 18:47:36 -0800341 delete [] supported_video_mode_lut;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700342 closeFrameBuffer();
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700343}
344
Arun Kumar K.R25187572013-02-28 18:47:36 -0800345/*
346 * sets the fb_var_screeninfo from the hdmi_mode_timing_info
347 */
348void setDisplayTiming(struct fb_var_screeninfo &info,
349 const msm_hdmi_mode_timing_info* mode)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700350{
351 info.reserved[0] = 0;
352 info.reserved[1] = 0;
353 info.reserved[2] = 0;
Ken Zhang7b03a952013-01-16 13:23:48 -0500354#ifndef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
Arun Kumar K.R25187572013-02-28 18:47:36 -0800355 info.reserved[3] = (info.reserved[3] & 0xFFFF) |
356 (mode->video_format << 16);
Ken Zhang7b03a952013-01-16 13:23:48 -0500357#endif
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700358 info.xoffset = 0;
359 info.yoffset = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800360 info.xres = mode->active_h;
361 info.yres = mode->active_v;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700362
Arun Kumar K.R25187572013-02-28 18:47:36 -0800363 info.pixclock = (mode->pixel_freq)*1000;
364 info.vmode = mode->interlaced ?
365 FB_VMODE_INTERLACED : FB_VMODE_NONINTERLACED;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700366
Arun Kumar K.R25187572013-02-28 18:47:36 -0800367 info.right_margin = mode->front_porch_h;
368 info.hsync_len = mode->pulse_width_h;
369 info.left_margin = mode->back_porch_h;
370 info.lower_margin = mode->front_porch_v;
371 info.vsync_len = mode->pulse_width_v;
372 info.upper_margin = mode->back_porch_v;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700373}
374
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700375int ExternalDisplay::parseResolution(char* edidStr, int* edidModes)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700376{
377 char delim = ',';
378 int count = 0;
379 char *start, *end;
380 // EDIDs are string delimited by ','
381 // Ex: 16,4,5,3,32,34,1
382 // Parse this string to get mode(int)
383 start = (char*) edidStr;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700384 end = &delim;
385 while(*end == delim) {
386 edidModes[count] = (int) strtol(start, &end, 10);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700387 start = end+1;
388 count++;
389 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700390 ALOGD_IF(DEBUG, "In %s: count = %d", __FUNCTION__, count);
391 for (int i = 0; i < count; i++)
392 ALOGD_IF(DEBUG, "Mode[%d] = %d", i, edidModes[i]);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700393 return count;
394}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700395
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700396bool ExternalDisplay::readResolution()
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700397{
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800398 char sysFsEDIDFilePath[MAX_SYSFS_FILE_PATH];
399 snprintf(sysFsEDIDFilePath , sizeof(sysFsEDIDFilePath),
400 "/sys/devices/virtual/graphics/fb%d/edid_modes", mHdmiFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800401
402 int hdmiEDIDFile = open(sysFsEDIDFilePath, O_RDONLY, 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700403 int len = -1;
404
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700405 if (hdmiEDIDFile < 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700406 ALOGE("%s: edid_modes file '%s' not found",
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800407 __FUNCTION__, sysFsEDIDFilePath);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700408 return false;
409 } else {
410 len = read(hdmiEDIDFile, mEDIDs, sizeof(mEDIDs)-1);
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700411 ALOGD_IF(DEBUG, "%s: EDID string: %s length = %d",
412 __FUNCTION__, mEDIDs, len);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700413 if ( len <= 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700414 ALOGE("%s: edid_modes file empty '%s'",
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800415 __FUNCTION__, sysFsEDIDFilePath);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700416 }
417 else {
418 while (len > 1 && isspace(mEDIDs[len-1]))
419 --len;
420 mEDIDs[len] = 0;
421 }
422 }
423 close(hdmiEDIDFile);
424 if(len > 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800425 // Get EDID modes from the EDID strings
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700426 mModeCount = parseResolution(mEDIDs, mEDIDModes);
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700427 ALOGD_IF(DEBUG, "%s: mModeCount = %d", __FUNCTION__,
428 mModeCount);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700429 }
430
431 return (strlen(mEDIDs) > 0);
432}
433
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800434bool ExternalDisplay::openFrameBuffer(int fbNum)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700435{
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700436 if (mFd == -1) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800437 mFd = open(msmFbDevicePath[fbNum-1], O_RDWR);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700438 if (mFd < 0)
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800439 ALOGE("%s: %s is not available", __FUNCTION__,
440 msmFbDevicePath[fbNum-1]);
441 if(mHwcContext) {
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800442 mHwcContext->dpyAttr[mExtDpyNum].fd = mFd;
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800443 }
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700444 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700445 return (mFd > 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700446}
447
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700448bool ExternalDisplay::closeFrameBuffer()
449{
450 int ret = 0;
Naseer Ahmedf53b3772013-02-15 19:13:50 -0500451 if(mFd >= 0) {
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700452 ret = close(mFd);
453 mFd = -1;
454 }
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700455 if(mHwcContext) {
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800456 mHwcContext->dpyAttr[mExtDpyNum].fd = mFd;
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700457 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700458 return (ret == 0);
459}
460
461// clears the vinfo, edid, best modes
462void ExternalDisplay::resetInfo()
463{
464 memset(&mVInfo, 0, sizeof(mVInfo));
465 memset(mEDIDs, 0, sizeof(mEDIDs));
466 memset(mEDIDModes, 0, sizeof(mEDIDModes));
467 mModeCount = 0;
468 mCurrentMode = -1;
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800469 mUnderscanSupported = false;
470 // Reset the underscan supported system property
471 const char* prop = "0";
472 property_set("hw.underscan_supported", prop);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700473}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700474
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700475int ExternalDisplay::getModeOrder(int mode)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700476{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800477 // XXX: We dont support interlaced modes but having
Arun Kumar K.R25187572013-02-28 18:47:36 -0800478 // it here for future
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700479 switch (mode) {
480 default:
Arun Kumar K.R25187572013-02-28 18:47:36 -0800481 case HDMI_VFRMT_1440x480i60_4_3:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700482 return 1; // 480i 4:3
Arun Kumar K.R25187572013-02-28 18:47:36 -0800483 case HDMI_VFRMT_1440x480i60_16_9:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700484 return 2; // 480i 16:9
Arun Kumar K.R25187572013-02-28 18:47:36 -0800485 case HDMI_VFRMT_1440x576i50_4_3:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700486 return 3; // i576i 4:3
Arun Kumar K.R25187572013-02-28 18:47:36 -0800487 case HDMI_VFRMT_1440x576i50_16_9:
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700488 return 4; // 576i 16:9
Arun Kumar K.R25187572013-02-28 18:47:36 -0800489 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800490 return 5; // 1080i 16:9
491 case HDMI_VFRMT_640x480p60_4_3:
492 return 6; // 640x480 4:3
493 case HDMI_VFRMT_720x480p60_4_3:
494 return 7; // 480p 4:3
495 case HDMI_VFRMT_720x480p60_16_9:
496 return 8; // 480p 16:9
497 case HDMI_VFRMT_720x576p50_4_3:
498 return 9; // 576p 4:3
499 case HDMI_VFRMT_720x576p50_16_9:
500 return 10; // 576p 16:9
501 case HDMI_VFRMT_1280x1024p60_5_4:
502 return 11; // 1024p; Vesa format
Arun Kumar K.R25187572013-02-28 18:47:36 -0800503 case HDMI_VFRMT_1280x720p50_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800504 return 12; // 720p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800505 case HDMI_VFRMT_1280x720p60_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800506 return 13; // 720p@60Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800507 case HDMI_VFRMT_1920x1080p24_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800508 return 14; //1080p@24Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800509 case HDMI_VFRMT_1920x1080p25_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800510 return 15; //108-p@25Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800511 case HDMI_VFRMT_1920x1080p30_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800512 return 16; //1080p@30Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800513 case HDMI_VFRMT_1920x1080p50_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800514 return 17; //1080p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800515 case HDMI_VFRMT_1920x1080p60_16_9:
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800516 return 18; //1080p@60Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800517 case HDMI_VFRMT_2560x1600p60_16_9:
518 return 19; //WQXGA@60Hz541
519 case HDMI_VFRMT_3840x2160p24_16_9:
520 return 20;//2160@24Hz
521 case HDMI_VFRMT_3840x2160p25_16_9:
522 return 21;//2160@25Hz
523 case HDMI_VFRMT_3840x2160p30_16_9:
524 return 22; //2160@30Hz
525 case HDMI_VFRMT_4096x2160p24_16_9:
526 return 23; //4kx2k@24Hz
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700527 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700528}
529
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800530/// Returns the user mode set(if any) using adb shell
531int ExternalDisplay::getUserMode() {
532 /* Based on the property set the resolution */
533 char property_value[PROPERTY_VALUE_MAX];
Arun Kumar K.Rc31bdcb2013-02-25 17:47:42 -0800534 property_get("hw.hdmi.resolution", property_value, "-1");
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800535 int mode = atoi(property_value);
536 // We dont support interlaced modes
537 if(isValidMode(mode) && !isInterlacedMode(mode)) {
Naseer Ahmed74214722013-02-09 08:11:36 -0500538 ALOGD_IF(DEBUG, "%s: setting the HDMI mode = %d", __FUNCTION__, mode);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800539 return mode;
540 }
541 return -1;
542}
543
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700544// Get the best mode for the current HD TV
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700545int ExternalDisplay::getBestMode() {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700546 int bestOrder = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800547 int bestMode = HDMI_VFRMT_640x480p60_4_3;
Saurabh Shah56f610d2012-08-07 15:27:06 -0700548 Mutex::Autolock lock(mExtDispLock);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700549 // for all the edid read, get the best mode
550 for(int i = 0; i < mModeCount; i++) {
551 int mode = mEDIDModes[i];
552 int order = getModeOrder(mode);
553 if (order > bestOrder) {
554 bestOrder = order;
555 bestMode = mode;
556 }
557 }
558 return bestMode;
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700559}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700560
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700561inline bool ExternalDisplay::isValidMode(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700562{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800563 bool valid = false;
564 for (int i = 0; i < mModeCount; i++) {
565 if(ID == mEDIDModes[i]) {
566 valid = true;
567 break;
568 }
569 }
570 return valid;
571}
572
573// returns true if the mode(ID) is interlaced mode format
574bool ExternalDisplay::isInterlacedMode(int ID) {
575 bool interlaced = false;
576 switch(ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800577 case HDMI_VFRMT_1440x480i60_4_3:
578 case HDMI_VFRMT_1440x480i60_16_9:
579 case HDMI_VFRMT_1440x576i50_4_3:
580 case HDMI_VFRMT_1440x576i50_16_9:
581 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800582 interlaced = true;
583 default:
584 interlaced = false;
585 }
586 return interlaced;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700587}
588
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700589void ExternalDisplay::setResolution(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700590{
591 struct fb_var_screeninfo info;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700592 int ret = 0;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700593 ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo);
594 if(ret < 0) {
595 ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__,
596 strerror(errno));
597 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700598 ALOGD_IF(DEBUG, "%s: GET Info<ID=%d %dx%d (%d,%d,%d),"
599 "(%d,%d,%d) %dMHz>", __FUNCTION__,
600 mVInfo.reserved[3], mVInfo.xres, mVInfo.yres,
601 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
602 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
603 mVInfo.pixclock/1000/1000);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800604 //If its a new ID - update var_screeninfo
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700605 if ((isValidMode(ID)) && mCurrentMode != ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800606 const struct msm_hdmi_mode_timing_info *mode =
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700607 &supported_video_mode_lut[0];
Arun Kumar K.R25187572013-02-28 18:47:36 -0800608 for (unsigned int i = 0; i < HDMI_VFRMT_MAX; ++i) {
609 const struct msm_hdmi_mode_timing_info *cur =
610 &supported_video_mode_lut[i];
611 if (cur->video_format == (uint32_t)ID) {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700612 mode = cur;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800613 break;
614 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700615 }
Arun Kumar K.R25187572013-02-28 18:47:36 -0800616 setDisplayTiming(mVInfo, mode);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700617 ALOGD_IF(DEBUG, "%s: SET Info<ID=%d => Info<ID=%d %dx %d"
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700618 "(%d,%d,%d), (%d,%d,%d) %dMHz>", __FUNCTION__, ID,
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800619 mode->video_format, mVInfo.xres, mVInfo.yres,
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700620 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
621 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
622 mVInfo.pixclock/1000/1000);
Ken Zhang7b03a952013-01-16 13:23:48 -0500623#ifdef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
624 struct msmfb_metadata metadata;
625 memset(&metadata, 0 , sizeof(metadata));
626 metadata.op = metadata_op_vic;
627 metadata.data.video_info_code = mode->video_format;
628 if (ioctl(mFd, MSMFB_METADATA_SET, &metadata) == -1) {
629 ALOGD("In %s: MSMFB_METADATA_SET failed Err Str = %s",
630 __FUNCTION__, strerror(errno));
631 }
632#endif
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800633 mVInfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_ALL | FB_ACTIVATE_FORCE;
634 ret = ioctl(mFd, FBIOPUT_VSCREENINFO, &mVInfo);
635 if(ret < 0) {
636 ALOGD("In %s: FBIOPUT_VSCREENINFO failed Err Str = %s",
637 __FUNCTION__, strerror(errno));
638 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700639 mCurrentMode = ID;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700640 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700641}
642
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800643void ExternalDisplay::setExternalDisplay(bool connected, int extFbNum)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700644{
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700645 hwc_context_t* ctx = mHwcContext;
646 if(ctx) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800647 ALOGD_IF(DEBUG, "%s: connected = %d", __FUNCTION__, connected);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700648 // Store the external display
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800649 mConnected = connected;
650 mConnectedFbNum = extFbNum;
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800651 mHwcContext->dpyAttr[mExtDpyNum].connected = connected;
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800652 // Update external fb number in Overlay context
653 overlay::Overlay::getInstance()->setExtFbNum(extFbNum);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700654 }
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800655}
656
657int ExternalDisplay::getExtFbNum(int &fbNum) {
658 int ret = -1;
659 if(mConnected) {
660 fbNum = mConnectedFbNum;
661 ret = 0;
662 }
663 return ret;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700664}
665
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700666bool ExternalDisplay::writeHPDOption(int userOption) const
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700667{
668 bool ret = true;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800669 char sysFsHPDFilePath[MAX_SYSFS_FILE_PATH];
670 snprintf(sysFsHPDFilePath ,sizeof(sysFsHPDFilePath),
671 "/sys/devices/virtual/graphics/fb%d/hpd", mHdmiFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800672 int hdmiHPDFile = open(sysFsHPDFilePath,O_RDWR, 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700673 if (hdmiHPDFile < 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800674 ALOGE("%s: state file '%s' not found : ret%d err str: %s", __FUNCTION__,
675 sysFsHPDFilePath, hdmiHPDFile, strerror(errno));
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700676 ret = false;
677 } else {
678 int err = -1;
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800679 ALOGD_IF(DEBUG, "%s: option = %d", __FUNCTION__, userOption);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700680 if(userOption)
681 err = write(hdmiHPDFile, "1", 2);
682 else
683 err = write(hdmiHPDFile, "0" , 2);
684 if (err <= 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800685 ALOGE("%s: file write failed '%s'", __FUNCTION__, sysFsHPDFilePath);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700686 ret = false;
687 }
688 close(hdmiHPDFile);
689 }
690 return ret;
691}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700692
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800693void ExternalDisplay::setDpyWfdAttr() {
694 if(mHwcContext) {
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800695 mHwcContext->dpyAttr[mExtDpyNum].xres = mVInfo.xres;
696 mHwcContext->dpyAttr[mExtDpyNum].yres = mVInfo.yres;
697 mHwcContext->dpyAttr[mExtDpyNum].vsync_period =
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800698 1000000000l /60;
699 ALOGD_IF(DEBUG,"%s: wfd...connected..!",__FUNCTION__);
700 }
701}
702
703void ExternalDisplay::setDpyHdmiAttr() {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700704 int width = 0, height = 0, fps = 0;
705 getAttrForMode(width, height, fps);
706 if(mHwcContext) {
Saurabh Shahc4d034f2012-09-27 15:55:15 -0700707 ALOGD("ExtDisplay setting xres = %d, yres = %d", width, height);
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700708 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
709 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
Saurabh Shahc4d034f2012-09-27 15:55:15 -0700710 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
711 1000000000l / fps;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700712 }
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700713}
714
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800715void ExternalDisplay::getAttrForMode(int& width, int& height, int& fps) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700716 switch (mCurrentMode) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800717 case HDMI_VFRMT_640x480p60_4_3:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700718 width = 640;
719 height = 480;
720 fps = 60;
721 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800722 case HDMI_VFRMT_720x480p60_4_3:
723 case HDMI_VFRMT_720x480p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700724 width = 720;
725 height = 480;
726 fps = 60;
727 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800728 case HDMI_VFRMT_720x576p50_4_3:
729 case HDMI_VFRMT_720x576p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700730 width = 720;
731 height = 576;
732 fps = 50;
733 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800734 case HDMI_VFRMT_1280x720p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700735 width = 1280;
736 height = 720;
737 fps = 50;
738 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800739 case HDMI_VFRMT_1280x720p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700740 width = 1280;
741 height = 720;
742 fps = 60;
743 break;
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800744 case HDMI_VFRMT_1280x1024p60_5_4:
745 width = 1280;
746 height = 1024;
747 fps = 60;
748 break;
Manoj Rao564ee922013-05-07 21:32:57 -0700749 case HDMI_VFRMT_1024x768p60_4_3:
750 width = 1024;
751 height = 768;
752 fps = 60;
753 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800754 case HDMI_VFRMT_1920x1080p24_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700755 width = 1920;
756 height = 1080;
757 fps = 24;
758 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800759 case HDMI_VFRMT_1920x1080p25_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700760 width = 1920;
761 height = 1080;
762 fps = 25;
763 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800764 case HDMI_VFRMT_1920x1080p30_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700765 width = 1920;
766 height = 1080;
767 fps = 30;
768 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800769 case HDMI_VFRMT_1920x1080p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700770 width = 1920;
771 height = 1080;
772 fps = 50;
773 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800774 case HDMI_VFRMT_1920x1080p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700775 width = 1920;
776 height = 1080;
777 fps = 60;
778 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800779 case HDMI_VFRMT_2560x1600p60_16_9:
780 width = 2560;
781 height = 1600;
782 fps = 60;
783 break;
784 case HDMI_VFRMT_3840x2160p24_16_9:
785 width = 3840;
786 height = 2160;
787 fps = 24;
788 break;
Arun Kumar K.R92ebf9d2013-04-09 19:23:14 -0700789 case HDMI_VFRMT_3840x2160p25_16_9:
790 width = 3840;
791 height = 2160;
792 fps = 25;
793 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800794 case HDMI_VFRMT_3840x2160p30_16_9:
795 width = 3840;
796 height = 2160;
797 fps = 30;
798 break;
799 case HDMI_VFRMT_4096x2160p24_16_9:
800 width = 4096;
801 height = 2160;
802 fps = 24;
803 break;
804
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700805 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700806}
807
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700808};