From 0d23c4f490fd580a5170741e4b595058077cdbc3 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Mar 2023 11:38:16 +0000 Subject: [PATCH] import plymouth-0.9.5-6.20210331git1ea1020.el9 --- ...troduce-ply_string_has_prefix-helper.patch | 158 +++++++++++++ ...er-Treat-SimpleDRM-drm-devices-as-fb.patch | 159 +++++++++++++ ...er-Move-verify_drm_device-higher-up-.patch | 213 ++++++++++++++++++ ...er-Remove-unnecessary-subsystem-NULL.patch | 88 ++++++++ ...er-verify_add_or_change-Move-local_c.patch | 103 +++++++++ ...er-verify_add_or_change-Move-local_c.patch | 162 +++++++++++++ SPECS/plymouth.spec | 18 +- 7 files changed, 898 insertions(+), 3 deletions(-) create mode 100644 SOURCES/0001-ply-utils-Reintroduce-ply_string_has_prefix-helper.patch create mode 100644 SOURCES/0002-ply-device-manager-Treat-SimpleDRM-drm-devices-as-fb.patch create mode 100644 SOURCES/0003-ply-device-manager-Move-verify_drm_device-higher-up-.patch create mode 100644 SOURCES/0004-ply-device-manager-Remove-unnecessary-subsystem-NULL.patch create mode 100644 SOURCES/0005-ply-device-manager-verify_add_or_change-Move-local_c.patch create mode 100644 SOURCES/0006-ply-device-manager-verify_add_or_change-Move-local_c.patch diff --git a/SOURCES/0001-ply-utils-Reintroduce-ply_string_has_prefix-helper.patch b/SOURCES/0001-ply-utils-Reintroduce-ply_string_has_prefix-helper.patch new file mode 100644 index 0000000..7e36b9f --- /dev/null +++ b/SOURCES/0001-ply-utils-Reintroduce-ply_string_has_prefix-helper.patch @@ -0,0 +1,158 @@ +From 58161da08c108243d59d58c6c1f9d3c97bb9a3ad Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 7 Mar 2022 12:25:56 +0100 +Subject: [PATCH 1/6] ply-utils: Reintroduce ply_string_has_prefix helper + +ply_string_has_prefix was dropped in commit c7965ea19abf ("ply-utils: +Drop unused ply_string_has_prefix helper"). We have a need for this +helper again, so reintroduce it. + +Signed-off-by: Hans de Goede +--- + src/libply/ply-utils.c | 9 +++++++++ + src/libply/ply-utils.h | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c +index f90ac40..f457579 100644 +--- a/src/libply/ply-utils.c ++++ b/src/libply/ply-utils.c +@@ -432,60 +432,69 @@ ply_copy_string_array (const char *const *array) + int i; + + for (i = 0; array[i] != NULL; i++) { + } + + copy = calloc (i + 1, sizeof(char *)); + + for (i = 0; array[i] != NULL; i++) { + copy[i] = strdup (array[i]); + } + + return copy; + } + + void + ply_free_string_array (char **array) + { + int i; + + if (array == NULL) + return; + + for (i = 0; array[i] != NULL; i++) { + free (array[i]); + array[i] = NULL; + } + + free (array); + } + ++bool ++ply_string_has_prefix (const char *str, const char *prefix) ++{ ++ if (str == NULL || prefix == NULL) ++ return false; ++ ++ return strncmp (str, prefix, strlen (prefix)) == 0; ++} ++ + double + ply_get_timestamp (void) + { + const double nanoseconds_per_second = 1000000000.0; + double timestamp; + struct timespec now = { 0L, /* zero-filled */ }; + + clock_gettime (CLOCK_MONOTONIC, &now); + timestamp = ((nanoseconds_per_second * now.tv_sec) + now.tv_nsec) / + nanoseconds_per_second; + + return timestamp; + } + + void + ply_save_errno (void) + { + assert (errno_stack_position < PLY_ERRNO_STACK_SIZE); + errno_stack[errno_stack_position] = errno; + errno_stack_position++; + } + + void + ply_restore_errno (void) + { + assert (errno_stack_position > 0); + errno_stack_position--; + errno = errno_stack[errno_stack_position]; + } + +diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h +index d7b7622..b4565c3 100644 +--- a/src/libply/ply-utils.h ++++ b/src/libply/ply-utils.h +@@ -56,60 +56,61 @@ typedef enum + #ifndef PLY_HIDE_FUNCTION_DECLARATIONS + + #define ply_round_to_multiple(n, m) (((n) + (((m) - 1))) & ~((m) - 1)) + + bool ply_open_unidirectional_pipe (int *sender_fd, + int *receiver_fd); + int ply_connect_to_unix_socket (const char *path, + ply_unix_socket_type_t type); + int ply_listen_to_unix_socket (const char *path, + ply_unix_socket_type_t type); + bool ply_get_credentials_from_fd (int fd, + pid_t *pid, + uid_t *uid, + gid_t *gid); + + bool ply_write (int fd, + const void *buffer, + size_t number_of_bytes); + bool ply_write_uint32 (int fd, + uint32_t value); + bool ply_read (int fd, + void *buffer, + size_t number_of_bytes); + bool ply_read_uint32 (int fd, + uint32_t *value); + + bool ply_fd_has_data (int fd); + bool ply_set_fd_as_blocking (int fd); + char **ply_copy_string_array (const char *const *array); + void ply_free_string_array (char **array); ++bool ply_string_has_prefix (const char *str, const char *prefix); + double ply_get_timestamp (void); + + void ply_save_errno (void); + void ply_restore_errno (void); + + bool ply_directory_exists (const char *dir); + bool ply_file_exists (const char *file); + bool ply_character_device_exists (const char *device); + + ply_module_handle_t *ply_open_module (const char *module_path); + ply_module_handle_t *ply_open_built_in_module (void); + + ply_module_function_t ply_module_look_up_function (ply_module_handle_t *handle, + const char *function_name); + void ply_close_module (ply_module_handle_t *handle); + + bool ply_create_directory (const char *directory); + bool ply_create_file_link (const char *source, + const char *destination); + void ply_show_new_kernel_messages (bool should_show); + + ply_daemon_handle_t *ply_create_daemon (void); + bool ply_detach_daemon (ply_daemon_handle_t *handle, + int exit_code); + + int ply_utf8_character_get_size (const char *string, + size_t n); + int ply_utf8_string_get_length (const char *string, + size_t n); + +-- +2.37.0.rc1 + diff --git a/SOURCES/0002-ply-device-manager-Treat-SimpleDRM-drm-devices-as-fb.patch b/SOURCES/0002-ply-device-manager-Treat-SimpleDRM-drm-devices-as-fb.patch new file mode 100644 index 0000000..76599b1 --- /dev/null +++ b/SOURCES/0002-ply-device-manager-Treat-SimpleDRM-drm-devices-as-fb.patch @@ -0,0 +1,159 @@ +From ccb1a425efa1a21ba0d6730b8eba030c5f1d4ada Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 28 Feb 2022 16:07:11 +0100 +Subject: [PATCH 2/6] ply-device-manager: Treat SimpleDRM drm devices as fbdev + devices + +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. + +Also adds 2 exceptions to this: + +1. If nomodeset is passed on the kernel commandline then no native +drivers will load, so in this case it is best to immediately use +SimpleDRM devices when they are detected. + +2. On some devics the firmware leave the panel black at boot. In this +case it is desirable to show the splash to the user ASAP so that there +is some visual feedback that the device is booting. Add a support for a +"plymouth.use-simpledrm" kernel cmdline option to show the splash +immediately on SimpleDRM devices rather then waiting for the native +driver to load. + +Closes #167 + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-device-manager.c | 39 +++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index aed7bac..b2484b4 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -378,78 +378,117 @@ create_devices_for_subsystem (ply_device_manager_t *manager, + static void + on_drm_udev_add_or_change (ply_device_manager_t *manager, + const char *action, + const char *device_path, + struct udev_device *device) + { + ply_renderer_t *renderer; + bool changed; + + renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path); + if (renderer == NULL) { + /* We also try to create the renderer again on change events, + * renderer creation fails when no outputs are connected and + * this may have changed. + */ + create_devices_for_udev_device (manager, device); + return; + } + + /* Renderer exists, bail if this is not a change event */ + if (strcmp (action, "change")) + return; + + changed = ply_renderer_handle_change_event (renderer); + if (changed) { + free_displays_for_renderer (manager, renderer); + create_pixel_displays_for_renderer (manager, renderer); + } + } + ++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, + const char *device_path, + struct udev_device *device) + { + const char *subsystem = udev_device_get_subsystem (device); + + if (strcmp (action, "add") && strcmp (action, "change")) + return false; + + subsystem = udev_device_get_subsystem (device); + + if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { + if (manager->local_console_managed && manager->local_console_is_text) { + 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; + } + + return true; + } + + static bool + duplicate_device_path (ply_list_t *events, const char *device_path) + { + struct udev_device *device; + ply_list_node_t *node; + + for (node = ply_list_get_first_node (events); + node; node = ply_list_get_next_node (events, node)) { + device = ply_list_node_get_data (node); + + if (strcmp (udev_device_get_devnode (device), device_path) == 0) + return true; + } + + return false; + } + + static void + process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events) + { + const char *action, *device_path; + struct udev_device *device; +-- +2.37.0.rc1 + diff --git a/SOURCES/0003-ply-device-manager-Move-verify_drm_device-higher-up-.patch b/SOURCES/0003-ply-device-manager-Move-verify_drm_device-higher-up-.patch new file mode 100644 index 0000000..8692e87 --- /dev/null +++ b/SOURCES/0003-ply-device-manager-Move-verify_drm_device-higher-up-.patch @@ -0,0 +1,213 @@ +From 7fbd59d04e971d327c3aaba417765f25c3168447 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 28 Sep 2022 15:14:00 +0200 +Subject: [PATCH 3/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 b2484b4..015bd70 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -236,60 +236,94 @@ fb_device_has_drm_device (ply_device_manager_t *manager, + 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; + } + ++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) + { + const char *device_path; + bool created = false; + + device_path = udev_device_get_devnode (device); + + if (device_path != NULL) { + const char *subsystem; + ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE; + + subsystem = udev_device_get_subsystem (device); + ply_trace ("device subsystem is %s", subsystem); + + if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) { + ply_trace ("found DRM device %s", device_path); + renderer_type = PLY_RENDERER_TYPE_DRM; + } else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) { + ply_trace ("found frame buffer device %s", device_path); + if (!fb_device_has_drm_device (manager, device)) + renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER; + else + ply_trace ("ignoring, since there's a DRM device associated with it"); + } + + if (renderer_type != PLY_RENDERER_TYPE_NONE) { + ply_terminal_t *terminal = NULL; + +@@ -378,94 +412,60 @@ create_devices_for_subsystem (ply_device_manager_t *manager, + static void + on_drm_udev_add_or_change (ply_device_manager_t *manager, + const char *action, + const char *device_path, + struct udev_device *device) + { + ply_renderer_t *renderer; + bool changed; + + renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path); + if (renderer == NULL) { + /* We also try to create the renderer again on change events, + * renderer creation fails when no outputs are connected and + * this may have changed. + */ + create_devices_for_udev_device (manager, device); + return; + } + + /* Renderer exists, bail if this is not a change event */ + if (strcmp (action, "change")) + return; + + changed = ply_renderer_handle_change_event (renderer); + if (changed) { + free_displays_for_renderer (manager, renderer); + create_pixel_displays_for_renderer (manager, renderer); + } + } + +-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, + const char *device_path, + struct udev_device *device) + { + const char *subsystem = udev_device_get_subsystem (device); + + if (strcmp (action, "add") && strcmp (action, "change")) + return false; + + subsystem = udev_device_get_subsystem (device); + + if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { + if (manager->local_console_managed && manager->local_console_is_text) { + 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; + } + + return true; + } +-- +2.37.0.rc1 + diff --git a/SOURCES/0004-ply-device-manager-Remove-unnecessary-subsystem-NULL.patch b/SOURCES/0004-ply-device-manager-Remove-unnecessary-subsystem-NULL.patch new file mode 100644 index 0000000..0bdc59f --- /dev/null +++ b/SOURCES/0004-ply-device-manager-Remove-unnecessary-subsystem-NULL.patch @@ -0,0 +1,88 @@ +From 5a493ef808b769f4ccc4f3acc1ecf048b8e3efdc Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 28 Feb 2022 16:20:43 +0100 +Subject: [PATCH 4/6] ply-device-manager: Remove unnecessary subsystem != NULL + check + +The ply-device-manager.c already assumes that the return value of +udev_device_get_subsystem () is never NULL in many places, including +in the condition of the "else if" just below the check which is +being removed. + +Remove the one lonely check for it being NULL for consistency. + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-device-manager.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index 015bd70..6b7ccd6 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -286,61 +286,61 @@ verify_drm_device (struct udev_device *device) + */ + 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) + { + const char *device_path; + bool created = false; + + device_path = udev_device_get_devnode (device); + + if (device_path != NULL) { + const char *subsystem; + ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE; + + subsystem = udev_device_get_subsystem (device); + ply_trace ("device subsystem is %s", subsystem); + +- if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) { ++ if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { + ply_trace ("found DRM device %s", device_path); + renderer_type = PLY_RENDERER_TYPE_DRM; + } else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) { + ply_trace ("found frame buffer device %s", device_path); + if (!fb_device_has_drm_device (manager, device)) + renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER; + else + ply_trace ("ignoring, since there's a DRM device associated with it"); + } + + if (renderer_type != PLY_RENDERER_TYPE_NONE) { + ply_terminal_t *terminal = NULL; + + if (!manager->local_console_managed) { + terminal = manager->local_console_terminal; + } + + created = create_devices_for_terminal_and_renderer_type (manager, + device_path, + terminal, + renderer_type); + if (created) { + if (renderer_type == PLY_RENDERER_TYPE_DRM) + manager->found_drm_device = 1; + if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER) + manager->found_fb_device = 1; + } + } + } + +-- +2.37.0.rc1 + diff --git a/SOURCES/0005-ply-device-manager-verify_add_or_change-Move-local_c.patch b/SOURCES/0005-ply-device-manager-verify_add_or_change-Move-local_c.patch new file mode 100644 index 0000000..f5bb7b8 --- /dev/null +++ b/SOURCES/0005-ply-device-manager-verify_add_or_change-Move-local_c.patch @@ -0,0 +1,103 @@ +From 406376fbe89078678d68392ea76151ecb4f0e30a Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 28 Feb 2022 16:36:58 +0100 +Subject: [PATCH 5/6] ply-device-manager: verify_add_or_change(): Move + local_console_is_text check + +Move the local_console_is_text check outside of the +"if (subsytem == SUBSYSTEM_DRM)" block. + +This check is equally relevant for SUBSYSTEM_FRAME_BUFFER. + +Note by itself this is a no-op since verify_add_or_change() *always* +returns false for SUBSYSTEM_FRAME_BUFFER devices. + +This is a preparation patch for making verify_add_or_change() not +return false when manager->device_timeout_elapsed is set. + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-device-manager.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index 6b7ccd6..bff4982 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -423,68 +423,68 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, + /* We also try to create the renderer again on change events, + * renderer creation fails when no outputs are connected and + * this may have changed. + */ + create_devices_for_udev_device (manager, device); + return; + } + + /* Renderer exists, bail if this is not a change event */ + if (strcmp (action, "change")) + return; + + changed = ply_renderer_handle_change_event (renderer); + if (changed) { + free_displays_for_renderer (manager, renderer); + create_pixel_displays_for_renderer (manager, renderer); + } + } + + static bool + verify_add_or_change (ply_device_manager_t *manager, + const char *action, + const char *device_path, + struct udev_device *device) + { + const char *subsystem = udev_device_get_subsystem (device); + + if (strcmp (action, "add") && strcmp (action, "change")) + return false; + ++ if (manager->local_console_managed && manager->local_console_is_text) { ++ ply_trace ("ignoring since we're already using text splash for local console"); ++ return false; ++ } ++ + subsystem = udev_device_get_subsystem (device); + + if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { +- if (manager->local_console_managed && manager->local_console_is_text) { +- 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; + } + + return true; + } + + static bool + duplicate_device_path (ply_list_t *events, const char *device_path) + { + struct udev_device *device; + ply_list_node_t *node; + + for (node = ply_list_get_first_node (events); + node; node = ply_list_get_next_node (events, node)) { + device = ply_list_node_get_data (node); + + if (strcmp (udev_device_get_devnode (device), device_path) == 0) + return true; + } + + return false; + } + + static void +-- +2.37.0.rc1 + diff --git a/SOURCES/0006-ply-device-manager-verify_add_or_change-Move-local_c.patch b/SOURCES/0006-ply-device-manager-verify_add_or_change-Move-local_c.patch new file mode 100644 index 0000000..ade0edf --- /dev/null +++ b/SOURCES/0006-ply-device-manager-verify_add_or_change-Move-local_c.patch @@ -0,0 +1,162 @@ +From eb40956898e35121525e253305f6d40b45cfbf23 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 28 Feb 2022 16:36:58 +0100 +Subject: [PATCH 6/6] ply-device-manager: verify_add_or_change(): Move + local_console_is_text check + +Move the local_console_is_text check outside of the +"if (subsytem == SUBSYSTEM_DRM)" block. + +This check is equally relevant for SUBSYSTEM_FRAME_BUFFER. + +Note by itself this is a no-op since verify_add_or_change() *always* +returns false for SUBSYSTEM_FRAME_BUFFER devices. + +This is a preparation patch for making verify_add_or_change() not +return false when manager->device_timeout_elapsed is set. + +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 bff4982..29b26fc 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -287,60 +287,64 @@ verify_drm_device (struct udev_device *device) + 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) + { + const char *device_path; + bool created = false; + + device_path = udev_device_get_devnode (device); + + if (device_path != NULL) { + const char *subsystem; + ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE; + + subsystem = udev_device_get_subsystem (device); + ply_trace ("device subsystem is %s", subsystem); + + if (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) { + ply_trace ("found frame buffer device %s", device_path); + if (!fb_device_has_drm_device (manager, device)) + renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER; + else + ply_trace ("ignoring, since there's a DRM device associated with it"); + } + + if (renderer_type != PLY_RENDERER_TYPE_NONE) { + ply_terminal_t *terminal = NULL; + + if (!manager->local_console_managed) { + terminal = manager->local_console_terminal; + } + + created = create_devices_for_terminal_and_renderer_type (manager, + device_path, + terminal, + renderer_type); + if (created) { + if (renderer_type == PLY_RENDERER_TYPE_DRM) + manager->found_drm_device = 1; + if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER) + manager->found_fb_device = 1; + } + } + } + +@@ -430,66 +434,61 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, + + /* Renderer exists, bail if this is not a change event */ + if (strcmp (action, "change")) + return; + + changed = ply_renderer_handle_change_event (renderer); + if (changed) { + free_displays_for_renderer (manager, renderer); + create_pixel_displays_for_renderer (manager, renderer); + } + } + + static bool + verify_add_or_change (ply_device_manager_t *manager, + const char *action, + const char *device_path, + struct udev_device *device) + { + const char *subsystem = udev_device_get_subsystem (device); + + if (strcmp (action, "add") && strcmp (action, "change")) + return false; + + if (manager->local_console_managed && manager->local_console_is_text) { + ply_trace ("ignoring since we're already using text splash for local console"); + return false; + } + + subsystem = udev_device_get_subsystem (device); + +- if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { +- if (!verify_drm_device (device)) { +- ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); +- return false; +- } +- } else { ++ if (strcmp (subsystem, SUBSYSTEM_DRM)) { + ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); + return false; + } + + return true; + } + + static bool + duplicate_device_path (ply_list_t *events, const char *device_path) + { + struct udev_device *device; + ply_list_node_t *node; + + for (node = ply_list_get_first_node (events); + node; node = ply_list_get_next_node (events, node)) { + device = ply_list_node_get_data (node); + + if (strcmp (udev_device_get_devnode (device), device_path) == 0) + return true; + } + + return false; + } + + static void + process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events) + { + const char *action, *device_path; + struct udev_device *device; + ply_list_node_t *node; +-- +2.37.0.rc1 + diff --git a/SPECS/plymouth.spec b/SPECS/plymouth.spec index af5a17a..9d48dba 100644 --- a/SPECS/plymouth.spec +++ b/SPECS/plymouth.spec @@ -5,7 +5,7 @@ Summary: Graphical Boot Animation and Logger Name: plymouth Version: 0.9.5 -Release: 5.%{commitdate}git%{shortcommit}%{?dist} +Release: 6.%{commitdate}git%{shortcommit}%{?dist} License: GPLv2+ URL: http://www.freedesktop.org/wiki/Software/Plymouth @@ -14,12 +14,20 @@ Source0: https://gitlab.freedesktop.org/jwrdegoede/plymouth/-/archive/%{commit}/ #Source0: https://gitlab.freedesktop.org/plymouth/plymouth/-/archive/%%{commit}/%%{name}-%%{shortcommit}.tar.gz Source2: charge.plymouth +Patch10001: 0001-ply-utils-Reintroduce-ply_string_has_prefix-helper.patch +Patch10002: 0002-ply-device-manager-Treat-SimpleDRM-drm-devices-as-fb.patch +Patch10003: 0003-ply-device-manager-Move-verify_drm_device-higher-up-.patch +Patch10004: 0004-ply-device-manager-Remove-unnecessary-subsystem-NULL.patch +Patch10005: 0005-ply-device-manager-verify_add_or_change-Move-local_c.patch +Patch10006: 0006-ply-device-manager-verify_add_or_change-Move-local_c.patch + # Upstream has bumped the soname because some obscure symbols were dropped, # but we really do not want to change soname in Fedora during a cycle. # The only libply* user in Fedora outside this pkg is plymouth-theme-breeze # and that does not need the removed symbols. -Patch0: 0001-Revert-configure-bump-so-name.patch -Patch1: ship-label-plugin-in-initrd.patch +Patch6660001: 0001-Revert-configure-bump-so-name.patch + +Patch9999001: ship-label-plugin-in-initrd.patch BuildRequires: make BuildRequires: gcc libtool git @@ -402,6 +410,10 @@ fi %changelog +* Wed Nov 16 2022 Ray Strode - 0.9.5-6.20210331git%(c=%{commit}; echo ${c:0:7}) +- Backport simpledrm patches from upstream + Resolves: #2104910 + * Mon Jan 31 2022 Ray Strode - 0.9.5-5.20210331git1ea1020 - Ship label plugin in initramfs Resolves: #2017138