From a70b435d100aa791429bc42e7a29b34041adcaef Mon Sep 17 00:00:00 2001 From: Shalaj Jain Date: Sun, 15 Jun 2014 13:47:47 -0700 Subject: [PATCH] display: remove compiler warnings Use correct typecasts and format specifiers and resolve compiler warnings Change-Id: I51b12ecb78a9a496cf1f76c3d32892a203f70c43 --- libcopybit/copybit_c2d.cpp | 2 +- libexternal/external.cpp | 4 ++-- libgralloc/gpu.cpp | 4 ++-- libgralloc/gralloc_priv.h | 2 +- libgralloc/ionalloc.cpp | 2 +- libhwcomposer/hwc.cpp | 6 +++--- libhwcomposer/hwc_copybit.cpp | 7 +++---- libhwcomposer/hwc_mdpcomp.cpp | 2 ++ libhwcomposer/hwc_utils.cpp | 11 ++++------- libhwcomposer/hwc_vsync.cpp | 6 +++--- liboverlay/overlayMdpRot.cpp | 2 +- libqdutils/idle_invalidator.cpp | 2 +- libqdutils/mdp_version.cpp | 1 - 13 files changed, 24 insertions(+), 27 deletions(-) diff --git a/libcopybit/copybit_c2d.cpp b/libcopybit/copybit_c2d.cpp index 7e2c5009..d2b00dd0 100644 --- a/libcopybit/copybit_c2d.cpp +++ b/libcopybit/copybit_c2d.cpp @@ -962,7 +962,7 @@ static void populate_buffer_info(struct copybit_image_t const *img, bufferInfo& /* Function to get the required size for a particular format, inorder for C2D to perform * the blit operation. */ -static size_t get_size(const bufferInfo& info) +static int get_size(const bufferInfo& info) { int size = 0; int w = info.width; diff --git a/libexternal/external.cpp b/libexternal/external.cpp index 98a22cd0..bf82cd8e 100644 --- a/libexternal/external.cpp +++ b/libexternal/external.cpp @@ -191,7 +191,7 @@ void ExternalDisplay::readCEUnderscanInfo() return; } else { len = read(hdmiScanInfoFile, scanInfo, sizeof(scanInfo)-1); - ALOGD("%s: Scan Info string: %s length = %zu", + ALOGD("%s: Scan Info string: %s length = %zd", __FUNCTION__, scanInfo, len); if (len <= 0) { close(hdmiScanInfoFile); @@ -313,7 +313,7 @@ bool ExternalDisplay::readResolution() return false; } else { len = read(hdmiEDIDFile, edidStr, sizeof(edidStr)-1); - ALOGD_IF(DEBUG, "%s: EDID string: %s length = %zu", + ALOGD_IF(DEBUG, "%s: EDID string: %s length = %zd", __FUNCTION__, edidStr, len); if ( len <= 0) { ALOGE("%s: edid_modes file empty '%s'", diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp index 78e875a2..82385100 100644 --- a/libgralloc/gpu.cpp +++ b/libgralloc/gpu.cpp @@ -233,7 +233,7 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(int usage, // find a free slot for (uint32_t i=0 ; ibufferMask |= (1LU<bufferMask |= (uint32_t)(1LU<finfo.line_length * m->info.yres; unsigned int index = (unsigned int) ((hnd->base - m->framebuffer->base) / bufferSize); - m->bufferMask &= ~(1LU<bufferMask &= (uint32_t)~(1LU<base, const_cast(hnd)); diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h index 7a4fc151..ce33ceae 100644 --- a/libgralloc/gralloc_priv.h +++ b/libgralloc/gralloc_priv.h @@ -259,7 +259,7 @@ struct private_handle_t : public native_handle { hnd->magic != sMagic) { ALOGD("Invalid gralloc handle (at %p): " - "ver(%d/%u) ints(%d/%d) fds(%d/%d)" + "ver(%d/%zu) ints(%d/%d) fds(%d/%d)" "magic(%c%c%c%c/%c%c%c%c)", h, h ? h->version : -1, sizeof(native_handle), diff --git a/libgralloc/ionalloc.cpp b/libgralloc/ionalloc.cpp index 20973208..ccf6ed5e 100644 --- a/libgralloc/ionalloc.cpp +++ b/libgralloc/ionalloc.cpp @@ -114,7 +114,7 @@ int IonAlloc::alloc_buffer(alloc_data& data) data.base = base; data.fd = fd_data.fd; ioctl(mIonFd, ION_IOC_FREE, &handle_data); - ALOGD_IF(DEBUG, "ion: Allocated buffer base:%p size:%u fd:%d", + ALOGD_IF(DEBUG, "ion: Allocated buffer base:%p size:%zu fd:%d", data.base, ionAllocData.len, data.fd); return 0; } diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index b2466d02..bb12e763 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -335,9 +335,9 @@ static int hwc_prepare(hwc_composer_device_1 *dev, size_t numDisplays, //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 f703fa09..c360e1d9 100644 --- a/libhwcomposer/hwc_copybit.cpp +++ b/libhwcomposer/hwc_copybit.cpp @@ -384,7 +384,7 @@ bool CopyBit::drawUsingAppBufferComposition(hwc_context_t *ctx, 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 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list, // 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 @@ struct copybit_device_t* CopyBit::getCopyBitDevice() { 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 b0953da1..7c295025 100644 --- a/libhwcomposer/hwc_mdpcomp.cpp +++ b/libhwcomposer/hwc_mdpcomp.cpp @@ -1682,6 +1682,8 @@ void MDPCompNonSplit::adjustForSourceSplit(hwc_context_t *ctx, //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 671388bd..aaa08d20 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -481,10 +481,10 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation, 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 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy, //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 7bde83bf..ca93ad2f 100644 --- a/libhwcomposer/hwc_vsync.cpp +++ b/libhwcomposer/hwc_vsync.cpp @@ -71,8 +71,8 @@ static void handle_vsync_event(hwc_context_t* ctx, int dpy, char *data) 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 @@ static void *vsync_loop(void *param) 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++) { diff --git a/liboverlay/overlayMdpRot.cpp b/liboverlay/overlayMdpRot.cpp index 38b0a92e..f4560293 100755 --- a/liboverlay/overlayMdpRot.cpp +++ b/liboverlay/overlayMdpRot.cpp @@ -33,7 +33,7 @@ MdpRot::~MdpRot() { close(); } bool MdpRot::enabled() const { return mRotImgInfo.enable; } -void MdpRot::setRotations(uint32_t r) { mRotImgInfo.rotations = r; } +void MdpRot::setRotations(uint32_t r) { mRotImgInfo.rotations = (uint8_t)r; } int MdpRot::getDstMemId() const { return mRotDataInfo.dst.memory_id; diff --git a/libqdutils/idle_invalidator.cpp b/libqdutils/idle_invalidator.cpp index d30375e3..86191e98 100644 --- a/libqdutils/idle_invalidator.cpp +++ b/libqdutils/idle_invalidator.cpp @@ -103,7 +103,7 @@ bool IdleInvalidator::threadLoop() { char data[64]; // Consume the node by reading it ssize_t len = pread(pFd.fd, data, 64, 0); - ALOGD_IF(II_DEBUG, "IdleInvalidator::%s Idle Timeout fired len %zu", + ALOGD_IF(II_DEBUG, "IdleInvalidator::%s Idle Timeout fired len %zd", __FUNCTION__, len); mHandler((void*)mHwcContext); } diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp index bc63ddfc..7ea8496e 100644 --- a/libqdutils/mdp_version.cpp +++ b/libqdutils/mdp_version.cpp @@ -137,7 +137,6 @@ void MDPVersion::updatePanelInfo() { FILE *panelInfoNodeFP = NULL; const int MAX_FRAME_BUFFER_NAME_SIZE = 128; char fbType[MAX_FRAME_BUFFER_NAME_SIZE]; - char panelInfo[MAX_FRAME_BUFFER_NAME_SIZE]; const char *strCmdPanel = "mipi dsi cmd panel"; const char *strVideoPanel = "mipi dsi video panel"; const char *strLVDSPanel = "lvds panel";