summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2023-01-18 01:35:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-01-18 01:35:51 +0000
commit07e37e08bec0dd718b0fda1ff11919c52e42f6cd (patch)
treef9b41a920ae5551d76b59e5fcd40ec798b865762
parent376a8b2db4b871d224c21b6f3da475b0336bd7cf (diff)
parent6d641eac2ad790f8d86e80aed93066e6b4536609 (diff)
downloadcommon-07e37e08bec0dd718b0fda1ff11919c52e42f6cd.tar.gz
Merge "libhwc2.1: allow to apply the first brightness" into tm-qpr-dev
-rw-r--r--libhwc2.1/libdevice/BrightnessController.cpp14
-rw-r--r--libhwc2.1/libdevice/BrightnessController.h2
-rw-r--r--libhwc2.1/libdevice/ExynosDisplay.cpp2
3 files changed, 14 insertions, 4 deletions
diff --git a/libhwc2.1/libdevice/BrightnessController.cpp b/libhwc2.1/libdevice/BrightnessController.cpp
index 1057629..4e16dbe 100644
--- a/libhwc2.1/libdevice/BrightnessController.cpp
+++ b/libhwc2.1/libdevice/BrightnessController.cpp
@@ -60,6 +60,9 @@ int BrightnessController::initDrm(const DrmDevice& drmDevice,
mLhbmSupported = connector.lhbm_on().id() != 0;
mGhbmSupported = connector.hbm_mode().id() != 0;
+
+ /* allow the first brightness to apply */
+ mBrightnessFloatReq.set_dirty();
return NO_ERROR;
}
@@ -214,6 +217,9 @@ int BrightnessController::processDisplayBrightness(float brightness, const nsecs
{
std::lock_guard<std::recursive_mutex> lock(mBrightnessMutex);
+ /* apply the first brightness */
+ if (mBrightnessFloatReq.is_dirty()) mBrightnessLevel.set_dirty();
+
mBrightnessFloatReq.store(brightness);
if (!mBrightnessFloatReq.is_dirty()) {
return NO_ERROR;
@@ -381,13 +387,17 @@ float BrightnessController::getSdrDimRatioForInstantHbm() {
return ratio;
}
-void BrightnessController::onClearDisplay() {
+void BrightnessController::onClearDisplay(bool needModeClear) {
resetLhbmState();
+ mInstantHbmReq.reset(false);
+
+ if (mBrightnessLevel.is_dirty()) applyBrightnessViaSysfs(mBrightnessLevel.get());
+
+ if (!needModeClear) return;
std::lock_guard<std::recursive_mutex> lock(mBrightnessMutex);
mEnhanceHbmReq.reset(false);
mBrightnessFloatReq.reset(-1);
- mInstantHbmReq.reset(false);
mBrightnessLevel.reset(0);
mDisplayWhitePointNits = 0;
diff --git a/libhwc2.1/libdevice/BrightnessController.h b/libhwc2.1/libdevice/BrightnessController.h
index 1a19758..b45fa4a 100644
--- a/libhwc2.1/libdevice/BrightnessController.h
+++ b/libhwc2.1/libdevice/BrightnessController.h
@@ -90,7 +90,7 @@ public:
*/
float getSdrDimRatioForInstantHbm();
- void onClearDisplay();
+ void onClearDisplay(bool needModeClear);
/**
* apply brightness change on drm path.
diff --git a/libhwc2.1/libdevice/ExynosDisplay.cpp b/libhwc2.1/libdevice/ExynosDisplay.cpp
index 2ccab48..79ecd9b 100644
--- a/libhwc2.1/libdevice/ExynosDisplay.cpp
+++ b/libhwc2.1/libdevice/ExynosDisplay.cpp
@@ -4381,7 +4381,7 @@ int ExynosDisplay::clearDisplay(bool needModeClear) {
mLastRetireFence = fence_close(mLastRetireFence, this, FENCE_TYPE_RETIRE, FENCE_IP_DPP);
if (mBrightnessController) {
- mBrightnessController->onClearDisplay();
+ mBrightnessController->onClearDisplay(needModeClear);
}
return ret;
}