aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaiyi Li <kaiyili@google.com>2024-01-23 16:24:23 -0800
committerKaiyi Li <kaiyili@google.com>2024-01-24 11:37:37 -0800
commit7d3a6601425d415c988ad3ee6232e001f0dd84e6 (patch)
treecb22d8211ce4df0d12a0e857b811ad3718d36e34
parent32fc2c7b201d9d7072755af736bde68a1f6ce979 (diff)
downloadgoldfish-opengl-7d3a6601425d415c988ad3ee6232e001f0dd84e6.tar.gz
HWC3: do not query pmem if not enabled
This change will reduce some error logs if pmem is not used to set the boot config id. Bug: b/322199104 Change-Id: I49eea74b47e0871b9447d58689dda168f9fd4fb7
-rw-r--r--system/hwc3/Device.cpp1
-rw-r--r--system/hwc3/Device.h2
-rw-r--r--system/hwc3/Display.cpp5
3 files changed, 8 insertions, 0 deletions
diff --git a/system/hwc3/Device.cpp b/system/hwc3/Device.cpp
index 04933ab4..2f03f6ab 100644
--- a/system/hwc3/Device.cpp
+++ b/system/hwc3/Device.cpp
@@ -162,4 +162,5 @@ HWC3::Error Device::setPersistentKeyValue(const std::string& key, const std::str
return HWC3::Error::None;
}
+bool Device::persistentKeyValueEnabled() const { return !getPmemPath().empty(); }
} // namespace aidl::android::hardware::graphics::composer3::impl
diff --git a/system/hwc3/Device.h b/system/hwc3/Device.h
index 443786ab..196f51b7 100644
--- a/system/hwc3/Device.h
+++ b/system/hwc3/Device.h
@@ -36,6 +36,8 @@ class Device : public ::android::Singleton<Device> {
HWC3::Error getComposer(FrameComposer** outComposer);
+ bool persistentKeyValueEnabled() const;
+
HWC3::Error getPersistentKeyValue(const std::string& key, const std::string& defaultVal,
std::string* outValue);
diff --git a/system/hwc3/Display.cpp b/system/hwc3/Display.cpp
index 7fef3bbc..3142e484 100644
--- a/system/hwc3/Display.cpp
+++ b/system/hwc3/Display.cpp
@@ -496,6 +496,11 @@ HWC3::Error Display::setActiveConfigWithConstraints(int32_t configId,
std::optional<int32_t> Display::getBootConfigId() {
DEBUG_LOG("%s: display:%" PRId64, __FUNCTION__, mId);
+ if (!Device::getInstance().persistentKeyValueEnabled()) {
+ ALOGD("%s: persistent boot config is not enabled.", __FUNCTION__);
+ return std::nullopt;
+ }
+
std::unique_lock<std::recursive_mutex> lock(mStateMutex);
std::string val;