c72d21a
From 227734be9cbd9934e51a345ccb6b28524c784584 Mon Sep 17 00:00:00 2001
c72d21a
From: Hans de Goede <hdegoede@redhat.com>
c72d21a
Date: Tue, 18 Oct 2016 16:10:19 +0200
c72d21a
Subject: [PATCH xserver v2 2/7] xfree86: Xorg.wrap: Do not require root rights
c72d21a
 for cards with 0 outputs
c72d21a
c72d21a
Prior to this commit the Xorg.wrap code to detect if root rights
c72d21a
are necessary checked for DRM_IOCTL_MODE_GETRESOURCES succeeding *and*
c72d21a
reporting more then 0 output connectors.
c72d21a
c72d21a
DRM_IOCTL_MODE_GETRESOURCES succeeding alone is enough to differentiate
c72d21a
between old drm only cards (which need ums and thus root) and kms capable
c72d21a
cards.
c72d21a
c72d21a
Some hybrid gfx laptops have 0 output connectors on one of their 2 GPUs,
c72d21a
resulting in Xorg needlessly running as root. This commits removes the
c72d21a
res.count_connectors > 0 check, fixing this.
c72d21a
c72d21a
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
c72d21a
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
c72d21a
---
c72d21a
 hw/xfree86/xorg-wrapper.c | 2 +-
c72d21a
 1 file changed, 1 insertion(+), 1 deletion(-)
c72d21a
c72d21a
diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
c72d21a
index d930962..a25e6ff 100644
c72d21a
--- a/hw/xfree86/xorg-wrapper.c
c72d21a
+++ b/hw/xfree86/xorg-wrapper.c
c72d21a
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
c72d21a
 
c72d21a
             memset(&res, 0, sizeof(struct drm_mode_card_res));
c72d21a
             r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res;;
c72d21a
-            if (r == 0 && res.count_connectors > 0)
c72d21a
+            if (r == 0)
c72d21a
                 kms_cards++;
c72d21a
 
c72d21a
             close(fd);
c72d21a
-- 
c72d21a
2.9.3
c72d21a