sdm: color transform support for HDR playback
In HDR playback case, colortransform is not applied, if it was set already.
This change will help restore color transform for HDR playback.
Change-Id: I3cf6f9eb7c5632e8622ccec2c0c40e3b51e8ad9b
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 3bb3441..a0a816a 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -928,6 +928,7 @@
DisplayError DisplayBase::SetColorTransform(const uint32_t length, const double *color_transform) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
+ DisplayError ret = kErrorNone;
if (!color_mgr_) {
return kErrorNotSupported;
}
@@ -936,7 +937,12 @@
return kErrorParameters;
}
- return color_mgr_->ColorMgrSetColorTransform(length, color_transform);
+ color_transform_active_ = false;
+ ret = color_mgr_->ColorMgrSetColorTransform(length, color_transform);
+ if (!ret) {
+ CopyColorTransformMatrix(color_transform);
+ }
+ return ret;
}
DisplayError DisplayBase::GetDefaultColorMode(std::string *color_mode) {
@@ -1477,6 +1483,9 @@
}
DLOGI("Setting color mode = %s", color_mode.c_str());
error = SetColorModeInternal(color_mode);
+ if (color_transform_active_) {
+ color_mgr_->ColorMgrSetColorTransform(kColorTransformlength_, color_transform_);
+ }
}
// DPPS and HDR features are mutually exclusive
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index 5e697d9..66f3707 100644
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -147,6 +147,12 @@
DisplayState GetLastPowerMode();
void SetPUonDestScaler();
void ClearColorInfo();
+ void CopyColorTransformMatrix(const double *input_matrix) {
+ for (uint32_t i = 0; i < kColorTransformlength_; i++) {
+ color_transform_[i] = input_matrix[i];
+ }
+ color_transform_active_ = true;
+ }
recursive_mutex recursive_mutex_;
DisplayType display_type_;
@@ -192,6 +198,9 @@
bool drop_hw_vsync_ = false;
uint32_t current_refresh_rate_ = 0;
bool drop_skewed_vsync_ = false;
+ static const uint32_t kColorTransformlength_ = 16;
+ double color_transform_[kColorTransformlength_] = {0};
+ bool color_transform_active_ = false;
};
} // namespace sdm