sdm: Fix Wconversion errors
Change-Id: Ica8ecd83e44126d7ef5d8595dcaf52f88aea6e70
CRs-fixed: 974030
diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
index 251e195..5ac2319 100644
--- a/sdm/include/utils/debug.h
+++ b/sdm/include/utils/debug.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -63,7 +63,7 @@
static inline DebugHandler* Get() { return debug_.debug_handler_; }
static int GetSimulationFlag();
static int GetHDMIResolution();
- static int GetIdleTimeoutMs();
+ static uint32_t GetIdleTimeoutMs();
static int GetBootAnimLayerCount();
static bool IsRotatorDownScaleDisabled();
static bool IsDecimationDisabled();
diff --git a/sdm/libs/core/Android.mk b/sdm/libs/core/Android.mk
index 3ccb3ea..3cc57d2 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -7,7 +7,7 @@
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
external/libcxx/include/
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
- -Wall -Werror -std=c++11 -fcolor-diagnostics\
+ -Wall -Werror -Wconversion -std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\"
LOCAL_CLANG := true
LOCAL_HW_INTF_PATH := fb
diff --git a/sdm/libs/core/color_manager.cpp b/sdm/libs/core/color_manager.cpp
index 5dee062..7b8a1ca 100644
--- a/sdm/libs/core/color_manager.cpp
+++ b/sdm/libs/core/color_manager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2015 - 2016, The Linux Foundataion. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -57,7 +57,7 @@
DisplayError PPFeaturesConfig::RetrieveNextFeature(PPFeatureInfo **feature) {
DisplayError ret = kErrorNone;
- int i(0);
+ uint32_t i(0);
for (i = next_idx_; i < kMaxNumPPFeatures; i++) {
if (feature_[i]) {
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 41c5213..8703bf0 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -418,7 +418,7 @@
return supported;
}
- for (int32_t i = layer_stack->layer_count - 1; i >= 0; i--) {
+ for (int32_t i = INT32(layer_stack->layer_count - 1); i >= 0; i--) {
Layer &layer = layer_stack->layers[i];
if (layer.composition == kCompositionGPUTarget) {
gpu_index = i;
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index f0b78b3..c54bb28 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -70,7 +70,7 @@
if (hw_info_intf_) {
HWResourceInfo hw_resource_info = HWResourceInfo();
hw_info_intf_->GetHWResourceInfo(&hw_resource_info);
- int max_mixer_stages = hw_resource_info.num_blending_stages;
+ auto max_mixer_stages = hw_resource_info.num_blending_stages;
int property_value = Debug::GetMaxPipesPerMixer(display_type_);
if (property_value >= 0) {
max_mixer_stages = MIN(UINT32(property_value), hw_resource_info.num_blending_stages);
@@ -142,8 +142,8 @@
return kErrorParameters;
}
- uint32_t gpu_target_layer_dst_xpixels = gpu_target_layer.dst_rect.right;
- uint32_t gpu_target_layer_dst_ypixels = gpu_target_layer.dst_rect.bottom;
+ auto gpu_target_layer_dst_xpixels = gpu_target_layer.dst_rect.right;
+ auto gpu_target_layer_dst_ypixels = gpu_target_layer.dst_rect.bottom;
HWDisplayAttributes display_attrib;
uint32_t active_index = 0;
diff --git a/sdm/libs/core/display_hdmi.cpp b/sdm/libs/core/display_hdmi.cpp
index 123e300..3a2946a 100644
--- a/sdm/libs/core/display_hdmi.cpp
+++ b/sdm/libs/core/display_hdmi.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -203,7 +203,7 @@
return hw_intf_->OnMinHdcpEncryptionLevelChange(min_enc_level);
}
-int DisplayHDMI::GetBestConfig(HWS3DMode s3d_mode) {
+uint32_t DisplayHDMI::GetBestConfig(HWS3DMode s3d_mode) {
uint32_t best_index = 0, index;
uint32_t num_modes = 0;
HWDisplayAttributes best_attrib;
@@ -223,7 +223,7 @@
}
}
if (index < num_modes) {
- best_index = index;
+ best_index = UINT32(index);
for (size_t index = best_index + 1; index < num_modes; index ++) {
if (!IS_BIT_SET(attrib[index].s3d_config, s3d_mode))
continue;
@@ -231,13 +231,13 @@
// From the available configs, select the best
// Ex: 1920x1080@60Hz is better than 1920x1080@30 and 1920x1080@30 is better than 1280x720@60
if (attrib[index].y_pixels > attrib[best_index].y_pixels) {
- best_index = index;
+ best_index = UINT32(index);
} else if (attrib[index].y_pixels == attrib[best_index].y_pixels) {
if (attrib[index].x_pixels > attrib[best_index].x_pixels) {
- best_index = index;
+ best_index = UINT32(index);
} else if (attrib[index].x_pixels == attrib[best_index].x_pixels) {
if (attrib[index].vsync_period_ns < attrib[best_index].vsync_period_ns) {
- best_index = index;
+ best_index = UINT32(index);
}
}
}
@@ -249,9 +249,9 @@
delete[] attrib;
// Used for changing HDMI Resolution - override the best with user set config
- uint32_t user_config = Debug::GetHDMIResolution();
+ uint32_t user_config = UINT32(Debug::GetHDMIResolution());
if (user_config) {
- uint32_t config_index = -1;
+ uint32_t config_index = 0;
// For the config, get the corresponding index
DisplayError error = hw_intf_->GetConfigIndex(user_config, &config_index);
if (error == kErrorNone)
@@ -263,8 +263,8 @@
void DisplayHDMI::GetScanSupport() {
DisplayError error = kErrorNone;
- uint32_t video_format = -1;
- uint32_t max_cea_format = -1;
+ uint32_t video_format = 0;
+ uint32_t max_cea_format = 0;
HWScanInfo scan_info = HWScanInfo();
hw_intf_->GetHWScanInfo(&scan_info);
diff --git a/sdm/libs/core/display_hdmi.h b/sdm/libs/core/display_hdmi.h
index 3d2fcc6..ca33035 100644
--- a/sdm/libs/core/display_hdmi.h
+++ b/sdm/libs/core/display_hdmi.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -66,7 +66,7 @@
virtual DisplayError SetCursorPosition(int x, int y);
private:
- virtual int GetBestConfig(HWS3DMode s3d_mode);
+ virtual uint32_t GetBestConfig(HWS3DMode s3d_mode);
virtual void GetScanSupport();
virtual void SetS3DMode(LayerStack *layer_stack);
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index a44582f..246e08e 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -292,7 +292,7 @@
}
mdp_commit.flags |= MDP_VALIDATE_LAYER;
- if (Sys::ioctl_(device_fd_, MSMFB_ATOMIC_COMMIT, &mdp_disp_commit_) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ATOMIC_COMMIT), &mdp_disp_commit_) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -409,11 +409,11 @@
}
mdp_commit.release_fence = -1;
- mdp_commit.flags &= ~MDP_VALIDATE_LAYER;
+ mdp_commit.flags &= UINT32(~MDP_VALIDATE_LAYER);
if (synchronous_commit_) {
mdp_commit.flags |= MDP_COMMIT_WAIT_FOR_FINISH;
}
- if (Sys::ioctl_(device_fd_, MSMFB_ATOMIC_COMMIT, &mdp_disp_commit_) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ATOMIC_COMMIT), &mdp_disp_commit_) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -477,8 +477,8 @@
mdp_commit.input_layer_cnt = 0;
mdp_commit.output_layer = NULL;
- mdp_commit.flags &= ~MDP_VALIDATE_LAYER;
- if (Sys::ioctl_(device_fd_, MSMFB_ATOMIC_COMMIT, &mdp_disp_commit_) < 0) {
+ mdp_commit.flags &= UINT32(~MDP_VALIDATE_LAYER);
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ATOMIC_COMMIT), &mdp_disp_commit_) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -754,9 +754,9 @@
} else if (!strncmp(tokens[0], "dyn_fps_en", strlen("dyn_fps_en"))) {
panel_info->dynamic_fps = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "min_fps", strlen("min_fps"))) {
- panel_info->min_fps = atoi(tokens[1]);
+ panel_info->min_fps = UINT32(atoi(tokens[1]));
} else if (!strncmp(tokens[0], "max_fps", strlen("max_fps"))) {
- panel_info->max_fps = atoi(tokens[1]);
+ panel_info->max_fps = UINT32(atoi(tokens[1]));
} else if (!strncmp(tokens[0], "primary_panel", strlen("primary_panel"))) {
panel_info->is_primary_panel = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "is_pluggable", strlen("is_pluggable"))) {
@@ -843,8 +843,8 @@
read = Sys::getline_(&line, &len, fileptr);
if (read > 0) {
if (!ParseLine(line, tokens, max_count, &token_count)) {
- panel_info->split_info.left_split = atoi(tokens[0]);
- panel_info->split_info.right_split = atoi(tokens[1]);
+ panel_info->split_info.left_split = UINT32(atoi(tokens[0]));
+ panel_info->split_info.right_split = UINT32(atoi(tokens[1]));
}
}
@@ -1022,15 +1022,15 @@
STRUCT_VAR(mdp_async_layer, async_layer);
async_layer.flags = MDP_LAYER_ASYNC;
async_layer.pipe_ndx = left_pipe->pipe_id;
- async_layer.src.x = left_pipe->src_roi.left;
- async_layer.src.y = left_pipe->src_roi.top;
- async_layer.dst.x = x;
- async_layer.dst.y = y;
+ async_layer.src.x = UINT32(left_pipe->src_roi.left);
+ async_layer.src.y = UINT32(left_pipe->src_roi.top);
+ async_layer.dst.x = UINT32(x);
+ async_layer.dst.y = UINT32(y);
STRUCT_VAR(mdp_position_update, pos_update);
pos_update.input_layer_cnt = 1;
pos_update.input_layers = &async_layer;
- if (Sys::ioctl_(device_fd_, MSMFB_ASYNC_POSITION_UPDATE, &pos_update) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ASYNC_POSITION_UPDATE), &pos_update) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -1095,8 +1095,8 @@
DLOGW("Open failed = %s", file_node);
return -1;
}
- ssize_t len = Sys::pwrite_(fd, value, length, 0);
- if (length <= 0) {
+ ssize_t len = Sys::pwrite_(fd, value, static_cast<size_t>(length), 0);
+ if (len <= 0) {
DLOGE("Write failed for path %s with value %s", file_node, value);
}
Sys::close_(fd);
diff --git a/sdm/libs/core/fb/hw_hdmi.cpp b/sdm/libs/core/fb/hw_hdmi.cpp
index 2d91b9d..48038c5 100644
--- a/sdm/libs/core/fb/hw_hdmi.cpp
+++ b/sdm/libs/core/fb/hw_hdmi.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -213,7 +213,7 @@
char *tokens[edid_count_max] = { NULL };
ParseLine(ptr, tokens, edid_count_max, &hdmi_mode_count_);
for (uint32_t i = 0; i < hdmi_mode_count_; i++) {
- hdmi_modes_[i] = atoi(tokens[i]);
+ hdmi_modes_[i] = UINT32(atoi(tokens[i]));
}
}
@@ -450,9 +450,9 @@
return;
}
- hw_scan_info_.pt_scan_support = MapHWScanSupport(atoi(tokens[0]));
- hw_scan_info_.it_scan_support = MapHWScanSupport(atoi(tokens[1]));
- hw_scan_info_.cea_scan_support = MapHWScanSupport(atoi(tokens[2]));
+ hw_scan_info_.pt_scan_support = MapHWScanSupport(UINT32(atoi(tokens[0])));
+ hw_scan_info_.it_scan_support = MapHWScanSupport(UINT32(atoi(tokens[1])));
+ hw_scan_info_.cea_scan_support = MapHWScanSupport(UINT32(atoi(tokens[2])));
DLOGI("PT %d IT %d CEA %d", hw_scan_info_.pt_scan_support, hw_scan_info_.it_scan_support,
hw_scan_info_.cea_scan_support);
}
@@ -577,7 +577,8 @@
}
snprintf(sys_fs_path , sizeof(sys_fs_path), "%s%d/%s", fb_path_, hdmi_node_index, node);
- length = HWDevice::SysFsWrite(sys_fs_path, property_value, strlen(property_value));
+ length = HWDevice::SysFsWrite(sys_fs_path, property_value,
+ static_cast<ssize_t>(strlen(property_value)));
if (length <= 0) {
DLOGW("Failed to write %s = %s", node, property_value);
}
diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp
index 3c17005..1a28b78 100644
--- a/sdm/libs/core/fb/hw_info.cpp
+++ b/sdm/libs/core/fb/hw_info.cpp
@@ -111,7 +111,7 @@
HWDynBwLimitInfo* bw_info = &hw_resource->dyn_bw_info;
for (int index = 0; index < kBwModeMax; index++) {
- bw_info->total_bw_limit[index] = hw_resource->max_bandwidth_low;
+ bw_info->total_bw_limit[index] = UINT32(hw_resource->max_bandwidth_low);
bw_info->pipe_bw_limit[index] = hw_resource->max_pipe_bw;
}
@@ -415,7 +415,7 @@
vector <LayerBufferFormat> supported_sdm_formats;
for (uint32_t mdp_format = 0; mdp_format < format_count; mdp_format++) {
if (IS_BIT_SET(format_supported[mdp_format >> 3], (mdp_format & 7))) {
- LayerBufferFormat sdm_format = GetSDMFormat(mdp_format);
+ LayerBufferFormat sdm_format = GetSDMFormat(INT(mdp_format));
if (sdm_format != kFormatInvalid) {
supported_sdm_formats.push_back(sdm_format);
}
diff --git a/sdm/libs/core/fb/hw_primary.cpp b/sdm/libs/core/fb/hw_primary.cpp
index 93d1f42..e8ab7cf 100644
--- a/sdm/libs/core/fb/hw_primary.cpp
+++ b/sdm/libs/core/fb/hw_primary.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -175,8 +175,8 @@
if (xpos == string::npos || ypos == string::npos) {
DLOGI("Resolution switch not supported");
} else {
- *curr_x_pixels = atoi(buffer + xpos + 1);
- *curr_y_pixels = atoi(buffer + ypos + 1);
+ *curr_x_pixels = static_cast<size_t>(atoi(buffer + xpos + 1));
+ *curr_y_pixels = static_cast<size_t>(atoi(buffer + ypos + 1));
DLOGI("Current Config: %u x %u", *curr_x_pixels, *curr_y_pixels);
ret = true;
}
@@ -218,14 +218,14 @@
continue;
}
- config.x_pixels = atoi(buffer + xpos + 1);
- config.y_pixels = atoi(buffer + ypos + 1);
+ config.x_pixels = UINT32(atoi(buffer + xpos + 1));
+ config.y_pixels = UINT32(atoi(buffer + ypos + 1));
DLOGI("Found mode %d x %d", config.x_pixels, config.y_pixels);
display_configs_.push_back(config);
display_config_strings_.push_back(string(buffer));
if (curr_x_pixels == config.x_pixels && curr_y_pixels == config.y_pixels) {
- active_config_index_ = display_configs_.size() - 1;
+ active_config_index_ = UINT32(display_configs_.size() - 1);
DLOGI("Active config index %u", active_config_index_);
}
}
@@ -253,7 +253,7 @@
}
DisplayError HWPrimary::GetNumDisplayAttributes(uint32_t *count) {
- *count = IsResolutionSwitchEnabled() ? display_configs_.size() : 1;
+ *count = IsResolutionSwitchEnabled() ? UINT32(display_configs_.size()) : 1;
return kErrorNone;
}
@@ -303,8 +303,8 @@
// If driver doesn't return width/height information, default to 160 dpi
if (INT(var_screeninfo.width) <= 0 || INT(var_screeninfo.height) <= 0) {
- var_screeninfo.width = INT(((FLOAT(var_screeninfo.xres) * 25.4f)/160.0f) + 0.5f);
- var_screeninfo.height = INT(((FLOAT(var_screeninfo.yres) * 25.4f)/160.0f) + 0.5f);
+ var_screeninfo.width = UINT32(((FLOAT(var_screeninfo.xres) * 25.4f)/160.0f) + 0.5f);
+ var_screeninfo.height = UINT32(((FLOAT(var_screeninfo.yres) * 25.4f)/160.0f) + 0.5f);
}
display_attributes_.x_pixels = var_screeninfo.xres;
@@ -438,19 +438,19 @@
LayerRect left_roi = hw_layers->info.left_partial_update;
LayerRect right_roi = hw_layers->info.right_partial_update;
- mdp_commit.left_roi.x = INT(left_roi.left);
- mdp_commit.left_roi.y = INT(left_roi.top);
- mdp_commit.left_roi.w = INT(left_roi.right - left_roi.left);
- mdp_commit.left_roi.h = INT(left_roi.bottom - left_roi.top);
+ mdp_commit.left_roi.x = UINT32(left_roi.left);
+ mdp_commit.left_roi.y = UINT32(left_roi.top);
+ mdp_commit.left_roi.w = UINT32(left_roi.right - left_roi.left);
+ mdp_commit.left_roi.h = UINT32(left_roi.bottom - left_roi.top);
// SDM treats ROI as one full coordinate system.
// In case source split is disabled, However, Driver assumes Mixer to operate in
// different co-ordinate system.
if (!hw_resource_.is_src_split) {
- mdp_commit.right_roi.x = INT(right_roi.left) - hw_panel_info_.split_info.left_split;
- mdp_commit.right_roi.y = INT(right_roi.top);
- mdp_commit.right_roi.w = INT(right_roi.right - right_roi.left);
- mdp_commit.right_roi.h = INT(right_roi.bottom - right_roi.top);
+ mdp_commit.right_roi.x = UINT32(right_roi.left) - hw_panel_info_.split_info.left_split;
+ mdp_commit.right_roi.y = UINT32(right_roi.top);
+ mdp_commit.right_roi.w = UINT32(right_roi.right - right_roi.left);
+ mdp_commit.right_roi.h = UINT32(right_roi.bottom - right_roi.top);
}
return HWDevice::Validate(hw_layers);
@@ -480,7 +480,7 @@
usleep(16666);
STRUCT_VAR(timeval, time_now);
gettimeofday(&time_now, NULL);
- uint64_t ts = uint64_t(time_now.tv_sec)*1000000000LL +uint64_t(time_now.tv_usec)*1000LL;
+ int64_t ts = int64_t(time_now.tv_sec)*1000000000LL +int64_t(time_now.tv_usec)*1000LL;
// Send Vsync event for primary display(0)
event_handler_->VSync(ts);
@@ -521,7 +521,7 @@
void HWPrimary::HandleVSync(char *data) {
int64_t timestamp = 0;
if (!strncmp(data, "VSYNC=", strlen("VSYNC="))) {
- timestamp = strtoull(data + strlen("VSYNC="), NULL, 0);
+ timestamp = strtoll(data + strlen("VSYNC="), NULL, 0);
}
event_handler_->VSync(timestamp);
}
@@ -537,7 +537,7 @@
void HWPrimary::HandleThermal(char *data) {
int64_t thermal_level = 0;
if (!strncmp(data, "thermal_level=", strlen("thermal_level="))) {
- thermal_level = strtoull(data + strlen("thermal_level="), NULL, 0);
+ thermal_level = strtoll(data + strlen("thermal_level="), NULL, 0);
}
DLOGI("Received thermal notification with thermal level = %d", thermal_level);
@@ -584,7 +584,7 @@
}
DisplayError HWPrimary::SetDisplayMode(const HWDisplayMode hw_display_mode) {
- uint32_t mode = -1;
+ uint32_t mode = kModeDefault;
switch (hw_display_mode) {
case kModeVideo:
@@ -599,7 +599,7 @@
return kErrorParameters;
}
- if (Sys::ioctl_(device_fd_, MSMFB_LPM_ENABLE, &mode) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_LPM_ENABLE), &mode) < 0) {
IOCTL_LOGE(MSMFB_LPM_ENABLE, device_type_);
return kErrorHardware;
}
@@ -628,7 +628,7 @@
return kErrorUndefined;
}
- ssize_t ret = Sys::pwrite_(fd, buffer, bytes, 0);
+ ssize_t ret = Sys::pwrite_(fd, buffer, static_cast<size_t>(bytes), 0);
if (ret <= 0) {
DLOGV_IF(kTagDriverConfig, "Failed to write to node = %s, error = %s ", kBrightnessNode,
strerror(errno));
@@ -690,7 +690,7 @@
for (int i(0); i < kMaxNumPPFeatures; i++) {
version.pp_feature = feature_id_mapping[i];
- if (Sys::ioctl_(device_fd_, MSMFB_MDP_PP_GET_FEATURE_VERSION, &version) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_MDP_PP_GET_FEATURE_VERSION), &version) < 0) {
IOCTL_LOGE(MSMFB_MDP_PP_GET_FEATURE_VERSION, device_type_);
return kErrorHardware;
}
@@ -716,7 +716,7 @@
if ((feature->feature_id_ < kMaxNumPPFeatures)) {
HWColorManager::SetFeature[feature->feature_id_](*feature, &kernel_params);
- if (Sys::ioctl_(device_fd_, MSMFB_MDP_PP, &kernel_params) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_MDP_PP), &kernel_params) < 0) {
IOCTL_LOGE(MSMFB_MDP_PP, device_type_);
feature_list->Reset();
diff --git a/sdm/libs/core/resource_default.cpp b/sdm/libs/core/resource_default.cpp
index 46582b8..79d9b96 100644
--- a/sdm/libs/core/resource_default.cpp
+++ b/sdm/libs/core/resource_default.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -73,7 +73,7 @@
}
for (uint32_t i = 0; i < num_pipe_; i++) {
- src_pipes_[i].priority = i;
+ src_pipes_[i].priority = INT(i);
}
DLOGI("hw_rev=%x, DMA=%d RGB=%d VIG=%d", hw_res_info_.hw_revision, hw_res_info_.num_dma_pipe,
@@ -634,8 +634,11 @@
}
// Make sure source in integral only if it is a non secure layer.
- if (!input_buffer->flags.secure && (src.left - roundf(src.left) || src.top - roundf(src.top) ||
- src.right - roundf(src.right) || src.bottom - roundf(src.bottom))) {
+ if (!input_buffer->flags.secure &&
+ ((src.left - roundf(src.left) != 0.0f) ||
+ (src.top - roundf(src.top) != 0.0f) ||
+ (src.right - roundf(src.right) != 0.0f) ||
+ (src.bottom - roundf(src.bottom) != 0.0f))) {
DLOGV_IF(kTagResources, "Input ROI is not integral");
return kErrorNotSupported;
}
diff --git a/sdm/libs/hwc/Android.mk b/sdm/libs/hwc/Android.mk
index 0bb63ef..d711366 100644
--- a/sdm/libs/hwc/Android.mk
+++ b/sdm/libs/hwc/Android.mk
@@ -5,15 +5,15 @@
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := hardware/qcom/display/sdm/include/ \
- hardware/qcom/display/libgralloc/ \
hardware/qcom/display/libqservice/ \
hardware/qcom/display/libqdutils/ \
hardware/qcom/display/libcopybit/ \
external/libcxx/include/
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
- -Wall -Werror -std=c++11 -fcolor-diagnostics\
+ -Wall -Werror -Wconversion -std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\" -DDEBUG_CALC_FPS
+LOCAL_CFLAGS += -isystem hardware/qcom/display/libgralloc
LOCAL_CLANG := true
# TODO: Move this to the common makefile
diff --git a/sdm/libs/hwc/blit_engine_c2d.cpp b/sdm/libs/hwc/blit_engine_c2d.cpp
index 898c5e5..dd11d2b 100755
--- a/sdm/libs/hwc/blit_engine_c2d.cpp
+++ b/sdm/libs/hwc/blit_engine_c2d.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -61,6 +61,12 @@
#define __CLASS__ "BlitEngineC2D"
+// TODO(user): Remove pragma after fixing sign conversion errors
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wsign-conversion"
+#endif
+
namespace sdm {
@@ -526,7 +532,7 @@
blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_FRAMEBUFFER_HEIGHT,
target_buffer->height);
int transform = 0;
- if (layer->transform.rotation) transform |= COPYBIT_TRANSFORM_ROT_90;
+ if (layer->transform.rotation != 0.0f) transform |= COPYBIT_TRANSFORM_ROT_90;
if (layer->transform.flip_horizontal) transform |= COPYBIT_TRANSFORM_FLIP_H;
if (layer->transform.flip_vertical) transform |= COPYBIT_TRANSFORM_FLIP_V;
blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_TRANSFORM, transform);
@@ -593,4 +599,7 @@
}
} // namespace sdm
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
diff --git a/sdm/libs/hwc/hwc_buffer_allocator.cpp b/sdm/libs/hwc/hwc_buffer_allocator.cpp
index 10c719b..7ec3594 100644
--- a/sdm/libs/hwc/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc/hwc_buffer_allocator.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -69,7 +69,7 @@
alloc_flags |= INT(GRALLOC_USAGE_PROTECTED);
data.align = SECURE_ALIGN;
} else {
- data.align = getpagesize();
+ data.align = UINT32(getpagesize());
}
if (buffer_config.cache == false) {
@@ -103,7 +103,7 @@
}
alloc_buffer_info->fd = data.fd;
- alloc_buffer_info->stride = aligned_width;
+ alloc_buffer_info->stride = UINT32(aligned_width);
alloc_buffer_info->size = buffer_size;
meta_buffer_info->base_addr = data.base;
@@ -151,7 +151,7 @@
}
uint32_t HWCBufferAllocator::GetBufferSize(BufferInfo *buffer_info) {
- uint32_t align = getpagesize();
+ uint32_t align = UINT32(getpagesize());
const BufferConfig &buffer_config = buffer_info->buffer_config;
diff --git a/sdm/libs/hwc/hwc_color_manager.cpp b/sdm/libs/hwc/hwc_color_manager.cpp
index 5abe94a..15270d5 100644
--- a/sdm/libs/hwc/hwc_color_manager.cpp
+++ b/sdm/libs/hwc/hwc_color_manager.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -64,8 +64,8 @@
uint32_t id(0);
uint32_t size(0);
- id = in.readInt32();
- size = in.readInt32();
+ id = UINT32(in.readInt32());
+ size = UINT32(in.readInt32());
if (size > 0 && size == in.dataAvail()) {
const void *data = in.readInplace(size);
const uint8_t *temp = reinterpret_cast<const uint8_t *>(data);
@@ -83,7 +83,7 @@
void HWCColorManager::MarshallStructIntoParcel(const PPDisplayAPIPayload &data,
android::Parcel *out_parcel) {
- out_parcel->writeInt32(data.size);
+ out_parcel->writeInt32(INT32(data.size));
if (data.payload)
out_parcel->write(data.payload, data.size);
}
@@ -259,7 +259,8 @@
// handle for solid fill layer with fd = -1.
private_handle_t *handle =
new private_handle_t(-1, 0, private_handle_t::PRIV_FLAGS_FRAMEBUFFER, BUFFER_TYPE_UI,
- HAL_PIXEL_FORMAT_RGBA_8888, primary_width, primary_height);
+ HAL_PIXEL_FORMAT_RGBA_8888, INT32(primary_width),
+ INT32(primary_height));
if (!buf || !handle) {
DLOGE("Failed to allocate memory.");
@@ -284,17 +285,18 @@
hwc_layer_1_t &layer = solid_fill_layers_->hwLayers[0];
hwc_rect_t solid_fill_rect = {
- INT(solid_fill_params_.rect.x), INT(solid_fill_params_.rect.y),
- INT(solid_fill_params_.rect.x + solid_fill_params_.rect.width),
- INT(solid_fill_params_.rect.y + solid_fill_params_.rect.height),
+ INT(solid_fill_params_.rect.x),
+ INT(solid_fill_params_.rect.y),
+ solid_fill_params_.rect.x + INT(solid_fill_params_.rect.width),
+ solid_fill_params_.rect.y + INT(solid_fill_params_.rect.height),
};
layer.compositionType = HWC_FRAMEBUFFER;
layer.blending = HWC_BLENDING_PREMULT;
layer.sourceCropf.left = solid_fill_params_.rect.x;
layer.sourceCropf.top = solid_fill_params_.rect.y;
- layer.sourceCropf.right = solid_fill_params_.rect.x + solid_fill_params_.rect.width;
- layer.sourceCropf.bottom = solid_fill_params_.rect.y + solid_fill_params_.rect.height;
+ layer.sourceCropf.right = UINT32(solid_fill_params_.rect.x) + solid_fill_params_.rect.width;
+ layer.sourceCropf.bottom = UINT32(solid_fill_params_.rect.y) + solid_fill_params_.rect.height;
layer.acquireFenceFd = -1;
layer.releaseFenceFd = -1;
layer.flags = 0;
@@ -371,7 +373,7 @@
}
// retrieve system GPU idle timeout value for later to recover.
- mode_mgr->entry_timeout_ = HWCDebugHandler::GetIdleTimeoutMs();
+ mode_mgr->entry_timeout_ = UINT32(HWCDebugHandler::GetIdleTimeoutMs());
// acquire the binder handle to Android system PowerManager for later use.
android::sp<android::IBinder> binder =
diff --git a/sdm/libs/hwc/hwc_debugger.cpp b/sdm/libs/hwc/hwc_debugger.cpp
index 6c58ba5..7c8bbfd 100644
--- a/sdm/libs/hwc/hwc_debugger.cpp
+++ b/sdm/libs/hwc/hwc_debugger.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -35,12 +35,12 @@
namespace sdm {
HWCDebugHandler HWCDebugHandler::debug_handler_;
-uint32_t HWCDebugHandler::debug_flags_ = 0x1;
-uint32_t HWCDebugHandler::verbose_level_ = 0x0;
+int32_t HWCDebugHandler::debug_flags_ = 0x1;
+int32_t HWCDebugHandler::verbose_level_ = 0x0;
void HWCDebugHandler::DebugAll(bool enable, int verbose_level) {
if (enable) {
- debug_flags_ = 0xFFFFFFFF;
+ debug_flags_ = 0x7FFFFFFF;
verbose_level_ = verbose_level;
} else {
debug_flags_ = 0x1; // kTagNone should always be printed.
diff --git a/sdm/libs/hwc/hwc_debugger.h b/sdm/libs/hwc/hwc_debugger.h
index e4e1ea3..68f95d9 100644
--- a/sdm/libs/hwc/hwc_debugger.h
+++ b/sdm/libs/hwc/hwc_debugger.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -65,8 +65,8 @@
private:
static HWCDebugHandler debug_handler_;
- static uint32_t debug_flags_;
- static uint32_t verbose_level_;
+ static int32_t debug_flags_;
+ static int32_t verbose_level_;
};
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index 177fc2b..d8f00df 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -241,13 +241,13 @@
for (int i = 0; attributes[i] != HWC_DISPLAY_NO_ATTRIBUTE; i++) {
switch (attributes[i]) {
case HWC_DISPLAY_VSYNC_PERIOD:
- values[i] = variable_config.vsync_period_ns;
+ values[i] = INT32(variable_config.vsync_period_ns);
break;
case HWC_DISPLAY_WIDTH:
- values[i] = variable_config.x_pixels;
+ values[i] = INT32(variable_config.x_pixels);
break;
case HWC_DISPLAY_HEIGHT:
- values[i] = variable_config.y_pixels;
+ values[i] = INT32(variable_config.y_pixels);
break;
case HWC_DISPLAY_DPI_X:
values[i] = INT32(variable_config.x_dpi * 1000.0f);
@@ -332,8 +332,8 @@
if (i < num_hw_layers) {
hwc_layer_1_t &hwc_layer = content_list->hwLayers[i];
- num_visible_rects = INT32(hwc_layer.visibleRegionScreen.numRects);
- num_dirty_rects = INT32(hwc_layer.surfaceDamage.numRects);
+ num_visible_rects = UINT32(hwc_layer.visibleRegionScreen.numRects);
+ num_dirty_rects = UINT32(hwc_layer.surfaceDamage.numRects);
}
// visible rectangles + dirty rectangles + blit rectangle
@@ -365,7 +365,7 @@
// Layer array address
layer_stack_ = LayerStack();
layer_stack_.layers = reinterpret_cast<Layer *>(current_address);
- layer_stack_.layer_count = INT32(num_hw_layers + blit_target_count);
+ layer_stack_.layer_count = UINT32(num_hw_layers + blit_target_count);
current_address += (num_hw_layers + blit_target_count) * sizeof(Layer);
for (size_t i = 0; i < num_hw_layers + blit_target_count; i++) {
@@ -402,8 +402,8 @@
if (pvt_handle) {
layer_buffer->format = GetSDMFormat(pvt_handle->format, pvt_handle->flags);
- layer_buffer->width = pvt_handle->width;
- layer_buffer->height = pvt_handle->height;
+ layer_buffer->width = UINT32(pvt_handle->width);
+ layer_buffer->height = UINT32(pvt_handle->height);
if (SetMetaData(pvt_handle, layer) != kErrorNone) {
return -EINVAL;
@@ -452,8 +452,8 @@
AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(INT(x_pixels), INT(y_pixels), format,
usage, aligned_width, aligned_height);
- layer_buffer->width = aligned_width;
- layer_buffer->height = aligned_height;
+ layer_buffer->width = UINT32(aligned_width);
+ layer_buffer->height = UINT32(aligned_height);
layer_buffer->format = GetSDMFormat(format, flags);
}
}
@@ -468,7 +468,7 @@
if (pvt_handle) {
layer_buffer->planes[0].fd = pvt_handle->fd;
layer_buffer->planes[0].offset = pvt_handle->offset;
- layer_buffer->planes[0].stride = pvt_handle->width;
+ layer_buffer->planes[0].stride = UINT32(pvt_handle->width);
}
// if swapinterval property is set to 0 then close and reset the acquireFd
@@ -560,8 +560,8 @@
// For solid fill, only dest rect need to be specified.
if (layer.flags.solid_fill) {
LayerBuffer *input_buffer = layer.input_buffer;
- input_buffer->width = layer.dst_rect.right - layer.dst_rect.left;
- input_buffer->height = layer.dst_rect.bottom - layer.dst_rect.top;
+ input_buffer->width = UINT32(layer.dst_rect.right - layer.dst_rect.left);
+ input_buffer->height = UINT32(layer.dst_rect.bottom - layer.dst_rect.top);
layer.src_rect.left = 0;
layer.src_rect.top = 0;
layer.src_rect.right = input_buffer->width;
@@ -573,7 +573,7 @@
layer.flags.updating = true;
if (num_hw_layers <= kMaxLayerCount) {
- layer.flags.updating = IsLayerUpdating(content_list, i);
+ layer.flags.updating = IsLayerUpdating(content_list, INT32(i));
}
#ifdef QTI_BSP
if (hwc_layer.flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
@@ -838,7 +838,7 @@
return true;
}
- if ((layer.composition == kCompositionGPU) && IsLayerUpdating(content_list, i)) {
+ if ((layer.composition == kCompositionGPU) && IsLayerUpdating(content_list, INT32(i))) {
return true;
}
}
@@ -1358,15 +1358,15 @@
}
if (meta_data->operation & LINEAR_FORMAT) {
- layer_buffer->format = GetSDMFormat(meta_data->linearFormat, 0);
+ layer_buffer->format = GetSDMFormat(INT32(meta_data->linearFormat), 0);
}
if (meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
int actual_width = pvt_handle->width;
int actual_height = pvt_handle->height;
AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(pvt_handle, actual_width, actual_height);
- layer_buffer->width = actual_width;
- layer_buffer->height = actual_height;
+ layer_buffer->width = UINT32(actual_width);
+ layer_buffer->height = UINT32(actual_height);
}
if (meta_data->operation & SET_SINGLE_BUFFER_MODE) {
@@ -1378,7 +1378,7 @@
if (meta_data->operation & S3D_FORMAT) {
std::map<int, LayerBufferS3DFormat>::iterator it =
- s3d_format_hwc_to_sdm_.find(meta_data->s3dFormat);
+ s3d_format_hwc_to_sdm_.find(INT32(meta_data->s3dFormat));
if (it != s3d_format_hwc_to_sdm_.end()) {
layer->input_buffer->s3d_format = it->second;
} else {
@@ -1454,7 +1454,7 @@
}
int HWCDisplay::SetActiveDisplayConfig(int config) {
- return display_intf_->SetActiveConfig(config) == kErrorNone ? 0 : -1;
+ return display_intf_->SetActiveConfig(UINT32(config)) == kErrorNone ? 0 : -1;
}
int HWCDisplay::GetActiveDisplayConfig(uint32_t *config) {
@@ -1466,7 +1466,7 @@
}
int HWCDisplay::GetDisplayAttributesForConfig(int config, DisplayConfigVariableInfo *attributes) {
- return display_intf_->GetConfig(config, attributes) == kErrorNone ? 0 : -1;
+ return display_intf_->GetConfig(UINT32(config), attributes) == kErrorNone ? 0 : -1;
}
bool HWCDisplay::SingleLayerUpdating(uint32_t app_layer_count) {
diff --git a/sdm/libs/hwc/hwc_display_external.cpp b/sdm/libs/hwc/hwc_display_external.cpp
index 74a79bb..86b36d8 100644
--- a/sdm/libs/hwc/hwc_display_external.cpp
+++ b/sdm/libs/hwc/hwc_display_external.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -155,16 +155,20 @@
return;
}
- uint32_t new_panel_width = panel_width * (1.0f - width_ratio);
- uint32_t new_panel_height = panel_height * (1.0f - height_ratio);
+ uint32_t new_panel_width = panel_width * UINT32(1.0f - width_ratio);
+ uint32_t new_panel_height = panel_height * UINT32(1.0f - height_ratio);
int x_offset = INT((FLOAT(panel_width) * width_ratio) / 2.0f);
int y_offset = INT((FLOAT(panel_height) * height_ratio) / 2.0f);
- display_frame->left = ((display_frame->left * new_panel_width) / panel_width) + x_offset;
- display_frame->top = ((display_frame->top * new_panel_height) / panel_height) + y_offset;
- display_frame->right = ((display_frame->right * new_panel_width) / panel_width) + x_offset;
- display_frame->bottom = ((display_frame->bottom * new_panel_height) / panel_height) + y_offset;
+ display_frame->left = (display_frame->left * INT32(new_panel_width) / INT32(panel_width))
+ + x_offset;
+ display_frame->top = (display_frame->top * INT32(new_panel_height) / INT32(panel_height)) +
+ y_offset;
+ display_frame->right = ((display_frame->right * INT32(new_panel_width)) / INT32(panel_width)) +
+ x_offset;
+ display_frame->bottom = ((display_frame->bottom * INT32(new_panel_height)) / INT32(panel_height))
+ + y_offset;
}
void HWCDisplayExternal::SetSecureDisplay(bool secure_display_active) {
diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp
index efef736..f17b00b 100644
--- a/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/sdm/libs/hwc/hwc_display_primary.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -56,8 +56,8 @@
HWCDebugHandler::Get()->GetProperty("sdm.fb_size_width", &width);
HWCDebugHandler::Get()->GetProperty("sdm.fb_size_height", &height);
if (width > 0 && height > 0) {
- primary_width = width;
- primary_height = height;
+ primary_width = UINT32(width);
+ primary_height = UINT32(height);
}
status = hwc_display_primary->SetFrameBufferResolution(primary_width, primary_height);
@@ -136,7 +136,7 @@
return status;
}
- bool one_updating_layer = SingleLayerUpdating(content_list->numHwLayers - 1);
+ bool one_updating_layer = SingleLayerUpdating(UINT32(content_list->numHwLayers - 1));
ToggleCPUHint(one_updating_layer);
uint32_t refresh_rate = GetOptimalRefreshRate(one_updating_layer);
@@ -200,23 +200,23 @@
int HWCDisplayPrimary::Perform(uint32_t operation, ...) {
va_list args;
va_start(args, operation);
- int val = va_arg(args, uint32_t);
+ int val = va_arg(args, int32_t);
va_end(args);
switch (operation) {
case SET_METADATA_DYN_REFRESH_RATE:
SetMetaDataRefreshRateFlag(val);
break;
case SET_BINDER_DYN_REFRESH_RATE:
- ForceRefreshRate(val);
+ ForceRefreshRate(UINT32(val));
break;
case SET_DISPLAY_MODE:
- SetDisplayMode(val);
+ SetDisplayMode(UINT32(val));
break;
case SET_QDCM_SOLID_FILL_INFO:
- SetQDCMSolidFillInfo(true, val);
+ SetQDCMSolidFillInfo(true, UINT32(val));
break;
case UNSET_QDCM_SOLID_FILL_INFO:
- SetQDCMSolidFillInfo(false, val);
+ SetQDCMSolidFillInfo(false, UINT32(val));
break;
default:
DLOGW("Invalid operation %d", operation);
diff --git a/sdm/libs/hwc/hwc_display_virtual.cpp b/sdm/libs/hwc/hwc_display_virtual.cpp
index f216f89..b405d91 100644
--- a/sdm/libs/hwc/hwc_display_virtual.cpp
+++ b/sdm/libs/hwc/hwc_display_virtual.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -78,7 +78,7 @@
int fb_width = fb_layer.displayFrame.right - fb_layer.displayFrame.left;
int fb_height = fb_layer.displayFrame.bottom - fb_layer.displayFrame.top;
- status = hwc_display_virtual->SetFrameBufferResolution(fb_width, fb_height);
+ status = hwc_display_virtual->SetFrameBufferResolution(UINT32(fb_width), UINT32(fb_height));
if (status) {
Destroy(hwc_display_virtual);
@@ -222,11 +222,11 @@
int fbt_height = frame.bottom - frame.top;
const MetaData_t *meta_data = reinterpret_cast<MetaData_t *>(output_handle->base_metadata);
if (meta_data && meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
- variable_info.x_pixels = meta_data->bufferDim.sliceWidth;
- variable_info.y_pixels = meta_data->bufferDim.sliceHeight;
+ variable_info.x_pixels = UINT32(meta_data->bufferDim.sliceWidth);
+ variable_info.y_pixels = UINT32(meta_data->bufferDim.sliceHeight);
} else {
- variable_info.x_pixels = fbt_width;
- variable_info.y_pixels = fbt_height;
+ variable_info.x_pixels = UINT32(fbt_width);
+ variable_info.y_pixels = UINT32(fbt_height);
}
// TODO(user): Need to get the framerate of primary display and update it.
variable_info.fps = 60;
@@ -272,8 +272,8 @@
AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, output_buffer_width,
output_buffer_height);
- output_buffer_->width = output_buffer_width;
- output_buffer_->height = output_buffer_height;
+ output_buffer_->width = UINT32(output_buffer_width);
+ output_buffer_->height = UINT32(output_buffer_height);
output_buffer_->flags.secure = 0;
output_buffer_->flags.video = 0;
@@ -285,7 +285,7 @@
// ToDo: Need to extend for non-RGB formats
output_buffer_->planes[0].fd = output_handle->fd;
output_buffer_->planes[0].offset = output_handle->offset;
- output_buffer_->planes[0].stride = output_handle->width;
+ output_buffer_->planes[0].stride = UINT32(output_handle->width);
}
layer_stack_.output_buffer = output_buffer_;
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index c84fab1..4c5260e 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -475,7 +475,7 @@
return;
}
- DumpInterface::GetDump(buffer, length);
+ DumpInterface::GetDump(buffer, UINT32(length));
}
int HWCSession::GetDisplayConfigs(hwc_composer_device_1 *device, int disp, uint32_t *configs,
@@ -859,7 +859,7 @@
uint32_t config = 0;
error = hwc_display_[dpy]->GetActiveDisplayConfig(&config);
if (error == 0) {
- output_parcel->writeInt32(config);
+ output_parcel->writeInt32(INT(config));
}
}
@@ -879,7 +879,7 @@
if (hwc_display_[dpy]) {
error = hwc_display_[dpy]->GetDisplayConfigCount(&count);
if (error == 0) {
- output_parcel->writeInt32(count);
+ output_parcel->writeInt32(INT(count));
}
}
@@ -901,9 +901,9 @@
if (hwc_display_[dpy]) {
error = hwc_display_[dpy]->GetDisplayAttributesForConfig(config, &attributes);
if (error == 0) {
- output_parcel->writeInt32(attributes.vsync_period_ns);
- output_parcel->writeInt32(attributes.x_pixels);
- output_parcel->writeInt32(attributes.y_pixels);
+ output_parcel->writeInt32(INT(attributes.vsync_period_ns));
+ output_parcel->writeInt32(INT(attributes.x_pixels));
+ output_parcel->writeInt32(INT(attributes.y_pixels));
output_parcel->writeFloat(attributes.x_dpi);
output_parcel->writeFloat(attributes.y_dpi);
output_parcel->writeInt32(0); // Panel type, unsupported.
@@ -1274,7 +1274,7 @@
}
DLOGI("Restoring power mode on primary");
- uint32_t mode = hwc_display_[HWC_DISPLAY_PRIMARY]->GetLastPowerMode();
+ int32_t mode = INT(hwc_display_[HWC_DISPLAY_PRIMARY]->GetLastPowerMode());
status = hwc_display_[HWC_DISPLAY_PRIMARY]->SetPowerMode(mode);
if (status) {
DLOGE("Setting power mode = %d on primary failed with error = %d", mode, status);
@@ -1336,7 +1336,7 @@
// trigger screen refresh to ensure sufficient resources are available to process new
// new display connection.
hwc_procs_->invalidate(hwc_procs_);
- int32_t vsync_period = GetVsyncPeriod(HWC_DISPLAY_PRIMARY);
+ uint32_t vsync_period = UINT32(GetVsyncPeriod(HWC_DISPLAY_PRIMARY));
usleep(vsync_period * 2 / 1000);
}
// notify client
diff --git a/sdm/libs/utils/Android.mk b/sdm/libs/utils/Android.mk
index dd3a0d1..5540385 100644
--- a/sdm/libs/utils/Android.mk
+++ b/sdm/libs/utils/Android.mk
@@ -5,7 +5,8 @@
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := hardware/qcom/display/sdm/include/
LOCAL_CFLAGS := -Wno-missing-field-initializers \
- -Wall -Werror -std=c++11 -fcolor-diagnostics\
+ -Wall -Werror -Wconversion \
+ -std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\"
LOCAL_CLANG := true
LOCAL_SRC_FILES := debug.cpp \
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index d0d21ee..7082421 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -52,11 +52,11 @@
return value;
}
-int Debug::GetIdleTimeoutMs() {
+uint32_t Debug::GetIdleTimeoutMs() {
int value = IDLE_TIMEOUT_DEFAULT_MS;
debug_.debug_handler_->GetProperty("sdm.idle_time", &value);
- return value;
+ return UINT32(value);
}
int Debug::GetBootAnimLayerCount() {