blob: 6f5cc090aa427f32c85a06f819aeb36d593d9653 [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
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700501 case HDMI_VFRMT_1024x768p60_4_3:
502 return 11; // 768p 4:3 Vesa format
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800503 case HDMI_VFRMT_1280x1024p60_5_4:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700504 return 12; // 1024p Vesa format
Arun Kumar K.R25187572013-02-28 18:47:36 -0800505 case HDMI_VFRMT_1280x720p50_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700506 return 13; // 720p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800507 case HDMI_VFRMT_1280x720p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700508 return 14; // 720p@60Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800509 case HDMI_VFRMT_1920x1080p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700510 return 15; //1080p@24Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800511 case HDMI_VFRMT_1920x1080p25_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700512 return 16; //108-p@25Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800513 case HDMI_VFRMT_1920x1080p30_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700514 return 17; //1080p@30Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800515 case HDMI_VFRMT_1920x1080p50_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700516 return 18; //1080p@50Hz
Arun Kumar K.R25187572013-02-28 18:47:36 -0800517 case HDMI_VFRMT_1920x1080p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700518 return 19; //1080p@60Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800519 case HDMI_VFRMT_2560x1600p60_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700520 return 20; //WQXGA@60Hz541
Ujwal Patelb9430d22012-11-15 18:10:19 -0800521 case HDMI_VFRMT_3840x2160p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700522 return 21;//2160@24Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800523 case HDMI_VFRMT_3840x2160p25_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700524 return 22;//2160@25Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800525 case HDMI_VFRMT_3840x2160p30_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700526 return 23; //2160@30Hz
Ujwal Patelb9430d22012-11-15 18:10:19 -0800527 case HDMI_VFRMT_4096x2160p24_16_9:
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700528 return 24; //4kx2k@24Hz
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700529 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700530}
531
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800532/// Returns the user mode set(if any) using adb shell
533int ExternalDisplay::getUserMode() {
534 /* Based on the property set the resolution */
535 char property_value[PROPERTY_VALUE_MAX];
Arun Kumar K.Rc31bdcb2013-02-25 17:47:42 -0800536 property_get("hw.hdmi.resolution", property_value, "-1");
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800537 int mode = atoi(property_value);
538 // We dont support interlaced modes
539 if(isValidMode(mode) && !isInterlacedMode(mode)) {
Naseer Ahmed74214722013-02-09 08:11:36 -0500540 ALOGD_IF(DEBUG, "%s: setting the HDMI mode = %d", __FUNCTION__, mode);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800541 return mode;
542 }
543 return -1;
544}
545
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700546// Get the best mode for the current HD TV
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700547int ExternalDisplay::getBestMode() {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700548 int bestOrder = 0;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800549 int bestMode = HDMI_VFRMT_640x480p60_4_3;
Saurabh Shah56f610d2012-08-07 15:27:06 -0700550 Mutex::Autolock lock(mExtDispLock);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700551 // for all the edid read, get the best mode
552 for(int i = 0; i < mModeCount; i++) {
553 int mode = mEDIDModes[i];
554 int order = getModeOrder(mode);
555 if (order > bestOrder) {
556 bestOrder = order;
557 bestMode = mode;
558 }
559 }
560 return bestMode;
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700561}
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700562
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700563inline bool ExternalDisplay::isValidMode(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700564{
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800565 bool valid = false;
566 for (int i = 0; i < mModeCount; i++) {
567 if(ID == mEDIDModes[i]) {
568 valid = true;
569 break;
570 }
571 }
572 return valid;
573}
574
575// returns true if the mode(ID) is interlaced mode format
576bool ExternalDisplay::isInterlacedMode(int ID) {
577 bool interlaced = false;
578 switch(ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800579 case HDMI_VFRMT_1440x480i60_4_3:
580 case HDMI_VFRMT_1440x480i60_16_9:
581 case HDMI_VFRMT_1440x576i50_4_3:
582 case HDMI_VFRMT_1440x576i50_16_9:
583 case HDMI_VFRMT_1920x1080i60_16_9:
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800584 interlaced = true;
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700585 break;
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800586 default:
587 interlaced = false;
Arun Kumar K.Rae46f3a2013-05-16 16:40:10 -0700588 break;
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800589 }
590 return interlaced;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700591}
592
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700593void ExternalDisplay::setResolution(int ID)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700594{
595 struct fb_var_screeninfo info;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700596 int ret = 0;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700597 ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo);
598 if(ret < 0) {
599 ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__,
600 strerror(errno));
601 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700602 ALOGD_IF(DEBUG, "%s: GET Info<ID=%d %dx%d (%d,%d,%d),"
603 "(%d,%d,%d) %dMHz>", __FUNCTION__,
604 mVInfo.reserved[3], mVInfo.xres, mVInfo.yres,
605 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
606 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
607 mVInfo.pixclock/1000/1000);
Arun Kumar K.R37552c52012-12-10 12:47:18 -0800608 //If its a new ID - update var_screeninfo
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700609 if ((isValidMode(ID)) && mCurrentMode != ID) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800610 const struct msm_hdmi_mode_timing_info *mode =
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700611 &supported_video_mode_lut[0];
Arun Kumar K.R25187572013-02-28 18:47:36 -0800612 for (unsigned int i = 0; i < HDMI_VFRMT_MAX; ++i) {
613 const struct msm_hdmi_mode_timing_info *cur =
614 &supported_video_mode_lut[i];
615 if (cur->video_format == (uint32_t)ID) {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700616 mode = cur;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800617 break;
618 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700619 }
Arun Kumar K.R25187572013-02-28 18:47:36 -0800620 setDisplayTiming(mVInfo, mode);
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700621 ALOGD_IF(DEBUG, "%s: SET Info<ID=%d => Info<ID=%d %dx %d"
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700622 "(%d,%d,%d), (%d,%d,%d) %dMHz>", __FUNCTION__, ID,
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800623 mode->video_format, mVInfo.xres, mVInfo.yres,
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700624 mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin,
625 mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin,
626 mVInfo.pixclock/1000/1000);
Ken Zhang7b03a952013-01-16 13:23:48 -0500627#ifdef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
628 struct msmfb_metadata metadata;
629 memset(&metadata, 0 , sizeof(metadata));
630 metadata.op = metadata_op_vic;
631 metadata.data.video_info_code = mode->video_format;
632 if (ioctl(mFd, MSMFB_METADATA_SET, &metadata) == -1) {
633 ALOGD("In %s: MSMFB_METADATA_SET failed Err Str = %s",
634 __FUNCTION__, strerror(errno));
635 }
636#endif
Arun Kumar K.Re1cea3e2013-02-06 16:57:43 -0800637 mVInfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_ALL | FB_ACTIVATE_FORCE;
638 ret = ioctl(mFd, FBIOPUT_VSCREENINFO, &mVInfo);
639 if(ret < 0) {
640 ALOGD("In %s: FBIOPUT_VSCREENINFO failed Err Str = %s",
641 __FUNCTION__, strerror(errno));
642 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700643 mCurrentMode = ID;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700644 }
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700645}
646
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800647void ExternalDisplay::setExternalDisplay(bool connected, int extFbNum)
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700648{
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700649 hwc_context_t* ctx = mHwcContext;
650 if(ctx) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800651 ALOGD_IF(DEBUG, "%s: connected = %d", __FUNCTION__, connected);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700652 // Store the external display
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800653 mConnected = connected;
654 mConnectedFbNum = extFbNum;
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800655 mHwcContext->dpyAttr[mExtDpyNum].connected = connected;
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800656 // Update external fb number in Overlay context
657 overlay::Overlay::getInstance()->setExtFbNum(extFbNum);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700658 }
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800659}
660
661int ExternalDisplay::getExtFbNum(int &fbNum) {
662 int ret = -1;
663 if(mConnected) {
664 fbNum = mConnectedFbNum;
665 ret = 0;
666 }
667 return ret;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700668}
669
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700670bool ExternalDisplay::writeHPDOption(int userOption) const
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700671{
672 bool ret = true;
Arun Kumar K.R26808f32013-02-11 19:17:05 -0800673 char sysFsHPDFilePath[MAX_SYSFS_FILE_PATH];
674 snprintf(sysFsHPDFilePath ,sizeof(sysFsHPDFilePath),
675 "/sys/devices/virtual/graphics/fb%d/hpd", mHdmiFbNum);
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800676 int hdmiHPDFile = open(sysFsHPDFilePath,O_RDWR, 0);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700677 if (hdmiHPDFile < 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800678 ALOGE("%s: state file '%s' not found : ret%d err str: %s", __FUNCTION__,
679 sysFsHPDFilePath, hdmiHPDFile, strerror(errno));
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700680 ret = false;
681 } else {
682 int err = -1;
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800683 ALOGD_IF(DEBUG, "%s: option = %d", __FUNCTION__, userOption);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700684 if(userOption)
685 err = write(hdmiHPDFile, "1", 2);
686 else
687 err = write(hdmiHPDFile, "0" , 2);
688 if (err <= 0) {
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800689 ALOGE("%s: file write failed '%s'", __FUNCTION__, sysFsHPDFilePath);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700690 ret = false;
691 }
692 close(hdmiHPDFile);
693 }
694 return ret;
695}
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700696
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800697void ExternalDisplay::setDpyWfdAttr() {
698 if(mHwcContext) {
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800699 mHwcContext->dpyAttr[mExtDpyNum].xres = mVInfo.xres;
700 mHwcContext->dpyAttr[mExtDpyNum].yres = mVInfo.yres;
701 mHwcContext->dpyAttr[mExtDpyNum].vsync_period =
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800702 1000000000l /60;
703 ALOGD_IF(DEBUG,"%s: wfd...connected..!",__FUNCTION__);
704 }
705}
706
707void ExternalDisplay::setDpyHdmiAttr() {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700708 int width = 0, height = 0, fps = 0;
709 getAttrForMode(width, height, fps);
710 if(mHwcContext) {
Saurabh Shahc4d034f2012-09-27 15:55:15 -0700711 ALOGD("ExtDisplay setting xres = %d, yres = %d", width, height);
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700712 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
713 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
Saurabh Shahc4d034f2012-09-27 15:55:15 -0700714 mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
715 1000000000l / fps;
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700716 }
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700717}
718
Amara Venkata Mastan Manoj Kumar5182a782012-12-03 12:08:48 -0800719void ExternalDisplay::getAttrForMode(int& width, int& height, int& fps) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700720 switch (mCurrentMode) {
Arun Kumar K.R25187572013-02-28 18:47:36 -0800721 case HDMI_VFRMT_640x480p60_4_3:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700722 width = 640;
723 height = 480;
724 fps = 60;
725 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800726 case HDMI_VFRMT_720x480p60_4_3:
727 case HDMI_VFRMT_720x480p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700728 width = 720;
729 height = 480;
730 fps = 60;
731 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800732 case HDMI_VFRMT_720x576p50_4_3:
733 case HDMI_VFRMT_720x576p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700734 width = 720;
735 height = 576;
736 fps = 50;
737 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800738 case HDMI_VFRMT_1280x720p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700739 width = 1280;
740 height = 720;
741 fps = 50;
742 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800743 case HDMI_VFRMT_1280x720p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700744 width = 1280;
745 height = 720;
746 fps = 60;
747 break;
Arun Kumar K.R6ce73ff2013-01-24 19:48:24 -0800748 case HDMI_VFRMT_1280x1024p60_5_4:
749 width = 1280;
750 height = 1024;
751 fps = 60;
752 break;
Manoj Rao564ee922013-05-07 21:32:57 -0700753 case HDMI_VFRMT_1024x768p60_4_3:
754 width = 1024;
755 height = 768;
756 fps = 60;
757 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800758 case HDMI_VFRMT_1920x1080p24_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700759 width = 1920;
760 height = 1080;
761 fps = 24;
762 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800763 case HDMI_VFRMT_1920x1080p25_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700764 width = 1920;
765 height = 1080;
766 fps = 25;
767 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800768 case HDMI_VFRMT_1920x1080p30_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700769 width = 1920;
770 height = 1080;
771 fps = 30;
772 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800773 case HDMI_VFRMT_1920x1080p50_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700774 width = 1920;
775 height = 1080;
776 fps = 50;
777 break;
Arun Kumar K.R25187572013-02-28 18:47:36 -0800778 case HDMI_VFRMT_1920x1080p60_16_9:
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700779 width = 1920;
780 height = 1080;
781 fps = 60;
782 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800783 case HDMI_VFRMT_2560x1600p60_16_9:
784 width = 2560;
785 height = 1600;
786 fps = 60;
787 break;
788 case HDMI_VFRMT_3840x2160p24_16_9:
789 width = 3840;
790 height = 2160;
791 fps = 24;
792 break;
Arun Kumar K.R92ebf9d2013-04-09 19:23:14 -0700793 case HDMI_VFRMT_3840x2160p25_16_9:
794 width = 3840;
795 height = 2160;
796 fps = 25;
797 break;
Ujwal Patelb9430d22012-11-15 18:10:19 -0800798 case HDMI_VFRMT_3840x2160p30_16_9:
799 width = 3840;
800 height = 2160;
801 fps = 30;
802 break;
803 case HDMI_VFRMT_4096x2160p24_16_9:
804 width = 4096;
805 height = 2160;
806 fps = 24;
807 break;
808
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700809 }
Naseer Ahmedf8ec1622012-07-31 18:56:23 -0700810}
811
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700812};