diff options
author | Long Ling <longling@google.com> | 2023-02-03 10:53:25 -0800 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-02-03 19:52:01 +0000 |
commit | 2f037bf60d3db37cd29a3cc25777a3ef7ad3ce64 (patch) | |
tree | e1d31eba8f6b846732c1b8fae5561d033e49e277 /libhwc2.1/libdevice/BrightnessController.cpp | |
parent | 199bff2a98dcdea14abb3eecbb5c2ba5746310ad (diff) |
Revert "libhwc2.1: wait for peak refresh rate via sysfs node"
Revert submission 21117545-rr_sysfs
Reason for revert: b/267569180
Reverted changes: /q/submissionid:21117545-rr_sysfs
Change-Id: Ifaaee60913ffc32e8ae9ab7acec327a968468ac7
(cherry picked from commit 334e1fee2f8204c8b30714291d60c19077e6df9f)
Merged-In: Ifaaee60913ffc32e8ae9ab7acec327a968468ac7
Diffstat (limited to 'libhwc2.1/libdevice/BrightnessController.cpp')
-rw-r--r-- | libhwc2.1/libdevice/BrightnessController.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/libhwc2.1/libdevice/BrightnessController.cpp b/libhwc2.1/libdevice/BrightnessController.cpp index 5b91786..497889a 100644 --- a/libhwc2.1/libdevice/BrightnessController.cpp +++ b/libhwc2.1/libdevice/BrightnessController.cpp @@ -713,23 +713,12 @@ int BrightnessController::checkSysfsStatus(const char* file, char buf[16]; String8 nodeName; - if (std::strstr(file, "%d")) { - nodeName.appendFormat(file, mPanelIndex); - } else if (std::strstr(file, "%s")) { - nodeName.appendFormat(file, mPanelIndex == 0 ? "primary" - : mPanelIndex == 1 ? "secondary" : "unknown"); - } else { - nodeName = file; - } + nodeName.appendFormat(file, mPanelIndex); UniqueFd fd = open(nodeName.string(), O_RDONLY); - if (fd.get() < 0) { - ALOGE("%s failed to open sysfs %s: %s", __func__, nodeName.c_str(), strerror(errno)); - return false; - } int size = read(fd.get(), buf, sizeof(buf)); if (size <= 0) { - ALOGE("%s failed to read from %s: %s", __func__, nodeName.c_str(), strerror(errno)); + ALOGE("%s failed to read from %s", __func__, kLocalHbmModeFileNode); return false; } @@ -756,7 +745,7 @@ int BrightnessController::checkSysfsStatus(const char* file, } int pollRet = poll(&pfd, 1, ns2ms(remainTimeNs)); if (pollRet == 0) { - ALOGW("%s poll %s timeout", __func__, nodeName.c_str()); + ALOGW("%s poll timeout", __func__); // time out ret = ETIMEDOUT; break; @@ -771,8 +760,7 @@ int BrightnessController::checkSysfsStatus(const char* file, val = std::string(buf, size - 1); if (std::find(expectedValue.begin(), expectedValue.end(), val) != expectedValue.end()) { - ret = OK; - break; + ret = 0; } else { std::string values; for (auto& s : expectedValue) { @@ -783,12 +771,13 @@ int BrightnessController::checkSysfsStatus(const char* file, } ALOGE("%s read %s expected %s after notified", __func__, val.c_str(), values.c_str()); + ret = EINVAL; } } else { ret = EIO; ALOGE("%s failed to read after notified %d", __func__, errno); - break; } + break; } else { if (errno == EAGAIN || errno == EINTR) { continue; |