Blob Blame History Raw
From b6b05961f76e9a8ac7697f61a78bc07bec933964 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <mario.limonciello@amd.com>
Date: Thu, 24 Aug 2023 13:39:51 -0500
Subject: [PATCH] local-display-factory: Skip simpledrm while checking for
 settled

Some platforms the DRM driver may take more time to load and this
will mean that GDM starts up using simpledrm instead of the proper
KMS driver.

To avoid this problem, skip simpledrm when checking if a given node
is settled.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2909
Suggested-by: Ray Strode <halfline@gmail.com>
Tested-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 daemon/gdm-local-display-factory.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index c10c1ef6c..9a1012103 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -650,63 +650,69 @@ udev_is_settled (GdmLocalDisplayFactory *factory)
 
         if (factory->seat0_has_boot_up_graphics) {
                 g_debug ("GdmLocalDisplayFactory: udev settled, boot up graphics available.");
                 return TRUE;
         }
 
         if (factory->seat0_graphics_check_timed_out) {
                 g_debug ("GdmLocalDisplayFactory: udev timed out, proceeding anyway.");
                 g_clear_signal_handler (&factory->uevent_handler_id, factory->gudev_client);
                 return TRUE;
         }
 
         g_debug ("GdmLocalDisplayFactory: Checking if udev has settled enough to support graphics.");
 
         enumerator = g_udev_enumerator_new (factory->gudev_client);
 
         g_udev_enumerator_add_match_name (enumerator, "card*");
         g_udev_enumerator_add_match_tag (enumerator, "master-of-seat");
         g_udev_enumerator_add_match_subsystem (enumerator, "drm");
 
         devices = g_udev_enumerator_execute (enumerator);
         if (!devices) {
                 g_debug ("GdmLocalDisplayFactory: udev has no candidate graphics devices available yet.");
                 return FALSE;
         }
 
         node = devices;
         while (node != NULL) {
                 GUdevDevice *device = node->data;
                 GList *next_node = node->next;
+                const gchar *id_path = g_udev_device_get_property (device, "ID_PATH");
                 g_autoptr (GUdevDevice) platform_device = NULL;
                 g_autoptr (GUdevDevice) pci_device = NULL;
 
+                if (g_str_has_prefix (id_path, "platform-simple-framebuffer")) {
+                        node = next_node;
+                        continue;
+                }
+
                 platform_device = g_udev_device_get_parent_with_subsystem (device, "platform", NULL);
 
                 if (platform_device != NULL) {
                         g_debug ("GdmLocalDisplayFactory: Found embedded platform graphics, proceeding.");
                         factory->seat0_has_platform_graphics = TRUE;
                         is_settled = TRUE;
                         break;
                 }
 
                 pci_device = g_udev_device_get_parent_with_subsystem (device, "pci", NULL);
 
                 if (pci_device != NULL) {
                         gboolean boot_vga;
 
                         boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
 
                         if (boot_vga == 1) {
                                  g_debug ("GdmLocalDisplayFactory: Found primary PCI graphics adapter, proceeding.");
                                  factory->seat0_has_boot_up_graphics = TRUE;
                                  is_settled = TRUE;
                                  break;
                         } else {
                                  g_debug ("GdmLocalDisplayFactory: Found secondary PCI graphics adapter, not proceeding yet.");
                         }
                 }
                 node = next_node;
         }
 
         g_debug ("GdmLocalDisplayFactory: udev has %ssettled enough for graphics.", is_settled? "" : "not ");
         g_list_free_full (devices, g_object_unref);
-- 
2.41.0.rc2