display: Fix issues when building with Clang
* Fix up all warnings to enable build with Werror too
Change-Id: Ibd1bcb3ba15677c7ea5570ae583235e0d3962b54
diff --git a/libcopybit/copybit_c2d.cpp b/libcopybit/copybit_c2d.cpp
index bbc21fa..f6ebdd7 100644
--- a/libcopybit/copybit_c2d.cpp
+++ b/libcopybit/copybit_c2d.cpp
@@ -194,22 +194,22 @@
struct hw_device_t** device);
static struct hw_module_methods_t copybit_module_methods = {
-open: open_copybit
+ .open = open_copybit
};
/*
* The COPYBIT Module
*/
struct copybit_module_t HAL_MODULE_INFO_SYM = {
-common: {
-tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
- id: COPYBIT_HARDWARE_MODULE_ID,
- name: "QCT COPYBIT C2D 2.0 Module",
- author: "Qualcomm",
- methods: ©bit_module_methods
- }
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = COPYBIT_HARDWARE_MODULE_ID,
+ .name = "QCT COPYBIT C2D 2.0 Module",
+ .author = "Qualcomm",
+ .methods = ©bit_module_methods
+ }
};
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp
index a7a58dc..f0fb850 100644
--- a/libgralloc/framebuffer.cpp
+++ b/libgralloc/framebuffer.cpp
@@ -99,7 +99,7 @@
return 0;
}
-static int fb_compositionComplete(struct framebuffer_device_t* dev)
+static int fb_compositionComplete(struct framebuffer_device_t* /*dev*/)
{
// TODO: Properly implement composition complete callback
glFinish();
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index ed1cee9..79115c4 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -184,7 +184,7 @@
}
}
-int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
+int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t /*size*/, int usage,
buffer_handle_t* pHandle)
{
private_module_t* m = reinterpret_cast<private_module_t*>(common.module);
diff --git a/libgralloc/gralloc.cpp b/libgralloc/gralloc.cpp
index 6334450..942ed8a 100644
--- a/libgralloc/gralloc.cpp
+++ b/libgralloc/gralloc.cpp
@@ -63,37 +63,37 @@
// HAL module methods
static struct hw_module_methods_t gralloc_module_methods = {
- open: gralloc_device_open
+ .open = gralloc_device_open
};
// HAL module initialize
struct private_module_t HAL_MODULE_INFO_SYM = {
- base: {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
- id: GRALLOC_HARDWARE_MODULE_ID,
- name: "Graphics Memory Allocator Module",
- author: "The Android Open Source Project",
- methods: &gralloc_module_methods,
- dso: 0,
- reserved: {0},
+ .base = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = GRALLOC_HARDWARE_MODULE_ID,
+ .name = "Graphics Memory Allocator Module",
+ .author = "The Android Open Source Project",
+ .methods = &gralloc_module_methods,
+ .dso = 0,
+ .reserved = {0},
},
- registerBuffer: gralloc_register_buffer,
- unregisterBuffer: gralloc_unregister_buffer,
- lock: gralloc_lock,
- unlock: gralloc_unlock,
- perform: gralloc_perform,
- lock_ycbcr: gralloc_lock_ycbcr,
+ .registerBuffer = gralloc_register_buffer,
+ .unregisterBuffer = gralloc_unregister_buffer,
+ .lock = gralloc_lock,
+ .unlock = gralloc_unlock,
+ .perform = gralloc_perform,
+ .lock_ycbcr = gralloc_lock_ycbcr,
},
- framebuffer: 0,
- fbFormat: 0,
- flags: 0,
- numBuffers: 0,
- bufferMask: 0,
- lock: PTHREAD_MUTEX_INITIALIZER,
- currentBuffer: 0,
+ .framebuffer = 0,
+ .fbFormat = 0,
+ .flags = 0,
+ .numBuffers = 0,
+ .bufferMask = 0,
+ .lock = PTHREAD_MUTEX_INITIALIZER,
+ .currentBuffer = 0,
};
// Open Gralloc device
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index bf698e6..f559012 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -55,7 +55,7 @@
return memalloc;
}
-static int gralloc_map(gralloc_module_t const* module,
+static int gralloc_map(gralloc_module_t const* /*module*/,
buffer_handle_t handle)
{
private_handle_t* hnd = (private_handle_t*)handle;
@@ -89,7 +89,7 @@
return 0;
}
-static int gralloc_unmap(gralloc_module_t const* module,
+static int gralloc_unmap(gralloc_module_t const* /*module*/,
buffer_handle_t handle)
{
private_handle_t* hnd = (private_handle_t*)handle;
@@ -261,7 +261,7 @@
return err;
}
-int gralloc_unlock(gralloc_module_t const* module,
+int gralloc_unlock(gralloc_module_t const* /*module*/,
buffer_handle_t handle)
{
if (private_handle_t::validate(handle) < 0)
@@ -282,7 +282,7 @@
/*****************************************************************************/
-int gralloc_perform(struct gralloc_module_t const* module,
+int gralloc_perform(struct gralloc_module_t const* /*module*/,
int operation, ... )
{
int res = -EINVAL;
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index dea8389..2d2dbfd 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -52,22 +52,22 @@
struct hw_device_t** device);
static struct hw_module_methods_t hwc_module_methods = {
- open: hwc_device_open
+ .open = hwc_device_open
};
static void reset_panel(struct hwc_composer_device_1* dev);
hwc_module_t HAL_MODULE_INFO_SYM = {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 2,
- version_minor: 0,
- id: HWC_HARDWARE_MODULE_ID,
- name: "Qualcomm Hardware Composer Module",
- author: "CodeAurora Forum",
- methods: &hwc_module_methods,
- dso: 0,
- reserved: {0},
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 2,
+ .version_minor = 0,
+ .id = HWC_HARDWARE_MODULE_ID,
+ .name = "Qualcomm Hardware Composer Module",
+ .author = "CodeAurora Forum",
+ .methods = &hwc_module_methods,
+ .dso = 0,
+ .reserved = {0},
}
};
diff --git a/libhwcomposer/hwc_ad.cpp b/libhwcomposer/hwc_ad.cpp
index d3aee80..e591401 100644
--- a/libhwcomposer/hwc_ad.cpp
+++ b/libhwcomposer/hwc_ad.cpp
@@ -256,12 +256,12 @@
return true;
}
-int AssertiveDisplay::getDstFd(hwc_context_t *ctx) const {
+int AssertiveDisplay::getDstFd(hwc_context_t * /*ctx*/) const {
overlay::Writeback *wb = overlay::Writeback::getInstance();
return wb->getDstFd();
}
-uint32_t AssertiveDisplay::getDstOffset(hwc_context_t *ctx) const {
+uint32_t AssertiveDisplay::getDstOffset(hwc_context_t * /*ctx*/) const {
overlay::Writeback *wb = overlay::Writeback::getInstance();
return wb->getOffset();
}
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index cc17a67..e2b45af 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -764,7 +764,7 @@
int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
- private_handle_t *renderBuffer, int dpy, bool isFG)
+ private_handle_t *renderBuffer, int /*dpy*/, bool isFG)
{
hwc_context_t* ctx = (hwc_context_t*)(dev);
int err = 0, acquireFd;
diff --git a/libhwcomposer/hwc_dump_layers.cpp b/libhwcomposer/hwc_dump_layers.cpp
index 9977367..680c259 100644
--- a/libhwcomposer/hwc_dump_layers.cpp
+++ b/libhwcomposer/hwc_dump_layers.cpp
@@ -373,65 +373,65 @@
switch(format) {
case HAL_PIXEL_FORMAT_RGBA_8888:
- strlcpy(pixFormatStr, "RGBA_8888", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "RGBA_8888", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_RGBX_8888:
- strlcpy(pixFormatStr, "RGBX_8888", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "RGBX_8888", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_RGB_888:
- strlcpy(pixFormatStr, "RGB_888", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "RGB_888", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_RGB_565:
- strlcpy(pixFormatStr, "RGB_565", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "RGB_565", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_BGRA_8888:
- strlcpy(pixFormatStr, "BGRA_8888", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "BGRA_8888", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YV12:
- strlcpy(pixFormatStr, "YV12", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YV12", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
- strlcpy(pixFormatStr, "YCbCr_422_SP_NV16", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCbCr_422_SP_NV16", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- strlcpy(pixFormatStr, "YCrCb_420_SP_NV21", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCrCb_420_SP_NV21", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCbCr_422_I:
- strlcpy(pixFormatStr, "YCbCr_422_I_YUY2", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCbCr_422_I_YUY2", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCrCb_422_I:
- strlcpy(pixFormatStr, "YCrCb_422_I_YVYU", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCrCb_422_I_YVYU", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
- strlcpy(pixFormatStr, "NV12_ENCODEABLE", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "NV12_ENCODEABLE", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
strlcpy(pixFormatStr, "YCbCr_420_SP_TILED_TILE_4x2",
- sizeof(pixFormatStr));
+ strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP:
- strlcpy(pixFormatStr, "YCbCr_420_SP", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCbCr_420_SP", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO:
- strlcpy(pixFormatStr, "YCrCb_420_SP_ADRENO", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCrCb_420_SP_ADRENO", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCrCb_422_SP:
- strlcpy(pixFormatStr, "YCrCb_422_SP", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCrCb_422_SP", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_R_8:
- strlcpy(pixFormatStr, "R_8", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "R_8", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_RG_88:
- strlcpy(pixFormatStr, "RG_88", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "RG_88", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_INTERLACE:
- strlcpy(pixFormatStr, "INTERLACE", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "INTERLACE", strlen(pixFormatStr));
break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
- strlcpy(pixFormatStr, "YCbCr_420_SP_VENUS", sizeof(pixFormatStr));
+ strlcpy(pixFormatStr, "YCbCr_420_SP_VENUS", strlen(pixFormatStr));
break;
default:
- size_t len = sizeof(pixFormatStr);
+ size_t len = strlen(pixFormatStr);
snprintf(pixFormatStr, len, "Unknown0x%X", format);
break;
}
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 8ab29ea..40b67d8 100755
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -28,6 +28,8 @@
#include <overlayRotator.h>
#include "hwc_copybit.h"
+#include <utils/Vector.h>
+
using namespace overlay;
using namespace qdutils;
using namespace overlay::utils;
@@ -818,7 +820,7 @@
return false;
}
private_handle_t *renderBuf = ctx->mCopyBit[mDpy]->getCurrentRenderBuffer();
- Whf layerWhf[numPTORLayersFound]; // To store w,h,f of PTOR layers
+ Vector<Whf> layerWhf; // To store w,h,f of PTOR layers
// Store the blending mode, planeAlpha, and transform of PTOR layers
int32_t blending[numPTORLayersFound];
@@ -838,7 +840,7 @@
// Store & update w, h, format of PTOR layer
private_handle_t *hnd = (private_handle_t *)layer->handle;
Whf whf(hnd->width, hnd->height, hnd->format, hnd->size);
- layerWhf[j] = whf;
+ layerWhf.insertAt(whf, j);
hnd->width = renderBuf->width;
hnd->height = renderBuf->height;
hnd->format = renderBuf->format;
@@ -901,9 +903,10 @@
int idx = ctx->mPtorInfo.layerIndex[i];
hwc_layer_1_t* layer = &list->hwLayers[idx];
private_handle_t *hnd = (private_handle_t *)list->hwLayers[idx].handle;
- hnd->width = layerWhf[i].w;
- hnd->height = layerWhf[i].h;
- hnd->format = layerWhf[i].format;
+ Whf whf = layerWhf.itemAt(i);
+ hnd->width = whf.w;
+ hnd->height = whf.h;
+ hnd->format = whf.format;
layer->blending = blending[i];
layer->planeAlpha = planeAlpha[i];
layer->transform = transform[i];
@@ -1080,7 +1083,7 @@
}
bool MDPComp::isLoadBasedCompDoable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) {
+ hwc_display_contents_1_t* /*list*/) {
if(mDpy or isSecurePresent(ctx, mDpy) or
isYuvPresent(ctx, mDpy)) {
return false;
@@ -1460,8 +1463,8 @@
return true;
}
-bool MDPComp::resourceCheck(hwc_context_t *ctx,
- hwc_display_contents_1_t *list) {
+bool MDPComp::resourceCheck(hwc_context_t * /*ctx*/,
+ hwc_display_contents_1_t * /*list*/) {
const bool fbUsed = mCurrentFrame.fbCount;
if(mCurrentFrame.mdpCount > sMaxPipesPerMixer - fbUsed) {
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index 8daf3cb..a73c73c 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -96,13 +96,17 @@
return result;
}
-static android::status_t vpuCommand(hwc_context_t *ctx,
+static android::status_t vpuCommand(hwc_context_t * /*ctx*/,
uint32_t command,
const Parcel* inParcel,
Parcel* outParcel) {
status_t result = NO_INIT;
#ifdef VPU_TARGET
result = ctx->mVPUClient->processCommand(command, inParcel, outParcel);
+#else
+ (void)command;
+ (void)inParcel;
+ (void)outParcel;
#endif
return result;
}
@@ -128,7 +132,7 @@
//XXX: Need to check what to return for HDMI
outParcel->writeInt32(ctx->mMDP.panel);
}
-static void setHSIC(hwc_context_t* ctx, const Parcel* inParcel) {
+static void setHSIC(hwc_context_t* /*ctx*/, const Parcel* inParcel) {
int dpy = inParcel->readInt32();
HSICData_t hsic_data;
hsic_data.hue = inParcel->readInt32();
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 145f778..7f9aab1 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -438,7 +438,7 @@
int count = (int) (sizeof(stdRefreshRates)/sizeof(stdRefreshRates[0]));
uint32_t rate = refreshRate;
for(int i=0; i< count; i++) {
- if(abs(stdRefreshRates[i] - refreshRate) < 2) {
+ if((stdRefreshRates[i] - refreshRate) < 2) {
// Most likely used for video, the fps can fluctuate
// Ex: b/w 29 and 30 for 30 fps clip
rate = stdRefreshRates[i];
@@ -1318,8 +1318,8 @@
return res;
}
-void optimizeLayerRects(hwc_context_t *ctx,
- const hwc_display_contents_1_t *list, const int& dpy) {
+void optimizeLayerRects(hwc_context_t * /*ctx*/,
+ const hwc_display_contents_1_t *list, const int& /*dpy*/) {
int i=list->numHwLayers-2;
hwc_rect_t irect;
while(i > 0) {
@@ -2242,8 +2242,7 @@
EGLint attr_list[] = {EGL_GPU_HINT_1,
EGL_GPU_LEVEL_3,
EGL_NONE };
- if((gpuHint->mCurrGPUPerfMode != EGL_GPU_LEVEL_3) &&
- !((*(ctx->mpfn_eglGpuPerfHintQCOM))(gpuHint->mEGLDisplay,
+ if (!((*(ctx->mpfn_eglGpuPerfHintQCOM))(gpuHint->mEGLDisplay,
gpuHint->mEGLContext, attr_list))) {
ALOGW("eglGpuPerfHintQCOM failed for Built in display");
} else {
@@ -2302,7 +2301,7 @@
ctx->layerProp[dpy] = new LayerProp[numAppLayers];
}
-void BwcPM::setBwc(hwc_context_t *ctx, const hwc_rect_t& crop,
+void BwcPM::setBwc(hwc_context_t * /*ctx*/, const hwc_rect_t& crop,
const hwc_rect_t& dst, const int& transform,
ovutils::eMdpFlags& mdpFlags) {
//Target doesnt support Bwc
diff --git a/libhwcomposer/hwc_virtual.h b/libhwcomposer/hwc_virtual.h
index 9ef5106..0adde5b 100644
--- a/libhwcomposer/hwc_virtual.h
+++ b/libhwcomposer/hwc_virtual.h
@@ -86,7 +86,7 @@
// instantiates mdpcomp, copybit and fbupdate objects and initialize those
// objects for virtual display during virtual display connect. This function
// is no-op for V4L2 design
- virtual void init(hwc_context_t *ctx) {};
+ virtual void init(hwc_context_t * /*ctx*/) {};
// Destroys mdpcomp, copybit and fbupdate objects and for virtual display
// during virtual display disconnect. This function is no-op for V4L2 design
virtual void destroy(hwc_context_t *, size_t ,