diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-01-17 11:00:58 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-01-17 11:00:58 +0000 |
commit | f6b6973db360d04c4f0bdcb3776b1bc00f789716 (patch) | |
tree | 212434fe3842bd25a1eeb08cb727d54cb8df1475 /driver | |
parent | b9e02db1d89692f477279fd941deb16d1772780e (diff) |
Open /dev/drm0 instead of /dev/dri/card0 and add privsep support.
ok jsg@
Diffstat (limited to 'driver')
-rw-r--r-- | driver/xf86-video-modesetting/src/driver.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/driver/xf86-video-modesetting/src/driver.c b/driver/xf86-video-modesetting/src/driver.c index 05b6176cb..a586ee45d 100644 --- a/driver/xf86-video-modesetting/src/driver.c +++ b/driver/xf86-video-modesetting/src/driver.c @@ -62,6 +62,12 @@ #include "compat-api.h" #include "driver.h" +#ifdef X_PRIVSEP +extern int priv_open_device(const char *); +#else +#define priv_open_device(n) open(n,O_RDWR|O_NONBLOCK|O_EXCL) +#endif + static void AdjustFrame(ADJUST_FRAME_ARGS_DECL); static Bool CloseScreen(CLOSE_SCREEN_ARGS_DECL); static Bool EnterVT(VT_FUNC_ARGS_DECL); @@ -187,12 +193,12 @@ static int open_hw(char *dev) { int fd; if (dev) - fd = open(dev, O_RDWR, 0); + fd = priv_open_device(dev); else { dev = getenv("KMSDEVICE"); - if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) { - dev = "/dev/dri/card0"; - fd = open(dev,O_RDWR, 0); + if ((NULL == dev) || ((fd = priv_open_device(dev)) == -1)) { + dev = "/dev/drm0"; + fd = priv_open_device(dev); } } if (fd == -1) |