summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Chang <cweichun@google.com>2023-11-25 22:25:53 +0000
committerJohn Chang <cweichun@google.com>2023-12-05 00:46:47 +0000
commit1769aeed2620f3efb8d1229fb6069639d432ba71 (patch)
treed171a3bd5bfd4b6e27d2804ab8dbdbc23321479b
parent7241df2099d5cd19d48789e781a468a33457ad27 (diff)
downloadcommon-1769aeed2620f3efb8d1229fb6069639d432ba71.tar.gz
libhwc2.1: vrrController: avoid post timeout event when doze/off state
Prior to transitioning from off/doze to the normal power mode, the system will set the active configuration. During this phase, it should avoid posting timeout event to avoid unexpected timeouts, which could potentially result in VRR controller state transition errors. Instead, the timeout event will post within setPowerMode in this case. Bug: 309873055 Test: no unexpected timeouts and pending event warnings during power mode transition Change-Id: I41363d2f91094297ab43b1c991747c6360277a1f
-rw-r--r--libhwc2.1/libvrr/VariableRefreshRateController.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libhwc2.1/libvrr/VariableRefreshRateController.cpp b/libhwc2.1/libvrr/VariableRefreshRateController.cpp
index a008ef2..a93c3b9 100644
--- a/libhwc2.1/libvrr/VariableRefreshRateController.cpp
+++ b/libhwc2.1/libvrr/VariableRefreshRateController.cpp
@@ -114,7 +114,8 @@ void VariableRefreshRateController::reset() {
}
void VariableRefreshRateController::setActiveVrrConfiguration(hwc2_config_t config) {
- LOG(INFO) << "VrrController: Set active Vrr configuration = " << config;
+ LOG(INFO) << "VrrController: Set active Vrr configuration = " << config
+ << ", power mode = " << mPowerMode;
ATRACE_CALL();
{
const std::lock_guard<std::mutex> lock(mMutex);
@@ -122,8 +123,11 @@ void VariableRefreshRateController::setActiveVrrConfiguration(hwc2_config_t conf
LOG(ERROR) << "VrrController: Set an undefined active configuration";
return;
}
- mState = VrrControllerState::kRendering;
mVrrActiveConfig = config;
+ if (mState == VrrControllerState::kDisable) {
+ return;
+ }
+ mState = VrrControllerState::kRendering;
dropEventLocked(kRenderingTimeout);
const auto& vrrConfig = mVrrConfigs[mVrrActiveConfig];
@@ -173,6 +177,7 @@ void VariableRefreshRateController::setPowerMode(int32_t powerMode) {
LOG(WARNING) << "VrrController: there should be no pending event when resume "
"from power mode = "
<< mPowerMode << " to power mode = " << powerMode;
+ LOG(INFO) << dumpEventQueueLocked();
}
mState = VrrControllerState::kRendering;
const auto& vrrConfig = mVrrConfigs[mVrrActiveConfig];
@@ -346,6 +351,7 @@ std::string VariableRefreshRateController::dumpEventQueueLocked() {
std::priority_queue<VrrControllerEvent> q;
while (!mEventQueue.empty()) {
const auto& it = mEventQueue.top();
+ content += "VrrController: event = ";
content += it.toString();
content += "\n";
q.push(it);