From f1b9360914430da57aa1ea77a4ec2a2ec6768929 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 28 Sep 2022 15:51:20 +0200 Subject: [PATCH] Fix SimpleDRM sometimes not being ignored (rhbz#2127663) Mark boot-duration file as %verify(not mode (rhbz#2122896) --- ...er-Move-verify_drm_device-higher-up-.patch | 105 ++++++++++++++++++ ...er-Also-ignore-SimpleDRM-devs-in-col.patch | 84 ++++++++++++++ plymouth.spec | 10 +- 3 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 0005-ply-device-manager-Move-verify_drm_device-higher-up-.patch create mode 100644 0006-ply-device-manager-Also-ignore-SimpleDRM-devs-in-col.patch diff --git a/0005-ply-device-manager-Move-verify_drm_device-higher-up-.patch b/0005-ply-device-manager-Move-verify_drm_device-higher-up-.patch new file mode 100644 index 0000000..b69a8d2 --- /dev/null +++ b/0005-ply-device-manager-Move-verify_drm_device-higher-up-.patch @@ -0,0 +1,105 @@ +From f775a38aefa3797d3697330aea78b341914e59f5 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 28 Sep 2022 15:14:00 +0200 +Subject: [PATCH 5/6] ply-device-manager: Move verify_drm_device() higher up in + the file + +Move verify_drm_device() higher up in ply-device-manager.c, this is +a preparation patch for the next patch in this series. + +This is a pure move without any changes to the moved block. + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-device-manager.c | 68 ++++++++++----------- + 1 file changed, 34 insertions(+), 34 deletions(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index cba2425..23b8b37 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -262,6 +262,40 @@ fb_device_has_drm_device (ply_device_manager_t *manager, + return has_drm_device; + } + ++static bool ++verify_drm_device (struct udev_device *device) ++{ ++ const char *id_path; ++ ++ /* ++ * Simple-framebuffer devices driven by simpledrm lack information ++ * like panel-rotation info and physical size, causing the splash ++ * to briefly render on its side / without HiDPI scaling, switching ++ * to the correct rendering when the native driver loads. ++ * To avoid this treat simpledrm devices as fbdev devices and only ++ * use them after the timeout. ++ */ ++ id_path = udev_device_get_property_value (device, "ID_PATH"); ++ if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer")) ++ return true; /* Not a SimpleDRM device */ ++ ++ /* ++ * With nomodeset, no native drivers will load, so SimpleDRM devices ++ * should be used immediately. ++ */ ++ if (ply_kernel_command_line_has_argument ("nomodeset")) ++ return true; ++ ++ /* ++ * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM ++ * use from the cmdline to show something to the user ASAP. ++ */ ++ if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) ++ return true; ++ ++ return false; ++} ++ + static bool + create_devices_for_udev_device (ply_device_manager_t *manager, + struct udev_device *device) +@@ -404,40 +438,6 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, + } + } + +-static bool +-verify_drm_device (struct udev_device *device) +-{ +- const char *id_path; +- +- /* +- * Simple-framebuffer devices driven by simpledrm lack information +- * like panel-rotation info and physical size, causing the splash +- * to briefly render on its side / without HiDPI scaling, switching +- * to the correct rendering when the native driver loads. +- * To avoid this treat simpledrm devices as fbdev devices and only +- * use them after the timeout. +- */ +- id_path = udev_device_get_property_value (device, "ID_PATH"); +- if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer")) +- return true; /* Not a SimpleDRM device */ +- +- /* +- * With nomodeset, no native drivers will load, so SimpleDRM devices +- * should be used immediately. +- */ +- if (ply_kernel_command_line_has_argument ("nomodeset")) +- return true; +- +- /* +- * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM +- * use from the cmdline to show something to the user ASAP. +- */ +- if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) +- return true; +- +- return false; +-} +- + static bool + verify_add_or_change (ply_device_manager_t *manager, + const char *action, +-- +2.37.3 + diff --git a/0006-ply-device-manager-Also-ignore-SimpleDRM-devs-in-col.patch b/0006-ply-device-manager-Also-ignore-SimpleDRM-devs-in-col.patch new file mode 100644 index 0000000..7608e81 --- /dev/null +++ b/0006-ply-device-manager-Also-ignore-SimpleDRM-devs-in-col.patch @@ -0,0 +1,84 @@ +From d32a748fe5c24d5cc3b3dd671a045102373dd392 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 28 Sep 2022 15:16:15 +0200 +Subject: [PATCH 6/6] ply-device-manager: Also ignore SimpleDRM devs in + coldplug enumeration path + +Plymouth has 2 hw discovery paths: +1. Enumerating devices already known by udev at plymouth startup +2. Devices which are hotplugged after startup + +At boot we have udevd which is enumerating hw and plymouthd racing +with each other, which means that plymouthd may discover the new +SimpleDRM device through either 1. or 2. + +Before this patch a check for SimpleDRM was missing from path 1, causing +it to be treated as a normal device instead of being ignored as intended: + +plymouth-debug.log for the simpledrm being enumerated in path 1: + +ply-device-manager.c:344: create_devices_for_subsystem: + found device /sys/devices/platform/simple-framebuffer.0/drm/card0 +ply-device-manager.c:351: create_devices_for_subsystem: + device is initialized +ply-device-manager.c:360: create_devices_for_subsystem: + found node /dev/dri/card0 +ply-device-manager.c:283: create_devices_for_udev_device: + found DRM device /dev/dri/card0 +ply-device-manager.c:885: create_devices_for_terminal_and_rende: + creating devices for /dev/dri/card0 (renderer type: 1) + +plymouth-debug.log for the simpledrm *not* being enumerated in path 1: + +ply-device-manager.c:344: create_devices_for_subsystem: + found device /sys/devices/platform/simple-framebuffer.0/drm/card0 +ply-device-manager.c:367: create_devices_for_subsystem: + it's not initialized + +followed by path 2 enumerating the device very shortly after this: + +ply-device-manager.c:532: on_udev_event: + got add event for device /dev/dri/card0 +ply-device-manager.c:462: verify_add_or_change: + ignoring since we only handle SimpleDRM devices after timeout + +Note how path 2 does correctly ignore SimpleDRM devices, where as +path 1 does not. This commit fixes this by moving the verify_drm_device() +check in to create_devices_for_udev_device() which runs in both paths. + +Link: https://bugzilla.redhat.com/show_bug.cgi?id=2127663 +Reported-by: Michael Catanzaro +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-device-manager.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index 23b8b37..820a282 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -314,6 +314,10 @@ create_devices_for_udev_device (ply_devi + ply_trace ("device subsystem is %s", subsystem); + + if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) { ++ if (!manager->device_timeout_elapsed && !verify_drm_device (device)) { ++ ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); ++ return false; ++ } + ply_trace ("found DRM device %s", device_path); + renderer_type = PLY_RENDERER_TYPE_DRM; + } else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) { +@@ -457,11 +461,6 @@ verify_add_or_change (ply_device_manager + ply_trace ("ignoring since we're already using text splash for local console"); + return false; + } +- +- if (!verify_drm_device (device)) { +- ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); +- return false; +- } + } else { + ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); + return false; +-- +2.37.3 diff --git a/plymouth.spec b/plymouth.spec index 2e2b9eb..199c28a 100644 --- a/plymouth.spec +++ b/plymouth.spec @@ -1,7 +1,7 @@ Summary: Graphical Boot Animation and Logger Name: plymouth Version: 22.02.122 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://www.freedesktop.org/wiki/Software/Plymouth @@ -13,6 +13,8 @@ Patch1: 0001-drm-Retry-setting-scanout-buffer-on-failure.patch Patch2: 0002-Add-support-for-CSI-sequences.patch Patch3: 0003-ply-utils-Reintroduce-ply_string_has_prefix-helper.patch Patch4: 0004-ply-device-manager-Treat-SimpleDRM-drm-devices-as-fb.patch +Patch5: 0005-ply-device-manager-Move-verify_drm_device-higher-up-.patch +Patch6: 0006-ply-device-manager-Also-ignore-SimpleDRM-devs-in-col.patch BuildRequires: make BuildRequires: gcc libtool git @@ -326,7 +328,7 @@ fi %{_datadir}/plymouth/plymouthd.defaults %{_localstatedir}/spool/plymouth %{_mandir}/man?/* -%ghost %{_localstatedir}/lib/plymouth/boot-duration +%ghost %verify(not mode) %{_localstatedir}/lib/plymouth/boot-duration %{_prefix}/lib/systemd/system/ %files devel @@ -396,6 +398,10 @@ fi %changelog +* Wed Sep 28 2022 Hans de Goede - 22.02.122-3 +- Fix SimpleDRM sometimes not being ignored (rhbz#2127663) +- Mark boot-duration file as %%verify(not mode (rhbz#2122896) + * Fri Jul 22 2022 Fedora Release Engineering - 22.02.122-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild