summaryrefslogtreecommitdiff
path: root/power-libperfmgr
diff options
context:
space:
mode:
authorMartin Liu <liumartin@google.com>2019-04-03 17:58:43 +0800
committerMartin Liu <liumartin@google.com>2019-04-03 11:33:20 +0000
commit42e1c24b55d8d1500fbc05a6b51bd29934779c16 (patch)
treed5f225c5f4975d93f82183ac5a2bf0c5b330d3d6 /power-libperfmgr
parent2273ac5b214245547cbec480706ba0dc24bc5931 (diff)
downloadpixel-42e1c24b55d8d1500fbc05a6b51bd29934779c16.tar.gz
PowerHal: Support legacy fb path
This patch is to support legacy fb path Bug: 129495482 Test: boot and check Interaction hint Change-Id: Ib0dc55a802c30fbf7ed41ecc73bcb08a0c65a432
Diffstat (limited to 'power-libperfmgr')
-rw-r--r--power-libperfmgr/InteractionHandler.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/power-libperfmgr/InteractionHandler.cpp b/power-libperfmgr/InteractionHandler.cpp
index 79754823..da6a9173 100644
--- a/power-libperfmgr/InteractionHandler.cpp
+++ b/power-libperfmgr/InteractionHandler.cpp
@@ -28,12 +28,14 @@
#include "InteractionHandler.h"
-#define FB_IDLE_PATH "/sys/class/drm/card0/device/idle_state"
#define MAX_LENGTH 64
#define MSINSEC 1000L
#define USINMS 1000000L
+static const std::vector<std::string> fb_idle_patch = {"/sys/class/drm/card0/device/idle_state",
+ "/sys/class/graphics/fb0/idle_state"};
+
InteractionHandler::InteractionHandler(std::shared_ptr<HintManager> const &hint_manager)
: mState(INTERACTION_STATE_UNINITIALIZED),
mWaitMs(100),
@@ -46,17 +48,27 @@ InteractionHandler::~InteractionHandler() {
Exit();
}
+static int fb_idle_open(void) {
+ int fd;
+ for (auto &path : fb_idle_patch) {
+ fd = open(path.c_str(), O_RDONLY);
+ if (fd >= 0)
+ return fd;
+ }
+ ALOGE("Unable to open fb idle state path (%d)", errno);
+ return -1;
+}
+
bool InteractionHandler::Init() {
std::lock_guard<std::mutex> lk(mLock);
if (mState != INTERACTION_STATE_UNINITIALIZED)
return true;
- mIdleFd = open(FB_IDLE_PATH, O_RDONLY);
- if (mIdleFd < 0) {
- ALOGE("Unable to open idle state path (%d)", errno);
+ int fd = fb_idle_open();
+ if (fd < 0)
return false;
- }
+ mIdleFd = fd;
mEventFd = eventfd(0, EFD_NONBLOCK);
if (mEventFd < 0) {