Re: [PATCH] xfree86: Xorg.wrap: Do not require root rights for cards with 0 outputs

2016-10-18 Thread Eric Engestrom
On Tuesday, 2016-10-18 16:36:32 +0200, Hans de Goede wrote:
> Prior to this commit the Xorg.wrap code to detect if root rights
> are necessary checked for DRM_IOCTL_MODE_GETRESOURCES succeeding *and*
> reporting more then 0 output connectors.
> 
> DRM_IOCTL_MODE_GETRESOURCES succeeding alone is enough to differentiate
> between old drm only cards (which need ums and thus root) and kms capable
> cards.
> 
> Some hybrid gfx laptops have 0 output connectors on one of their 2 GPUs,
> resulting in Xorg needlessly running as root. This commits removes the
> res.count_connectors > 0 check, fixing this.
> 
> Signed-off-by: Hans de Goede 

Reviewed-by: Eric Engestrom 

> ---
>  hw/xfree86/xorg-wrapper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
> index d930962..a25e6ff 100644
> --- a/hw/xfree86/xorg-wrapper.c
> +++ b/hw/xfree86/xorg-wrapper.c
> @@ -240,7 +240,7 @@ int main(int argc, char *argv[])
>  
>  memset(, 0, sizeof(struct drm_mode_card_res));
>  r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, );
> -if (r == 0 && res.count_connectors > 0)
> +if (r == 0)
>  kms_cards++;
>  
>  close(fd);
> -- 
> 2.9.3
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH] xfree86: Xorg.wrap: Do not require root rights for cards with 0 outputs

2016-10-18 Thread Hans de Goede
Prior to this commit the Xorg.wrap code to detect if root rights
are necessary checked for DRM_IOCTL_MODE_GETRESOURCES succeeding *and*
reporting more then 0 output connectors.

DRM_IOCTL_MODE_GETRESOURCES succeeding alone is enough to differentiate
between old drm only cards (which need ums and thus root) and kms capable
cards.

Some hybrid gfx laptops have 0 output connectors on one of their 2 GPUs,
resulting in Xorg needlessly running as root. This commits removes the
res.count_connectors > 0 check, fixing this.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/xorg-wrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index d930962..a25e6ff 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
 
 memset(, 0, sizeof(struct drm_mode_card_res));
 r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, );
-if (r == 0 && res.count_connectors > 0)
+if (r == 0)
 kms_cards++;
 
 close(fd);
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel