diff options
-rw-r--r-- | test/common/va_display_drm.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/test/common/va_display_drm.c b/test/common/va_display_drm.c index aa9f60a..b6394cd 100644 --- a/test/common/va_display_drm.c +++ b/test/common/va_display_drm.c @@ -37,12 +37,28 @@ static int drm_fd = -1; 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; + + static const char *drm_device_paths[] = { + "/dev/dri/renderD128", + "/dev/dri/card0", + NULL + }; + + for (i = 0; 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 |