[Libva] [PATCH 2/2] tests: try a render-node device by default for VA/DRM displays.

Gwenole Beauchesne gb.devel at gmail.com
Wed Sep 24 01:40:03 PDT 2014


Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 test/common/va_display_drm.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/test/common/va_display_drm.c b/test/common/va_display_drm.c
index aa9f60a..d427984 100644
--- a/test/common/va_display_drm.c
+++ b/test/common/va_display_drm.c
@@ -34,15 +34,31 @@
 
 static int drm_fd = -1;
 
+static const char *drm_device_paths[] = {
+    "/dev/dri/renderD128",
+    "/dev/dri/card0",
+    NULL
+};
+
 static VADisplay
 va_open_display_drm(void)
 {
-    drm_fd = open("/dev/dri/card0", O_RDWR);
-    if (drm_fd < 0) {
-        fprintf(stderr, "error: can't open DRM connection!\n");
-        return NULL;
+    VADisplay va_dpy;
+    int i;
+
+    for (i = 0; !va_dpy && drm_device_paths[i]; i++) {
+        drm_fd = open(drm_device_paths[i], O_RDWR);
+        if (drm_fd < 0)
+            continue;
+
+        va_dpy = vaGetDisplayDRM(drm_fd);
+        if (va_dpy)
+            return va_dpy;
+
+        close(drm_fd);
+        drm_fd = -1;
     }
-    return vaGetDisplayDRM(drm_fd);
+    return NULL;
 }
 
 static void
-- 
1.9.1



More information about the Libva mailing list