compositor: Open drm device through launcher

This commit is contained in:
Kristian Høgsberg 2013-09-17 14:03:42 -07:00
parent b42fb52537
commit 1ff5109b5f
2 changed files with 6 additions and 3 deletions

View File

@ -1215,7 +1215,7 @@ init_drm(struct drm_compositor *ec, struct udev_device *device)
} }
filename = udev_device_get_devnode(device); filename = udev_device_get_devnode(device);
fd = open(filename, O_RDWR | O_CLOEXEC); fd = weston_launcher_open(&ec->base, filename, O_RDWR);
if (fd < 0) { if (fd < 0) {
/* Probably permissions error */ /* Probably permissions error */
weston_log("couldn't open %s, skipping\n", weston_log("couldn't open %s, skipping\n",

View File

@ -58,6 +58,8 @@
#include "weston-launch.h" #include "weston-launch.h"
#define DRM_MAJOR 226
#define MAX_ARGV_SIZE 256 #define MAX_ARGV_SIZE 256
struct weston_launch { struct weston_launch {
@ -313,10 +315,11 @@ handle_open(struct weston_launch *wl, struct msghdr *msg, ssize_t len)
goto err0; goto err0;
} }
if (major(s.st_rdev) != INPUT_MAJOR) { if (major(s.st_rdev) != INPUT_MAJOR &&
major(s.st_rdev) != DRM_MAJOR) {
close(fd); close(fd);
fd = -1; fd = -1;
fprintf(stderr, "Device %s is not an input device\n", fprintf(stderr, "Device %s is not an input or drm device\n",
message->path); message->path);
goto err0; goto err0;
} }