public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Hans de Goede <johannes.goede@oss.qualcomm.com>
To: git-commits@fedoraproject.org
Subject: [rpms/plymouth] rawhide: Restore dropped patch to fix race in fb_device_has_drm_device ()
Date: Mon, 22 Jun 2026 15:37:24 GMT	[thread overview]
Message-ID: <178214264464.1.14948536193837908814.rpms-plymouth-5792b4cc9814@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/plymouth
            Branch : rawhide
            Commit : 5792b4cc981448dc6d2761f1093811eeebc11e67
            Author : Hans de Goede <johannes.goede@oss.qualcomm.com>
            Date   : 2026-06-22T12:04:07+02:00
            Stats  : +112/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/plymouth/c/5792b4cc981448dc6d2761f1093811eeebc11e67?branch=rawhide

            Log:
            Restore dropped patch to fix race in fb_device_has_drm_device ()

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

---
diff --git a/0001-ply-device-manager-Fix-race-in-fb_device_has_drm_dev.patch b/0001-ply-device-manager-Fix-race-in-fb_device_has_drm_dev.patch
new file mode 100644
index 0000000..a8de1f8
--- /dev/null
+++ b/0001-ply-device-manager-Fix-race-in-fb_device_has_drm_dev.patch
@@ -0,0 +1,108 @@
+From b47e50d8094d6b021b1ce75ec0645d2a92fd14a1 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <johannes.goede@oss.qualcomm.com>
+Date: Sun, 21 Dec 2025 15:51:43 +0100
+Subject: [PATCH] ply-device-manager: Fix race in fb_device_has_drm_device ()
+
+In the common case of plymouth starting from the initramfs and using
+its drm plugin to display the splash, the following may happen:
+
+When udev gets restarted after changing root from the initramfs to the real
+root, plymouth will receive a udev add event for the /dev/fb0 belonging
+to the drm device on which it is already displaying the splash.
+
+fb_device_has_drm_device () then checks the udev database for any DRM
+(/dev/dri/card#) devices with the same ID_PATH (e.g. "pci-0000:2b:00.0").
+However there is a race here since udev was just started from the real
+root and is still enumerating devices, so when it gets the udev add event
+for /dev/fb0 and fb_device_has_drm_device () calls
+udev_enumerate_scan_devices () with a filter to find the matching DRM
+device, then the DRM device may not be enumerated yet.
+
+This results in fb_device_has_drm_device () returning false and plymouth
+loading the frame-buffer plugin to open the /dev/fb0 which belongs to
+the /dev/dri/card# which it already has open. Opening the same display
+output twice, once through DRM and once through fbdev is not good.
+
+Fix this by rewriting fb_device_has_drm_device () to simply check if
+the fbdev name ends in 'drmfb' which is true for all fbdev's which
+are backward compatible emulated fbdev-s for DRM devices. This also
+greatly simplifies the fb_device_has_drm_device () code.
+
+Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
+---
+ src/libply-splash-core/ply-device-manager.c | 54 +--------------------
+ 1 file changed, 2 insertions(+), 52 deletions(-)
+
+diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
+index aacab4d3..b5f793d1 100644
+--- a/src/libply-splash-core/ply-device-manager.c
++++ b/src/libply-splash-core/ply-device-manager.c
+@@ -281,63 +281,13 @@ remove_input_device_from_renderers (ply_device_manager_t *manager,
+ }
+ 
+ #ifdef HAVE_UDEV
+-static bool
+-drm_device_in_use (ply_device_manager_t *manager,
+-                   const char           *device_path)
+-{
+-        ply_renderer_t *renderer;
+-
+-        renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path);
+-
+-        return renderer != NULL;
+-}
+-
+ static bool
+ fb_device_has_drm_device (ply_device_manager_t *manager,
+                           struct udev_device   *fb_device)
+ {
+-        struct udev_enumerate *card_matches;
+-        struct udev_list_entry *card_entry;
+-        const char *id_path;
+-        bool has_drm_device = false;
++        const char *name = udev_device_get_sysattr_value (fb_device, "name");
+ 
+-        /* We want to see if the framebuffer is associated with a DRM-capable
+-         * graphics card, if it is, we'll use the DRM device */
+-        card_matches = udev_enumerate_new (manager->udev_context);
+-        udev_enumerate_add_match_is_initialized (card_matches);
+-        udev_enumerate_add_match_parent (card_matches, udev_device_get_parent (fb_device));
+-        udev_enumerate_add_match_subsystem (card_matches, "drm");
+-        id_path = udev_device_get_property_value (fb_device, "ID_PATH");
+-        udev_enumerate_add_match_property (card_matches, "ID_PATH", id_path);
+-
+-        ply_trace ("trying to find associated drm node for fb device (path: %s)", id_path);
+-
+-        udev_enumerate_scan_devices (card_matches);
+-
+-        /* there should only ever be at most one match so we don't iterate through
+-         * the list, but just look at the first entry */
+-        card_entry = udev_enumerate_get_list_entry (card_matches);
+-
+-        if (card_entry != NULL) {
+-                struct udev_device *card_device = NULL;
+-                const char *card_node;
+-                const char *card_path;
+-
+-                card_path = udev_list_entry_get_name (card_entry);
+-                card_device = udev_device_new_from_syspath (manager->udev_context, card_path);
+-                card_node = udev_device_get_devnode (card_device);
+-                if (card_node != NULL && drm_device_in_use (manager, card_node))
+-                        has_drm_device = true;
+-                else
+-                        ply_trace ("no card node!");
+-
+-                udev_device_unref (card_device);
+-        } else {
+-                ply_trace ("no card entry!");
+-        }
+-
+-        udev_enumerate_unref (card_matches);
+-        return has_drm_device;
++        return ply_string_has_suffix (name, "drmfb");
+ }
+ 
+ static bool
+-- 
+2.54.0
+

diff --git a/plymouth.spec b/plymouth.spec
index 88031ae..8de9edf 100644
--- a/plymouth.spec
+++ b/plymouth.spec
@@ -11,6 +11,10 @@ Source0: https://gitlab.freedesktop.org/plymouth/plymouth/-/archive/%{version}/%
 Source1: spinner-update.tar.gz
 Source2: charge.plymouth
 
+# Fix race in fb_device_has_drm_device () causing frame-buffer plugin to
+# sometimes load while drm plugin is already handling the display
+Patch: 0001-ply-device-manager-Fix-race-in-fb_device_has_drm_dev.patch
+
 BuildRequires: meson
 BuildRequires: system-logos
 BuildRequires: gcc libtool git

                 reply	other threads:[~2026-06-22 15:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178214264464.1.14948536193837908814.rpms-plymouth-5792b4cc9814@fedoraproject.org \
    --to=johannes.goede@oss.qualcomm.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox