summaryrefslogtreecommitdiff
path: root/hwc3/impl/HalImpl.cpp
diff options
context:
space:
mode:
authorAdy Abraham <adyabr@google.com>2021-12-21 14:10:37 -0800
committerAdy Abraham <adyabr@google.com>2021-12-21 14:12:18 -0800
commit169defd014b8d5ea2e424c8c80ea1b53a906199d (patch)
tree4081681d300cea8e2f75d56d85b42fbdfce2e8cf /hwc3/impl/HalImpl.cpp
parent139c5539d48b14df34ab4aabc8fbd22487ad56f6 (diff)
hwc3: DisplayCommand.colorTransform is just a matrix
Remove the hint from DisplayCommand.colorTransform as currently we only use ColorTransform::IDENTITY and ColorTransform::ARBITRARY_MATRIX, which both can be expressed using a matrix. Bug: 208879711 Test: VTS Change-Id: If35d0f1dcc17983d75adb95d63b423799cce064a
Diffstat (limited to 'hwc3/impl/HalImpl.cpp')
-rw-r--r--hwc3/impl/HalImpl.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/hwc3/impl/HalImpl.cpp b/hwc3/impl/HalImpl.cpp
index 45dfa32..85f0edd 100644
--- a/hwc3/impl/HalImpl.cpp
+++ b/hwc3/impl/HalImpl.cpp
@@ -620,8 +620,19 @@ int32_t HalImpl::setColorMode(int64_t display, ColorMode mode, RenderIntent inte
return halDisplay->setColorModeWithRenderIntent(hwcMode, hwcIntent);
}
-int32_t HalImpl::setColorTransform(int64_t display, const std::vector<float>& matrix,
- common::ColorTransform hint) {
+int32_t HalImpl::setColorTransform(int64_t display, const std::vector<float>& matrix) {
+ // clang-format off
+ constexpr std::array<float, 16> kIdentity = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+ };
+ // clang-format on
+ const bool isIdentity = (std::equal(matrix.begin(), matrix.end(), kIdentity.begin()));
+ const common::ColorTransform hint = isIdentity ? common::ColorTransform::IDENTITY
+ : common::ColorTransform::ARBITRARY_MATRIX;
+
ExynosDisplay* halDisplay;
RET_IF_ERR(getHalDisplay(display, halDisplay));