diff options
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 2f7edb9f277..9a7633a070a 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -492,7 +492,12 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) gbm = disp->PlatformDisplay; if (gbm == NULL) { - fd = open("/dev/dri/card0", O_RDWR); + char buf[64]; + int n = snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, 0); + if (n != -1 && n < sizeof(buf)) + fd = open(buf, O_RDWR); + if (fd < 0) + fd = open("/dev/dri/card0", O_RDWR); dri2_dpy->own_device = 1; gbm = gbm_create_device(fd); if (gbm == NULL) |