drm_hwcomposer: Move IsKMSDev to DrmDevice
IsKMSDev() is a DRM device helper, therefore DrmDevice class
is better home for it.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/drm/ResourceManager.cpp b/drm/ResourceManager.cpp
index 5a5a241..c55d6b8 100644
--- a/drm/ResourceManager.cpp
+++ b/drm/ResourceManager.cpp
@@ -51,7 +51,7 @@
if (stat(path.str().c_str(), &buf))
break;
- if (IsKMSDev(path.str().c_str()))
+ if (DrmDevice::IsKMSDev(path.str().c_str()))
ret = AddDrmDevice(path.str());
}
}
@@ -83,23 +83,6 @@
return ret;
}
-bool ResourceManager::IsKMSDev(const char *path) {
- auto fd = UniqueFd(open(path, O_RDWR | O_CLOEXEC));
- if (!fd) {
- return false;
- }
-
- auto res = MakeDrmModeResUnique(fd.Get());
- if (!res) {
- return false;
- }
-
- bool is_kms = res->count_crtcs > 0 && res->count_connectors > 0 &&
- res->count_encoders > 0;
-
- return is_kms;
-}
-
DrmDevice *ResourceManager::GetDrmDevice(int display) {
for (auto &drm : drms_) {
if (drm->HandlesDisplay(display))