display: remove compiler warnings
Use correct typecasts and format specifiers and resolve
compiler warnings
Change-Id: I51b12ecb78a9a496cf1f76c3d32892a203f70c43
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index b2466d0..bb12e76 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -335,9 +335,9 @@
//Will be unlocked at the end of set
ctx->mDrawLock.lock();
- setPaddingRound(ctx,numDisplays,displays);
- setDMAState(ctx,numDisplays,displays);
- setNumActiveDisplays(ctx,numDisplays,displays);
+ setPaddingRound(ctx, (int)numDisplays, displays);
+ setDMAState(ctx, (int)numDisplays, displays);
+ setNumActiveDisplays(ctx, (int)numDisplays, displays);
reset(ctx, (int)numDisplays, displays);
ctx->mOverlay->configBegin();
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index f703fa0..c360e1d 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -384,7 +384,7 @@
hwc_display_contents_1_t *list,
int dpy, int *copybitFd) {
int layerCount = 0;
- uint32_t last = list->numHwLayers - 1;
+ uint32_t last = (uint32_t)list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
private_handle_t *fbhnd = (private_handle_t *)fbLayer->handle;
@@ -501,7 +501,6 @@
// numAppLayers-1, as we iterate from 0th layer index with HWC_COPYBIT flag
for (int i = 0; i <= (ctx->listStats[dpy].numAppLayers-1); i++) {
- hwc_layer_1_t *layer = &list->hwLayers[i];
if(!(layerProp[i].mFlags & HWC_COPYBIT)) {
ALOGD_IF(DEBUG_COPYBIT, "%s: Not Marked for copybit", __FUNCTION__);
continue;
@@ -1054,8 +1053,8 @@
return mEngine;
}
-CopyBit::CopyBit(hwc_context_t *ctx, const int& dpy) : mIsModeOn(false),
- mCopyBitDraw(false), mCurRenderBufferIndex(0), mEngine(0) {
+CopyBit::CopyBit(hwc_context_t *ctx, const int& dpy) : mEngine(0),
+ mIsModeOn(false), mCopyBitDraw(false), mCurRenderBufferIndex(0) {
getBufferSizeAndDimensions(ctx->dpyAttr[dpy].xres,
ctx->dpyAttr[dpy].yres,
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index b0953da..7c29502 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -1682,6 +1682,8 @@
//fbz is above 4k2k layer, increment fb zorder by 1
//as we split 4k2k layer and increment zorder for right half
//of the layer
+ if(!ctx)
+ return;
if(mCurrentFrame.fbZ >= 0) {
for (int index = 0, mdpNextZOrder = 0; index < mCurrentFrame.layerCount;
index++) {
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 671388b..aaa08d2 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -481,10 +481,10 @@
width = float(rect.right - rect.left);
height = float(rect.bottom - rect.top);
}
- xRatio = (float)(inPos.x/actualWidth);
- yRatio = (float)(inPos.y/actualHeight);
- wRatio = (float)(inPos.w/actualWidth);
- hRatio = (float)(inPos.h/actualHeight);
+ xRatio = (float)((float)inPos.x/actualWidth);
+ yRatio = (float)((float)inPos.y/actualHeight);
+ wRatio = (float)((float)inPos.w/actualWidth);
+ hRatio = (float)((float)inPos.h/actualHeight);
//Calculate the pos9ition...
outPos.x = uint32_t((xRatio * width) + (float)xPos);
@@ -1347,10 +1347,7 @@
//Waits for acquire fences, returns a release fence
if(LIKELY(!swapzero)) {
- uint64_t start = systemTime();
ret = ioctl(fbFd, MSMFB_BUFFER_SYNC, &data);
- ALOGD_IF(HWC_UTILS_DEBUG, "%s: time taken for MSMFB_BUFFER_SYNC IOCTL = %d",
- __FUNCTION__, (size_t) ns2ms(systemTime() - start));
}
if(ret < 0) {
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 7bde83b..ca93ad2 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -71,8 +71,8 @@
static void handle_blank_event(hwc_context_t* ctx, int dpy, char *data)
{
if (!strncmp(data, PANEL_ON_STR, strlen(PANEL_ON_STR))) {
- uint32_t poweron = strtoul(data + strlen(PANEL_ON_STR), NULL, 0);
- ALOGI("%s: dpy:%d panel power state: %d", __FUNCTION__, dpy, poweron);
+ unsigned long int poweron = strtoul(data + strlen(PANEL_ON_STR), NULL, 0);
+ ALOGI("%s: dpy:%d panel power state: %ld", __FUNCTION__, dpy, poweron);
ctx->dpyAttr[dpy].isActive = poweron ? true: false;
}
}
@@ -151,7 +151,7 @@
if (LIKELY(!ctx->vstate.fakevsync)) {
do {
- int err = poll(*pfd, num_displays * num_events, -1);
+ int err = poll(*pfd, (int)(num_displays * num_events), -1);
if(err > 0) {
for (int dpy = HWC_DISPLAY_PRIMARY; dpy < num_displays; dpy++) {
for(size_t ev = 0; ev < num_events; ev++) {