On 23/03/14 04:53, Jonathan Gray wrote: > Don't hardcode /dev/dri/card0 but instead use the drm > macros which allows the correct /dev/drm0 device to be > opened on OpenBSD. > > v2: use snprintf and fallback to /dev/dri/card0 > suggested by Emil Velikov. > > Signed-off-by: Jonathan Gray <j...@jsg.id.au> > --- > src/egl/drivers/dri2/platform_drm.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/src/egl/drivers/dri2/platform_drm.c > b/src/egl/drivers/dri2/platform_drm.c > index 2f7edb9..964ac5a 100644 > --- a/src/egl/drivers/dri2/platform_drm.c > +++ b/src/egl/drivers/dri2/platform_drm.c > @@ -492,7 +492,11 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) > > gbm = disp->PlatformDisplay; > if (gbm == NULL) { > - fd = open("/dev/dri/card0", O_RDWR); > + char buf[64]; > + if (snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, 0) != -1) If I'm reading things correctly, one should check against the correct length as snprintf may return smaller value on failure, and -1 when it's completely stuffed.
With that fixed all three patches are Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com> I would not object if anyone else takes a look, so that we can land those in time for 10.1.1. Many thanks for the patches Jonathan. -Emil > + 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) > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev