diff --git a/src/intel_device.c b/src/intel_device.c index a55f62b2..43372284 100644 --- a/src/intel_device.c +++ b/src/intel_device.c @@ -270,6 +270,18 @@ static int get_fd(struct xf86_platform_device *dev) } #endif +static int is_master(int fd) +{ + drmSetVersion sv; + + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; + sv.drm_dd_minor = -1; + + return drmIoctl(fd, DRM_IOCTL_SET_VERSION, &sv) == 0; +} + int intel_open_device(int entity_num, const struct pci_device *pci, struct xf86_platform_device *platform) @@ -316,6 +328,10 @@ int intel_open_device(int entity_num, if (hosted()) master_count++; + /* Non-root user holding MASTER, don't let go */ + if (geteuid() && is_master(fd)) + master_count++; + dev->fd = fd; dev->open_count = master_count; dev->master_count = master_count;