diff options
author | Ray Strode <rstrode@redhat.com> | 2016-10-18 16:43:04 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2016-10-19 13:08:19 -0400 |
commit | e2bfaf07514ed633f8721b5f521577685b6cccc0 (patch) | |
tree | e5f66c9448eed3fab71d310de8fd5df4b87591f2 /src/backends/native/meta-launcher.c | |
parent | f1e1a5ff06ab17a06b3a157bc60f75077af67420 (diff) | |
download | mutter-e2bfaf07514ed633f8721b5f521577685b6cccc0.tar.gz |
native: fail on systems with connectors spread across multiple gpus
We don't support using more than one GPU for output yet, so we should fail
if we encounter that situation, so GDM will fall back to X.
https://bugzilla.gnome.org/show_bug.cgi?id=771442
Diffstat (limited to 'src/backends/native/meta-launcher.c')
-rw-r--r-- | src/backends/native/meta-launcher.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index 765e5efa1..a2885a1bb 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -284,6 +284,53 @@ on_active_changed (Login1Session *session, sync_active (self); } +static guint +count_devices_with_connectors (const gchar *seat_name, + GList *devices) +{ + g_autoptr (GHashTable) cards = NULL; + GList *tmp; + + cards = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); + for (tmp = devices; tmp != NULL; tmp = tmp->next) + { + GUdevDevice *device = tmp->data; + g_autoptr (GUdevDevice) parent_device = NULL; + const gchar *parent_device_type = NULL; + const gchar *card_seat; + + /* filter out the real card devices, we only care about the connectors */ + if (g_udev_device_get_device_type (device) != G_UDEV_DEVICE_TYPE_NONE) + continue; + + /* only connectors have a modes attribute */ + if (!g_udev_device_has_sysfs_attr (device, "modes")) + continue; + + parent_device = g_udev_device_get_parent (device); + + if (g_udev_device_get_device_type (parent_device) == G_UDEV_DEVICE_TYPE_CHAR) + parent_device_type = g_udev_device_get_property (parent_device, "DEVTYPE"); + + if (g_strcmp0 (parent_device_type, DRM_CARD_UDEV_DEVICE_TYPE) != 0) + continue; + + card_seat = g_udev_device_get_property (parent_device, "ID_SEAT"); + + if (!card_seat) + card_seat = "seat0"; + + if (g_strcmp0 (seat_name, card_seat) != 0) + continue; + + g_hash_table_insert (cards, + (gpointer) g_udev_device_get_name (parent_device), + g_steal_pointer (&parent_device)); + } + + return g_hash_table_size (cards); +} + static gchar * get_primary_gpu_path (const gchar *seat_name) { @@ -306,6 +353,20 @@ get_primary_gpu_path (const gchar *seat_name) if (!devices) goto out; + /* For now, fail on systems where some of the connectors + * are connected to secondary gpus. + * + * https://bugzilla.gnome.org/show_bug.cgi?id=771442 + */ + if (g_getenv ("MUTTER_ALLOW_HYBRID_GPUS") == NULL) + { + guint num_devices; + + num_devices = count_devices_with_connectors (seat_name, devices); + if (num_devices != 1) + goto out; + } + for (tmp = devices; tmp != NULL; tmp = tmp->next) { g_autoptr (GUdevDevice) platform_device = NULL; @@ -362,9 +423,9 @@ get_primary_gpu_path (const gchar *seat_name) } } +out: g_list_free_full (devices, g_object_unref); -out: return path; } |