drm_hwcomposer: treewide: Handle bool properties in the Property class
To clean things up and unify the usage of properties.
Change-Id: I0e034ed309f5f8a0d4fc9be7a4a3edcb39050e7f
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/drm/DrmDisplayPipeline.cpp b/drm/DrmDisplayPipeline.cpp
index 2d81578..7588ee2 100644
--- a/drm/DrmDisplayPipeline.cpp
+++ b/drm/DrmDisplayPipeline.cpp
@@ -158,22 +158,12 @@
return {};
}
-static bool ReadUseOverlayProperty() {
- char use_overlay_planes_prop[PROPERTY_VALUE_MAX];
- property_get("vendor.hwc.drm.use_overlay_planes", use_overlay_planes_prop,
- "1");
- constexpr int kStrtolBase = 10;
- return strtol(use_overlay_planes_prop, nullptr, kStrtolBase) != 0;
-}
-
auto DrmDisplayPipeline::GetUsablePlanes()
-> std::vector<std::shared_ptr<BindingOwner<DrmPlane>>> {
std::vector<std::shared_ptr<BindingOwner<DrmPlane>>> planes;
planes.emplace_back(primary_plane);
- const static bool kUseOverlayPlanes = ReadUseOverlayProperty();
-
- if (kUseOverlayPlanes) {
+ if (Properties::UseOverlayPlanes()) {
for (const auto &plane : device->GetPlanes()) {
if (plane->IsCrtcSupported(*crtc->Get())) {
if (plane->GetType() == DRM_PLANE_TYPE_OVERLAY) {
diff --git a/drm/DrmHwc.cpp b/drm/DrmHwc.cpp
index aaba506..3f30123 100644
--- a/drm/DrmHwc.cpp
+++ b/drm/DrmHwc.cpp
@@ -200,7 +200,7 @@
/* Virtual display is an experimental feature.
* Unless explicitly set to true, return 0 for no support.
*/
- if (0 == property_get_bool("vendor.hwc.drm.enable_virtual_display", 0)) {
+ if (!Properties::EnableVirtualDisplay()) {
return 0;
}
diff --git a/drm/ResourceManager.cpp b/drm/ResourceManager.cpp
index 0c23734..9c68816 100644
--- a/drm/ResourceManager.cpp
+++ b/drm/ResourceManager.cpp
@@ -76,10 +76,9 @@
}
}
- char proptext[PROPERTY_VALUE_MAX];
- property_get("vendor.hwc.drm.scale_with_gpu", proptext, "0");
- scale_with_gpu_ = bool(strncmp(proptext, "0", 1));
+ scale_with_gpu_ = Properties::ScaleWithGpu();
+ char proptext[PROPERTY_VALUE_MAX];
constexpr char kDrmOrGpu[] = "DRM_OR_GPU";
constexpr char kDrmOrIgnore[] = "DRM_OR_IGNORE";
property_get("vendor.hwc.drm.ctm", proptext, kDrmOrGpu);