summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2008-08-24 16:54:43 +1000
committerDave Airlie <airlied@linux.ie>2008-08-24 16:54:47 +1000
commit9101a0205c897fea28e6a3d875111a83ad7f7732 (patch)
treec10c1b54f5ea1e2605555e56513501350cc5feee /libdrm
parent0da66c27fa2aabdbaf4c003ba3712a61253d7ffe (diff)
libdrm: add udev support.
This patch allows you to --enable-udev, and will avoid having libdrm make device nodes. If you are using udev, you should really --enable-udev your libdrm.
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 7202c8d7..c36f1964 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -297,6 +297,7 @@ static int drmOpenDevice(long dev, int minor)
group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
}
+#if !defined(UDEV)
if (stat(DRM_DIR_NAME, &st)) {
if (!isroot)
return DRM_ERR_NOT_ROOT;
@@ -317,6 +318,30 @@ static int drmOpenDevice(long dev, int minor)
chown(buf, user, group);
chmod(buf, devmode);
}
+#else
+ /* if we modprobed then wait for udev */
+ {
+ int udev_count = 0;
+wait_for_udev:
+ if (stat(DRM_DIR_NAME, &st)) {
+ usleep(20);
+ udev_count++;
+
+ if (udev_count == 50)
+ return -1;
+ goto wait_for_udev;
+ }
+
+ if (stat(buf, &st)) {
+ usleep(20);
+ udev_count++;
+
+ if (udev_count == 50)
+ return -1;
+ goto wait_for_udev;
+ }
+ }
+#endif
fd = open(buf, O_RDWR, 0);
drmMsg("drmOpenDevice: open result is %d, (%s)\n",