sm6375-common: power-libperfmgr: ADPF: avoid to call close() twice

To get rid of error logs, avoid to call close() twice.

07-29 17:20:35.341 E powerhal-libperfmgr: Unexpected Error! Failed to
look up tid:2585 in TidRefCountMap
07-29 17:20:35.341 E powerhal-libperfmgr: Unexpected Error! Failed to
look up tid:2586 in TidRefCountMap
07-29 17:20:35.341 E powerhal-libperfmgr: Unexpected Error! Failed to
look up tid:2031 in TidRefCountMap
07-29 17:20:35.341 E powerhal-libperfmgr: Unexpected Error! Failed to
look up tid:2585 in TidRefCountMap

Bug: 194775170
Test: build and check log.
Change-Id: I91adf907b837382f68935b9054e19465a499049c
This commit is contained in:
Jimmy Shiu 2024-07-18 20:16:00 +05:30 committed by Anand S
parent 0515fc6f25
commit 20db3354f7
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
2 changed files with 6 additions and 1 deletions

View file

@ -24,6 +24,7 @@
#include <sys/syscall.h>
#include <time.h>
#include <utils/Trace.h>
#include <atomic>
#include "PowerHintSession.h"
#include "PowerSessionManager.h"
@ -238,8 +239,11 @@ ndk::ScopedAStatus PowerHintSession::resume() {
}
ndk::ScopedAStatus PowerHintSession::close() {
bool sessionClosedExpectedToBe = false;
if (!mSessionClosed.compare_exchange_strong(sessionClosedExpectedToBe, true)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
PowerHintMonitor::getInstance()->getLooper()->removeMessages(mStaleHandler);
// Reset to (0, 1024) uclamp value -- instead of threads' original setting.
setUclamp(0);
PowerSessionManager::getInstance()->removePowerSession(this);
updateUniveralBoostMode();

View file

@ -108,6 +108,7 @@ class PowerHintSession : public BnPowerHintSession {
sp<MessageHandler> mPowerManagerHandler;
std::mutex mLock;
const nanoseconds kAdpfRate;
std::atomic<bool> mSessionClosed = false;
};
} // namespace pixel