[waffle] [PATCH] gbm: allow user to specify device

Ilia Mirkin imirkin at alum.mit.edu
Sat Aug 15 13:46:17 PDT 2015


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/waffle/gbm/wgbm_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/waffle/gbm/wgbm_display.c b/src/waffle/gbm/wgbm_display.c
index b46524a..905ca2f 100644
--- a/src/waffle/gbm/wgbm_display.c
+++ b/src/waffle/gbm/wgbm_display.c
@@ -75,6 +75,9 @@ wgbm_get_default_fd_for_pattern(const char *pattern)
     struct udev_device *device;
     int fd;
 
+    if (!pattern)
+        return -1;
+
     ud = udev_new();
     en = udev_enumerate_new(ud);
     udev_enumerate_add_match_subsystem(en, "drm");
@@ -105,6 +108,11 @@ wgbm_get_default_fd(void)
 {
     int fd;
 
+    // Try opening the user-specified device
+    fd = wgbm_get_default_fd_for_pattern(getenv("GBM_DEVICE"));
+    if (fd >= 0)
+        return fd;
+
     // Try opening render node first
     fd = wgbm_get_default_fd_for_pattern("renderD[0-9]*");
     if (fd >= 0)
-- 
2.4.6



More information about the waffle mailing list