Merge "hwc: Clean up scattered definitions of commonly used constants/values"

This commit is contained in:
Linux Build Service Account
2014-08-30 22:37:38 -07:00
committed by Gerrit - the friendly Code Review server
8 changed files with 31 additions and 30 deletions

View File

@@ -37,14 +37,11 @@
#include "qd_utils.h"
using namespace android;
using namespace qdutils;
namespace qhwc {
#define MAX_SYSFS_FILE_PATH 255
#define UNKNOWN_STRING "unknown"
#define SPD_NAME_LENGTH 16
/* Max. resolution assignable to when downscale */
#define SUPPORTED_DOWNSCALE_EXT_AREA (1920*1080)
int ExternalDisplay::configure() {
if(!openFrameBuffer()) {
@@ -594,7 +591,7 @@ void ExternalDisplay::setAttributes() {
// downscale mode
// Restrict this upto 1080p resolution max
if(((priW * priH) > (width * height)) &&
((priW * priH) <= SUPPORTED_DOWNSCALE_EXT_AREA)) {
((priW * priH) <= SUPPORTED_DOWNSCALE_AREA)) {
// tmpW and tmpH will hold the primary dimensions before we
// update the aspect ratio if necessary.
int tmpW = priW;
@@ -611,7 +608,7 @@ void ExternalDisplay::setAttributes() {
// We get around this by calculating a new resolution by
// keeping aspect ratio intact.
hwc_rect r = {0, 0, 0, 0};
getAspectRatioPosition(tmpW, tmpH, width, height, r);
qdutils::getAspectRatioPosition(tmpW, tmpH, width, height, r);
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres =
r.right - r.left;
mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres =

View File

@@ -488,8 +488,8 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
if(extOrientation & HAL_TRANSFORM_ROT_90) {
// Swap width/height for input position
swapWidthHeight(actualWidth, actualHeight);
getAspectRatioPosition((int)fbWidth, (int)fbHeight, (int)actualWidth,
(int)actualHeight, rect);
qdutils::getAspectRatioPosition((int)fbWidth, (int)fbHeight,
(int)actualWidth, (int)actualHeight, rect);
xPos = rect.left;
yPos = rect.top;
width = float(rect.right - rect.left);
@@ -520,7 +520,7 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
xRatio = (float)(outPos.x - xPos)/width;
// GetaspectRatio -- tricky to get the correct aspect ratio
// But we need to do this.
getAspectRatioPosition((int)width, (int)height,
qdutils::getAspectRatioPosition((int)width, (int)height,
(int)width,(int)height, r);
xPos = r.left;
yPos = r.top;
@@ -603,7 +603,7 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
if(!isPrimaryPortrait(ctx)) {
swap(srcWidth, srcHeight);
} // Get Aspect Ratio for external
getAspectRatioPosition(dstWidth, dstHeight, srcWidth,
qdutils::getAspectRatioPosition(dstWidth, dstHeight, srcWidth,
srcHeight, displayFrame);
// Crop - this is needed, because for sidesync, the dest fb will
// be in portrait orientation, so update the crop to not show the

View File

@@ -27,16 +27,17 @@
#include <sys/prctl.h>
#include <poll.h>
#include "hwc_utils.h"
#include "qd_utils.h"
#include "string.h"
#include "external.h"
#include "overlay.h"
#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
using namespace qdutils;
namespace qhwc {
#define HWC_VSYNC_THREAD_NAME "hwcVsyncThread"
#define MAX_SYSFS_FILE_PATH 255
#define PANEL_ON_STR "panel_power_on ="
#define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
#define MAX_THERMAL_LEVEL 3

View File

@@ -32,6 +32,7 @@
#include "pipes/overlayGenPipe.h"
#include "mdp_version.h"
#include "qdMetaData.h"
#include "qd_utils.h"
#define PIPE_DEBUG 0
@@ -452,7 +453,6 @@ int Overlay::initOverlay() {
}
FILE *displayDeviceFP = NULL;
const int MAX_FRAME_BUFFER_NAME_SIZE = 128;
char fbType[MAX_FRAME_BUFFER_NAME_SIZE];
char msmFbTypePath[MAX_FRAME_BUFFER_NAME_SIZE];
const char *strDtvPanel = "dtv panel";

View File

@@ -29,6 +29,7 @@
#include <cutils/log.h>
#include <linux/msm_mdp.h>
#include "mdp_version.h"
#include "qd_utils.h"
#define DEBUG 0
@@ -146,7 +147,6 @@ int MDPVersion::tokenizeParams(char *inputParams, const char *delim,
void MDPVersion::updatePanelInfo() {
FILE *displayDeviceFP = NULL;
FILE *panelInfoNodeFP = NULL;
const int MAX_FRAME_BUFFER_NAME_SIZE = 128;
char fbType[MAX_FRAME_BUFFER_NAME_SIZE];
const char *strCmdPanel = "mipi dsi cmd panel";
const char *strVideoPanel = "mipi dsi video panel";

View File

@@ -28,11 +28,10 @@
*/
#include "qd_utils.h"
#define MAX_FRAME_BUFFER_NAME_SIZE (80)
#define QD_UTILS_DEBUG 0
namespace qdutils {
int getHDMINode(void)
{
FILE *displayDeviceFP = NULL;
@@ -121,3 +120,4 @@ void getAspectRatioPosition(int destWidth, int destHeight, int srcWidth,
rect.bottom = srcHeight + rect.top;
}
}; //namespace qdutils

View File

@@ -44,11 +44,18 @@
#include <cutils/properties.h>
#include <hardware/hwcomposer.h>
#define EDID_RAW_DATA_SIZE 640
namespace qdutils {
#define EDID_RAW_DATA_SIZE 640
enum qd_utils {
MAX_FRAME_BUFFER_NAME_SIZE = 128,
MAX_SYSFS_FILE_PATH = 255,
SUPPORTED_DOWNSCALE_AREA = (1920*1080)
};
int getEdidRawData(char *buffer);
void getAspectRatioPosition(int destWidth, int destHeight, int srcWidth,
int srcHeight, hwc_rect_t& rect);
}; //namespace qdutils
#endif

View File

@@ -50,14 +50,10 @@
#include "qd_utils.h"
using namespace android;
using namespace qdutils;
namespace qhwc {
#define MAX_SYSFS_FILE_PATH 255
/* Max. resolution assignable to virtual display. */
#define SUPPORTED_VIRTUAL_AREA (1920*1080)
int VirtualDisplay::configure() {
if(!openFrameBuffer())
return -1;
@@ -124,9 +120,9 @@ void VirtualDisplay::setToPrimary(uint32_t maxArea,
// for eg., primary in 1600p and WFD in 1080p
// we wont use downscale feature because MAX MDP
// writeback resolution supported is 1080p (tracked
// by SUPPORTED_VIRTUAL_AREA).
// by SUPPORTED_DOWNSCALE_AREA).
if((maxArea == (priW * priH))
&& (maxArea <= SUPPORTED_VIRTUAL_AREA)) {
&& (maxArea <= SUPPORTED_DOWNSCALE_AREA)) {
// tmpW and tmpH will hold the primary dimensions before we
// update the aspect ratio if necessary.
uint32_t tmpW = priW;
@@ -143,7 +139,7 @@ void VirtualDisplay::setToPrimary(uint32_t maxArea,
// We get around this by calculating a new resolution by
// keeping aspect ratio intact.
hwc_rect r = {0, 0, 0, 0};
getAspectRatioPosition(tmpW, tmpH, extW, extH, r);
qdutils::getAspectRatioPosition(tmpW, tmpH, extW, extH, r);
extW = r.right - r.left;
extH = r.bottom - r.top;
}
@@ -156,13 +152,13 @@ void VirtualDisplay::setToPrimary(uint32_t maxArea,
2. WFD down scale path i.e. when WFD resolution is lower than
primary resolution.
Furthermore, downscale mode is only valid when downscaling from
SUPPORTED_VIRTUAL_AREA to a lower resolution.
(SUPPORTED_VIRTUAL_AREA represents the maximum resolution that
SUPPORTED_DOWNSCALE_AREA to a lower resolution.
(SUPPORTED_DOWNSCALE_AREA represents the maximum resolution that
we can configure to the virtual display)
*/
void VirtualDisplay::setDownScaleMode(uint32_t maxArea) {
if((maxArea > (mVInfo.xres * mVInfo.yres))
&& (maxArea <= SUPPORTED_VIRTUAL_AREA)) {
&& (maxArea <= SUPPORTED_DOWNSCALE_AREA)) {
mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].mDownScaleMode = true;
}else {
mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].mDownScaleMode = false;
@@ -214,7 +210,7 @@ bool VirtualDisplay::openFrameBuffer()
int fbNum = overlay::Overlay::getInstance()->
getFbForDpy(HWC_DISPLAY_VIRTUAL);
char strDevPath[MAX_SYSFS_FILE_PATH];
char strDevPath[qdutils::MAX_SYSFS_FILE_PATH];
snprintf(strDevPath,sizeof(strDevPath), "/dev/graphics/fb%d", fbNum);
mFd = open(strDevPath, O_RDWR);