2012-06-14 07:56:20 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
|
|
|
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and/or other materials provided
|
|
|
|
* with the distribution.
|
|
|
|
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
|
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
|
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2012-07-02 06:54:19 +00:00
|
|
|
#include <cutils/log.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <linux/fb.h>
|
|
|
|
#include "mdp_version.h"
|
2012-06-14 07:56:20 +00:00
|
|
|
|
2012-07-02 06:54:19 +00:00
|
|
|
ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::MDPVersion);
|
|
|
|
namespace qdutils {
|
2012-06-14 07:56:20 +00:00
|
|
|
|
2012-07-26 01:27:14 +00:00
|
|
|
MDPVersion::MDPVersion()
|
2012-07-02 06:54:19 +00:00
|
|
|
{
|
|
|
|
int fb_fd = open("/dev/graphics/fb0", O_RDWR);
|
|
|
|
int mdp_version = MDP_V_UNKNOWN;
|
2012-07-26 01:27:14 +00:00
|
|
|
char panel_type = 0;
|
2012-07-02 06:54:19 +00:00
|
|
|
struct fb_fix_screeninfo fb_finfo;
|
|
|
|
if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &fb_finfo) < 0) {
|
|
|
|
ALOGE("FBIOGET_FSCREENINFO failed");
|
|
|
|
mdp_version = MDP_V_UNKNOWN;
|
|
|
|
} else {
|
|
|
|
if(!strncmp(fb_finfo.id, "msmfb", 5)) {
|
|
|
|
char str_ver[4] = { 0 };
|
|
|
|
memcpy(str_ver, &fb_finfo.id[5], 3);
|
|
|
|
str_ver[3] = '\0';
|
|
|
|
mdp_version = atoi(str_ver);
|
2012-06-14 07:56:20 +00:00
|
|
|
|
2012-07-02 06:54:19 +00:00
|
|
|
//Normalize MDP version to ease comparison.
|
|
|
|
//This is needed only because
|
|
|
|
//MDP 3.0.3 reports value as 303 which
|
|
|
|
//is more than all the others
|
|
|
|
if (mdp_version < 100)
|
|
|
|
mdp_version *= 10;
|
2012-06-14 07:56:20 +00:00
|
|
|
|
2012-07-02 06:54:19 +00:00
|
|
|
} else if (!strncmp(fb_finfo.id, "mdssfb", 6)) {
|
|
|
|
mdp_version = MDSS_V5;
|
|
|
|
} else {
|
|
|
|
mdp_version = MDP_V_UNKNOWN;
|
|
|
|
}
|
2012-07-26 01:27:14 +00:00
|
|
|
int len = strlen("msmfbXX_");
|
2012-08-28 08:21:09 +00:00
|
|
|
if (mdp_version == MDP_V3_0_2 || mdp_version == MDP_V3_0_3)
|
2012-07-26 01:27:14 +00:00
|
|
|
len++;
|
|
|
|
panel_type = fb_finfo.id[len];
|
|
|
|
|
2012-07-02 06:54:19 +00:00
|
|
|
}
|
|
|
|
close(fb_fd);
|
2012-07-26 01:27:14 +00:00
|
|
|
mMDPVersion = mdp_version;
|
|
|
|
mHasOverlay = false;
|
2012-07-02 06:54:19 +00:00
|
|
|
if((mMDPVersion >= MDP_V4_0) || (mMDPVersion == MDP_V_UNKNOWN))
|
|
|
|
mHasOverlay = true;
|
2012-07-26 01:27:14 +00:00
|
|
|
mPanelType = panel_type;
|
2012-08-03 03:23:03 +00:00
|
|
|
#ifdef TARGET_8x50
|
|
|
|
mMDPVersion = MDP_V3_1;
|
|
|
|
mHasOverlay = false;
|
|
|
|
mPanelType = 0;
|
|
|
|
#endif
|
2012-07-02 06:54:19 +00:00
|
|
|
}
|
|
|
|
}; //namespace qdutils
|
2012-06-14 07:56:20 +00:00
|
|
|
|