hwc: Use proper typecasts

- Remove compiler warnings
- Use proper typecasts

Change-Id: I7391f32ae31283239f5cebb93b02f3ce3a5c99f3
This commit is contained in:
Praveena Pachipulusu
2014-02-17 10:42:28 +05:30
parent d32e1243e6
commit d9443c7e81
12 changed files with 163 additions and 162 deletions

View File

@@ -115,7 +115,7 @@ static void reset(hwc_context_t *ctx, int numDisplays,
// cache we need to reset it. // cache we need to reset it.
// We can probably rethink that later on // We can probably rethink that later on
if (LIKELY(list && list->numHwLayers > 0)) { if (LIKELY(list && list->numHwLayers > 0)) {
for(uint32_t j = 0; j < list->numHwLayers; j++) { for(size_t j = 0; j < list->numHwLayers; j++) {
if(list->hwLayers[j].compositionType != HWC_FRAMEBUFFER_TARGET) if(list->hwLayers[j].compositionType != HWC_FRAMEBUFFER_TARGET)
list->hwLayers[j].compositionType = HWC_FRAMEBUFFER; list->hwLayers[j].compositionType = HWC_FRAMEBUFFER;
} }
@@ -135,7 +135,7 @@ static void reset(hwc_context_t *ctx, int numDisplays,
*/ */
ctx->isPaddingRound = true; ctx->isPaddingRound = true;
} }
ctx->mPrevHwLayerCount[i] = list->numHwLayers; ctx->mPrevHwLayerCount[i] = (int)list->numHwLayers;
} else { } else {
ctx->mPrevHwLayerCount[i] = 0; ctx->mPrevHwLayerCount[i] = 0;
} }
@@ -160,29 +160,31 @@ bool isEqual(float f1, float f2) {
static void scaleDisplayFrame(hwc_context_t *ctx, int dpy, static void scaleDisplayFrame(hwc_context_t *ctx, int dpy,
hwc_display_contents_1_t *list) { hwc_display_contents_1_t *list) {
float origXres = ctx->dpyAttr[dpy].xres_orig; uint32_t origXres = ctx->dpyAttr[dpy].xres_orig;
float origYres = ctx->dpyAttr[dpy].yres_orig; uint32_t origYres = ctx->dpyAttr[dpy].yres_orig;
float fakeXres = ctx->dpyAttr[dpy].xres; uint32_t fakeXres = ctx->dpyAttr[dpy].xres;
float fakeYres = ctx->dpyAttr[dpy].yres; uint32_t fakeYres = ctx->dpyAttr[dpy].yres;
float xresRatio = origXres / fakeXres; float xresRatio = (float)origXres / (float)fakeXres;
float yresRatio = origYres / fakeYres; float yresRatio = (float)origYres / (float)fakeYres;
for (size_t i = 0; i < list->numHwLayers; i++) { for (size_t i = 0; i < list->numHwLayers; i++) {
hwc_layer_1_t *layer = &list->hwLayers[i]; hwc_layer_1_t *layer = &list->hwLayers[i];
hwc_rect_t& displayFrame = layer->displayFrame; hwc_rect_t& displayFrame = layer->displayFrame;
hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf);
float layerWidth = displayFrame.right - displayFrame.left; uint32_t layerWidth = displayFrame.right - displayFrame.left;
float layerHeight = displayFrame.bottom - displayFrame.top; uint32_t layerHeight = displayFrame.bottom - displayFrame.top;
float sourceWidth = sourceCrop.right - sourceCrop.left; uint32_t sourceWidth = sourceCrop.right - sourceCrop.left;
float sourceHeight = sourceCrop.bottom - sourceCrop.top; uint32_t sourceHeight = sourceCrop.bottom - sourceCrop.top;
if (isEqual(layerWidth / sourceWidth, xresRatio) && if (isEqual(((float)layerWidth / (float)sourceWidth), xresRatio) &&
isEqual(layerHeight / sourceHeight, yresRatio)) isEqual(((float)layerHeight / (float)sourceHeight), yresRatio))
break; break;
displayFrame.left = xresRatio * displayFrame.left; displayFrame.left = (int)(xresRatio * (float)displayFrame.left);
displayFrame.top = yresRatio * displayFrame.top; displayFrame.top = (int)(yresRatio * (float)displayFrame.top);
displayFrame.right = displayFrame.left + layerWidth * xresRatio; displayFrame.right = (int)((float)displayFrame.left +
displayFrame.bottom = displayFrame.top + layerHeight * yresRatio; (float)layerWidth * xresRatio);
displayFrame.bottom = (int)((float)displayFrame.top +
(float)layerHeight * yresRatio);
} }
} }
@@ -198,7 +200,7 @@ static int hwc_prepare_primary(hwc_composer_device_1 *dev,
if (ctx->dpyAttr[dpy].customFBSize) if (ctx->dpyAttr[dpy].customFBSize)
scaleDisplayFrame(ctx, dpy, list); scaleDisplayFrame(ctx, dpy, list);
reset_layer_prop(ctx, dpy, list->numHwLayers - 1); reset_layer_prop(ctx, dpy, (int)list->numHwLayers - 1);
setListStats(ctx, list, dpy); setListStats(ctx, list, dpy);
fbComp = (ctx->mMDPComp[dpy]->prepare(ctx, list) < 0); fbComp = (ctx->mMDPComp[dpy]->prepare(ctx, list) < 0);
@@ -226,7 +228,7 @@ static int hwc_prepare_external(hwc_composer_device_1 *dev,
if (LIKELY(list && list->numHwLayers > 1) && if (LIKELY(list && list->numHwLayers > 1) &&
ctx->dpyAttr[dpy].isActive && ctx->dpyAttr[dpy].isActive &&
ctx->dpyAttr[dpy].connected) { ctx->dpyAttr[dpy].connected) {
reset_layer_prop(ctx, dpy, list->numHwLayers - 1); reset_layer_prop(ctx, dpy, (int)list->numHwLayers - 1);
if(!ctx->dpyAttr[dpy].isPause) { if(!ctx->dpyAttr[dpy].isPause) {
ctx->dpyAttr[dpy].isConfiguring = false; ctx->dpyAttr[dpy].isConfiguring = false;
setListStats(ctx, list, dpy); setListStats(ctx, list, dpy);
@@ -261,13 +263,13 @@ static int hwc_prepare(hwc_composer_device_1 *dev, size_t numDisplays,
//Will be unlocked at the end of set //Will be unlocked at the end of set
ctx->mDrawLock.lock(); ctx->mDrawLock.lock();
reset(ctx, numDisplays, displays); reset(ctx, (int)numDisplays, displays);
ctx->mOverlay->configBegin(); ctx->mOverlay->configBegin();
ctx->mRotMgr->configBegin(); ctx->mRotMgr->configBegin();
overlay::Writeback::configBegin(); overlay::Writeback::configBegin();
for (int32_t i = (numDisplays-1); i >= 0; i--) { for (int32_t i = ((int32_t)numDisplays-1); i >=0 ; i--) {
hwc_display_contents_1_t *list = displays[i]; hwc_display_contents_1_t *list = displays[i];
int dpy = getDpyforExternalDisplay(ctx, i); int dpy = getDpyforExternalDisplay(ctx, i);
switch(dpy) { switch(dpy) {
@@ -496,7 +498,7 @@ static int hwc_set_primary(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
int ret = 0; int ret = 0;
const int dpy = HWC_DISPLAY_PRIMARY; const int dpy = HWC_DISPLAY_PRIMARY;
if (LIKELY(list) && ctx->dpyAttr[dpy].isActive) { if (LIKELY(list) && ctx->dpyAttr[dpy].isActive) {
uint32_t last = list->numHwLayers - 1; size_t last = list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last]; hwc_layer_1_t *fbLayer = &list->hwLayers[last];
int fd = -1; //FenceFD from the Copybit(valid in async mode) int fd = -1; //FenceFD from the Copybit(valid in async mode)
bool copybitDone = false; bool copybitDone = false;
@@ -552,7 +554,7 @@ static int hwc_set_external(hwc_context_t *ctx,
if (LIKELY(list) && ctx->dpyAttr[dpy].isActive && if (LIKELY(list) && ctx->dpyAttr[dpy].isActive &&
ctx->dpyAttr[dpy].connected && ctx->dpyAttr[dpy].connected &&
!ctx->dpyAttr[dpy].isPause) { !ctx->dpyAttr[dpy].isPause) {
uint32_t last = list->numHwLayers - 1; size_t last = list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last]; hwc_layer_1_t *fbLayer = &list->hwLayers[last];
int fd = -1; //FenceFD from the Copybit(valid in async mode) int fd = -1; //FenceFD from the Copybit(valid in async mode)
bool copybitDone = false; bool copybitDone = false;
@@ -605,7 +607,7 @@ static int hwc_set(hwc_composer_device_1 *dev,
{ {
int ret = 0; int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev); hwc_context_t* ctx = (hwc_context_t*)(dev);
for (uint32_t i = 0; i < numDisplays; i++) { for (int i = 0; i < (int)numDisplays; i++) {
hwc_display_contents_1_t* list = displays[i]; hwc_display_contents_1_t* list = displays[i];
int dpy = getDpyforExternalDisplay(ctx, i); int dpy = getDpyforExternalDisplay(ctx, i);
switch(dpy) { switch(dpy) {
@@ -685,7 +687,7 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
HWC_DISPLAY_NO_ATTRIBUTE, HWC_DISPLAY_NO_ATTRIBUTE,
}; };
const int NUM_DISPLAY_ATTRIBUTES = (sizeof(DISPLAY_ATTRIBUTES) / const size_t NUM_DISPLAY_ATTRIBUTES = (sizeof(DISPLAY_ATTRIBUTES) /
sizeof(DISPLAY_ATTRIBUTES)[0]); sizeof(DISPLAY_ATTRIBUTES)[0]);
for (size_t i = 0; i < NUM_DISPLAY_ATTRIBUTES - 1; i++) { for (size_t i = 0; i < NUM_DISPLAY_ATTRIBUTES - 1; i++) {

View File

@@ -82,7 +82,7 @@ static void adWrite(const int& value) {
if(adFd >= 0) { if(adFd >= 0) {
char opStr[4] = ""; char opStr[4] = "";
snprintf(opStr, sizeof(opStr), "%d", value); snprintf(opStr, sizeof(opStr), "%d", value);
int ret = write(adFd, opStr, strlen(opStr)); ssize_t ret = write(adFd, opStr, strlen(opStr));
if(ret < 0) { if(ret < 0) {
ALOGE("%s: Failed to write %d with error %s", ALOGE("%s: Failed to write %d with error %s",
__func__, value, strerror(errno)); __func__, value, strerror(errno));
@@ -206,7 +206,8 @@ bool AssertiveDisplay::prepare(hwc_context_t *ctx,
return false; return false;
} }
int tmpW, tmpH, size; int tmpW, tmpH;
size_t size;
int format = ovutils::getHALFormat(wb->getOutputFormat()); int format = ovutils::getHALFormat(wb->getOutputFormat());
if(format < 0) { if(format < 0) {
ALOGE("%s invalid format %d", __func__, format); ALOGE("%s invalid format %d", __func__, format);
@@ -217,7 +218,7 @@ bool AssertiveDisplay::prepare(hwc_context_t *ctx,
size = getBufferSizeAndDimensions(hnd->width, hnd->height, size = getBufferSizeAndDimensions(hnd->width, hnd->height,
format, tmpW, tmpH); format, tmpW, tmpH);
if(!wb->configureMemory(size)) { if(!wb->configureMemory((uint32_t)size)) {
ALOGE("%s: config memory failed", __func__); ALOGE("%s: config memory failed", __func__);
mDoable = false; mDoable = false;
return false; return false;

View File

@@ -38,7 +38,7 @@ struct region_iterator : public copybit_region_t {
region_iterator(hwc_region_t region) { region_iterator(hwc_region_t region) {
mRegion = region; mRegion = region;
r.end = region.numRects; r.end = (int)region.numRects;
r.current = 0; r.current = 0;
this->next = iterate; this->next = iterate;
} }
@@ -193,8 +193,8 @@ bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
__FUNCTION__, dst_w,src_w,dst_h,src_h); __FUNCTION__, dst_w,src_w,dst_h,src_h);
return false; return false;
} }
dx = (float)dst_w/src_w; dx = (float)dst_w/(float)src_w;
dy = (float)dst_h/src_h; dy = (float)dst_h/(float)src_h;
if (dx > MAX_SCALE_FACTOR || dx < MIN_SCALE_FACTOR) if (dx > MAX_SCALE_FACTOR || dx < MIN_SCALE_FACTOR)
return false; return false;
@@ -273,7 +273,7 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
//render buffer //render buffer
if (ctx->mMDP.version == qdutils::MDP_V3_0_4) { if (ctx->mMDP.version == qdutils::MDP_V3_0_4) {
last = list->numHwLayers - 1; last = (uint32_t)list->numHwLayers - 1;
renderBuffer = (private_handle_t *)list->hwLayers[last].handle; renderBuffer = (private_handle_t *)list->hwLayers[last].handle;
} else { } else {
renderBuffer = getCurrentRenderBuffer(); renderBuffer = getCurrentRenderBuffer();
@@ -462,8 +462,8 @@ int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
return -1; return -1;
} }
float dsdx = (float)screen_w/src_crop_width; float dsdx = (float)screen_w/(float)src_crop_width;
float dtdy = (float)screen_h/src_crop_height; float dtdy = (float)screen_h/(float)src_crop_height;
float scaleLimitMax = copybitsMaxScale * copybitsMaxScale; float scaleLimitMax = copybitsMaxScale * copybitsMaxScale;
float scaleLimitMin = copybitsMinScale * copybitsMinScale; float scaleLimitMin = copybitsMinScale * copybitsMinScale;
@@ -494,14 +494,14 @@ int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
int tmp_h = src_crop_height; int tmp_h = src_crop_height;
if (dsdx > copybitsMaxScale || dtdy > copybitsMaxScale ){ if (dsdx > copybitsMaxScale || dtdy > copybitsMaxScale ){
tmp_w = src_crop_width*copybitsMaxScale; tmp_w = (int)((float)src_crop_width*copybitsMaxScale);
tmp_h = src_crop_height*copybitsMaxScale; tmp_h = (int)((float)src_crop_height*copybitsMaxScale);
}else if (dsdx < 1/copybitsMinScale ||dtdy < 1/copybitsMinScale ){ }else if (dsdx < 1/copybitsMinScale ||dtdy < 1/copybitsMinScale ){
// ceil the tmp_w and tmp_h value to maintain proper ratio // ceil the tmp_w and tmp_h value to maintain proper ratio
// b/w src and dst (should not cross the desired scale limit // b/w src and dst (should not cross the desired scale limit
// due to float -> int ) // due to float -> int )
tmp_w = ceil(src_crop_width/copybitsMinScale); tmp_w = (int)ceil((float)src_crop_width/copybitsMinScale);
tmp_h = ceil(src_crop_height/copybitsMinScale); tmp_h = (int)ceil((float)src_crop_height/copybitsMinScale);
} }
ALOGD("%s:%d::tmp_w = %d,tmp_h = %d",__FUNCTION__,__LINE__,tmp_w,tmp_h); ALOGD("%s:%d::tmp_w = %d,tmp_h = %d",__FUNCTION__,__LINE__,tmp_w,tmp_h);

View File

@@ -211,7 +211,7 @@ void HwcDebug::logHwcProps(uint32_t listFlags)
void HwcDebug::logLayer(size_t layerIndex, hwc_layer_1_t hwLayers[]) void HwcDebug::logLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
{ {
if (NULL == hwLayers) { if (NULL == hwLayers) {
ALOGE("Display[%s] Layer[%d] Error. No hwc layers to log.", ALOGE("Display[%s] Layer[%zu] Error. No hwc layers to log.",
mDisplayName, layerIndex); mDisplayName, layerIndex);
return; return;
} }
@@ -238,7 +238,7 @@ void HwcDebug::logLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
getHalPixelFormatStr(hnd->format, pixFormatStr); getHalPixelFormatStr(hnd->format, pixFormatStr);
// Log Line 1 // Log Line 1
ALOGI("Display[%s] Layer[%d] SrcBuff[%dx%d] SrcCrop[%dl, %dt, %dr, %db] " ALOGI("Display[%s] Layer[%zu] SrcBuff[%dx%d] SrcCrop[%dl, %dt, %dr, %db] "
"DispFrame[%dl, %dt, %dr, %db] VisRegsScr%s", mDisplayName, layerIndex, "DispFrame[%dl, %dt, %dr, %db] VisRegsScr%s", mDisplayName, layerIndex,
(hnd)? getWidth(hnd) : -1, (hnd)? getHeight(hnd) : -1, (hnd)? getWidth(hnd) : -1, (hnd)? getHeight(hnd) : -1,
sourceCrop.left, sourceCrop.top, sourceCrop.left, sourceCrop.top,
@@ -247,7 +247,7 @@ void HwcDebug::logLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
displayFrame.right, displayFrame.bottom, displayFrame.right, displayFrame.bottom,
hwcVisRegsScrLog.string()); hwcVisRegsScrLog.string());
// Log Line 2 // Log Line 2
ALOGI("Display[%s] Layer[%d] LayerCompType = %s, Format = %s, " ALOGI("Display[%s] Layer[%zu] LayerCompType = %s, Format = %s, "
"Orientation = %s, Flags = %s%s%s, Hints = %s%s%s, " "Orientation = %s, Flags = %s%s%s, Hints = %s%s%s, "
"Blending = %s%s%s", mDisplayName, layerIndex, "Blending = %s%s%s", mDisplayName, layerIndex,
(layer->compositionType == HWC_FRAMEBUFFER)? "Framebuffer(GPU)": (layer->compositionType == HWC_FRAMEBUFFER)? "Framebuffer(GPU)":
@@ -292,7 +292,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
return; return;
if (NULL == hwLayers) { if (NULL == hwLayers) {
ALOGE("Display[%s] Layer[%d] %s%s Error: No hwc layers to dump.", ALOGE("Display[%s] Layer[%zu] %s%s Error: No hwc layers to dump.",
mDisplayName, layerIndex, dumpLogStrRaw, dumpLogStrPng); mDisplayName, layerIndex, dumpLogStrRaw, dumpLogStrPng);
return; return;
} }
@@ -302,7 +302,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
char pixFormatStr[32] = "None"; char pixFormatStr[32] = "None";
if (NULL == hnd) { if (NULL == hnd) {
ALOGI("Display[%s] Layer[%d] %s%s Skipping dump: Bufferless layer.", ALOGI("Display[%s] Layer[%zu] %s%s Skipping dump: Bufferless layer.",
mDisplayName, layerIndex, dumpLogStrRaw, dumpLogStrPng); mDisplayName, layerIndex, dumpLogStrRaw, dumpLogStrPng);
return; return;
} }
@@ -315,7 +315,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
SkBitmap *tempSkBmp = new SkBitmap(); SkBitmap *tempSkBmp = new SkBitmap();
SkBitmap::Config tempSkBmpConfig = SkBitmap::kNo_Config; SkBitmap::Config tempSkBmpConfig = SkBitmap::kNo_Config;
snprintf(dumpFilename, sizeof(dumpFilename), snprintf(dumpFilename, sizeof(dumpFilename),
"%s/sfdump%03d.layer%d.%s.png", mDumpDirPng, "%s/sfdump%03d.layer%zu.%s.png", mDumpDirPng,
mDumpCntrPng, layerIndex, mDisplayName); mDumpCntrPng, layerIndex, mDisplayName);
switch (hnd->format) { switch (hnd->format) {
@@ -337,11 +337,11 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
tempSkBmp->setPixels((void*)hnd->base); tempSkBmp->setPixels((void*)hnd->base);
bResult = SkImageEncoder::EncodeFile(dumpFilename, bResult = SkImageEncoder::EncodeFile(dumpFilename,
*tempSkBmp, SkImageEncoder::kPNG_Type, 100); *tempSkBmp, SkImageEncoder::kPNG_Type, 100);
ALOGI("Display[%s] Layer[%d] %s Dump to %s: %s", ALOGI("Display[%s] Layer[%zu] %s Dump to %s: %s",
mDisplayName, layerIndex, dumpLogStrPng, mDisplayName, layerIndex, dumpLogStrPng,
dumpFilename, bResult ? "Success" : "Fail"); dumpFilename, bResult ? "Success" : "Fail");
} else { } else {
ALOGI("Display[%s] Layer[%d] %s Skipping dump: Unsupported layer" ALOGI("Display[%s] Layer[%zu] %s Skipping dump: Unsupported layer"
" format %s for png encoder", " format %s for png encoder",
mDisplayName, layerIndex, dumpLogStrPng, pixFormatStr); mDisplayName, layerIndex, dumpLogStrPng, pixFormatStr);
} }
@@ -352,7 +352,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
char dumpFilename[PATH_MAX]; char dumpFilename[PATH_MAX];
bool bResult = false; bool bResult = false;
snprintf(dumpFilename, sizeof(dumpFilename), snprintf(dumpFilename, sizeof(dumpFilename),
"%s/sfdump%03d.layer%d.%dx%d.%s.%s.raw", "%s/sfdump%03d.layer%zu.%dx%d.%s.%s.raw",
mDumpDirRaw, mDumpCntrRaw, mDumpDirRaw, mDumpCntrRaw,
layerIndex, getWidth(hnd), getHeight(hnd), layerIndex, getWidth(hnd), getHeight(hnd),
pixFormatStr, mDisplayName); pixFormatStr, mDisplayName);
@@ -361,7 +361,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
bResult = (bool) fwrite((void*)hnd->base, hnd->size, 1, fp); bResult = (bool) fwrite((void*)hnd->base, hnd->size, 1, fp);
fclose(fp); fclose(fp);
} }
ALOGI("Display[%s] Layer[%d] %s Dump to %s: %s", ALOGI("Display[%s] Layer[%zu] %s Dump to %s: %s",
mDisplayName, layerIndex, dumpLogStrRaw, mDisplayName, layerIndex, dumpLogStrRaw,
dumpFilename, bResult ? "Success" : "Fail"); dumpFilename, bResult ? "Success" : "Fail");
} }
@@ -432,7 +432,8 @@ void HwcDebug::getHalPixelFormatStr(int format, char pixFormatStr[])
strlcpy(pixFormatStr, "YCbCr_420_SP_VENUS", sizeof(pixFormatStr)); strlcpy(pixFormatStr, "YCbCr_420_SP_VENUS", sizeof(pixFormatStr));
break; break;
default: default:
snprintf(pixFormatStr, sizeof(pixFormatStr), "Unknown0x%X", format); size_t len = sizeof(pixFormatStr);
snprintf(pixFormatStr, len, "Unknown0x%X", format);
break; break;
} }
} }

View File

@@ -239,7 +239,7 @@ bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
overlay::Overlay& ov = *(ctx->mOverlay); overlay::Overlay& ov = *(ctx->mOverlay);
ovutils::eDest dest = mDest; ovutils::eDest dest = mDest;
int fd = hnd->fd; int fd = hnd->fd;
uint32_t offset = hnd->offset; uint32_t offset = (uint32_t)hnd->offset;
if(mRot) { if(mRot) {
if(!mRot->queueBuffer(fd, offset)) if(!mRot->queueBuffer(fd, offset))
return false; return false;
@@ -396,14 +396,14 @@ bool FBUpdateSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
bool ret = true; bool ret = true;
overlay::Overlay& ov = *(ctx->mOverlay); overlay::Overlay& ov = *(ctx->mOverlay);
if(mDestLeft != ovutils::OV_INVALID) { if(mDestLeft != ovutils::OV_INVALID) {
if (!ov.queueBuffer(hnd->fd, hnd->offset, mDestLeft)) { if (!ov.queueBuffer(hnd->fd, (uint32_t)hnd->offset, mDestLeft)) {
ALOGE("%s: queue failed for left of dpy = %d", ALOGE("%s: queue failed for left of dpy = %d",
__FUNCTION__, mDpy); __FUNCTION__, mDpy);
ret = false; ret = false;
} }
} }
if(mDestRight != ovutils::OV_INVALID) { if(mDestRight != ovutils::OV_INVALID) {
if (!ov.queueBuffer(hnd->fd, hnd->offset, mDestRight)) { if (!ov.queueBuffer(hnd->fd, (uint32_t)hnd->offset, mDestRight)) {
ALOGE("%s: queue failed for right of dpy = %d", ALOGE("%s: queue failed for right of dpy = %d",
__FUNCTION__, mDpy); __FUNCTION__, mDpy);
ret = false; ret = false;

View File

@@ -149,7 +149,8 @@ bool MDPComp::init(hwc_context_t *ctx) {
ALOGE("%s: failed to instantiate idleInvalidator object", ALOGE("%s: failed to instantiate idleInvalidator object",
__FUNCTION__); __FUNCTION__);
} else { } else {
idleInvalidator->init(timeout_handler, ctx, idle_timeout); idleInvalidator->init(timeout_handler, ctx,
(unsigned int)idle_timeout);
} }
} }
@@ -268,7 +269,7 @@ void MDPComp::LayerCache::reset() {
} }
void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) { void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) {
const int numAppLayers = list->numHwLayers - 1; const int numAppLayers = (int)list->numHwLayers - 1;
for(int i = 0; i < numAppLayers; i++) { for(int i = 0; i < numAppLayers; i++) {
hnd[i] = list->hwLayers[i].handle; hnd[i] = list->hwLayers[i].handle;
} }
@@ -1125,10 +1126,8 @@ void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
mCurrentFrame.fbCount); mCurrentFrame.fbCount);
} }
hwc_rect_t MDPComp::getUpdatingFBRect(hwc_context_t *ctx, hwc_rect_t MDPComp::getUpdatingFBRect(hwc_display_contents_1_t* list){
hwc_display_contents_1_t* list){
hwc_rect_t fbRect = (struct hwc_rect){0, 0, 0, 0}; hwc_rect_t fbRect = (struct hwc_rect){0, 0, 0, 0};
hwc_layer_1_t *fbLayer = &list->hwLayers[mCurrentFrame.layerCount];
/* Update only the region of FB needed for composition */ /* Update only the region of FB needed for composition */
for(int i = 0; i < mCurrentFrame.layerCount; i++ ) { for(int i = 0; i < mCurrentFrame.layerCount; i++ ) {
@@ -1145,7 +1144,7 @@ bool MDPComp::postHeuristicsHandling(hwc_context_t *ctx,
hwc_display_contents_1_t* list) { hwc_display_contents_1_t* list) {
//Capability checks //Capability checks
if(!resourceCheck(ctx, list)) { if(!resourceCheck()) {
ALOGD_IF(isDebug(), "%s: resource check failed", __FUNCTION__); ALOGD_IF(isDebug(), "%s: resource check failed", __FUNCTION__);
return false; return false;
} }
@@ -1158,7 +1157,7 @@ bool MDPComp::postHeuristicsHandling(hwc_context_t *ctx,
//Configure framebuffer first if applicable //Configure framebuffer first if applicable
if(mCurrentFrame.fbZ >= 0) { if(mCurrentFrame.fbZ >= 0) {
hwc_rect_t fbRect = getUpdatingFBRect(ctx, list); hwc_rect_t fbRect = getUpdatingFBRect(list);
if(!ctx->mFBUpdate[mDpy]->prepare(ctx, list, fbRect, mCurrentFrame.fbZ)) if(!ctx->mFBUpdate[mDpy]->prepare(ctx, list, fbRect, mCurrentFrame.fbZ))
{ {
ALOGD_IF(isDebug(), "%s configure framebuffer failed", ALOGD_IF(isDebug(), "%s configure framebuffer failed",
@@ -1219,8 +1218,7 @@ bool MDPComp::postHeuristicsHandling(hwc_context_t *ctx,
return true; return true;
} }
bool MDPComp::resourceCheck(hwc_context_t *ctx, bool MDPComp::resourceCheck() {
hwc_display_contents_1_t *list) {
const bool fbUsed = mCurrentFrame.fbCount; const bool fbUsed = mCurrentFrame.fbCount;
if(mCurrentFrame.mdpCount > sMaxPipesPerMixer - fbUsed) { if(mCurrentFrame.mdpCount > sMaxPipesPerMixer - fbUsed) {
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
@@ -1274,7 +1272,6 @@ bool MDPComp::hwLimitationsCheck(hwc_context_t* ctx,
int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) { int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
int ret = 0; int ret = 0;
const int numLayers = ctx->listStats[mDpy].numAppLayers; const int numLayers = ctx->listStats[mDpy].numAppLayers;
MDPVersion& mdpVersion = qdutils::MDPVersion::getInstance();
//Do not cache the information for next draw cycle. //Do not cache the information for next draw cycle.
if(numLayers > MAX_NUM_APP_LAYERS or (!numLayers)) { if(numLayers > MAX_NUM_APP_LAYERS or (!numLayers)) {
@@ -1519,7 +1516,7 @@ bool MDPCompNonSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
ovutils::eDest indexL = pipe_info.lIndex; ovutils::eDest indexL = pipe_info.lIndex;
ovutils::eDest indexR = pipe_info.rIndex; ovutils::eDest indexR = pipe_info.rIndex;
int fd = hnd->fd; int fd = hnd->fd;
uint32_t offset = hnd->offset; uint32_t offset = (uint32_t)hnd->offset;
if(rot) { if(rot) {
rot->queueBuffer(fd, offset); rot->queueBuffer(fd, offset);
fd = rot->getDstMemId(); fd = rot->getDstMemId();
@@ -1565,7 +1562,7 @@ bool MDPCompNonSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
hnd, dest ); hnd, dest );
int fd = hnd->fd; int fd = hnd->fd;
uint32_t offset = hnd->offset; uint32_t offset = (uint32_t)hnd->offset;
Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot; Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
if(rot) { if(rot) {
@@ -1765,7 +1762,7 @@ bool MDPCompSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
ovutils::eDest indexL = pipe_info.lIndex; ovutils::eDest indexL = pipe_info.lIndex;
ovutils::eDest indexR = pipe_info.rIndex; ovutils::eDest indexR = pipe_info.rIndex;
int fd = hnd->fd; int fd = hnd->fd;
uint32_t offset = hnd->offset; uint32_t offset = (uint32_t)hnd->offset;
if(rot) { if(rot) {
rot->queueBuffer(fd, offset); rot->queueBuffer(fd, offset);
fd = rot->getDstMemId(); fd = rot->getDstMemId();
@@ -1802,7 +1799,7 @@ bool MDPCompSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
ovutils::eDest indexR = pipe_info.rIndex; ovutils::eDest indexR = pipe_info.rIndex;
int fd = hnd->fd; int fd = hnd->fd;
int offset = hnd->offset; int offset = (uint32_t)hnd->offset;
if(ctx->mAD->isModeOn()) { if(ctx->mAD->isModeOn()) {
if(ctx->mAD->draw(ctx, fd, offset)) { if(ctx->mAD->draw(ctx, fd, offset)) {

View File

@@ -213,9 +213,8 @@ protected:
hwc_display_contents_1_t* list); hwc_display_contents_1_t* list);
void reset(hwc_context_t *ctx); void reset(hwc_context_t *ctx);
bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer); bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer);
bool resourceCheck(hwc_context_t *ctx, hwc_display_contents_1_t *list); bool resourceCheck();
hwc_rect_t getUpdatingFBRect(hwc_context_t *ctx, hwc_rect_t getUpdatingFBRect(hwc_display_contents_1_t* list);
hwc_display_contents_1_t* list);
int mDpy; int mDpy;
static bool sEnabled; static bool sEnabled;

View File

@@ -323,7 +323,7 @@ static void *uevent_loop(void *param)
} }
while(1) { while(1) {
len = uevent_next_event(udata, sizeof(udata) - 2); len = uevent_next_event(udata, (int)sizeof(udata) - 2);
handle_uevent(ctx, udata, len); handle_uevent(ctx, udata, len);
} }

View File

@@ -123,12 +123,12 @@ static int openFramebufferDevice(hwc_context_t *ctx)
if (int(info.width) <= 0 || int(info.height) <= 0) { if (int(info.width) <= 0 || int(info.height) <= 0) {
// the driver doesn't return that information // the driver doesn't return that information
// default to 160 dpi // default to 160 dpi
info.width = ((info.xres * 25.4f)/160.0f + 0.5f); info.width = (int)(((float)info.xres * 25.4f)/160.0f + 0.5f);
info.height = ((info.yres * 25.4f)/160.0f + 0.5f); info.height = (int)(((float)info.yres * 25.4f)/160.0f + 0.5f);
} }
float xdpi = (info.xres * 25.4f) / info.width; float xdpi = ((float)info.xres * 25.4f) / (float)info.width;
float ydpi = (info.yres * 25.4f) / info.height; float ydpi = ((float)info.yres * 25.4f) / (float)info.height;
#ifdef MSMFB_METADATA_GET #ifdef MSMFB_METADATA_GET
struct msmfb_metadata metadata; struct msmfb_metadata metadata;
@@ -142,7 +142,7 @@ static int openFramebufferDevice(hwc_context_t *ctx)
return -errno; return -errno;
} }
float fps = metadata.data.panel_frame_rate; float fps = (float)metadata.data.panel_frame_rate;
#else #else
//XXX: Remove reserved field usage on all baselines //XXX: Remove reserved field usage on all baselines
//The reserved[3] field is used to store FPS by the driver. //The reserved[3] field is used to store FPS by the driver.
@@ -163,7 +163,8 @@ static int openFramebufferDevice(hwc_context_t *ctx)
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres = info.yres; ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres = info.yres;
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xdpi = xdpi; ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xdpi = xdpi;
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].ydpi = ydpi; ctx->dpyAttr[HWC_DISPLAY_PRIMARY].ydpi = ydpi;
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period = 1000000000l / fps; ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period =
(uint32_t)(1000000000l / fps);
//To change resolution of primary display //To change resolution of primary display
changeResolution(ctx, info.xres, info.yres); changeResolution(ctx, info.xres, info.yres);
@@ -388,26 +389,26 @@ void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& rect) {
float asX = 0; float asX = 0;
float asY = 0; float asY = 0;
float asW = fbWidth; float asW = (float)fbWidth;
float asH = fbHeight; float asH = (float)fbHeight;
// based on the action safe ratio, get the Action safe rectangle // based on the action safe ratio, get the Action safe rectangle
asW = fbWidth * (1.0f - asWidthRatio / 100.0f); asW = ((float)fbWidth * (1.0f - (float)asWidthRatio / 100.0f));
asH = fbHeight * (1.0f - asHeightRatio / 100.0f); asH = ((float)fbHeight * (1.0f - (float)asHeightRatio / 100.0f));
asX = (fbWidth - asW) / 2; asX = ((float)fbWidth - asW) / 2;
asY = (fbHeight - asH) / 2; asY = ((float)fbHeight - asH) / 2;
// calculate the position ratio // calculate the position ratio
xRatio = (float)x/fbWidth; xRatio = (float)x/(float)fbWidth;
yRatio = (float)y/fbHeight; yRatio = (float)y/(float)fbHeight;
wRatio = (float)w/fbWidth; wRatio = (float)w/(float)fbWidth;
hRatio = (float)h/fbHeight; hRatio = (float)h/(float)fbHeight;
//Calculate the position... //Calculate the position...
x = (xRatio * asW) + asX; x = int((xRatio * asW) + asX);
y = (yRatio * asH) + asY; y = int((yRatio * asH) + asY);
w = (wRatio * asW); w = int(wRatio * asW);
h = (hRatio * asH); h = int(hRatio * asH);
// Convert it back to hwc_rect_t // Convert it back to hwc_rect_t
rect.left = x; rect.left = x;
@@ -423,8 +424,8 @@ void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& rect) {
void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation, void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
hwc_rect_t& inRect, hwc_rect_t& outRect) { hwc_rect_t& inRect, hwc_rect_t& outRect) {
// Physical display resolution // Physical display resolution
float fbWidth = ctx->dpyAttr[dpy].xres; float fbWidth = (float)ctx->dpyAttr[dpy].xres;
float fbHeight = ctx->dpyAttr[dpy].yres; float fbHeight = (float)ctx->dpyAttr[dpy].yres;
//display position(x,y,w,h) in correct aspectratio after rotation //display position(x,y,w,h) in correct aspectratio after rotation
int xPos = 0; int xPos = 0;
int yPos = 0; int yPos = 0;
@@ -445,7 +446,7 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
Dim outPos(outRect.left, outRect.top, outRect.right - outRect.left, Dim outPos(outRect.left, outRect.top, outRect.right - outRect.left,
outRect.bottom - outRect.top); outRect.bottom - outRect.top);
Whf whf(fbWidth, fbHeight, 0); Whf whf((uint32_t)fbWidth, (uint32_t)fbHeight, 0);
eTransform extorient = static_cast<eTransform>(extOrientation); eTransform extorient = static_cast<eTransform>(extOrientation);
// To calculate the destination co-ordinates in the new orientation // To calculate the destination co-ordinates in the new orientation
preRotateSource(extorient, whf, inPos); preRotateSource(extorient, whf, inPos);
@@ -453,24 +454,23 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
if(extOrientation & HAL_TRANSFORM_ROT_90) { if(extOrientation & HAL_TRANSFORM_ROT_90) {
// Swap width/height for input position // Swap width/height for input position
swapWidthHeight(actualWidth, actualHeight); swapWidthHeight(actualWidth, actualHeight);
getAspectRatioPosition(fbWidth, fbHeight, (int)actualWidth, getAspectRatioPosition((int)fbWidth, (int)fbHeight, (int)actualWidth,
(int)actualHeight, rect); (int)actualHeight, rect);
xPos = rect.left; xPos = rect.left;
yPos = rect.top; yPos = rect.top;
width = rect.right - rect.left; width = float(rect.right - rect.left);
height = rect.bottom - rect.top; height = float(rect.bottom - rect.top);
} }
xRatio = inPos.x/actualWidth; xRatio = (float)(inPos.x/actualWidth);
yRatio = inPos.y/actualHeight; yRatio = (float)(inPos.y/actualHeight);
wRatio = inPos.w/actualWidth; wRatio = (float)(inPos.w/actualWidth);
hRatio = inPos.h/actualHeight; hRatio = (float)(inPos.h/actualHeight);
//Calculate the pos9ition...
//Calculate the position... outPos.x = uint32_t((xRatio * width) + (float)xPos);
outPos.x = (xRatio * width) + xPos; outPos.y = uint32_t((yRatio * height) + (float)yPos);
outPos.y = (yRatio * height) + yPos; outPos.w = uint32_t(wRatio * width);
outPos.w = wRatio * width; outPos.h = uint32_t(hRatio * height);
outPos.h = hRatio * height;
ALOGD_IF(HWC_UTILS_DEBUG, "%s: Calculated AspectRatio Position: x = %d," ALOGD_IF(HWC_UTILS_DEBUG, "%s: Calculated AspectRatio Position: x = %d,"
"y = %d w = %d h = %d", __FUNCTION__, outPos.x, outPos.y, "y = %d w = %d h = %d", __FUNCTION__, outPos.x, outPos.y,
outPos.w, outPos.h); outPos.w, outPos.h);
@@ -483,22 +483,23 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
isOrientationPortrait(ctx)) { isOrientationPortrait(ctx)) {
hwc_rect_t r = {0, 0, 0, 0}; hwc_rect_t r = {0, 0, 0, 0};
//Calculate the position //Calculate the position
xRatio = (outPos.x - xPos)/width; xRatio = (float)(outPos.x - xPos)/width;
// GetaspectRatio -- tricky to get the correct aspect ratio // GetaspectRatio -- tricky to get the correct aspect ratio
// But we need to do this. // But we need to do this.
getAspectRatioPosition(width, height, width, height, r); getAspectRatioPosition((int)width, (int)height,
(int)width,(int)height, r);
xPos = r.left; xPos = r.left;
yPos = r.top; yPos = r.top;
float tempHeight = r.bottom - r.top; float tempHeight = float(r.bottom - r.top);
yRatio = yPos/height; yRatio = (float)yPos/height;
wRatio = outPos.w/width; wRatio = (float)outPos.w/width;
hRatio = tempHeight/height; hRatio = tempHeight/height;
//Map the coordinates back to Framebuffer domain //Map the coordinates back to Framebuffer domain
outPos.x = (xRatio * fbWidth); outPos.x = uint32_t(xRatio * fbWidth);
outPos.y = (yRatio * fbHeight); outPos.y = uint32_t(yRatio * fbHeight);
outPos.w = wRatio * fbWidth; outPos.w = uint32_t(wRatio * fbWidth);
outPos.h = hRatio * fbHeight; outPos.h = uint32_t(hRatio * fbHeight);
ALOGD_IF(HWC_UTILS_DEBUG, "%s: Calculated AspectRatio for device in" ALOGD_IF(HWC_UTILS_DEBUG, "%s: Calculated AspectRatio for device in"
"portrait: x = %d,y = %d w = %d h = %d", __FUNCTION__, "portrait: x = %d,y = %d w = %d h = %d", __FUNCTION__,
@@ -511,18 +512,18 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
ctx->mExtDisplay->getAttributes(extW, extH); ctx->mExtDisplay->getAttributes(extW, extH);
else else
ctx->mVirtualDisplay->getAttributes(extW, extH); ctx->mVirtualDisplay->getAttributes(extW, extH);
fbWidth = ctx->dpyAttr[dpy].xres; fbWidth = (float)ctx->dpyAttr[dpy].xres;
fbHeight = ctx->dpyAttr[dpy].yres; fbHeight = (float)ctx->dpyAttr[dpy].yres;
//Calculate the position... //Calculate the position...
xRatio = outPos.x/fbWidth; xRatio = (float)outPos.x/fbWidth;
yRatio = outPos.y/fbHeight; yRatio = (float)outPos.y/fbHeight;
wRatio = outPos.w/fbWidth; wRatio = (float)outPos.w/fbWidth;
hRatio = outPos.h/fbHeight; hRatio = (float)outPos.h/fbHeight;
outPos.x = xRatio * extW; outPos.x = uint32_t(xRatio * (float)extW);
outPos.y = yRatio * extH; outPos.y = uint32_t(yRatio * (float)extH);
outPos.w = wRatio * extW; outPos.w = uint32_t(wRatio * (float)extW);
outPos.h = hRatio * extH; outPos.h = uint32_t(hRatio * (float)extH);
} }
// Convert Dim to hwc_rect_t // Convert Dim to hwc_rect_t
outRect.left = outPos.x; outRect.left = outPos.x;
@@ -585,8 +586,8 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
int extW, extH; int extW, extH;
// if downscale is enabled, map the co-ordinates to new // if downscale is enabled, map the co-ordinates to new
// domain(downscaled) // domain(downscaled)
float fbWidth = ctx->dpyAttr[dpy].xres; float fbWidth = (float)ctx->dpyAttr[dpy].xres;
float fbHeight = ctx->dpyAttr[dpy].yres; float fbHeight = (float)ctx->dpyAttr[dpy].yres;
// query MDP configured attributes // query MDP configured attributes
if(dpy == HWC_DISPLAY_EXTERNAL) if(dpy == HWC_DISPLAY_EXTERNAL)
ctx->mExtDisplay->getAttributes(extW, extH); ctx->mExtDisplay->getAttributes(extW, extH);
@@ -597,10 +598,10 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
float hRatio = ((float)extH)/fbHeight; float hRatio = ((float)extH)/fbHeight;
//convert Dim to hwc_rect_t //convert Dim to hwc_rect_t
displayFrame.left *= wRatio; displayFrame.left = int(wRatio*(float)displayFrame.left);
displayFrame.top *= hRatio; displayFrame.top = int(hRatio*(float)displayFrame.top);
displayFrame.right *= wRatio; displayFrame.right = int(wRatio*(float)displayFrame.right);
displayFrame.bottom *= hRatio; displayFrame.bottom = int(hRatio*(float)displayFrame.bottom);
} }
}else { }else {
if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) { if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) {
@@ -765,10 +766,10 @@ static void trimList(hwc_context_t *ctx, hwc_display_contents_1_t *list,
list->hwLayers[i].transform, list->hwLayers[i].transform,
(hwc_rect_t&)crop, (hwc_rect_t&)crop,
(hwc_rect_t&)list->hwLayers[i].displayFrame); (hwc_rect_t&)list->hwLayers[i].displayFrame);
layer->sourceCropf.left = crop.left; layer->sourceCropf.left = (float)crop.left;
layer->sourceCropf.right = crop.right; layer->sourceCropf.right = (float)crop.right;
layer->sourceCropf.top = crop.top; layer->sourceCropf.top = (float)crop.top;
layer->sourceCropf.bottom = crop.bottom; layer->sourceCropf.bottom = (float)crop.bottom;
} }
} }
@@ -798,8 +799,8 @@ void setListStats(hwc_context_t *ctx,
hwc_display_contents_1_t *list, int dpy) { hwc_display_contents_1_t *list, int dpy) {
const int prevYuvCount = ctx->listStats[dpy].yuvCount; const int prevYuvCount = ctx->listStats[dpy].yuvCount;
memset(&ctx->listStats[dpy], 0, sizeof(ListStats)); memset(&ctx->listStats[dpy], 0, sizeof(ListStats));
ctx->listStats[dpy].numAppLayers = list->numHwLayers - 1; ctx->listStats[dpy].numAppLayers = (int)list->numHwLayers - 1;
ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1; ctx->listStats[dpy].fbLayerIndex = (int)list->numHwLayers - 1;
ctx->listStats[dpy].skipCount = 0; ctx->listStats[dpy].skipCount = 0;
ctx->listStats[dpy].preMultipliedAlpha = false; ctx->listStats[dpy].preMultipliedAlpha = false;
ctx->listStats[dpy].isSecurePresent = false; ctx->listStats[dpy].isSecurePresent = false;
@@ -851,12 +852,12 @@ void setListStats(hwc_context_t *ctx,
if (UNLIKELY(isYuvBuffer(hnd))) { if (UNLIKELY(isYuvBuffer(hnd))) {
int& yuvCount = ctx->listStats[dpy].yuvCount; int& yuvCount = ctx->listStats[dpy].yuvCount;
ctx->listStats[dpy].yuvIndices[yuvCount] = i; ctx->listStats[dpy].yuvIndices[yuvCount] = (int)i;
yuvCount++; yuvCount++;
if(UNLIKELY(is4kx2kYuvBuffer(hnd))){ if(UNLIKELY(is4kx2kYuvBuffer(hnd))){
int& yuv4k2kCount = ctx->listStats[dpy].yuv4k2kCount; int& yuv4k2kCount = ctx->listStats[dpy].yuv4k2kCount;
ctx->listStats[dpy].yuv4k2kIndices[yuv4k2kCount] = i; ctx->listStats[dpy].yuv4k2kIndices[yuv4k2kCount] = (int)i;
yuv4k2kCount++; yuv4k2kCount++;
} }
@@ -874,7 +875,7 @@ void setListStats(hwc_context_t *ctx,
if(UNLIKELY(isExtOnly(hnd))){ if(UNLIKELY(isExtOnly(hnd))){
ctx->listStats[dpy].extOnlyLayerIndex = i; ctx->listStats[dpy].extOnlyLayerIndex = (int)i;
} }
} }
if(ctx->listStats[dpy].yuvCount > 0) { if(ctx->listStats[dpy].yuvCount > 0) {
@@ -1140,7 +1141,7 @@ hwc_rect_t deductRect(const hwc_rect_t& rect1, const hwc_rect_t& rect2) {
} }
void optimizeLayerRects(const hwc_display_contents_1_t *list) { void optimizeLayerRects(const hwc_display_contents_1_t *list) {
int i=list->numHwLayers-2; int i= (int)list->numHwLayers-2;
while(i > 0) { while(i > 0) {
//see if there is no blending required. //see if there is no blending required.
//If it is opaque see if we can substract this region from below //If it is opaque see if we can substract this region from below
@@ -1165,10 +1166,10 @@ void optimizeLayerRects(const hwc_display_contents_1_t *list) {
qhwc::calculate_crop_rects(bottomCrop, bottomframe, qhwc::calculate_crop_rects(bottomCrop, bottomframe,
dest_rect, transform); dest_rect, transform);
//Update layer sourceCropf //Update layer sourceCropf
layer->sourceCropf.left = bottomCrop.left; layer->sourceCropf.left =(float)bottomCrop.left;
layer->sourceCropf.top = bottomCrop.top; layer->sourceCropf.top = (float)bottomCrop.top;
layer->sourceCropf.right = bottomCrop.right; layer->sourceCropf.right = (float)bottomCrop.right;
layer->sourceCropf.bottom = bottomCrop.bottom; layer->sourceCropf.bottom = (float)bottomCrop.bottom;
} }
} }
j--; j--;
@@ -1181,7 +1182,7 @@ void optimizeLayerRects(const hwc_display_contents_1_t *list) {
void getNonWormholeRegion(hwc_display_contents_1_t* list, void getNonWormholeRegion(hwc_display_contents_1_t* list,
hwc_rect_t& nwr) hwc_rect_t& nwr)
{ {
uint32_t last = list->numHwLayers - 1; size_t last = list->numHwLayers - 1;
hwc_rect_t fbDisplayFrame = list->hwLayers[last].displayFrame; hwc_rect_t fbDisplayFrame = list->hwLayers[last].displayFrame;
//Initiliaze nwr to first frame //Initiliaze nwr to first frame
nwr.left = list->hwLayers[0].displayFrame.left; nwr.left = list->hwLayers[0].displayFrame.left;
@@ -1189,7 +1190,7 @@ void getNonWormholeRegion(hwc_display_contents_1_t* list,
nwr.right = list->hwLayers[0].displayFrame.right; nwr.right = list->hwLayers[0].displayFrame.right;
nwr.bottom = list->hwLayers[0].displayFrame.bottom; nwr.bottom = list->hwLayers[0].displayFrame.bottom;
for (uint32_t i = 1; i < last; i++) { for (size_t i = 1; i < last; i++) {
hwc_rect_t displayFrame = list->hwLayers[i].displayFrame; hwc_rect_t displayFrame = list->hwLayers[i].displayFrame;
nwr = getUnion(nwr, displayFrame); nwr = getUnion(nwr, displayFrame);
} }
@@ -1322,12 +1323,11 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
if(ret < 0) { if(ret < 0) {
ALOGE("%s: ioctl MSMFB_BUFFER_SYNC failed, err=%s", ALOGE("%s: ioctl MSMFB_BUFFER_SYNC failed, err=%s",
__FUNCTION__, strerror(errno)); __FUNCTION__, strerror(errno));
ALOGE("%s: acq_fen_fd_cnt=%d flags=%d fd=%d dpy=%d numHwLayers=%d", ALOGE("%s: acq_fen_fd_cnt=%d flags=%d fd=%d dpy=%d numHwLayers=%zu",
__FUNCTION__, data.acq_fen_fd_cnt, data.flags, fbFd, __FUNCTION__, data.acq_fen_fd_cnt, data.flags, fbFd,
dpy, list->numHwLayers); dpy, list->numHwLayers);
} }
LayerProp *layerProp = ctx->layerProp[dpy];
for(uint32_t i = 0; i < list->numHwLayers; i++) { for(uint32_t i = 0; i < list->numHwLayers; i++) {
if(list->hwLayers[i].compositionType == HWC_OVERLAY || if(list->hwLayers[i].compositionType == HWC_OVERLAY ||
list->hwLayers[i].compositionType == HWC_BLIT || list->hwLayers[i].compositionType == HWC_BLIT ||
@@ -1576,7 +1576,7 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
int downscale = 0; int downscale = 0;
int rotFlags = ovutils::ROT_FLAGS_NONE; int rotFlags = ovutils::ROT_FLAGS_NONE;
uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd)); uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size); Whf whf(getWidth(hnd), getHeight(hnd), format, (uint32_t)hnd->size);
// Handle R/B swap // Handle R/B swap
if (layer->flags & HWC_FORMAT_RB_SWAP) { if (layer->flags & HWC_FORMAT_RB_SWAP) {
@@ -1683,7 +1683,7 @@ int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
const int downscale = 0; const int downscale = 0;
int rotFlags = ROT_FLAGS_NONE; int rotFlags = ROT_FLAGS_NONE;
uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd)); uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size); Whf whf(getWidth(hnd), getHeight(hnd), format, (uint32_t)hnd->size);
// Handle R/B swap // Handle R/B swap
if (layer->flags & HWC_FORMAT_RB_SWAP) { if (layer->flags & HWC_FORMAT_RB_SWAP) {
@@ -1830,7 +1830,7 @@ int configureSourceSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
eZorder rz = (eZorder)(z + 1); eZorder rz = (eZorder)(z + 1);
Whf whf(getWidth(hnd), getHeight(hnd), Whf whf(getWidth(hnd), getHeight(hnd),
getMdpFormat(hnd->format), hnd->size); getMdpFormat(hnd->format), (uint32_t)hnd->size);
/* Calculate the external display position based on MDP downscale, /* Calculate the external display position based on MDP downscale,
ActionSafe, and extorientation features. */ ActionSafe, and extorientation features. */

View File

@@ -189,7 +189,7 @@ inline overlay::Rotator* LayerRotMap::getRot(uint32_t index) const {
} }
inline hwc_rect_t integerizeSourceCrop(const hwc_frect_t& cropF) { inline hwc_rect_t integerizeSourceCrop(const hwc_frect_t& cropF) {
hwc_rect_t cropI = {0}; hwc_rect_t cropI = {0,0,0,0};
cropI.left = int(ceilf(cropF.left)); cropI.left = int(ceilf(cropF.left));
cropI.top = int(ceilf(cropF.top)); cropI.top = int(ceilf(cropF.top));
cropI.right = int(floorf(cropF.right)); cropI.right = int(floorf(cropF.right));

View File

@@ -95,8 +95,8 @@ int HWCVirtualVDS::prepare(hwc_composer_device_1 *dev,
const int dpy = HWC_DISPLAY_VIRTUAL; const int dpy = HWC_DISPLAY_VIRTUAL;
if (list && list->outbuf && list->numHwLayers > 0) { if (list && list->outbuf && list->numHwLayers > 0) {
reset_layer_prop(ctx, dpy, list->numHwLayers - 1); reset_layer_prop(ctx, dpy, (int)list->numHwLayers - 1);
uint32_t last = list->numHwLayers - 1; uint32_t last = (uint32_t)list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last]; hwc_layer_1_t *fbLayer = &list->hwLayers[last];
int fbWidth = 0, fbHeight = 0; int fbWidth = 0, fbHeight = 0;
getLayerResolution(fbLayer, fbWidth, fbHeight); getLayerResolution(fbLayer, fbWidth, fbHeight);
@@ -147,7 +147,7 @@ int HWCVirtualVDS::set(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
const int dpy = HWC_DISPLAY_VIRTUAL; const int dpy = HWC_DISPLAY_VIRTUAL;
if (list && list->outbuf && list->numHwLayers > 0) { if (list && list->outbuf && list->numHwLayers > 0) {
uint32_t last = list->numHwLayers - 1; uint32_t last = (uint32_t)list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last]; hwc_layer_1_t *fbLayer = &list->hwLayers[last];
if(ctx->dpyAttr[dpy].connected if(ctx->dpyAttr[dpy].connected
@@ -188,7 +188,8 @@ int HWCVirtualVDS::set(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
ret = -1; ret = -1;
} }
Writeback::getInstance()->queueBuffer(ohnd->fd, ohnd->offset); Writeback::getInstance()->queueBuffer(ohnd->fd,
(uint32_t)ohnd->offset);
if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) { if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
ALOGE("%s: display commit fail!", __FUNCTION__); ALOGE("%s: display commit fail!", __FUNCTION__);
ret = -1; ret = -1;
@@ -252,7 +253,7 @@ int HWCVirtualV4L2::prepare(hwc_composer_device_1 *dev,
ctx->dpyAttr[dpy].isActive && ctx->dpyAttr[dpy].isActive &&
ctx->dpyAttr[dpy].connected && ctx->dpyAttr[dpy].connected &&
canUseMDPforVirtualDisplay(ctx,list)) { canUseMDPforVirtualDisplay(ctx,list)) {
reset_layer_prop(ctx, dpy, list->numHwLayers - 1); reset_layer_prop(ctx, dpy, (int)list->numHwLayers - 1);
if(!ctx->dpyAttr[dpy].isPause) { if(!ctx->dpyAttr[dpy].isPause) {
ctx->dpyAttr[dpy].isConfiguring = false; ctx->dpyAttr[dpy].isConfiguring = false;
setListStats(ctx, list, dpy); setListStats(ctx, list, dpy);
@@ -284,7 +285,7 @@ int HWCVirtualV4L2::set(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
ctx->dpyAttr[dpy].connected && ctx->dpyAttr[dpy].connected &&
(!ctx->dpyAttr[dpy].isPause) && (!ctx->dpyAttr[dpy].isPause) &&
canUseMDPforVirtualDisplay(ctx,list)) { canUseMDPforVirtualDisplay(ctx,list)) {
uint32_t last = list->numHwLayers - 1; uint32_t last = (uint32_t)list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last]; hwc_layer_1_t *fbLayer = &list->hwLayers[last];
int fd = -1; //FenceFD from the Copybit(valid in async mode) int fd = -1; //FenceFD from the Copybit(valid in async mode)
bool copybitDone = false; bool copybitDone = false;

View File

@@ -156,8 +156,8 @@ static void *vsync_loop(void *param)
for (int dpy = HWC_DISPLAY_PRIMARY; dpy < num_displays; dpy++) { for (int dpy = HWC_DISPLAY_PRIMARY; dpy < num_displays; dpy++) {
for(size_t ev = 0; ev < num_events; ev++) { for(size_t ev = 0; ev < num_events; ev++) {
if (pfd[dpy][ev].revents & POLLPRI) { if (pfd[dpy][ev].revents & POLLPRI) {
err = pread(pfd[dpy][ev].fd, vdata, MAX_DATA, 0); ssize_t len = pread(pfd[dpy][ev].fd, vdata, MAX_DATA, 0);
if (UNLIKELY(err < 0)) { if (UNLIKELY(len < 0)) {
// If the read was just interrupted - it is not // If the read was just interrupted - it is not
// a fatal error. Just continue in this case // a fatal error. Just continue in this case
ALOGE ("%s: Unable to read event:%zu for \ ALOGE ("%s: Unable to read event:%zu for \