Blame SOURCES/fall-back-to-xorg-on-hybrid-gpus.patch

db633a
From 5bea406b353f39867eb86307b1c8b4093f22968e Mon Sep 17 00:00:00 2001
db633a
From: Ray Strode <rstrode@redhat.com>
db633a
Date: Tue, 18 Oct 2016 16:40:14 -0400
db633a
Subject: [PATCH 1/4] native: only match drm subsystem devices
db633a
db633a
Despite g_udev_client_new taking a list of subsystems, it doesn't
db633a
implicitly filter results to those subsystems.
db633a
db633a
This commit explicitly adds a subsystem match to make sure sound cards
db633a
don't end up in the resulting list of video cards.
db633a
db633a
https://bugzilla.gnome.org/show_bug.cgi?id=771442
db633a
---
db633a
 src/backends/native/meta-launcher.c | 5 +++++
db633a
 1 file changed, 5 insertions(+)
db633a
db633a
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
db633a
index ea28e5a..03a928a 100644
db633a
--- a/src/backends/native/meta-launcher.c
db633a
+++ b/src/backends/native/meta-launcher.c
db633a
@@ -268,60 +268,65 @@ sync_active (MetaLauncher *self)
db633a
   self->session_active = active;
db633a
 
db633a
   if (active)
db633a
     session_unpause ();
db633a
   else
db633a
     session_pause ();
db633a
 }
db633a
 
db633a
 static void
db633a
 on_active_changed (Login1Session *session,
db633a
                    GParamSpec    *pspec,
db633a
                    gpointer       user_data)
db633a
 {
db633a
   MetaLauncher *self = user_data;
db633a
   sync_active (self);
db633a
 }
db633a
 
db633a
 static gchar *
db633a
 get_primary_gpu_path (const gchar *seat_name)
db633a
 {
db633a
   const gchar *subsystems[] = {"drm", NULL};
db633a
   gchar *path = NULL;
db633a
   GList *devices, *tmp;
db633a
 
db633a
   g_autoptr (GUdevClient) gudev_client = g_udev_client_new (subsystems);
db633a
   g_autoptr (GUdevEnumerator) enumerator = g_udev_enumerator_new (gudev_client);
db633a
 
db633a
   g_udev_enumerator_add_match_name (enumerator, "card*");
db633a
   g_udev_enumerator_add_match_tag (enumerator, "seat");
db633a
 
db633a
+  /* We need to explicitly match the subsystem for now.
db633a
+   * https://bugzilla.gnome.org/show_bug.cgi?id=773224
db633a
+   */
db633a
+  g_udev_enumerator_add_match_subsystem (enumerator, "drm");
db633a
+
db633a
   devices = g_udev_enumerator_execute (enumerator);
db633a
   if (!devices)
db633a
     goto out;
db633a
 
db633a
   for (tmp = devices; tmp != NULL; tmp = tmp->next)
db633a
     {
db633a
       g_autoptr (GUdevDevice) platform_device = NULL;
db633a
       g_autoptr (GUdevDevice) pci_device = NULL;
db633a
       GUdevDevice *dev = tmp->data;
db633a
       gint boot_vga;
db633a
       const gchar *device_seat;
db633a
 
db633a
       /* filter out devices that are not character device, like card0-VGA-1 */
db633a
       if (g_udev_device_get_device_type (dev) != G_UDEV_DEVICE_TYPE_CHAR)
db633a
         continue;
db633a
 
db633a
       device_seat = g_udev_device_get_property (dev, "ID_SEAT");
db633a
       if (!device_seat)
db633a
         {
db633a
           /* when ID_SEAT is not set, it means seat0 */
db633a
           device_seat = "seat0";
db633a
         }
db633a
       else if (g_strcmp0 (device_seat, "seat0") != 0)
db633a
         {
db633a
           /* if the device has been explicitly assigned other seat
db633a
            * than seat0, it is probably the right device to use */
db633a
           path = g_strdup (g_udev_device_get_device_file (dev));
db633a
           break;
db633a
         }
db633a
 
db633a
-- 
db633a
2.10.1
db633a
db633a
db633a
From d9dc6ac094080a4190508297e8244a8905a8dcb4 Mon Sep 17 00:00:00 2001
db633a
From: Ray Strode <rstrode@redhat.com>
db633a
Date: Wed, 19 Oct 2016 10:41:14 -0400
db633a
Subject: [PATCH 2/4] native: shore up matching of card device
db633a
db633a
Right now we accept any character device that matches the glob card*.
db633a
db633a
That's fine, but we can be a little more specific by checking that
db633a
the devtype is what we expect.
db633a
db633a
This commit does that.
db633a
db633a
https://bugzilla.gnome.org/show_bug.cgi?id=771442
db633a
---
db633a
 src/backends/native/meta-launcher.c | 7 +++++++
db633a
 1 file changed, 7 insertions(+)
db633a
db633a
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
db633a
index 03a928a..765e5ef 100644
db633a
--- a/src/backends/native/meta-launcher.c
db633a
+++ b/src/backends/native/meta-launcher.c
db633a
@@ -20,60 +20,62 @@
db633a
 #include "config.h"
db633a
 
db633a
 #include "meta-launcher.h"
db633a
 
db633a
 #include <gio/gunixfdlist.h>
db633a
 
db633a
 #include <clutter/clutter.h>
db633a
 #include <clutter/egl/clutter-egl.h>
db633a
 #include <clutter/evdev/clutter-evdev.h>
db633a
 
db633a
 #include <sys/types.h>
db633a
 #include <sys/stat.h>
db633a
 #include <malloc.h>
db633a
 #include <fcntl.h>
db633a
 #include <errno.h>
db633a
 #include <stdlib.h>
db633a
 #include <string.h>
db633a
 #include <unistd.h>
db633a
 
db633a
 #include <systemd/sd-login.h>
db633a
 #include <gudev/gudev.h>
db633a
 
db633a
 #include "dbus-utils.h"
db633a
 #include "meta-dbus-login1.h"
db633a
 
db633a
 #include "backends/meta-backend-private.h"
db633a
 #include "meta-cursor-renderer-native.h"
db633a
 #include "meta-idle-monitor-native.h"
db633a
 #include "meta-renderer-native.h"
db633a
 
db633a
+#define DRM_CARD_UDEV_DEVICE_TYPE "drm_minor"
db633a
+
db633a
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevDevice, g_object_unref)
db633a
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevClient, g_object_unref)
db633a
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevEnumerator, g_object_unref)
db633a
 
