aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Macnak <natsu@google.com>2020-09-08 17:12:49 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-09-08 17:12:49 +0000
commit9d9a3bf320543c211e4a2d64adf2558e2bd8fdf0 (patch)
tree407f05ed314440f47f459e47b4adbb4c205154e6
parent48eaaa48138e6598f9ed7dff293c4a2479a10a6e (diff)
parent3598c2e2a2f837d9e577455c9e6cdb33972446e2 (diff)
downloaddrm_hwcomposer-9d9a3bf320543c211e4a2d64adf2558e2bd8fdf0.tar.gz
Merge remote-tracking branch 'aosp/upstream-main' into HEAD am: 42de64e56d am: 58a4d1f46b am: 2b534bc255 am: 3598c2e2a2
Original change: https://android-review.googlesource.com/c/platform/external/drm_hwcomposer/+/1419031 Change-Id: Iffe2041c77afb5e90616df3030b17ee09c5e8c78
-rw-r--r--drm/drmdevice.cpp8
-rw-r--r--drm/resourcemanager.cpp34
-rw-r--r--drmhwctwo.cpp3
-rw-r--r--include/resourcemanager.h1
-rw-r--r--platform/platformdrmgeneric.cpp3
5 files changed, 40 insertions, 9 deletions
diff --git a/drm/drmdevice.cpp b/drm/drmdevice.cpp
index bef41d8..d7fd2f2 100644
--- a/drm/drmdevice.cpp
+++ b/drm/drmdevice.cpp
@@ -59,7 +59,7 @@ namespace android {
static std::vector<std::string> read_primary_display_order_prop() {
std::array<char, PROPERTY_VALUE_MAX> display_order_buf;
- property_get("hwc.drm.primary_display_order", display_order_buf.data(),
+ property_get("vendor.hwc.drm.primary_display_order", display_order_buf.data(),
"...");
std::vector<std::string> display_order;
@@ -254,7 +254,7 @@ std::tuple<int, int> DrmDevice::Init(const char *path, int num_displays) {
}
// Primary display priority:
- // 1) hwc.drm.primary_display_order property
+ // 1) vendor.hwc.drm.primary_display_order property
// 2) internal connectors
// 3) anything else
std::vector<DrmConnector *>
@@ -267,8 +267,8 @@ std::tuple<int, int> DrmDevice::Init(const char *path, int num_displays) {
found_primary = true;
} else {
ALOGE(
- "Failed to find primary display from \"hwc.drm.primary_display_order\" "
- "property");
+ "Failed to find primary display from "
+ "\"vendor.hwc.drm.primary_display_order\" property");
}
// If no priority display were found then pick first available as primary and
diff --git a/drm/resourcemanager.cpp b/drm/resourcemanager.cpp
index da1a2db..986d4ab 100644
--- a/drm/resourcemanager.cpp
+++ b/drm/resourcemanager.cpp
@@ -20,6 +20,7 @@
#include <cutils/properties.h>
#include <log/log.h>
+#include <sys/stat.h>
#include <sstream>
#include <string>
@@ -32,7 +33,8 @@ int ResourceManager::Init() {
char path_pattern[PROPERTY_VALUE_MAX];
// Could be a valid path or it can have at the end of it the wildcard %
// which means that it will try open all devices until an error is met.
- int path_len = property_get("hwc.drm.device", path_pattern, "/dev/dri/card0");
+ int path_len = property_get("vendor.hwc.drm.device", path_pattern,
+ "/dev/dri/card%");
int ret = 0;
if (path_pattern[path_len - 1] != '%') {
ret = AddDrmDevice(std::string(path_pattern));
@@ -41,7 +43,13 @@ int ResourceManager::Init() {
for (int idx = 0; !ret; ++idx) {
std::ostringstream path;
path << path_pattern << idx;
- ret = AddDrmDevice(path.str());
+
+ struct stat buf;
+ if (stat(path.str().c_str(), &buf)) {
+ break;
+ } else if (IsKMSDev(path.str().c_str())) {
+ ret = AddDrmDevice(path.str());
+ }
}
}
@@ -51,7 +59,7 @@ int ResourceManager::Init() {
}
char scale_with_gpu[PROPERTY_VALUE_MAX];
- property_get("hwc.drm.scale_with_gpu", scale_with_gpu, "0");
+ property_get("vendor.hwc.drm.scale_with_gpu", scale_with_gpu, "0");
scale_with_gpu_ = bool(strncmp(scale_with_gpu, "0", 1));
return hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
@@ -94,6 +102,26 @@ DrmConnector *ResourceManager::AvailableWritebackConnector(int display) {
return writeback_conn;
}
+bool ResourceManager::IsKMSDev(const char *path) {
+ int fd = open(path, O_RDWR | O_CLOEXEC);
+ if (fd < 0)
+ return false;
+
+ auto res = drmModeGetResources(fd);
+ if (!res) {
+ close(fd);
+ return false;
+ }
+
+ bool is_kms = res->count_crtcs > 0 && res->count_connectors > 0 &&
+ res->count_encoders > 0;
+
+ drmModeFreeResources(res);
+ close(fd);
+
+ return is_kms;
+}
+
DrmDevice *ResourceManager::GetDrmDevice(int display) {
for (auto &drm : drms_) {
if (drm->HandlesDisplay(display))
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index 5afc96d..a847c35 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -271,7 +271,8 @@ HWC2::Error DrmHwcTwo::HwcDisplay::Init(std::vector<DrmPlane *> *planes) {
// Split up the given display planes into primary and overlay to properly
// interface with the composition
char use_overlay_planes_prop[PROPERTY_VALUE_MAX];
- property_get("hwc.drm.use_overlay_planes", use_overlay_planes_prop, "1");
+ property_get("vendor.hwc.drm.use_overlay_planes", use_overlay_planes_prop,
+ "1");
bool use_overlay_planes = atoi(use_overlay_planes_prop);
for (auto &plane : *planes) {
if (plane->type() == DRM_PLANE_TYPE_PRIMARY)
diff --git a/include/resourcemanager.h b/include/resourcemanager.h
index 7a86828..9fefb46 100644
--- a/include/resourcemanager.h
+++ b/include/resourcemanager.h
@@ -46,6 +46,7 @@ class ResourceManager {
private:
int AddDrmDevice(std::string path);
+ static bool IsKMSDev(const char *path);
int num_displays_;
std::vector<std::unique_ptr<DrmDevice>> drms_;
diff --git a/platform/platformdrmgeneric.cpp b/platform/platformdrmgeneric.cpp
index 1aa8160..bc28dd5 100644
--- a/platform/platformdrmgeneric.cpp
+++ b/platform/platformdrmgeneric.cpp
@@ -66,7 +66,8 @@ int DrmGenericImporter::Init() {
gralloc_->common.author);
char exclude_non_hwfb_prop[PROPERTY_VALUE_MAX];
- property_get("hwc.drm.exclude_non_hwfb_imports", exclude_non_hwfb_prop, "0");
+ property_get("vendor.hwc.drm.exclude_non_hwfb_imports", exclude_non_hwfb_prop,
+ "0");
exclude_non_hwfb_ = static_cast<bool>(strncmp(exclude_non_hwfb_prop, "0", 1));
return 0;