drm_hwcomposer: Support other drm nodes than card0
On dragon, card0 = Nouveau, card1 = TegraDRM.
Change-Id: Ie69639e40162ceb4ab99025dd9406ae44b7204c8
Reviewed-on: https://chrome-internal-review.googlesource.com/196021
Reviewed-by: Stéphane Marchesin <marcheu@google.com>
Commit-Queue: Stéphane Marchesin <marcheu@google.com>
Tested-by: Stéphane Marchesin <marcheu@google.com>
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index cf0a8c3..92cfea6 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -31,6 +31,7 @@
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
+#include <cutils/properties.h>
#include <sync/sync.h>
#include <sw_sync.h>
@@ -1276,6 +1277,7 @@
{
int ret = 0;
struct hwc_context_t *ctx;
+ char path[PROPERTY_VALUE_MAX];
if (strcmp(name, HWC_HARDWARE_COMPOSER)) {
ALOGE("Invalid module name- %s", name);
@@ -1294,8 +1296,9 @@
goto out;
}
+ property_get("hwc.drm.device", path, HWCOMPOSER_DRM_DEVICE);
/* TODO: Use drmOpenControl here instead */
- ctx->fd = open(HWCOMPOSER_DRM_DEVICE, O_RDWR);
+ ctx->fd = open(path, O_RDWR);
if (ctx->fd < 0) {
ALOGE("Failed to open dri- %s", strerror(-errno));
goto out;