drmFreeVersion(ver);
return name;
}
+
+auto DrmDevice::IsKMSDev(const char *path) -> bool {
+ 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;
+}
+
} // namespace android
return *mDrmFbImporter.get();
}
+ static auto IsKMSDev(const char *path) -> bool;
+
private:
int TryEncoderForDisplay(int display, DrmEncoder *enc);
int GetProperty(uint32_t obj_id, uint32_t obj_type, const char *prop_name,
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());
}
}
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))
private:
int AddDrmDevice(std::string const &path);
- static bool IsKMSDev(const char *path);
int num_displays_;
std::vector<std::unique_ptr<DrmDevice>> drms_;