db633a
 struct _MetaLauncher
db633a
 {
db633a
   Login1Session *session_proxy;
db633a
   Login1Seat *seat_proxy;
db633a
 
db633a
   gboolean session_active;
db633a
 
db633a
   int kms_fd;
db633a
 };
db633a
 
db633a
 static Login1Session *
db633a
 get_session_proxy (GCancellable *cancellable,
db633a
                    GError      **error)
db633a
 {
db633a
   g_autofree char *proxy_path = NULL;
db633a
   g_autofree char *session_id = NULL;
db633a
   Login1Session *session_proxy;
db633a
 
db633a
   if (sd_pid_get_session (getpid (), &session_id) < 0)
db633a
     {
db633a
       g_set_error (error,
db633a
                    G_IO_ERROR,
db633a
                    G_IO_ERROR_NOT_FOUND,
db633a
                    "Could not get session ID: %m");
db633a
       return NULL;
db633a
     }
db633a
@@ -283,66 +285,71 @@ on_active_changed (Login1Session *session,
db633a
 }
db633a
 
db633a
 static gchar *
db633a
 get_primary_gpu_path (const gchar *seat_name)
db633a
 {
db633a
   const gchar *subsystems[] = {"drm", NULL};
db633a
   gchar *path = NULL;
db633a
   GList *devices, *tmp;
db633a
 
db633a
   g_autoptr (GUdevClient) gudev_client = g_udev_client_new (subsystems);
db633a
   g_autoptr (GUdevEnumerator) enumerator = g_udev_enumerator_new (gudev_client);
db633a
 
db633a
   g_udev_enumerator_add_match_name (enumerator, "card*");
db633a
   g_udev_enumerator_add_match_tag (enumerator, "seat");
db633a
 
db633a
   /* We need to explicitly match the subsystem for now.
db633a
    * https://bugzilla.gnome.org/show_bug.cgi?id=773224
db633a
    */
db633a
   g_udev_enumerator_add_match_subsystem (enumerator, "drm");
db633a
 
db633a
   devices = g_udev_enumerator_execute (enumerator);
db633a
   if (!devices)
db633a
     goto out;
db633a
 
db633a
   for (tmp = devices; tmp != NULL; tmp = tmp->next)
db633a
     {
db633a
       g_autoptr (GUdevDevice) platform_device = NULL;
db633a
       g_autoptr (GUdevDevice) pci_device = NULL;
db633a
       GUdevDevice *dev = tmp->data;
db633a
       gint boot_vga;
db633a
+      const gchar *device_type;
db633a
       const gchar *device_seat;
db633a
 
db633a
       /* filter out devices that are not character device, like card0-VGA-1 */
db633a
       if (g_udev_device_get_device_type (dev) != G_UDEV_DEVICE_TYPE_CHAR)
db633a
         continue;
db633a
 
db633a
+      device_type = g_udev_device_get_property (dev, "DEVTYPE");
db633a
+      if (g_strcmp0 (device_type, DRM_CARD_UDEV_DEVICE_TYPE) != 0)
db633a
+        continue;
db633a
+
db633a
       device_seat = g_udev_device_get_property (dev, "ID_SEAT");
db633a
       if (!device_seat)
db633a
         {
db633a
           /* when ID_SEAT is not set, it means seat0 */
db633a
           device_seat = "seat0";
db633a
         }
db633a
       else if (g_strcmp0 (device_seat, "seat0") != 0)
db633a
         {
db633a
           /* if the device has been explicitly assigned other seat
db633a
            * than seat0, it is probably the right device to use */
db633a
           path = g_strdup (g_udev_device_get_device_file (dev));
db633a
           break;
db633a
         }
db633a
 
db633a
       /* skip devices that do not belong to our seat */
db633a
       if (g_strcmp0 (seat_name, device_seat))
db633a
         continue;
db633a
 
db633a
       platform_device = g_udev_device_get_parent_with_subsystem (dev, "platform", NULL);
db633a
       if (platform_device != NULL)
db633a
         {
db633a
           path = g_strdup (g_udev_device_get_device_file (dev));
db633a
           break;
db633a
         }
db633a
 
db633a
       pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
db633a
       if (pci_device != NULL)
db633a
         {
db633a
           /* get value of boot_vga attribute or 0 if the device has no boot_vga */
db633a
           boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
db633a
-- 
db633a
2.10.1
db633a
db633a
db633a
From 54ceafff8c8b0b02cd9124eae56a05da4f117033 Mon Sep 17 00:00:00 2001
db633a
From: Ray Strode <rstrode@redhat.com>
db633a
Date: Tue, 18 Oct 2016 16:43:04 -0400
db633a
Subject: [PATCH 3/4] native: fail on systems with connectors spread across
db633a
 multiple gpus
db633a
db633a
We don't support using more than one GPU for output yet, so we should fail
db633a
if we encounter that situation, so GDM will fall back to X.
db633a
db633a
https://bugzilla.gnome.org/show_bug.cgi?id=771442
db633a
---
db633a
 src/backends/native/meta-launcher.c | 63 ++++++++++++++++++++++++++++++++++++-
db633a
 1 file changed, 62 insertions(+), 1 deletion(-)
db633a
db633a
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
db633a
index 765e5ef..a2885a1 100644
db633a
--- a/src/backends/native/meta-launcher.c
db633a
+++ b/src/backends/native/meta-launcher.c
db633a
@@ -257,141 +257,202 @@ on_evdev_device_close (int      fd,
db633a
 
db633a
 out:
db633a
   close (fd);
db633a
 }
db633a
 
db633a
 static void
db633a
 sync_active (MetaLauncher *self)
db633a
 {
db633a
   gboolean active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy));
db633a
 
db633a
   if (active == self->session_active)
db633a
     return;
db633a
 
db633a
   self->session_active = active;
db633a
 
db633a
   if (active)
db633a
     session_unpause ();
db633a
   else
db633a
     session_pause ();
db633a
 }
db633a
 
db633a
 static void
db633a
 on_active_changed (Login1Session *session,
db633a
                    GParamSpec    *pspec,
db633a
                    gpointer       user_data)
db633a
 {
db633a
   MetaLauncher *self = user_data;
db633a
   sync_active (self);
db633a
 }
db633a
 
db633a
+static guint
db633a
+count_devices_with_connectors (const gchar *seat_name,
db633a
+                               GList       *devices)
db633a
+{
db633a
+  g_autoptr (GHashTable) cards = NULL;
db633a
+  GList *tmp;
db633a
+
db633a
+  cards = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
db633a
+  for (tmp = devices; tmp != NULL; tmp = tmp->next)
db633a
+    {
db633a
+      GUdevDevice *device = tmp->data;
db633a
+      g_autoptr (GUdevDevice) parent_device = NULL;
db633a
+      const gchar *parent_device_type = NULL;
db633a
+      const gchar *card_seat;
db633a
+
db633a
+      /* filter out the real card devices, we only care about the connectors */
db633a
+      if (g_udev_device_get_device_type (device) != G_UDEV_DEVICE_TYPE_NONE)
db633a
+        continue;
db633a
+
db633a
+      /* only connectors have a modes attribute */
db633a
+      if (!g_udev_device_has_sysfs_attr (device, "modes"))
db633a
+        continue;
db633a
+
db633a
+      parent_device = g_udev_device_get_parent (device);
db633a
+
db633a
+      if (g_udev_device_get_device_type (parent_device) == G_UDEV_DEVICE_TYPE_CHAR)
db633a
+        parent_device_type = g_udev_device_get_property (parent_device, "DEVTYPE");
db633a
+
db633a
+      if (g_strcmp0 (parent_device_type, DRM_CARD_UDEV_DEVICE_TYPE) != 0)
db633a
+        continue;
db633a
+
db633a
+      card_seat = g_udev_device_get_property (parent_device, "ID_SEAT");
db633a
+
db633a
+      if (!card_seat)
db633a
+        card_seat = "seat0";
db633a
+
db633a
+      if (g_strcmp0 (seat_name, card_seat) != 0)
db633a
+        continue;
db633a
+
db633a
+      g_hash_table_insert (cards,
db633a
+                           (gpointer) g_udev_device_get_name (parent_device),
db633a
+                           g_steal_pointer (&parent_device));
db633a
+    }
db633a
+
db633a
+  return g_hash_table_size (cards);
db633a
+}
db633a
+
db633a
 static gchar *
db633a
 get_primary_gpu_path (const gchar *seat_name)
db633a
 {
db633a
   const gchar *subsystems[] = {"drm", NULL};
db633a
   gchar *path = NULL;
db633a
   GList *devices, *tmp;
db633a
 
db633a
   g_autoptr (GUdevClient) gudev_client = g_udev_client_new (subsystems);
db633a
   g_autoptr (GUdevEnumerator) enumerator = g_udev_enumerator_new (gudev_client);
db633a
 
db633a
   g_udev_enumerator_add_match_name (enumerator, "card*");
db633a
   g_udev_enumerator_add_match_tag (enumerator, "seat");
db633a
 
db633a
   /* We need to explicitly match the subsystem for now.
db633a
    * https://bugzilla.gnome.org/show_bug.cgi?id=773224
db633a
    */
db633a
   g_udev_enumerator_add_match_subsystem (enumerator, "drm");
db633a
 
db633a
   devices = g_udev_enumerator_execute (enumerator);
db633a
   if (!devices)
db633a
     goto out;
db633a
 
db633a
+  /* For now, fail on systems where some of the connectors
db633a
+   * are connected to secondary gpus.
db633a
+   *
db633a
+   * https://bugzilla.gnome.org/show_bug.cgi?id=771442
db633a
+   */
db633a
+  if (g_getenv ("MUTTER_ALLOW_HYBRID_GPUS") == NULL)
db633a
+    {
db633a
+      guint num_devices;
db633a
+
db633a
+      num_devices = count_devices_with_connectors (seat_name, devices);
db633a
+      if (num_devices != 1)
db633a
+        goto out;
db633a
+    }
db633a
+
db633a
   for (tmp = devices; tmp != NULL; tmp = tmp->next)
db633a
     {
db633a
       g_autoptr (GUdevDevice) platform_device = NULL;
db633a
       g_autoptr (GUdevDevice) pci_device = NULL;
db633a
       GUdevDevice *dev = tmp->data;
db633a
       gint boot_vga;
db633a
       const gchar *device_type;
db633a
       const gchar *device_seat;
db633a
 
db633a
       /* filter out devices that are not character device, like card0-VGA-1 */
db633a
       if (g_udev_device_get_device_type (dev) != G_UDEV_DEVICE_TYPE_CHAR)
db633a
         continue;
db633a
 
db633a
       device_type = g_udev_device_get_property (dev, "DEVTYPE");
db633a
       if (g_strcmp0 (device_type, DRM_CARD_UDEV_DEVICE_TYPE) != 0)
db633a
         continue;
db633a
 
db633a
       device_seat = g_udev_device_get_property (dev, "ID_SEAT");
db633a
       if (!device_seat)
db633a
         {
db633a
           /* when ID_SEAT is not set, it means seat0 */
db633a
           device_seat = "seat0";
db633a
         }
db633a
       else if (g_strcmp0 (device_seat, "seat0") != 0)
db633a
         {
db633a
           /* if the device has been explicitly assigned other seat
db633a
            * than seat0, it is probably the right device to use */
db633a
           path = g_strdup (g_udev_device_get_device_file (dev));
db633a
           break;
db633a
         }
db633a
 
db633a
       /* skip devices that do not belong to our seat */
db633a
       if (g_strcmp0 (seat_name, device_seat))
db633a
         continue;
db633a
 
db633a
       platform_device = g_udev_device_get_parent_with_subsystem (dev, "platform", NULL);
db633a
       if (platform_device != NULL)
db633a
         {
db633a
           path = g_strdup (g_udev_device_get_device_file (dev));
db633a
           break;
db633a
         }
db633a
 
db633a
       pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
db633a
       if (pci_device != NULL)
db633a
         {
db633a
           /* get value of boot_vga attribute or 0 if the device has no boot_vga */
db633a
           boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
db633a
           if (boot_vga == 1)
db633a
             {
db633a
               /* found the boot_vga device */
db633a
               path = g_strdup (g_udev_device_get_device_file (dev));
db633a
               break;
db633a
             }
db633a
         }
db633a
     }
db633a
 
db633a
+out:
db633a
   g_list_free_full (devices, g_object_unref);
db633a
 
db633a
-out:
db633a
   return path;
db633a
 }
db633a
 
db633a
 static gboolean
db633a
 get_kms_fd (Login1Session *session_proxy,
db633a
             const gchar   *seat_id,
db633a
             int           *fd_out,
db633a
             GError       **error)
db633a
 {
db633a
   int major, minor;
db633a
   int fd;
db633a
 
db633a
   g_autofree gchar *path = get_primary_gpu_path (seat_id);
db633a
   if (!path)
db633a
     {
db633a
       g_set_error (error,
db633a
                    G_IO_ERROR,
db633a
                    G_IO_ERROR_NOT_FOUND,
db633a
                    "could not find drm kms device");
db633a
       return FALSE;
db633a
     }
db633a
 
db633a
   if (!get_device_info_from_path (path, &major, &minor))
db633a
     {
db633a
       g_set_error (error,
db633a
                    G_IO_ERROR,
db633a
                    G_IO_ERROR_NOT_FOUND,
db633a
                    "Could not get device info for path %s: %m", path);
db633a
       return FALSE;
db633a
     }
db633a
-- 
db633a
2.10.1
db633a
db633a
db633a
From 0d87baa029329c409646e04bcf40bea5da67b5f7 Mon Sep 17 00:00:00 2001
db633a
From: Ray Strode <rstrode@redhat.com>
db633a
Date: Wed, 19 Oct 2016 14:27:24 -0400
db633a
Subject: [PATCH 4/4] native: don't call steal_pointer prematurely
db633a
db633a
commit e2bfaf07514ed633f8721b5f521577685b6cccc0 does this:
db633a
db633a
g_hash_table_insert (cards,
db633a
                     g_udev_device_get_name (parent_device),
db633a
                     g_steal_pointer (&parent_device));
db633a
db633a
The problem is the g_steal_pointer call may happen before the
db633a
g_udev_device_get_name call leading to a crash.
db633a
db633a
This commit does the get_name call on an earlier line
db633a
db633a
https://bugzilla.gnome.org/show_bug.cgi?id=771442
db633a
---
db633a
 src/backends/native/meta-launcher.c | 4 +++-
db633a
 1 file changed, 3 insertions(+), 1 deletion(-)
db633a
db633a
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
db633a
index a2885a1..ddb7080 100644
db633a
--- a/src/backends/native/meta-launcher.c
db633a
+++ b/src/backends/native/meta-launcher.c
db633a
@@ -270,88 +270,90 @@ sync_active (MetaLauncher *self)
db633a
   self->session_active = active;
db633a
 
db633a
   if (active)
db633a
     session_unpause ();
db633a
   else
db633a
     session_pause ();
db633a
 }
db633a
 
db633a
 static void
db633a
 on_active_changed (Login1Session *session,
db633a
                    GParamSpec    *pspec,
db633a
                    gpointer       user_data)
db633a
 {
db633a
   MetaLauncher *self = user_data;
db633a
   sync_active (self);
db633a
 }
db633a
 
db633a
 static guint
db633a
 count_devices_with_connectors (const gchar *seat_name,
db633a
                                GList       *devices)
db633a
 {
db633a
   g_autoptr (GHashTable) cards = NULL;
db633a
   GList *tmp;
db633a
 
db633a
   cards = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
db633a
   for (tmp = devices; tmp != NULL; tmp = tmp->next)
db633a
     {
db633a
       GUdevDevice *device = tmp->data;
db633a
       g_autoptr (GUdevDevice) parent_device = NULL;
db633a
       const gchar *parent_device_type = NULL;
db633a
+      const gchar *parent_device_name = NULL;
db633a
       const gchar *card_seat;
db633a
 
db633a
       /* filter out the real card devices, we only care about the connectors */
db633a
       if (g_udev_device_get_device_type (device) != G_UDEV_DEVICE_TYPE_NONE)
db633a
         continue;
db633a
 
db633a
       /* only connectors have a modes attribute */
db633a
       if (!g_udev_device_has_sysfs_attr (device, "modes"))
db633a
         continue;
db633a
 
db633a
       parent_device = g_udev_device_get_parent (device);
db633a
 
db633a
       if (g_udev_device_get_device_type (parent_device) == G_UDEV_DEVICE_TYPE_CHAR)
db633a
         parent_device_type = g_udev_device_get_property (parent_device, "DEVTYPE");
db633a
 
db633a
       if (g_strcmp0 (parent_device_type, DRM_CARD_UDEV_DEVICE_TYPE) != 0)
db633a
         continue;
db633a
 
db633a
       card_seat = g_udev_device_get_property (parent_device, "ID_SEAT");
db633a
 
db633a
       if (!card_seat)
db633a
         card_seat = "seat0";
db633a
 
db633a
       if (g_strcmp0 (seat_name, card_seat) != 0)
db633a
         continue;
db633a
 
db633a
+      parent_device_name = g_udev_device_get_name (parent_device);
db633a
       g_hash_table_insert (cards,
db633a
-                           (gpointer) g_udev_device_get_name (parent_device),
db633a
+                           (gpointer) parent_device_name ,
db633a
                            g_steal_pointer (&parent_device));
db633a
     }
db633a
 
db633a
   return g_hash_table_size (cards);
db633a
 }
db633a
 
db633a
 static gchar *
db633a
 get_primary_gpu_path (const gchar *seat_name)
db633a
 {
db633a
   const gchar *subsystems[] = {"drm", NULL};
db633a
   gchar *path = NULL;
db633a
   GList *devices, *tmp;
db633a
 
db633a
   g_autoptr (GUdevClient) gudev_client = g_udev_client_new (subsystems);
db633a
   g_autoptr (GUdevEnumerator) enumerator = g_udev_enumerator_new (gudev_client);
db633a
 
db633a
   g_udev_enumerator_add_match_name (enumerator, "card*");
db633a
   g_udev_enumerator_add_match_tag (enumerator, "seat");
db633a
 
db633a
   /* We need to explicitly match the subsystem for now.
db633a
    * https://bugzilla.gnome.org/show_bug.cgi?id=773224
db633a
    */
db633a
   g_udev_enumerator_add_match_subsystem (enumerator, "drm");
db633a
 
db633a
   devices = g_udev_enumerator_execute (enumerator);
db633a
   if (!devices)
db633a
     goto out;
db633a
 
db633a
   /* For now, fail on systems where some of the connectors
db633a
    * are connected to secondary gpus.
db633a
-- 
db633a
2.10.1
db633a