aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2023-01-29 00:48:10 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2023-01-29 00:48:10 +0800
commit152bc62dc8ec4c38ec18ff917062f29d38f25744 (patch)
treed093cc45e102e5f962cba77b218bed3cdea6e4cc
parent22fe9617dab9c0568ce625143b1d064c95df8fa2 (diff)
downloaddrm_hwcomposer-152bc62dc8ec4c38ec18ff917062f29d38f25744.tar.gz
drm_hwcomposer: fix shift compiling error with AOSP
which reported like this: 08:58:21 external/drm_hwcomposer/hwc2_device/HwcDisplay.cpp:76:26: error: constexpr variable 'kOne' must be initialized by a constant expression 08:58:21 constexpr uint64_t kOne = 1L << 32; /* 1.0 in s31.32 format */ 08:58:21 ^ ~~~~~~~~ 08:58:21 external/drm_hwcomposer/hwc2_device/HwcDisplay.cpp:76:36: note: shift count 32 >= width of type 'long' (32 bits) 08:58:21 constexpr uint64_t kOne = 1L << 32; /* 1.0 in s31.32 format */ 08:58:21 ^ 08:58:21 external/drm_hwcomposer/hwc2_device/HwcDisplay.cpp:76:36: error: shift count >= width of type [-Werror,-Wshift-count-overflow] 08:58:21 constexpr uint64_t kOne = 1L << 32; /* 1.0 in s31.32 format */ 08:58:21 ^ ~~ 08:58:21 external/drm_hwcomposer/hwc2_device/HwcDisplay.cpp:697:71: error: shift count >= width of type [-Werror,-Wshift-count-overflow] 08:58:21 auto value = uint64_t(matrix[i * kInCtmRows + j] * float(1L << 32)); 08:58:21 ^ ~~ 08:58:21 3 errors generated. Test: build passes and could boot to home screen Change-Id: Ia9dfcd842a186dfbe279da1793363c6a25df0e2f Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--hwc2_device/HwcDisplay.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 13da016..d335d72 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -73,7 +73,7 @@ void HwcDisplay::SetColorMarixToIdentity() {
color_matrix_ = std::make_shared<drm_color_ctm>();
for (int i = 0; i < kCtmCols; i++) {
for (int j = 0; j < kCtmRows; j++) {
- constexpr uint64_t kOne = 1L << 32; /* 1.0 in s31.32 format */
+ constexpr uint64_t kOne = (1ULL << 32); /* 1.0 in s31.32 format */
color_matrix_->matrix[i * kCtmRows + j] = (i == j) ? kOne : 0;
}
}
@@ -694,7 +694,7 @@ HWC2::Error HwcDisplay::SetColorTransform(const float *matrix, int32_t hint) {
for (int j = 0; j < kCtmRows; j++) {
constexpr int kInCtmRows = 4;
/* HAL matrix type is float, but DRM expects a s31.32 fix point */
- auto value = uint64_t(matrix[i * kInCtmRows + j] * float(1L << 32));
+ auto value = uint64_t(matrix[i * kInCtmRows + j] * float(1ULL << 32));
color_matrix_->matrix[i * kCtmRows + j] = value;
}
}