]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-device-manager: Create renderer for simpledrm devices right away
authorHans de Goede <hdegoede@redhat.com>
Tue, 4 Jun 2024 21:07:19 +0000 (23:07 +0200)
committerHans de Goede <hdegoede@redhat.com>
Fri, 7 Jun 2024 15:21:00 +0000 (17:21 +0200)
Often when plymouth starts and enumerates udev devices which are already
present at start (coldplug detection), udev is still initializing all
the devices and it reports 0 for udev_device_get_is_initialized ().

It may take a long time for the state of the simpledrm udev device
to change to initialized and for a udev add event to be send.

Especially when the amdgpu kernel module is involved which is very
large for a kernel module and can take op to 7 seconds to load.

In this case it is even possible for plymouth's default DeviceTimeout
of 8 seconds to trigger before the simpledrm device is considered
initialized. See for example these lines extracted from the plymouth-debug
log attached to: https://bugzilla.redhat.com/show_bug.cgi?id=2183743

  00:00:02.909 ../src/libply-splash-core/ply-device-manager.c:498:create_devi: found device /sys/devices/pci0000:00/0000:00:01.0/simple-framebuffer.0/drm/card0
  00:00:02.910 ../src/libply-splash-core/ply-device-manager.c:513:create_devi: it's not initialized
  00:00:10.917 ../src/libply-splash-core/ply-device-manager.c:1237:create_dev: Timeout elapsed, looking for devices from udev
  00:00:10.918 ../src/libply-splash-core/ply-device-manager.c:498:create_devi: found device /sys/devices/pci0000:00/0000:00:01.0/simple-framebuffer.0/drm/card0
  00:00:10.918 ../src/libply-splash-core/ply-device-manager.c:513:create_devi: it's not initialized

This leads to plymouth falling back to the text splash even when
plymouth.use-simpledrm is passed on the kernel commandline.

Add a special case for simpledrm devices and add these during coldboot
even if they are not initialized yet.

src/libply-splash-core/ply-device-manager.c

index 1c9560d7b85eec0d150360c28856d3e134b0421b..90a6066160870a3caa4474bce232fe4cb15244d8 100644 (file)
@@ -490,6 +490,7 @@ create_devices_for_subsystem (ply_device_manager_t *manager,
         udev_list_entry_foreach (entry, udev_enumerate_get_list_entry (matches)){
                 struct udev_device *device = NULL;
                 const char *path, *node;
+                int initialized;
 
                 path = udev_list_entry_get_name (entry);
 
@@ -502,10 +503,11 @@ create_devices_for_subsystem (ply_device_manager_t *manager,
 
                 device = udev_device_new_from_syspath (manager->udev_context, path);
 
-                /* if device isn't fully initialized, we'll get an add event later
-                 */
-                if (udev_device_get_is_initialized (device)) {
-                        ply_trace ("device is initialized");
+                /* If device isn't fully initialized, we'll get an add event later */
+                initialized = udev_device_get_is_initialized (device);
+                /* Simpledrm can be handled uninitialized and this shows the splash sooner */
+                if (initialized || syspath_is_simpledrm (path)) {
+                        ply_trace ("device is initialized %d", initialized);
 
                         node = udev_device_get_devnode (device);
                         if (node != NULL) {