From f6b6973db360d04c4f0bdcb3776b1bc00f789716 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 17 Jan 2013 11:00:58 +0000 Subject: Open /dev/drm0 instead of /dev/dri/card0 and add privsep support. ok jsg@ --- driver/xf86-video-modesetting/src/driver.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'driver/xf86-video-modesetting/src') 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) -- cgit v1.2.3