diff --git a/0001-device-manager-drop-superfluous-create_pixel_display.patch b/0001-device-manager-drop-superfluous-create_pixel_display.patch new file mode 100644 index 0000000..92ec6ce --- /dev/null +++ b/0001-device-manager-drop-superfluous-create_pixel_display.patch @@ -0,0 +1,32 @@ +From 6e9e95dc0fe89a3c52f50e44ff0096a6e65e46a6 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Wed, 20 Dec 2017 10:49:19 -0500 +Subject: [PATCH 1/6] device-manager: drop superfluous + create_pixel_displays_for_renderer call + +commit 29e27637694eefc962d53333c729e6cac1c66518 tried to move +create_pixel_displays_for_renderer down a couple of lines, but it +inadvertently copied it instead of moved it. + +This commit fixes that. + +https://bugs.freedesktop.org/show_bug.cgi?id=104353 +--- + src/libply-splash-core/ply-device-manager.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index cf56f4e..fbf4723 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -713,7 +713,6 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + if (manager->keyboard_added_handler != NULL) + manager->keyboard_added_handler (manager->event_handler_data, keyboard); + +- create_pixel_displays_for_renderer (manager, renderer); + ply_hashtable_insert (manager->renderers, strdup (ply_renderer_get_device_name (renderer)), renderer); + create_pixel_displays_for_renderer (manager, renderer); + +-- +2.17.0 + diff --git a/0001-device-manager-fall-back-to-text-mode-if-graphical-d.patch b/0001-device-manager-fall-back-to-text-mode-if-graphical-d.patch new file mode 100644 index 0000000..84e3924 --- /dev/null +++ b/0001-device-manager-fall-back-to-text-mode-if-graphical-d.patch @@ -0,0 +1,113 @@ +From bdfcf889f8cda47190d98fa8a3e401a1db38074c Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Tue, 7 Nov 2017 13:49:30 -0500 +Subject: [PATCH] device-manager: fall back to text mode if graphical devices + fail + +Right now we assume if we find a /dev/dri/card0 that it will work. +That may not be true. The proprietary nvidia driver, for instance, +provides /dev/dri/card0 but disables modesetting by default. + +This commit makes sure we fall back to text mode if /dev/dri/card0 +is insufficient for our needs. + +https://bugs.freedesktop.org/show_bug.cgi?id=103612 +--- + src/libply-splash-core/ply-device-manager.c | 26 ++++++++++++--------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index b4c33d4..cf56f4e 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -47,7 +47,7 @@ + static void create_devices_from_udev (ply_device_manager_t *manager); + #endif + +-static void create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, ++static bool create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + const char *device_path, + ply_terminal_t *terminal, + ply_renderer_type_t renderer_type); +@@ -212,11 +212,12 @@ fb_device_has_drm_device (ply_device_manager_t *manager, + return has_drm_device; + } + +-static void ++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); + +@@ -245,12 +246,14 @@ create_devices_for_udev_device (ply_device_manager_t *manager, + terminal = manager->local_console_terminal; + } + +- create_devices_for_terminal_and_renderer_type (manager, +- device_path, +- terminal, +- renderer_type); ++ created = create_devices_for_terminal_and_renderer_type (manager, ++ device_path, ++ terminal, ++ renderer_type); + } + } ++ ++ return created; + } + + static void +@@ -310,8 +313,7 @@ create_devices_for_subsystem (ply_device_manager_t *manager, + node = udev_device_get_devnode (device); + if (node != NULL) { + ply_trace ("found node %s", node); +- found_device = true; +- create_devices_for_udev_device (manager, device); ++ found_device = create_devices_for_udev_device (manager, device); + } + } else { + ply_trace ("device doesn't have a devices tag"); +@@ -656,7 +658,7 @@ create_text_displays_for_terminal (ply_device_manager_t *manager, + manager->text_display_added_handler (manager->event_handler_data, display); + } + +-static void ++static bool + create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + const char *device_path, + ply_terminal_t *terminal, +@@ -670,7 +672,7 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + + if (renderer != NULL) { + ply_trace ("ignoring device %s since it's already managed", device_path); +- return; ++ return true; + } + + ply_trace ("creating devices for %s (renderer type: %u) (terminal: %s)", +@@ -686,7 +688,7 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + renderer = NULL; + + if (renderer_type != PLY_RENDERER_TYPE_AUTO) +- return; ++ return false; + } + + if (renderer != NULL) { +@@ -743,6 +745,8 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, + ply_trace ("activating keyboards"); + ply_keyboard_watch_for_input (keyboard); + } ++ ++ return true; + } + + static void +-- +2.17.1 + diff --git a/0001-device-manager-skip-graphical-renderer-setup-when-de.patch b/0001-device-manager-skip-graphical-renderer-setup-when-de.patch new file mode 100644 index 0000000..0795c49 --- /dev/null +++ b/0001-device-manager-skip-graphical-renderer-setup-when-de.patch @@ -0,0 +1,117 @@ +From 014c2158898067176738ec36c9c90cc266a7e35b Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Wed, 6 Jun 2018 17:06:14 -0700 +Subject: [PATCH] device-manager: skip graphical renderer setup when details + forced + +If neither "rhgb" nor "splash" is on the kernel cmdline, then +plymouth forces the "details" splash. This splash is merely +a passthrough plugin, where it makes boot looks like plymouth +isn't even running. + +In this case, the code sets PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV. +The idea is to not bother waiting for udev events notifying +plymouth when graphics devices show up, since it doesn't need +to use the grpahics devices directly anyway. + +Unfortunately, it does still erroneously try to setup graphical +renderers in this case, including the /dev/fb renderer. + +Before commit e4f86e3c, these graphical renderers failed because +they were given the wrong device name, but since that fix, they're +suceeding. We definitely don't want the /dev/fb renderer to +load if we're ignoring udev on efi systems, since during very +early boot /dev/fb is backed by efifb, something we never want to +use. efifb is supposed to get replaced during the boot process +by other fb implementations like say radeondrmfb, virtiodrmfb or +bochsdrmfb, and some of those implementations can't handle the +transition if /dev/fb is open at switchover time. + +This commit adds a new flag to tell the device manager to +not bother trying to setup graphical renderers when details are +forced. + +http://bugzilla.redhat.com/1518464 +--- + src/libply-splash-core/ply-device-manager.c | 20 ++++++++++++++++---- + src/libply-splash-core/ply-device-manager.h | 3 ++- + src/main.c | 4 +++- + 3 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index fbf4723..b637fb8 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -786,6 +786,15 @@ create_devices_from_terminals (ply_device_manager_t *manager) + return false; + } + ++static void ++create_non_graphical_devices (ply_device_manager_t *manager) ++{ ++ create_devices_for_terminal_and_renderer_type (manager, ++ NULL, ++ manager->local_console_terminal, ++ PLY_RENDERER_TYPE_NONE); ++} ++ + #ifdef HAVE_UDEV + static void + create_devices_from_udev (ply_device_manager_t *manager) +@@ -801,10 +810,7 @@ create_devices_from_udev (ply_device_manager_t *manager) + return; + + ply_trace ("Creating non-graphical devices, since there's no suitable graphics hardware"); +- create_devices_for_terminal_and_renderer_type (manager, +- NULL, +- manager->local_console_terminal, +- PLY_RENDERER_TYPE_NONE); ++ create_non_graphical_devices (manager); + } + #endif + +@@ -845,6 +851,12 @@ ply_device_manager_watch_devices (ply_device_manager_t *manager, + if (done_with_initial_devices_setup) + return; + ++ if ((manager->flags & PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS)) { ++ ply_trace ("Creating non-graphical devices, since renderers are being explicitly skipped"); ++ create_non_graphical_devices (manager); ++ return; ++ } ++ + if ((manager->flags & PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV)) { + ply_trace ("udev support disabled, creating fallback devices"); + create_fallback_devices (manager); +diff --git a/src/libply-splash-core/ply-device-manager.h b/src/libply-splash-core/ply-device-manager.h +index 058f6e8..ad05897 100644 +--- a/src/libply-splash-core/ply-device-manager.h ++++ b/src/libply-splash-core/ply-device-manager.h +@@ -31,7 +31,8 @@ typedef enum + { + PLY_DEVICE_MANAGER_FLAGS_NONE = 0, + PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES = 1 << 0, +- PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1 ++ PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1, ++ PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS = 1 << 2 + } ply_device_manager_flags_t; + + typedef struct _ply_device_manager ply_device_manager_t; +diff --git a/src/main.c b/src/main.c +index f1e0fa7..841fe6b 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -2358,7 +2358,9 @@ main (int argc, + device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV; + + if (!plymouth_should_show_default_splash (&state)) { +- /* don't bother listening for udev events if we're forcing details */ ++ /* don't bother listening for udev events or setting up a graphical renderer ++ * if we're forcing details */ ++ device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS; + device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV; + + /* don't ever delay showing the detailed splash */ +-- +2.17.1 + diff --git a/0001-main-ensure-tty-is-closed-on-deactivate.patch b/0001-main-ensure-tty-is-closed-on-deactivate.patch new file mode 100644 index 0000000..e6a048f --- /dev/null +++ b/0001-main-ensure-tty-is-closed-on-deactivate.patch @@ -0,0 +1,71 @@ +From 28ee4012c94b4045b97e5a2a66f66b7688b2dff3 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Sat, 25 Aug 2018 12:21:45 -0400 +Subject: [PATCH 1/5] main: ensure tty is closed on deactivate + +If plymouth doesn't get explicitly "activated" then when +GDM tries to deactivate it, the deactivation request is +a noop. + +One aspect of being active, though is having ownership and +control of the terminal. This happens immediately, even +before a splash is shown. + +The `deactivate` request needs to relinguish such control, +unconditionally, since some display server is about to use +the tty. + +This commit fixes that. +--- + src/main.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/src/main.c b/src/main.c +index 7e58fff..0564e15 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -1267,13 +1267,8 @@ quit_program (state_t *state) + } + + static void +-deactivate_splash (state_t *state) ++deactivate_console (state_t *state) + { +- assert (!state->is_inactive); +- +- if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash)) +- ply_device_manager_deactivate_renderers (state->device_manager); +- + detach_from_running_session (state); + + if (state->local_console_terminal != NULL) { +@@ -1287,6 +1282,18 @@ deactivate_splash (state_t *state) + if (command_line_has_argument (state->kernel_command_line, "plymouth.debug")) + ply_logger_close_file (ply_logger_get_error_default ()); + ++} ++ ++static void ++deactivate_splash (state_t *state) ++{ ++ assert (!state->is_inactive); ++ ++ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash)) ++ ply_device_manager_deactivate_renderers (state->device_manager); ++ ++ deactivate_console (state); ++ + state->is_inactive = true; + + ply_trigger_pull (state->deactivate_trigger, NULL); +@@ -1322,6 +1329,7 @@ on_deactivate (state_t *state, + ply_trigger_t *deactivate_trigger) + { + if (state->is_inactive) { ++ deactivate_console (state); + ply_trigger_pull (deactivate_trigger, NULL); + return; + } +-- +2.19.0 + diff --git a/0001-renderer-support-reactivating-renderer-without-closi.patch b/0001-renderer-support-reactivating-renderer-without-closi.patch new file mode 100644 index 0000000..715ed08 --- /dev/null +++ b/0001-renderer-support-reactivating-renderer-without-closi.patch @@ -0,0 +1,36 @@ +From eb147e52b123070ab8839c3f59aaecc43fcc8652 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 25 Jun 2018 22:02:07 +0200 +Subject: [PATCH 1/9] renderer: support reactivating renderer without closing + it first + +At the moment, ply_renderer_activate() doesn't work immediately following +ply_renderer_deactivate(). This is because the renderer isn't marked +inactive until it's closed. + +This commit marks the renderer inactive when it's deactivated. + +Signed-off-by: Hans de Goede + +https://bugs.freedesktop.org/show_bug.cgi?id=107047 +--- + src/libply-splash-core/ply-renderer.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/libply-splash-core/ply-renderer.c b/src/libply-splash-core/ply-renderer.c +index b9059ef..ecf7082 100644 +--- a/src/libply-splash-core/ply-renderer.c ++++ b/src/libply-splash-core/ply-renderer.c +@@ -314,7 +314,8 @@ ply_renderer_deactivate (ply_renderer_t *renderer) + { + assert (renderer->plugin_interface != NULL); + +- return renderer->plugin_interface->deactivate (renderer->backend); ++ renderer->plugin_interface->deactivate (renderer->backend); ++ renderer->is_active = false; + } + + bool +-- +2.18.0 + diff --git a/0002-libply-Move-kernel-commandline-parsing-functions-to-.patch b/0002-libply-Move-kernel-commandline-parsing-functions-to-.patch new file mode 100644 index 0000000..58af9e9 --- /dev/null +++ b/0002-libply-Move-kernel-commandline-parsing-functions-to-.patch @@ -0,0 +1,494 @@ +From 13d95b10dd15974a74f645e99f99d934544afe37 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 4 Oct 2018 12:47:52 +0200 +Subject: [PATCH 2/5] libply: Move kernel commandline parsing functions to + libply/ply-utils + +Move kernel commandline parsing functions to libply/ply-utils to avoid +code duplication between the daemon, the client and the plugins. + +Signed-off-by: Hans de Goede +--- + src/client/plymouth.c | 34 +--------- + src/libply/ply-utils.c | 94 ++++++++++++++++++++++++++++ + src/libply/ply-utils.h | 4 ++ + src/main.c | 137 ++++++----------------------------------- + 4 files changed, 120 insertions(+), 149 deletions(-) + +diff --git a/src/client/plymouth.c b/src/client/plymouth.c +index 46a64f5..4e14603 100644 +--- a/src/client/plymouth.c ++++ b/src/client/plymouth.c +@@ -49,7 +49,6 @@ typedef struct + ply_event_loop_t *loop; + ply_boot_client_t *client; + ply_command_parser_t *command_parser; +- char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE]; + } state_t; + + typedef struct +@@ -704,31 +703,6 @@ on_quit_request (state_t *state, + on_failure, state); + } + +-static bool +-get_kernel_command_line (state_t *state) +-{ +- int fd; +- +- ply_trace ("opening /proc/cmdline"); +- fd = open ("/proc/cmdline", O_RDONLY); +- +- if (fd < 0) { +- ply_trace ("couldn't open it: %m"); +- return false; +- } +- +- ply_trace ("reading kernel command line"); +- if (read (fd, state->kernel_command_line, sizeof(state->kernel_command_line) - 1) < 0) { +- ply_trace ("couldn't read it: %m"); +- close (fd); +- return false; +- } +- +- ply_trace ("Kernel command line is: '%s'", state->kernel_command_line); +- close (fd); +- return true; +-} +- + static void + on_update_root_fs_request (state_t *state, + const char *command) +@@ -1099,12 +1073,8 @@ main (int argc, + return 0; + } + +- if (get_kernel_command_line (&state)) { +- if ((strstr (state.kernel_command_line, "plymouth.debug") != NULL || +- strstr (state.kernel_command_line, "plymouth:debug") != NULL) +- && !ply_is_tracing ()) +- ply_toggle_tracing (); +- } ++ if (ply_kernel_cmd_line_has_argument ("plymouth.debug") && !ply_is_tracing ()) ++ ply_toggle_tracing (); + + if (should_be_verbose && !ply_is_tracing ()) + ply_toggle_tracing (); +diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c +index 89e37e9..1f7f07c 100644 +--- a/src/libply/ply-utils.c ++++ b/src/libply/ply-utils.c +@@ -24,6 +24,7 @@ + #include "ply-utils.h" + + #include ++#include + #include + #include + #include +@@ -80,6 +81,9 @@ static int errno_stack_position = 0; + + static int overridden_device_scale = 0; + ++static char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE]; ++static bool kernel_command_line_is_set; ++ + bool + ply_open_unidirectional_pipe (int *sender_fd, + int *receiver_fd) +@@ -1015,4 +1019,94 @@ ply_get_device_scale (uint32_t width, + return device_scale; + } + ++static const char * ++ply_get_kernel_command_line (void) ++{ ++ const char *remaining_command_line; ++ char *key; ++ int fd; ++ ++ if (kernel_command_line_is_set) ++ return kernel_command_line; ++ ++ ply_trace ("opening /proc/cmdline"); ++ fd = open ("/proc/cmdline", O_RDONLY); ++ ++ if (fd < 0) { ++ ply_trace ("couldn't open it: %m"); ++ return NULL; ++ } ++ ++ ply_trace ("reading kernel command line"); ++ if (read (fd, kernel_command_line, sizeof(kernel_command_line) - 1) < 0) { ++ ply_trace ("couldn't read it: %m"); ++ close (fd); ++ return NULL; ++ } ++ ++ /* we now use plymouth.argument for kernel commandline arguments. ++ * It used to be plymouth:argument. This bit just rewrites all : to be . ++ */ ++ remaining_command_line = kernel_command_line; ++ while ((key = strstr (remaining_command_line, "plymouth:")) != NULL) { ++ char *colon; ++ ++ colon = key + strlen ("plymouth"); ++ *colon = '.'; ++ ++ remaining_command_line = colon + 1; ++ } ++ ply_trace ("Kernel command line is: '%s'", kernel_command_line); ++ ++ close (fd); ++ ++ kernel_command_line_is_set = true; ++ return kernel_command_line; ++} ++ ++const char * ++ply_kernel_cmd_line_get_string_after_prefix (const char *prefix) ++{ ++ const char *command_line = ply_get_kernel_command_line(); ++ char *argument; ++ ++ if (!command_line) ++ return NULL; ++ ++ argument = strstr (command_line, prefix); ++ ++ if (argument == NULL) ++ return NULL; ++ ++ if (argument == command_line || ++ argument[-1] == ' ') ++ return argument + strlen (prefix); ++ ++ return NULL; ++} ++ ++bool ++ply_kernel_cmd_line_has_argument (const char *argument) ++{ ++ const char *string; ++ ++ string = ply_kernel_cmd_line_get_string_after_prefix (argument); ++ ++ if (string == NULL) ++ return false; ++ ++ if (!isspace ((int) string[0]) && string[0] != '\0') ++ return false; ++ ++ return true; ++} ++ ++void ++ply_kernel_cmd_line_set (const char *cmd_line) ++{ ++ strncpy (kernel_command_line, cmd_line, sizeof(kernel_command_line)); ++ kernel_command_line[sizeof(kernel_command_line) - 1] = '\0'; ++ kernel_command_line_is_set = true; ++} ++ + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h +index c46603e..6016484 100644 +--- a/src/libply/ply-utils.h ++++ b/src/libply/ply-utils.h +@@ -128,6 +128,10 @@ int ply_get_device_scale (uint32_t width, + uint32_t width_mm, + uint32_t height_mm); + ++const char *ply_kernel_cmd_line_get_string_after_prefix (const char *prefix); ++bool ply_kernel_cmd_line_has_argument (const char *argument); ++void ply_kernel_cmd_line_set (const char *cmd_line); ++ + #endif + + #endif /* PLY_UTILS_H */ +diff --git a/src/main.c b/src/main.c +index 0564e15..61d94c1 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -24,7 +24,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -56,10 +55,6 @@ + #include "ply-utils.h" + #include "ply-progress.h" + +-#ifndef PLY_MAX_COMMAND_LINE_SIZE +-#define PLY_MAX_COMMAND_LINE_SIZE 4097 +-#endif +- + #define BOOT_DURATION_FILE PLYMOUTH_TIME_DIRECTORY "/boot-duration" + #define SHUTDOWN_DURATION_FILE PLYMOUTH_TIME_DIRECTORY "/shutdown-duration" + +@@ -109,8 +104,6 @@ typedef struct + double splash_delay; + double device_timeout; + +- char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE]; +- uint32_t kernel_command_line_is_set : 1; + uint32_t no_boot_log : 1; + uint32_t showing_details : 1; + uint32_t system_initialized : 1; +@@ -381,41 +374,6 @@ show_detailed_splash (state_t *state) + update_display (state); + } + +-static const char * +-command_line_get_string_after_prefix (const char *command_line, +- const char *prefix) +-{ +- char *argument; +- +- argument = strstr (command_line, prefix); +- +- if (argument == NULL) +- return NULL; +- +- if (argument == command_line || +- argument[-1] == ' ') +- return argument + strlen (prefix); +- +- return NULL; +-} +- +-static bool +-command_line_has_argument (const char *command_line, +- const char *argument) +-{ +- const char *string; +- +- string = command_line_get_string_after_prefix (command_line, argument); +- +- if (string == NULL) +- return false; +- +- if (!isspace ((int) string[0]) && string[0] != '\0') +- return false; +- +- return true; +-} +- + static void + find_override_splash (state_t *state) + { +@@ -424,8 +382,7 @@ find_override_splash (state_t *state) + if (state->override_splash_path != NULL) + return; + +- splash_string = command_line_get_string_after_prefix (state->kernel_command_line, +- "plymouth.splash="); ++ splash_string = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.splash="); + + if (splash_string != NULL) { + const char *end; +@@ -452,7 +409,7 @@ find_override_splash (state_t *state) + if (isnan (state->splash_delay)) { + const char *delay_string; + +- delay_string = command_line_get_string_after_prefix (state->kernel_command_line, "plymouth.splash-delay="); ++ delay_string = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.splash-delay="); + + if (delay_string != NULL) + state->splash_delay = atof (delay_string); +@@ -464,7 +421,7 @@ find_force_scale (state_t *state) + { + const char *scale_string; + +- scale_string = command_line_get_string_after_prefix (state->kernel_command_line, "plymouth.force-scale="); ++ scale_string = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.force-scale="); + + if (scale_string != NULL) + ply_set_device_scale (strtoul (scale_string, NULL, 0)); +@@ -879,10 +836,10 @@ static bool + plymouth_should_ignore_show_splash_calls (state_t *state) + { + ply_trace ("checking if plymouth should be running"); +- if (state->mode != PLY_MODE_BOOT || command_line_has_argument (state->kernel_command_line, "plymouth.force-splash")) ++ if (state->mode != PLY_MODE_BOOT || ply_kernel_cmd_line_has_argument ("plymouth.force-splash")) + return false; + +- if (command_line_has_argument (state->kernel_command_line, "plymouth.ignore-show-splash")) ++ if (ply_kernel_cmd_line_has_argument ("plymouth.ignore-show-splash")) + return true; + + return false; +@@ -894,7 +851,7 @@ sh_is_init (state_t *state) + const char *init_string; + size_t length; + +- init_string = command_line_get_string_after_prefix (state->kernel_command_line, "init="); ++ init_string = ply_kernel_cmd_line_get_string_after_prefix ("init="); + + if (init_string) { + length = strcspn (init_string, " \n"); +@@ -919,28 +876,28 @@ plymouth_should_show_default_splash (state_t *state) + return false; + + for (i = 0; strings[i] != NULL; i++) { +- if (command_line_has_argument (state->kernel_command_line, strings[i])) { ++ if (ply_kernel_cmd_line_has_argument (strings[i])) { + ply_trace ("no default splash because kernel command line has option \"%s\"", strings[i]); + return false; + } + } + +- if (command_line_has_argument (state->kernel_command_line, "splash=verbose")) { ++ if (ply_kernel_cmd_line_has_argument ("splash=verbose")) { + ply_trace ("no default splash because kernel command line has option \"splash=verbose\""); + return false; + } + +- if (command_line_has_argument (state->kernel_command_line, "rhgb")) { ++ if (ply_kernel_cmd_line_has_argument ("rhgb")) { + ply_trace ("using default splash because kernel command line has option \"rhgb\""); + return true; + } + +- if (command_line_has_argument (state->kernel_command_line, "splash")) { ++ if (ply_kernel_cmd_line_has_argument ("splash")) { + ply_trace ("using default splash because kernel command line has option \"splash\""); + return true; + } + +- if (command_line_has_argument (state->kernel_command_line, "splash=silent")) { ++ if (ply_kernel_cmd_line_has_argument ("splash=silent")) { + ply_trace ("using default splash because kernel command line has option \"splash=silent\""); + return true; + } +@@ -1279,7 +1236,7 @@ deactivate_console (state_t *state) + } + + /* do not let any tty opened where we could write after deactivate */ +- if (command_line_has_argument (state->kernel_command_line, "plymouth.debug")) ++ if (ply_kernel_cmd_line_has_argument ("plymouth.debug")) + ply_logger_close_file (ply_logger_get_error_default ()); + + } +@@ -1872,52 +1829,6 @@ detach_from_running_session (state_t *state) + state->is_attached = false; + } + +-static bool +-get_kernel_command_line (state_t *state) +-{ +- int fd; +- const char *remaining_command_line; +- char *key; +- +- if (state->kernel_command_line_is_set) +- return true; +- +- ply_trace ("opening /proc/cmdline"); +- fd = open ("/proc/cmdline", O_RDONLY); +- +- if (fd < 0) { +- ply_trace ("couldn't open it: %m"); +- return false; +- } +- +- ply_trace ("reading kernel command line"); +- if (read (fd, state->kernel_command_line, sizeof(state->kernel_command_line) - 1) < 0) { +- ply_trace ("couldn't read it: %m"); +- close (fd); +- return false; +- } +- +- +- /* we now use plymouth.argument for kernel commandline arguments. +- * It used to be plymouth:argument. This bit just rewrites all : to be . +- */ +- remaining_command_line = state->kernel_command_line; +- while ((key = strstr (remaining_command_line, "plymouth:")) != NULL) { +- char *colon; +- +- colon = key + strlen ("plymouth"); +- *colon = '.'; +- +- remaining_command_line = colon + 1; +- } +- ply_trace ("Kernel command line is: '%s'", state->kernel_command_line); +- +- close (fd); +- +- state->kernel_command_line_is_set = true; +- return true; +-} +- + static void + check_verbosity (state_t *state) + { +@@ -1926,13 +1837,11 @@ check_verbosity (state_t *state) + + ply_trace ("checking if tracing should be enabled"); + +- stream = command_line_get_string_after_prefix (state->kernel_command_line, +- "plymouth.debug=stream:"); ++ stream = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.debug=stream:"); + +- path = command_line_get_string_after_prefix (state->kernel_command_line, +- "plymouth.debug=file:"); ++ path = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.debug=file:"); + if (stream != NULL || path != NULL || +- command_line_has_argument (state->kernel_command_line, "plymouth.debug")) { ++ ply_kernel_cmd_line_has_argument ("plymouth.debug")) { + int fd; + + ply_trace ("tracing should be enabled!"); +@@ -2010,7 +1919,7 @@ check_logging (state_t *state) + + ply_trace ("checking if console messages should be redirected and logged"); + +- kernel_no_log = command_line_has_argument (state->kernel_command_line, "plymouth.nolog"); ++ kernel_no_log = ply_kernel_cmd_line_has_argument ("plymouth.nolog"); + if (kernel_no_log) + state->no_boot_log = true; + +@@ -2064,9 +1973,6 @@ initialize_environment (state_t *state) + { + ply_trace ("initializing minimal work environment"); + +- if (!get_kernel_command_line (state)) +- return false; +- + if (!state->default_tty) + if (getenv ("DISPLAY") != NULL && access (PLYMOUTH_PLUGIN_PATH "renderers/x11.so", F_OK) == 0) + state->default_tty = "/dev/tty"; +@@ -2279,11 +2185,8 @@ main (int argc, + if (tty != NULL) + state.default_tty = tty; + +- if (kernel_command_line != NULL) { +- strncpy (state.kernel_command_line, kernel_command_line, sizeof(state.kernel_command_line)); +- state.kernel_command_line[sizeof(state.kernel_command_line) - 1] = '\0'; +- state.kernel_command_line_is_set = true; +- } ++ if (kernel_command_line != NULL) ++ ply_kernel_cmd_line_set (kernel_command_line); + + if (geteuid () != 0) { + ply_error ("plymouthd must be run as root user"); +@@ -2375,10 +2278,10 @@ main (int argc, + find_system_default_splash (&state); + find_distribution_default_splash (&state); + +- if (command_line_has_argument (state.kernel_command_line, "plymouth.ignore-serial-consoles")) ++ if (ply_kernel_cmd_line_has_argument ("plymouth.ignore-serial-consoles")) + device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES; + +- if (command_line_has_argument (state.kernel_command_line, "plymouth.ignore-udev") || ++ if (ply_kernel_cmd_line_has_argument ("plymouth.ignore-udev") || + (getenv ("DISPLAY") != NULL)) + device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV; + +-- +2.19.0 + diff --git a/0002-main-Do-not-update-the-display-on-backspace-when-the.patch b/0002-main-Do-not-update-the-display-on-backspace-when-the.patch new file mode 100644 index 0000000..d92621a --- /dev/null +++ b/0002-main-Do-not-update-the-display-on-backspace-when-the.patch @@ -0,0 +1,45 @@ +From da27e42316962be6f6b8ba2afb49760d9704d070 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 21 Jan 2018 14:07:39 +0100 +Subject: [PATCH 2/6] main: Do not update the display on backspace when there + is no input to remove + +On machines with a slow CPU (Atom) and a highres screen drawing the +diskcrypt dialog may take longer then the keyrepeat speed, this leads to +a long delay before showing keypresses when doing the following: + +1) Type long password +2) Realize it is wrong, press + hold backspace + the key-repeat will now generate backspace key presses faster then we + process them as main.c does an update_display for each press +3) Users releases backspace when we've processed input-length backspace + key-presses, but since we were drawing slower then key-presses were + coming in many more backspace keypresses are in the keyboard buffer +4) User types first character of the right password, this shows up up to + a couple of seconds later because first we are still processing all + the queued up backspace presses and doing a redraw for each. + +This commit fixes this by skipping the redraws in on_backspace when there +is no more input left in the input buffer. + +https://bugs.freedesktop.org/show_bug.cgi?id=104714 +--- + src/main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/main.c b/src/main.c +index 08c7fe1..f1e0fa7 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -1570,6 +1570,8 @@ on_backspace (state_t *state) + + bytes = ply_buffer_get_bytes (state->entry_buffer); + size = ply_buffer_get_size (state->entry_buffer); ++ if (size == 0) ++ return; + + bytes_to_remove = MIN (size, PLY_UTF8_CHARACTER_SIZE_MAX); + while ((previous_character_size = ply_utf8_character_get_size (bytes + size - bytes_to_remove, bytes_to_remove)) < bytes_to_remove) { +-- +2.17.0 + diff --git a/0002-main-move-ply_device_manager_deactivate_renderers-in.patch b/0002-main-move-ply_device_manager_deactivate_renderers-in.patch new file mode 100644 index 0000000..336b6c6 --- /dev/null +++ b/0002-main-move-ply_device_manager_deactivate_renderers-in.patch @@ -0,0 +1,61 @@ +From 778e0fb77a9dfb85270242f1238eba237488eb48 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 25 Jun 2018 16:55:39 +0200 +Subject: [PATCH 2/9] main: move ply_device_manager_deactivate_renderers() into + hide_splash() + +hide_splash() should be the counter-part of show_splash(). show_splash() +calls ply_device_manager_activate_renderers() (through show_theme()). + +2 of the 3 callers of hide_splash() are already calling +ply_device_manager_deactivate_renderers() directly before calling +hide_splash(). This commit moves the deactivate call into hide_splash() +so that it also gets called from the 3th code-path, which is when +the user hits the escape to key to toggle from the splash to details. + +It's important that plymouth deactivates its renderers before going +to details, because those renderers can block the kernel from +initializing fbcon, which the kernel will start doing lazily in the +future: + +https://lkml.org/lkml/2018/6/26/489. + +Signed-off-by: Hans de Goede + +https://bugs.freedesktop.org/show_bug.cgi?id=107047 +--- + src/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/main.c b/src/main.c +index 841fe6b..ff02ea6 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -1174,6 +1174,8 @@ quit_splash (state_t *state) + static void + hide_splash (state_t *state) + { ++ ply_device_manager_deactivate_renderers (state->device_manager); ++ + state->is_shown = false; + + cancel_pending_delayed_show (state); +@@ -1193,7 +1195,6 @@ dump_details_and_quit_splash (state_t *state) + state->showing_details = false; + toggle_between_splash_and_details (state); + +- ply_device_manager_deactivate_renderers (state->device_manager); + hide_splash (state); + quit_splash (state); + } +@@ -1291,7 +1292,6 @@ on_boot_splash_idle (state_t *state) + if (state->quit_trigger != NULL) { + if (!state->should_retain_splash) { + ply_trace ("hiding splash"); +- ply_device_manager_deactivate_renderers (state->device_manager); + hide_splash (state); + } + +-- +2.18.0 + diff --git a/0003-drm-Reset-LUT-gamma-table-before-the-first-drmModeSe.patch b/0003-drm-Reset-LUT-gamma-table-before-the-first-drmModeSe.patch new file mode 100644 index 0000000..08e7790 --- /dev/null +++ b/0003-drm-Reset-LUT-gamma-table-before-the-first-drmModeSe.patch @@ -0,0 +1,123 @@ +From 2da4f7614e5aecb470b748752a3864d2ecae365a Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 2 Oct 2018 10:26:28 +0200 +Subject: [PATCH 3/5] drm: Reset LUT/gamma table before the first + drmModeSetCrtc call + +When we takeover the kms master from whatever process came before us the +LUT table may be a mess making the graphics funky. So lets reset it once +before our first drmModeSetCrtc call. + +Closes #59 + +Signed-off-by: Hans de Goede +--- + src/plugins/renderers/drm/plugin.c | 40 +++++++++++++++++++++++++++--- + 1 file changed, 37 insertions(+), 3 deletions(-) + +diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c +index 1080590..6e6b520 100644 +--- a/src/plugins/renderers/drm/plugin.c ++++ b/src/plugins/renderers/drm/plugin.c +@@ -84,6 +84,9 @@ struct _ply_renderer_head + uint32_t encoder_id; + uint32_t console_buffer_id; + uint32_t scan_out_buffer_id; ++ ++ int gamma_size; ++ uint16_t *gamma; + }; + + struct _ply_renderer_input_source +@@ -451,11 +454,13 @@ ply_renderer_head_new (ply_renderer_backend_t *backend, + int connector_mode_index, + uint32_t encoder_id, + uint32_t controller_id, +- uint32_t console_buffer_id) ++ uint32_t console_buffer_id, ++ int gamma_size) + { + ply_renderer_head_t *head; + drmModeModeInfo *mode; +- int rotation; ++ unsigned int shift; ++ int i, rotation; + + head = calloc (1, sizeof(ply_renderer_head_t)); + +@@ -476,6 +481,20 @@ ply_renderer_head_new (ply_renderer_backend_t *backend, + head->area.width = mode->hdisplay; + head->area.height = mode->vdisplay; + ++ if (gamma_size) { ++ head->gamma_size = gamma_size; ++ head->gamma = malloc(gamma_size * 3 * sizeof(uint16_t)); ++ ++ /* gamma_size is always a power of 2 */ ++ for (shift = 0; (gamma_size << shift) < (1 << 16); shift++); ++ ++ for (i = 0; i < gamma_size; i++) { ++ head->gamma[0 * gamma_size + i] = i << shift; /* red */ ++ head->gamma[1 * gamma_size + i] = i << shift; /* green */ ++ head->gamma[2 * gamma_size + i] = i << shift; /* blue */ ++ } ++ } ++ + ply_renderer_head_add_connector (head, connector, connector_mode_index); + assert (ply_array_get_size (head->connector_ids) > 0); + +@@ -502,6 +521,7 @@ ply_renderer_head_free (ply_renderer_head_t *head) + + drmModeFreeConnector (head->connector0); + ply_array_free (head->connector_ids); ++ free (head->gamma); + free (head); + } + +@@ -601,6 +621,18 @@ ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend, + ply_trace ("Setting scan out buffer of %ldx%ld head to our buffer", + head->area.width, head->area.height); + ++ /* Set gamma table, do this only once */ ++ if (head->gamma) { ++ drmModeCrtcSetGamma (backend->device_fd, ++ head->controller_id, ++ head->gamma_size, ++ head->gamma + 0 * head->gamma_size, ++ head->gamma + 1 * head->gamma_size, ++ head->gamma + 2 * head->gamma_size); ++ free (head->gamma); ++ head->gamma = NULL; ++ } ++ + /* Tell the controller to use the allocated scan out buffer on each connectors + */ + if (drmModeSetCrtc (backend->device_fd, head->controller_id, buffer_id, +@@ -1024,6 +1056,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + uint32_t controller_id; + uint32_t console_buffer_id; + int connector_mode_index; ++ int gamma_size; + + connector = drmModeGetConnector (backend->device_fd, + backend->resources->connectors[i]); +@@ -1069,6 +1102,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + } + + console_buffer_id = controller->buffer_id; ++ gamma_size = controller->gamma_size; + drmModeFreeCrtc (controller); + + head = ply_hashtable_lookup (heads_by_controller_id, +@@ -1077,7 +1111,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + if (head == NULL) { + head = ply_renderer_head_new (backend, connector, connector_mode_index, + encoder_id, controller_id, +- console_buffer_id); ++ console_buffer_id, gamma_size); + + ply_list_append_data (backend->heads, head); + +-- +2.19.0 + diff --git a/0003-main-Only-activate-renderers-if-the-splash-uses-pixe.patch b/0003-main-Only-activate-renderers-if-the-splash-uses-pixe.patch new file mode 100644 index 0000000..ff9f018 --- /dev/null +++ b/0003-main-Only-activate-renderers-if-the-splash-uses-pixe.patch @@ -0,0 +1,98 @@ +From 447c783046a0e6bd0486e780f6a94396637a5bd4 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 2 Jul 2018 09:39:12 +0200 +Subject: [PATCH 3/9] main: Only activate renderers if the splash uses + pixel-displays + +Since commit eb147e52b123 ("renderer: support reactivating renderer without +closing it first"), the show_theme() call done by +toggle_between_splash_and_details() will reactivate the renderers after +switching to details mode, causing the drm renderer to switch the screen +from text to graphics mode hiding the details being logged on the console. + +This commit fixes this by only calling ply_device_manager_activate_renderers() +and ply_device_manager_deactivate_renderers if the splash uses pixel-displays. + +Signed-off-by: Hans de Goede + +https://bugs.freedesktop.org/show_bug.cgi?id=107047 +--- + src/libply-splash-core/ply-boot-splash.c | 6 ++++++ + src/libply-splash-core/ply-boot-splash.h | 1 + + src/main.c | 12 ++++++++---- + 3 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/src/libply-splash-core/ply-boot-splash.c b/src/libply-splash-core/ply-boot-splash.c +index 87a7a0c..2e295f4 100644 +--- a/src/libply-splash-core/ply-boot-splash.c ++++ b/src/libply-splash-core/ply-boot-splash.c +@@ -695,4 +695,10 @@ ply_boot_splash_become_idle (ply_boot_splash_t *splash, + splash->plugin_interface->become_idle (splash->plugin, splash->idle_trigger); + } + ++bool ++ply_boot_splash_uses_pixel_displays (ply_boot_splash_t *splash) ++{ ++ return splash->plugin_interface->add_pixel_display != NULL; ++} ++ + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +diff --git a/src/libply-splash-core/ply-boot-splash.h b/src/libply-splash-core/ply-boot-splash.h +index b66ca47..0bdbe96 100644 +--- a/src/libply-splash-core/ply-boot-splash.h ++++ b/src/libply-splash-core/ply-boot-splash.h +@@ -89,6 +89,7 @@ void ply_boot_splash_attach_progress (ply_boot_splash_t *splash, + void ply_boot_splash_become_idle (ply_boot_splash_t *splash, + ply_boot_splash_on_idle_handler_t idle_handler, + void *user_data); ++bool ply_boot_splash_uses_pixel_displays (ply_boot_splash_t *splash); + + + #endif +diff --git a/src/main.c b/src/main.c +index ff02ea6..ed23968 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -1174,7 +1174,8 @@ quit_splash (state_t *state) + static void + hide_splash (state_t *state) + { +- ply_device_manager_deactivate_renderers (state->device_manager); ++ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash)) ++ ply_device_manager_deactivate_renderers (state->device_manager); + + state->is_shown = false; + +@@ -1260,7 +1261,8 @@ deactivate_splash (state_t *state) + { + assert (!state->is_inactive); + +- ply_device_manager_deactivate_renderers (state->device_manager); ++ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash)) ++ ply_device_manager_deactivate_renderers (state->device_manager); + + detach_from_running_session (state); + +@@ -1359,7 +1361,8 @@ on_reactivate (state_t *state) + } + + ply_device_manager_activate_keyboards (state->device_manager); +- ply_device_manager_activate_renderers (state->device_manager); ++ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash)) ++ ply_device_manager_activate_renderers (state->device_manager); + + state->is_inactive = false; + +@@ -1763,7 +1766,8 @@ show_theme (state_t *state, + return NULL; + + attach_splash_to_devices (state, splash); +- ply_device_manager_activate_renderers (state->device_manager); ++ if (ply_boot_splash_uses_pixel_displays (splash)) ++ ply_device_manager_activate_renderers (state->device_manager); + + splash_mode = get_splash_mode_from_mode (state->mode); + +-- +2.18.0 + diff --git a/0003-pixel-buffer-Add-the-concept-of-device-rotation.patch b/0003-pixel-buffer-Add-the-concept-of-device-rotation.patch new file mode 100644 index 0000000..0317509 --- /dev/null +++ b/0003-pixel-buffer-Add-the-concept-of-device-rotation.patch @@ -0,0 +1,249 @@ +From 0e4e268844ea38075535eb5b233dda325da4481d Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 6 Dec 2017 17:37:12 +0100 +Subject: [PATCH 3/6] pixel-buffer: Add the concept of device rotation + +On some devices the LCD panel is mounted in the casing in such a way +that the up/top side of the panel does not match with the top side of +the device (e.g. it is mounted upside-down). + +This commit adds support to the ply-pixel-buffer code to create +buffers which take device rotation into account and which will rotate +the picture to compensate. + +https://bugs.freedesktop.org/show_bug.cgi?id=104714 +--- + src/libply-splash-core/ply-pixel-buffer.c | 109 ++++++++++++++++++++-- + src/libply-splash-core/ply-pixel-buffer.h | 9 ++ + 2 files changed, 110 insertions(+), 8 deletions(-) + +diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c +index 52a3f86..a337407 100644 +--- a/src/libply-splash-core/ply-pixel-buffer.c ++++ b/src/libply-splash-core/ply-pixel-buffer.c +@@ -50,6 +50,7 @@ struct _ply_pixel_buffer + ply_region_t *updated_areas; /* in device pixels */ + uint32_t is_opaque : 1; + int device_scale; ++ int device_rotation; + }; + + static inline void ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer, +@@ -153,6 +154,52 @@ make_pixel_value_translucent (uint32_t pixel_value, + return (alpha << 24) | (red << 16) | (green << 8) | blue; + } + ++static inline void ply_pixel_buffer_set_pixel (ply_pixel_buffer_t *buffer, ++ int x, ++ int y, ++ uint32_t pixel_value) ++{ ++ switch (buffer->device_rotation) { ++ case PLY_PIXEL_BUFFER_ROTATE_UPRIGHT: ++ buffer->bytes[y * buffer->area.width + x] = pixel_value; ++ break; ++ case PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN: ++ x = (buffer->area.width - 1) - x; ++ y = (buffer->area.height - 1) - y; ++ buffer->bytes[y * buffer->area.width + x] = pixel_value; ++ break; ++ case PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE: ++ y = (buffer->area.height - 1) - y; ++ buffer->bytes[x * buffer->area.height + y] = pixel_value; ++ break; ++ case PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE: ++ x = (buffer->area.width - 1) - x; ++ buffer->bytes[x * buffer->area.height + y] = pixel_value; ++ break; ++ } ++} ++ ++static inline uint32_t ply_pixel_buffer_get_pixel (ply_pixel_buffer_t *buffer, ++ int x, ++ int y) ++{ ++ switch (buffer->device_rotation) { ++ case PLY_PIXEL_BUFFER_ROTATE_UPRIGHT: ++ return buffer->bytes[y * buffer->area.width + x]; ++ case PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN: ++ x = (buffer->area.width - 1) - x; ++ y = (buffer->area.height - 1) - y; ++ return buffer->bytes[y * buffer->area.width + x]; ++ case PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE: ++ y = (buffer->area.height - 1) - y; ++ return buffer->bytes[x * buffer->area.height + y]; ++ case PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE: ++ x = (buffer->area.width - 1) - x; ++ return buffer->bytes[x * buffer->area.height + y]; ++ } ++ return 0; ++} ++ + static inline void + ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer, + int x, +@@ -162,12 +209,12 @@ ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer, + uint32_t old_pixel_value; + + if ((pixel_value >> 24) != 0xff) { +- old_pixel_value = buffer->bytes[y * buffer->area.width + x]; ++ old_pixel_value = ply_pixel_buffer_get_pixel (buffer, x, y); + + pixel_value = blend_two_pixel_values (pixel_value, old_pixel_value); + } + +- buffer->bytes[y * buffer->area.width + x] = pixel_value; ++ ply_pixel_buffer_set_pixel (buffer, x, y, pixel_value); + } + + static void +@@ -222,6 +269,35 @@ ply_pixel_buffer_crop_area_to_clip_area (ply_pixel_buffer_t *buffer, + } + } + ++static void ply_pixel_buffer_add_updated_area (ply_pixel_buffer_t *buffer, ++ ply_rectangle_t *area) ++{ ++ ply_rectangle_t updated_area = *area; ++ ++ switch (buffer->device_rotation) { ++ case PLY_PIXEL_BUFFER_ROTATE_UPRIGHT: ++ break; ++ case PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN: ++ updated_area.x = buffer->area.width - area->width - area->x; ++ updated_area.y = buffer->area.height - area->height - area->y; ++ break; ++ case PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE: ++ updated_area.x = buffer->area.height - area->height - area->y; ++ updated_area.y = area->x; ++ updated_area.height = area->width; ++ updated_area.width = area->height; ++ break; ++ case PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE: ++ updated_area.x = area->y; ++ updated_area.y = buffer->area.width - area->width - area->x; ++ updated_area.height = area->width; ++ updated_area.width = area->height; ++ break; ++ } ++ ++ ply_region_add_rectangle (buffer->updated_areas, &updated_area); ++} ++ + static void + ply_pixel_buffer_fill_area_with_pixel_value (ply_pixel_buffer_t *buffer, + ply_rectangle_t *fill_area, +@@ -251,7 +327,7 @@ ply_pixel_buffer_fill_area_with_pixel_value (ply_pixel_buffer_t *buffer, + } + } + +- ply_region_add_rectangle (buffer->updated_areas, &cropped_area); ++ ply_pixel_buffer_add_updated_area (buffer, &cropped_area); + } + + void +@@ -281,9 +357,24 @@ ply_pixel_buffer_pop_clip_area (ply_pixel_buffer_t *buffer) + ply_pixel_buffer_t * + ply_pixel_buffer_new (unsigned long width, + unsigned long height) ++{ ++ return ply_pixel_buffer_new_with_device_rotation ( ++ width, height, PLY_PIXEL_BUFFER_ROTATE_UPRIGHT); ++} ++ ++ply_pixel_buffer_t * ++ply_pixel_buffer_new_with_device_rotation (unsigned long width, ++ unsigned long height, ++ int device_rotation) + { + ply_pixel_buffer_t *buffer; + ++ if (device_rotation >= PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE) { ++ unsigned long tmp = width; ++ width = height; ++ height = tmp; ++ } ++ + buffer = calloc (1, sizeof(ply_pixel_buffer_t)); + + buffer->updated_areas = ply_region_new (); +@@ -292,6 +383,7 @@ ply_pixel_buffer_new (unsigned long width, + buffer->area.height = height; + buffer->logical_area = buffer->area; + buffer->device_scale = 1; ++ buffer->device_rotation = device_rotation; + + buffer->clip_areas = ply_list_new (); + ply_pixel_buffer_push_clip_area (buffer, &buffer->area); +@@ -447,7 +539,7 @@ ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer, + + for (y = buffer->area.y; y < buffer->area.y + buffer->area.height; y++) { + if (cropped_area.y <= y && y < cropped_area.y + cropped_area.height) { +- if (cropped_area.width < UNROLLED_PIXEL_COUNT) { ++ if (cropped_area.width < UNROLLED_PIXEL_COUNT || buffer->device_rotation) { + for (x = cropped_area.x; x < cropped_area.x + cropped_area.width; x++) { + pixel = 0xff000000; + RANDOMIZE (noise); +@@ -457,7 +549,7 @@ ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer, + RANDOMIZE (noise); + pixel |= (((blue + noise) & COLOR_MASK) >> BLUE_SHIFT); + +- buffer->bytes[y * buffer->area.width + x] = pixel; ++ ply_pixel_buffer_set_pixel (buffer, x, y, pixel); + } + } else { + uint32_t shaded_set[UNROLLED_PIXEL_COUNT]; +@@ -485,7 +577,7 @@ ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer, + blue += blue_step; + } + +- ply_region_add_rectangle (buffer->updated_areas, &cropped_area); ++ ply_pixel_buffer_add_updated_area (buffer, &cropped_area); + } + + void +@@ -671,7 +763,7 @@ ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip_and_scale (ply_pixel + } + } + +- ply_region_add_rectangle (buffer->updated_areas, &cropped_area); ++ ply_pixel_buffer_add_updated_area (buffer, &cropped_area); + } + + void +@@ -756,7 +848,8 @@ ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canv + + /* Fast path to memcpy if we need no blending or scaling */ + if (opacity == 1.0 && ply_pixel_buffer_is_opaque (source) && +- canvas->device_scale == source->device_scale) { ++ canvas->device_scale == source->device_scale && ++ canvas->device_rotation == PLY_PIXEL_BUFFER_ROTATE_UPRIGHT) { + ply_rectangle_t cropped_area; + + cropped_area.x = x_offset; +diff --git a/src/libply-splash-core/ply-pixel-buffer.h b/src/libply-splash-core/ply-pixel-buffer.h +index 595e9bd..7736dd3 100644 +--- a/src/libply-splash-core/ply-pixel-buffer.h ++++ b/src/libply-splash-core/ply-pixel-buffer.h +@@ -37,9 +37,18 @@ typedef struct _ply_pixel_buffer ply_pixel_buffer_t; + | ((uint8_t) (CLAMP (g * 255.0, 0.0, 255.0)) << 8) \ + | ((uint8_t) (CLAMP (b * 255.0, 0.0, 255.0)))) + ++#define PLY_PIXEL_BUFFER_ROTATE_UPRIGHT 0 ++#define PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN 1 ++#define PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE 2 ++#define PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE 3 ++ + #ifndef PLY_HIDE_FUNCTION_DECLARATIONS + ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width, + unsigned long height); ++ply_pixel_buffer_t * ++ply_pixel_buffer_new_with_device_rotation (unsigned long width, ++ unsigned long height, ++ int device_rotation); + void ply_pixel_buffer_free (ply_pixel_buffer_t *buffer); + void ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer, + ply_rectangle_t *size); +-- +2.17.0 + diff --git a/0004-drm-Check-for-panel-orientation-connector-property.patch b/0004-drm-Check-for-panel-orientation-connector-property.patch new file mode 100644 index 0000000..f953c8b --- /dev/null +++ b/0004-drm-Check-for-panel-orientation-connector-property.patch @@ -0,0 +1,102 @@ +From a6f25b727698a2382e332ab566ed39ee30f8efdc Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 12 Dec 2017 19:47:26 +0100 +Subject: [PATCH 4/6] drm: Check for "panel orientation" connector property + +On some devices the LCD panel is mounted in the casing in such a way +that the up/top side of the panel does not match with the top side of +the device (e.g. it is mounted upside-down). + +Kernel 4.16 introduces a new "panel-orientation" property on the drm +connector which allows modesetting applications / code to check for +such LCD panels. + +This commit adds support for this new property and passes this to the +pixel_buffer code using the new ply_pixel_buffer_new_with_device_rotation +method, so that the pixel_buffer code will automatically rotate the +image to correct for the panel orientation. + +https://bugs.freedesktop.org/show_bug.cgi?id=104714 +--- + src/plugins/renderers/drm/plugin.c | 51 +++++++++++++++++++++++++++++- + 1 file changed, 50 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c +index b93e8e4..f495854 100644 +--- a/src/plugins/renderers/drm/plugin.c ++++ b/src/plugins/renderers/drm/plugin.c +@@ -367,6 +367,53 @@ destroy_output_buffer (ply_renderer_backend_t *backend, + ply_renderer_buffer_free (backend, buffer); + } + ++static int ++connector_orientation_prop_to_rotation (drmModePropertyPtr prop, ++ int orientation) ++{ ++ const char *name = prop->enums[orientation].name; ++ ++ if (strcmp (name, "Upside Down") == 0) ++ return PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN; ++ ++ if (strcmp (name, "Left Side Up") == 0) { ++ /* Left side up, rotate counter clockwise to correct */ ++ return PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE; ++ } ++ ++ if (strcmp (name, "Right Side Up") == 0) { ++ /* Left side up, rotate clockwise to correct */ ++ return PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE; ++ } ++ ++ return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; ++} ++ ++static int ++ply_renderer_connector_get_rotation (ply_renderer_backend_t *backend, ++ drmModeConnector *connector) ++{ ++ drmModePropertyPtr prop; ++ int i, rotation; ++ ++ for (i = 0; i < connector->count_props; i++) { ++ prop = drmModeGetProperty (backend->device_fd, connector->props[i]); ++ if (!prop) ++ continue; ++ ++ if ((prop->flags & DRM_MODE_PROP_ENUM) && ++ strcmp (prop->name, "panel orientation") == 0) { ++ rotation = connector_orientation_prop_to_rotation (prop, connector->prop_values[i]); ++ drmModeFreeProperty (prop); ++ return rotation; ++ } ++ ++ drmModeFreeProperty (prop); ++ } ++ ++ return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; ++} ++ + static bool + ply_renderer_head_add_connector (ply_renderer_head_t *head, + drmModeConnector *connector, +@@ -402,6 +449,7 @@ ply_renderer_head_new (ply_renderer_backend_t *backend, + { + ply_renderer_head_t *head; + drmModeModeInfo *mode; ++ int rotation; + + head = calloc (1, sizeof(ply_renderer_head_t)); + +@@ -425,7 +473,8 @@ ply_renderer_head_new (ply_renderer_backend_t *backend, + ply_renderer_head_add_connector (head, connector, connector_mode_index); + assert (ply_array_get_size (head->connector_ids) > 0); + +- head->pixel_buffer = ply_pixel_buffer_new (head->area.width, head->area.height); ++ rotation = ply_renderer_connector_get_rotation (backend, connector); ++ head->pixel_buffer = ply_pixel_buffer_new_with_device_rotation (head->area.width, head->area.height, rotation); + ply_pixel_buffer_set_device_scale (head->pixel_buffer, + ply_get_device_scale (head->area.width, + head->area.height, +-- +2.17.0 + diff --git a/0004-drm-Refactor-ply_renderer_connector_get_rotation.patch b/0004-drm-Refactor-ply_renderer_connector_get_rotation.patch new file mode 100644 index 0000000..0bc50cd --- /dev/null +++ b/0004-drm-Refactor-ply_renderer_connector_get_rotation.patch @@ -0,0 +1,144 @@ +From 8db07cf2629d3a211b78c24b676f803703b1ec1f Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 2 Oct 2018 14:13:19 +0200 +Subject: [PATCH 4/5] drm: Refactor ply_renderer_connector_get_rotation + +ply_renderer_connector_get_rotation walks over all properties to add +support for selecting the preferred mode we also want to know if a connector +is part of a tiled output or not, which also requires walking over the props. + +This commit refactors ply_renderer_connector_get_rotation into +ply_renderer_connector_get_rotation_and_tiled to prepare for this. + +While at also properly use ply_pixel_buffer_rotation_t for the orientation +instead of an int. + +Signed-off-by: Hans de Goede +--- + src/plugins/renderers/drm/plugin.c | 52 +++++++++++++++++------------- + 1 file changed, 30 insertions(+), 22 deletions(-) + +diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c +index 6e6b520..2d90ecb 100644 +--- a/src/plugins/renderers/drm/plugin.c ++++ b/src/plugins/renderers/drm/plugin.c +@@ -376,7 +376,7 @@ destroy_output_buffer (ply_renderer_backend_t *backend, + ply_renderer_buffer_free (backend, buffer); + } + +-static int ++static ply_pixel_buffer_rotation_t + connector_orientation_prop_to_rotation (drmModePropertyPtr prop, + int orientation) + { +@@ -398,12 +398,17 @@ connector_orientation_prop_to_rotation (drmModePropertyPtr prop, + return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; + } + +-static int +-ply_renderer_connector_get_rotation (ply_renderer_backend_t *backend, +- drmModeConnector *connector) ++static void ++ply_renderer_connector_get_rotation_and_tiled (ply_renderer_backend_t *backend, ++ drmModeConnector *connector, ++ ply_pixel_buffer_rotation_t *rotation, ++ bool *tiled) + { + drmModePropertyPtr prop; +- int i, rotation; ++ int i; ++ ++ *rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; ++ *tiled = false; + + for (i = 0; i < connector->count_props; i++) { + prop = drmModeGetProperty (backend->device_fd, connector->props[i]); +@@ -411,16 +416,15 @@ ply_renderer_connector_get_rotation (ply_renderer_backend_t *backend, + continue; + + if ((prop->flags & DRM_MODE_PROP_ENUM) && +- strcmp (prop->name, "panel orientation") == 0) { +- rotation = connector_orientation_prop_to_rotation (prop, connector->prop_values[i]); +- drmModeFreeProperty (prop); +- return rotation; +- } ++ strcmp (prop->name, "panel orientation") == 0) ++ *rotation = connector_orientation_prop_to_rotation (prop, connector->prop_values[i]); ++ ++ if ((prop->flags & DRM_MODE_PROP_BLOB) && ++ strcmp (prop->name, "TILE") == 0) ++ *tiled = true; + + drmModeFreeProperty (prop); + } +- +- return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; + } + + static bool +@@ -449,18 +453,19 @@ ply_renderer_head_add_connector (ply_renderer_head_t *head, + } + + static ply_renderer_head_t * +-ply_renderer_head_new (ply_renderer_backend_t *backend, +- drmModeConnector *connector, +- int connector_mode_index, +- uint32_t encoder_id, +- uint32_t controller_id, +- uint32_t console_buffer_id, +- int gamma_size) ++ply_renderer_head_new (ply_renderer_backend_t *backend, ++ drmModeConnector *connector, ++ int connector_mode_index, ++ uint32_t encoder_id, ++ uint32_t controller_id, ++ uint32_t console_buffer_id, ++ int gamma_size, ++ ply_pixel_buffer_rotation_t rotation) + { + ply_renderer_head_t *head; + drmModeModeInfo *mode; + unsigned int shift; +- int i, rotation; ++ int i; + + head = calloc (1, sizeof(ply_renderer_head_t)); + +@@ -498,7 +503,6 @@ ply_renderer_head_new (ply_renderer_backend_t *backend, + ply_renderer_head_add_connector (head, connector, connector_mode_index); + assert (ply_array_get_size (head->connector_ids) > 0); + +- rotation = ply_renderer_connector_get_rotation (backend, connector); + head->pixel_buffer = ply_pixel_buffer_new_with_device_rotation (head->area.width, head->area.height, rotation); + ply_pixel_buffer_set_device_scale (head->pixel_buffer, + ply_get_device_scale (head->area.width, +@@ -1057,6 +1061,8 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + uint32_t console_buffer_id; + int connector_mode_index; + int gamma_size; ++ ply_pixel_buffer_rotation_t rotation; ++ bool tiled; + + connector = drmModeGetConnector (backend->device_fd, + backend->resources->connectors[i]); +@@ -1092,6 +1098,8 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + + controller_id = controller->crtc_id; + ++ ply_renderer_connector_get_rotation_and_tiled (backend, connector, &rotation, &tiled); ++ + connector_mode_index = get_index_of_active_mode (backend, controller, connector); + + /* If we couldn't find the current active mode, fall back to the first available. +@@ -1111,7 +1119,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + if (head == NULL) { + head = ply_renderer_head_new (backend, connector, connector_mode_index, + encoder_id, controller_id, +- console_buffer_id, gamma_size); ++ console_buffer_id, gamma_size, rotation); + + ply_list_append_data (backend->heads, head); + +-- +2.19.0 + diff --git a/0004-drm-Remove-unnecessary-reset_scan_out_buffer_if_need.patch b/0004-drm-Remove-unnecessary-reset_scan_out_buffer_if_need.patch new file mode 100644 index 0000000..ce6aea6 --- /dev/null +++ b/0004-drm-Remove-unnecessary-reset_scan_out_buffer_if_need.patch @@ -0,0 +1,85 @@ +From b527834c8821362da6d01ee15ecab589a43abfcb Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 2 Jul 2018 23:46:59 +0200 +Subject: [PATCH 4/9] drm: Remove unnecessary reset_scan_out_buffer_if_needed() + call from ply_renderer_head_map() + +ply_renderer_head_map() gets only called from map_to_device() which +calls activate() directly afterwards which calls +ply_renderer_head_set_scan_out_buffer(), so there is no need for the +reset_scan_out_buffer_if_needed() call. + +Not only is it not needed, but it is actually harmful, there are 2 problems +woth it: + +1) Normally the drm plugin gets instantiated by ply-renderer.c with + rendered->is_active=true, backend->is_active=false. The + rendered->is_active=true causes the first ply_renderer_activate call + to be a no-op without calling backend->activate(). So when the first + map_to_device() calls happen activate() has not been called yet and we've + not yet claimed master rights, so ply_renderer_head_set_scan_out_buffer() + calls will always fail, resulting in this in a ply-trace: + + Mapping buffer for 1920x1080 renderer head + Redrawing 1920x1080 renderer head + Setting scan out buffer of 1920x1080 head to our buffer + Couldn't set scan out buffer for head with controller id 41 + + This is harmless, but also shows that the reset_scan_out_buffer_if_needed() + is really not needed. + +2. If deactivate_renderer() gets called before the first show-splash then + rendered->is_active will become false, so renderer_activate() done before + map_to_device() will now actually call backend->activate() claiming + drm master rights and setting backend->is_active=true. + + The map_to_device() -> ply_renderer_head_map() call done after this, calls + ply_renderer_head_redraw() -> flush_head() which under 1. was a no-op + as it exits directly when backend->is_active=false. But now it actually + flushes the buffers by calling reset_scan_out_buffer_if_needed(). This + itself is fine. + + But since reset_scan_out_buffer_if_needed() has already happened in + ply_renderer_head_redraw() the reset_scan_out_buffer_if_needed() call this + commit removes would always return false (no reset necessary) causing + ply_renderer_head_map() to destroy the buffer and return an error. + + This results in the splash briefly showing, followed by the core soon after + trying another map_to_device(), which again briefly shows the splash, etc. + With the end result being a badly flickering display. + +Signed-off-by: Hans de Goede +--- + src/plugins/renderers/drm/plugin.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c +index fb79aa6..1080590 100644 +--- a/src/plugins/renderers/drm/plugin.c ++++ b/src/plugins/renderers/drm/plugin.c +@@ -618,8 +618,6 @@ static bool + ply_renderer_head_map (ply_renderer_backend_t *backend, + ply_renderer_head_t *head) + { +- bool scan_out_set; +- + assert (backend != NULL); + assert (backend->device_fd >= 0); + assert (backend != NULL); +@@ -646,13 +644,6 @@ ply_renderer_head_map (ply_renderer_backend_t *backend, + */ + ply_renderer_head_redraw (backend, head); + +- scan_out_set = reset_scan_out_buffer_if_needed (backend, head); +- if (!scan_out_set && backend->is_active) { +- destroy_output_buffer (backend, head->scan_out_buffer_id); +- head->scan_out_buffer_id = 0; +- return false; +- } +- + return true; + } + +-- +2.18.0 + diff --git a/0005-drm-Reset-primary-plane-rotation-to-DRM_MODE_ROTATE_.patch b/0005-drm-Reset-primary-plane-rotation-to-DRM_MODE_ROTATE_.patch new file mode 100644 index 0000000..0602bad --- /dev/null +++ b/0005-drm-Reset-primary-plane-rotation-to-DRM_MODE_ROTATE_.patch @@ -0,0 +1,148 @@ +From d769f1194c934ed4ff7ce6bfc502ba485d461c12 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sat, 20 Jan 2018 12:20:29 +0100 +Subject: [PATCH 5/6] drm: Reset primary plane rotation to DRM_MODE_ROTATE_0 + +On devices where the (LCD) panel is mounted upside-down in the case +the kernel's drm_fb_helper code may have set up rotation on the primary +plane to make the text-console (and other fbdev using apps) show the right +way up. + +We inherit this rotation from the text-mode and since we do our own rotation +where necessary we end up rotating twice and showing the boot-splash +upside-down again. + +Dealing with hardware rotation may require using a specific framebuffer +tiling which we do not support, so we should just disable the hardware +rotation and keep using our own software rotation. + +This commit adds code to find the primary plane and its rotation property +and if it is not DRM_MODE_ROTATE_0 then sets it to DRM_MODE_ROTATE_0. fixing +the double rotation issue. + +https://bugs.freedesktop.org/show_bug.cgi?id=104714 +--- + src/plugins/renderers/drm/plugin.c | 86 ++++++++++++++++++++++++++++++ + 1 file changed, 86 insertions(+) + +diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c +index f495854..fb79aa6 100644 +--- a/src/plugins/renderers/drm/plugin.c ++++ b/src/plugins/renderers/drm/plugin.c +@@ -43,6 +43,7 @@ + #include + + #include ++#include + #include + #include + +@@ -62,6 +63,11 @@ + + #define BYTES_PER_PIXEL (4) + ++/* For builds with libdrm < 2.4.89 */ ++#ifndef DRM_MODE_ROTATE_0 ++#define DRM_MODE_ROTATE_0 (1<<0) ++#endif ++ + struct _ply_renderer_head + { + ply_renderer_backend_t *backend; +@@ -499,6 +505,85 @@ ply_renderer_head_free (ply_renderer_head_t *head) + free (head); + } + ++static void ++ply_renderer_head_clear_plane_rotation (ply_renderer_backend_t *backend, ++ ply_renderer_head_t *head) ++{ ++ drmModeObjectPropertiesPtr plane_props; ++ drmModePlaneResPtr plane_resources; ++ drmModePropertyPtr prop; ++ drmModePlanePtr plane; ++ uint64_t rotation; ++ uint32_t i, j; ++ int rotation_prop_id = -1; ++ int primary_id = -1; ++ int err; ++ ++ err = drmSetClientCap (backend->device_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); ++ if (err) ++ return; ++ ++ plane_resources = drmModeGetPlaneResources (backend->device_fd); ++ if (!plane_resources) ++ return; ++ ++ for (i = 0; i < plane_resources->count_planes; i++) { ++ plane = drmModeGetPlane (backend->device_fd, ++ plane_resources->planes[i]); ++ if (!plane) ++ continue; ++ ++ if (plane->crtc_id != head->controller_id) { ++ drmModeFreePlane (plane); ++ continue; ++ } ++ ++ plane_props = drmModeObjectGetProperties (backend->device_fd, ++ plane->plane_id, ++ DRM_MODE_OBJECT_PLANE); ++ ++ for (j = 0; plane_props && (j < plane_props->count_props); j++) { ++ prop = drmModeGetProperty (backend->device_fd, ++ plane_props->props[j]); ++ if (!prop) ++ continue; ++ ++ if (strcmp (prop->name, "type") == 0 && ++ plane_props->prop_values[j] == DRM_PLANE_TYPE_PRIMARY) { ++ primary_id = plane->plane_id; ++ } ++ ++ if (strcmp (prop->name, "rotation") == 0) { ++ rotation_prop_id = plane_props->props[j]; ++ rotation = plane_props->prop_values[j]; ++ } ++ ++ drmModeFreeProperty (prop); ++ } ++ ++ drmModeFreeObjectProperties (plane_props); ++ drmModeFreePlane (plane); ++ ++ if (primary_id != -1) ++ break; ++ ++ /* Not primary -> clear any found rotation property */ ++ rotation_prop_id = -1; ++ } ++ ++ if (primary_id != -1 && rotation_prop_id != -1 && rotation != DRM_MODE_ROTATE_0) { ++ err = drmModeObjectSetProperty (backend->device_fd, ++ primary_id, ++ DRM_MODE_OBJECT_PLANE, ++ rotation_prop_id, ++ DRM_MODE_ROTATE_0); ++ ply_trace ("Cleared rotation on primary plane %d result %d", ++ primary_id, err); ++ } ++ ++ drmModeFreePlaneResources (plane_resources); ++} ++ + static bool + ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend, + ply_renderer_head_t *head, +@@ -525,6 +610,7 @@ ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend, + return false; + } + ++ ply_renderer_head_clear_plane_rotation (backend, head); + return true; + } + +-- +2.17.0 + diff --git a/0005-drm-Use-preferred-mode-for-outputs-instead-of-curren.patch b/0005-drm-Use-preferred-mode-for-outputs-instead-of-curren.patch new file mode 100644 index 0000000..21944cf --- /dev/null +++ b/0005-drm-Use-preferred-mode-for-outputs-instead-of-curren.patch @@ -0,0 +1,126 @@ +From 65fce3926d6519b2991f67097517c1614c8fc535 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 2 Oct 2018 11:44:28 +0200 +Subject: [PATCH 5/5] drm: Use preferred mode for outputs instead of current + mode + +When enumerating outputs pick the preferred mode instead of the current +active mode, which may be e.g. a very low res mode. + +Sofar we've been relying on fbcon setting up the modes for us, but as +mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=101520#c22 +we really should not rely on this. + +With the recent flickerfree boot changes we can no longer rely on fbcon +to do the setup for us, hence this commit. For now this commit only +changes the mode-picking logic on UEFI setups as we only have +flickerfree boot there. Once the setup code is more mature we should +probably always use it. + +Closes #68 + +Signed-off-by: Hans de Goede +--- + src/plugins/renderers/drm/plugin.c | 51 ++++++++++++++++++++++++++++-- + 1 file changed, 49 insertions(+), 2 deletions(-) + +diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c +index 2d90ecb..e72f6c6 100644 +--- a/src/plugins/renderers/drm/plugin.c ++++ b/src/plugins/renderers/drm/plugin.c +@@ -137,6 +137,7 @@ struct _ply_renderer_backend + + uint32_t is_active : 1; + uint32_t requires_explicit_flushing : 1; ++ uint32_t use_preferred_mode : 1; + }; + + ply_renderer_plugin_interface_t *ply_renderer_backend_get_interface (void); +@@ -149,6 +150,31 @@ static bool reset_scan_out_buffer_if_needed (ply_renderer_backend_t *backend, + static void flush_head (ply_renderer_backend_t *backend, + ply_renderer_head_t *head); + ++/* A small helper to determine if we should try to keep the current mode ++ * or pick the best mode ourselves, we keep the current mode if: ++ * 1. The user specified a specific mode using video= on the commandline ++ * 2. The code to pick the best mode was added because with flicker-free boot ++ * we can no longer rely on the kernel's fbcon code setting things up. ++ * We should be able to do a better job then fbcon regardless, but for ++ * now lets only use the new code on flicker-free systems until it is ++ * more mature, this means only using it on UEFI systems. ++ */ ++static bool ++should_use_preferred_mode (void) ++{ ++ bool use_preferred_mode = true; ++ ++ if (ply_kernel_cmd_line_get_string_after_prefix ("video=")) ++ use_preferred_mode = false; ++ ++ if (access("/sys/firmware/efi/efivars/", F_OK) != 0) ++ use_preferred_mode = false; ++ ++ ply_trace ("should_use_preferred_mode: %d", use_preferred_mode); ++ ++ return use_preferred_mode; ++} ++ + static bool + ply_renderer_buffer_map (ply_renderer_backend_t *backend, + ply_renderer_buffer_t *buffer) +@@ -779,6 +805,7 @@ create_backend (const char *device_name, + backend->requires_explicit_flushing = true; + backend->output_buffers = ply_hashtable_new (ply_hashtable_direct_hash, + ply_hashtable_direct_compare); ++ backend->use_preferred_mode = should_use_preferred_mode(); + + return backend; + } +@@ -1027,6 +1054,22 @@ find_index_of_mode (ply_renderer_backend_t *backend, + return -1; + } + ++static int ++get_index_of_preferred_mode (drmModeConnector *connector) ++{ ++ int i; ++ ++ for (i = 0; i < connector->count_modes; i++) ++ if (connector->modes[i].type & DRM_MODE_TYPE_PREFERRED) { ++ ply_trace("Found preferred mode %dx%d at index %d\n", ++ connector->modes[i].hdisplay, ++ connector->modes[i].vdisplay, i); ++ return i; ++ } ++ ++ return -1; ++} ++ + static int + get_index_of_active_mode (ply_renderer_backend_t *backend, + drmModeCrtc *controller, +@@ -1059,7 +1102,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + drmModeCrtc *controller; + uint32_t controller_id; + uint32_t console_buffer_id; +- int connector_mode_index; ++ int connector_mode_index = -1; + int gamma_size; + ply_pixel_buffer_rotation_t rotation; + bool tiled; +@@ -1100,7 +1143,11 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) + + ply_renderer_connector_get_rotation_and_tiled (backend, connector, &rotation, &tiled); + +- connector_mode_index = get_index_of_active_mode (backend, controller, connector); ++ if (!tiled && backend->use_preferred_mode) ++ connector_mode_index = get_index_of_preferred_mode (connector); ++ ++ if (connector_mode_index < 0) ++ connector_mode_index = get_index_of_active_mode (backend, controller, connector); + + /* If we couldn't find the current active mode, fall back to the first available. + */ +-- +2.19.0 + diff --git a/0005-main-Show-details-when-ESC-is-pressed-during-splash_.patch b/0005-main-Show-details-when-ESC-is-pressed-during-splash_.patch new file mode 100644 index 0000000..81ba4af --- /dev/null +++ b/0005-main-Show-details-when-ESC-is-pressed-during-splash_.patch @@ -0,0 +1,40 @@ +From 129b4a5004d771e83de37fc6f0d74615119ec102 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 3 Jul 2018 08:44:33 +0200 +Subject: [PATCH 5/9] main: Show details when ESC is pressed during + splash_delay + +Start listening for keypresses on the first show_splash() call, so that +pressing ESC while we're delaying show the non-details splash will show +the details splash. + +Signed-off-by: Hans de Goede +--- + src/main.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/main.c b/src/main.c +index ed23968..d7f192f 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -361,6 +361,8 @@ show_detailed_splash (state_t *state) + { + ply_boot_splash_t *splash; + ++ cancel_pending_delayed_show (state); ++ + if (state->boot_splash != NULL) + return; + +@@ -1001,6 +1003,8 @@ show_splash (state_t *state) + (ply_event_loop_timeout_handler_t) + show_splash, + state); ++ /* Listen for ESC to show details */ ++ ply_device_manager_activate_keyboards (state->device_manager); + return; + } + } +-- +2.18.0 + diff --git a/0006-main-Fix-getting-detailed-logs-from-systemd.patch b/0006-main-Fix-getting-detailed-logs-from-systemd.patch new file mode 100644 index 0000000..ea124d4 --- /dev/null +++ b/0006-main-Fix-getting-detailed-logs-from-systemd.patch @@ -0,0 +1,96 @@ +From 6a1fdabf344bdc15956e69d6dee78752680369a5 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 26 Jun 2018 09:15:25 +0200 +Subject: [PATCH 6/9] main: Fix getting detailed logs from systemd + +This are 3 issues with the detailed logs handling: + +1) plymouth attaches to the session directly on a show-splash command +(in on_show_splash()), but it does not tell systemd to start printing +details until the splash is actually shown after the splash_delay. + +2) If the splash is actually shown during the initrd (e.g. a diskcript +password is necessary) then we tell the initrd systemd instance to +print details, but we don't tell the regular initrd instance which takes +over as pid 1 after the switch-root to print details. + +This leads to rather inconsistent logging/printing behavior, e.g.: + +* If a diskcrypt password is asked for, we only log details from +the initrd phase. + +* If the boot is shorter then splash_delay no details are logged + +* If the user presses ESC during boot during the initrd, only initrd + messages are printed + +* If the user presses ESC during boot after the initrd, only normal + messages are printed + +This commit fixes both these issues by: + +1) Telling systemd to print details as soon as we have attached to the session; + and to stop printing details when we detach from the session (*) +2) Telling systemd to print details after the rootfs has been remounted rw + +*) This is necessary to have a smooth transition to e.g. gdm if the splash +has not shown because the boot is shorter then splash_delay + +Signed-off-by: Hans de Goede +--- + src/main.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/src/main.c b/src/main.c +index d7f192f..634a38e 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -853,6 +853,11 @@ on_system_initialized (state_t *state) + ply_trace ("system now initialized, opening log"); + state->system_initialized = true; + ++#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION ++ if (state->is_attached) ++ tell_systemd_to_print_details (state); ++#endif ++ + prepare_logging (state); + } + +@@ -1782,11 +1787,6 @@ show_theme (state_t *state, + return NULL; + } + +-#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION +- if (state->is_attached) +- tell_systemd_to_print_details (state); +-#endif +- + ply_device_manager_activate_keyboards (state->device_manager); + + return splash; +@@ -1833,6 +1833,10 @@ attach_to_running_session (state_t *state) + return false; + } + ++#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION ++ tell_systemd_to_print_details (state); ++#endif ++ + state->is_redirected = should_be_redirected; + state->is_attached = true; + state->session = session; +@@ -1849,6 +1853,10 @@ detach_from_running_session (state_t *state) + if (!state->is_attached) + return; + ++#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION ++ tell_systemd_to_stop_printing_details (state); ++#endif ++ + ply_trace ("detaching from terminal session"); + ply_terminal_session_detach (state->session); + state->is_redirected = false; +-- +2.18.0 + diff --git a/0006-pixel-buffer-switch-device-rotation-to-an-enum.patch b/0006-pixel-buffer-switch-device-rotation-to-an-enum.patch new file mode 100644 index 0000000..bd94acc --- /dev/null +++ b/0006-pixel-buffer-switch-device-rotation-to-an-enum.patch @@ -0,0 +1,80 @@ +From 555257c74f75bbb1086155fca52c29d71399b305 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Tue, 10 Apr 2018 16:40:06 -0400 +Subject: [PATCH 6/6] pixel-buffer: switch device rotation to an enum + +Right now device rotation is stored in a bare integer. + +For clarity, switch that to an enum. +--- + src/libply-splash-core/ply-pixel-buffer.c | 12 +++++++----- + src/libply-splash-core/ply-pixel-buffer.h | 13 ++++++++----- + 2 files changed, 15 insertions(+), 10 deletions(-) + +diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c +index a337407..de3b107 100644 +--- a/src/libply-splash-core/ply-pixel-buffer.c ++++ b/src/libply-splash-core/ply-pixel-buffer.c +@@ -50,7 +50,8 @@ struct _ply_pixel_buffer + ply_region_t *updated_areas; /* in device pixels */ + uint32_t is_opaque : 1; + int device_scale; +- int device_rotation; ++ ++ ply_pixel_buffer_rotation_t device_rotation; + }; + + static inline void ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer, +@@ -363,13 +364,14 @@ ply_pixel_buffer_new (unsigned long width, + } + + ply_pixel_buffer_t * +-ply_pixel_buffer_new_with_device_rotation (unsigned long width, +- unsigned long height, +- int device_rotation) ++ply_pixel_buffer_new_with_device_rotation (unsigned long width, ++ unsigned long height, ++ ply_pixel_buffer_rotation_t device_rotation) + { + ply_pixel_buffer_t *buffer; + +- if (device_rotation >= PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE) { ++ if (device_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE || ++ device_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) { + unsigned long tmp = width; + width = height; + height = tmp; +diff --git a/src/libply-splash-core/ply-pixel-buffer.h b/src/libply-splash-core/ply-pixel-buffer.h +index 7736dd3..ea7f833 100644 +--- a/src/libply-splash-core/ply-pixel-buffer.h ++++ b/src/libply-splash-core/ply-pixel-buffer.h +@@ -37,10 +37,13 @@ typedef struct _ply_pixel_buffer ply_pixel_buffer_t; + | ((uint8_t) (CLAMP (g * 255.0, 0.0, 255.0)) << 8) \ + | ((uint8_t) (CLAMP (b * 255.0, 0.0, 255.0)))) + +-#define PLY_PIXEL_BUFFER_ROTATE_UPRIGHT 0 +-#define PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN 1 +-#define PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE 2 +-#define PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE 3 ++typedef enum ++{ ++ PLY_PIXEL_BUFFER_ROTATE_UPRIGHT = 0, ++ PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN, ++ PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE, ++ PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE ++} ply_pixel_buffer_rotation_t; + + #ifndef PLY_HIDE_FUNCTION_DECLARATIONS + ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width, +@@ -48,7 +51,7 @@ ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width, + ply_pixel_buffer_t * + ply_pixel_buffer_new_with_device_rotation (unsigned long width, + unsigned long height, +- int device_rotation); ++ ply_pixel_buffer_rotation_t device_rotation); + void ply_pixel_buffer_free (ply_pixel_buffer_t *buffer); + void ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer, + ply_rectangle_t *size); +-- +2.17.0 + diff --git a/0007-main-fix-build.patch b/0007-main-fix-build.patch new file mode 100644 index 0000000..618de38 --- /dev/null +++ b/0007-main-fix-build.patch @@ -0,0 +1,28 @@ +From 75ef8ee24bf5875875af44a91cd24975a4d92664 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Tue, 10 Jul 2018 15:58:04 -0400 +Subject: [PATCH 7/7] main: fix build + +I slightly modified Hans patch in commit 129b4a50 before pushing it +and broke the build. + +This fixes the build by adding a forward declaration. +--- + src/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/main.c b/src/main.c +index 5555f0b..7e58fff 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -168,6 +168,7 @@ static void on_quit (state_t *state, + bool retain_splash, + ply_trigger_t *quit_trigger); + static bool sh_is_init (state_t *state); ++static void cancel_pending_delayed_show (state_t *state); + + static ply_boot_splash_mode_t + get_splash_mode_from_mode (ply_mode_t mode) +-- +2.18.0 + diff --git a/0007-terminal-add-include-for-sysmacros.h.patch b/0007-terminal-add-include-for-sysmacros.h.patch new file mode 100644 index 0000000..41b9311 --- /dev/null +++ b/0007-terminal-add-include-for-sysmacros.h.patch @@ -0,0 +1,27 @@ +From e12b5ee34c619e88509f59424068417790b69e04 Mon Sep 17 00:00:00 2001 +From: Sakaki +Date: Fri, 18 Aug 2017 10:08:23 -0400 +Subject: [PATCH] terminal: add include for sysmacros.h + +That file is, in some cases, not included implicitly by sys/types.h. + +This commit explicitly includes it. +--- + src/libply-splash-core/ply-terminal.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c +index a0954f2..f3b32fe 100644 +--- a/src/libply-splash-core/ply-terminal.c ++++ b/src/libply-splash-core/ply-terminal.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.17.0 + diff --git a/INSTALL-Fix-a-spelling-error-in-the-command-example.patch b/INSTALL-Fix-a-spelling-error-in-the-command-example.patch new file mode 100644 index 0000000..84986fb --- /dev/null +++ b/INSTALL-Fix-a-spelling-error-in-the-command-example.patch @@ -0,0 +1,26 @@ +From fa66a5b66700779dafc73f1034ad771d56db9e84 Mon Sep 17 00:00:00 2001 +From: zhaoqiang +Date: Thu, 30 Nov 2017 17:21:39 +0800 +Subject: [PATCH 006/142] INSTALL: Fix a spelling error in the command example + +https://bugs.freedesktop.org/show_bug.cgi?id=103995 +--- + INSTALL | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/INSTALL b/INSTALL +index 3b5a3ec..b568d63 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -61,7 +61,7 @@ show the splash screen. + + To decrypt your root, run + +-lymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T ..." ++plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T ..." + + where the --command is whatever makes sense for you. + +-- +2.7.4 + diff --git a/boot-server-free-the-argument-and-triggers.patch b/boot-server-free-the-argument-and-triggers.patch new file mode 100644 index 0000000..636a8b2 --- /dev/null +++ b/boot-server-free-the-argument-and-triggers.patch @@ -0,0 +1,100 @@ +From 3945071e39ffcf4e6b17bd07a6246898c3ed1923 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 15 Oct 2018 21:56:03 -0400 +Subject: [PATCH 053/142] boot-server: free the argument and triggers + +coverity found some pervasive leaking of the argument +and triggers. + +This commit mops them up. +--- + src/ply-boot-server.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/ply-boot-server.c b/src/ply-boot-server.c +index 3c1a268..ff0e6fd 100644 +--- a/src/ply-boot-server.c ++++ b/src/ply-boot-server.c +@@ -386,6 +386,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK))) + ply_trace ("could not finish writing is-not-root nak: %m"); + ++ free (argument); + free (command); + return; + } +@@ -466,6 +467,8 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + + if (server->deactivate_handler != NULL) + server->deactivate_handler (server->user_data, deactivate_trigger, server); ++ else ++ ply_trigger_free (deactivate_trigger); + + free (argument); + free (command); +@@ -491,6 +494,8 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + + if (server->quit_handler != NULL) + server->quit_handler (server->user_data, retain_splash, quit_trigger, server); ++ else ++ ply_trigger_free (quit_trigger); + + free (argument); + free (command); +@@ -511,6 +516,9 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + argument, + answer, + server); ++ } else { ++ ply_trigger_free (answer); ++ free (argument); + } + /* will reply later + */ +@@ -592,6 +600,9 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + argument, + answer, + server); ++ } else { ++ ply_trigger_free (answer); ++ free (argument); + } + /* will reply later + */ +@@ -621,6 +632,9 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + argument, + answer, + server); ++ } else { ++ ply_trigger_free (answer); ++ free (argument); + } + /* will reply later + */ +@@ -659,6 +673,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK))) + ply_trace ("could not finish writing nak: %m"); + ++ free (argument); + free (command); + return; + } +@@ -670,6 +685,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK))) + ply_trace ("could not finish writing ping reply: %m"); + ++ free (argument); + free (command); + return; + } +@@ -678,6 +694,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) + PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK, + strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK))) + ply_trace ("could not finish writing ack: %m"); ++ free (argument); + free (command); + } + +-- +2.7.4 + diff --git a/boot-splash-fix-memory-leak-in-error-path.patch b/boot-splash-fix-memory-leak-in-error-path.patch new file mode 100644 index 0000000..a421c03 --- /dev/null +++ b/boot-splash-fix-memory-leak-in-error-path.patch @@ -0,0 +1,32 @@ +From 310b63cd154552605f380fa2743b08f6cd63bcdd Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 15 Oct 2018 21:04:47 -0400 +Subject: [PATCH 049/142] boot-splash: fix memory leak in error path + +If the splash key file fails to load, we don't free +the associated key file object. + +This commit fixes that. +--- + src/libply-splash-core/ply-boot-splash.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/libply-splash-core/ply-boot-splash.c b/src/libply-splash-core/ply-boot-splash.c +index 2e295f4..54c7696 100644 +--- a/src/libply-splash-core/ply-boot-splash.c ++++ b/src/libply-splash-core/ply-boot-splash.c +@@ -208,8 +208,10 @@ ply_boot_splash_load (ply_boot_splash_t *splash) + + key_file = ply_key_file_new (splash->theme_path); + +- if (!ply_key_file_load (key_file)) ++ if (!ply_key_file_load (key_file)) { ++ ply_key_file_free (key_file); + return false; ++ } + + module_name = ply_key_file_get_value (key_file, "Plymouth Theme", "ModuleName"); + +-- +2.7.4 + diff --git a/charge.plymouth b/charge.plymouth new file mode 100644 index 0000000..f499c0f --- /dev/null +++ b/charge.plymouth @@ -0,0 +1,13 @@ +[Plymouth Theme] +Name=Charge +Description=A theme that features the shadowy hull of a Fedora logo charge up and and finally burst into into full form. +ModuleName=two-step + +[two-step] +ImageDir=/usr/share/plymouth/themes/charge +HorizontalAlignment=.5 +VerticalAlignment=.5 +Transition=none +TransitionDuration=0.0 +BackgroundStartColor=0x202020 +BackgroundEndColor=0x202020 diff --git a/client-fix-typo-in-help-text.patch b/client-fix-typo-in-help-text.patch new file mode 100644 index 0000000..b8543fd --- /dev/null +++ b/client-fix-typo-in-help-text.patch @@ -0,0 +1,29 @@ +From 2b5b27cbdce3e93e181a05b2a887b9a8defe251f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ulrich=20=C3=96lmann?= +Date: Fri, 27 Apr 2018 15:23:42 +0200 +Subject: [PATCH 023/142] client: fix typo in help text +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Ulrich Ölmann +--- + src/client/plymouth.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/client/plymouth.c b/src/client/plymouth.c +index 97caf65..46a64f5 100644 +--- a/src/client/plymouth.c ++++ b/src/client/plymouth.c +@@ -897,7 +897,7 @@ main (int argc, + "get-splash-plugin-path", "Get directory where splash plugins are installed", PLY_COMMAND_OPTION_TYPE_FLAG, + "newroot", "Tell boot daemon that new root filesystem is mounted", PLY_COMMAND_OPTION_TYPE_STRING, + "quit", "Tell boot daemon to quit", PLY_COMMAND_OPTION_TYPE_FLAG, +- "ping", "Check of boot daemon is running", PLY_COMMAND_OPTION_TYPE_FLAG, ++ "ping", "Check if boot daemon is running", PLY_COMMAND_OPTION_TYPE_FLAG, + "has-active-vt", "Check if boot daemon has an active vt", PLY_COMMAND_OPTION_TYPE_FLAG, + "sysinit", "Tell boot daemon root filesystem is mounted read-write", PLY_COMMAND_OPTION_TYPE_FLAG, + "show-splash", "Show splash screen", PLY_COMMAND_OPTION_TYPE_FLAG, +-- +2.7.4 + diff --git a/device-manager-free-keyboards-when-deactivating-a-re.patch b/device-manager-free-keyboards-when-deactivating-a-re.patch new file mode 100644 index 0000000..8d49af8 --- /dev/null +++ b/device-manager-free-keyboards-when-deactivating-a-re.patch @@ -0,0 +1,64 @@ +From c46f446fe44457f599805b685547c2258bb3fa96 Mon Sep 17 00:00:00 2001 +From: Mathieu Trudel-Lapierre +Date: Tue, 4 Dec 2018 14:41:35 -0500 +Subject: [PATCH 089/142] device-manager: free keyboards when deactivating a + renderer + +Based on an original patch by Gert van de Kraats, on Ubuntu Launchpad bug: +https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/1794292 + +Signed-off-by: Mathieu Trudel-Lapierre +--- + src/libply-splash-core/ply-device-manager.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index d70e709..8ceee10 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -137,6 +137,34 @@ free_displays_for_renderer (ply_device_manager_t *manager, + } + + static void ++free_keyboards_for_renderer (ply_device_manager_t *manager, ++ ply_renderer_t *renderer) ++{ ++ ply_list_node_t *node; ++ ++ node = ply_list_get_first_node (manager->keyboards); ++ while (node != NULL) { ++ ply_list_node_t *next_node; ++ ply_keyboard_t *keyboard; ++ ply_renderer_t *keyboard_renderer; ++ ++ keyboard = ply_list_node_get_data (node); ++ next_node = ply_list_get_next_node (manager->keyboards, node); ++ keyboard_renderer = ply_keyboard_get_renderer (keyboard); ++ ++ if (keyboard_renderer == renderer) { ++ ply_keyboard_free (keyboard); ++ ply_list_remove_node (manager->keyboards, node); ++ } ++ ++ node = next_node; ++ } ++ if (ply_list_get_first_node (manager->keyboards) == NULL) { ++ manager->local_console_managed = false; ++ } ++} ++ ++static void + free_devices_from_device_path (ply_device_manager_t *manager, + const char *device_path) + { +@@ -152,6 +180,7 @@ free_devices_from_device_path (ply_device_manager_t *manager, + return; + + free_displays_for_renderer (manager, renderer); ++ free_keyboards_for_renderer (manager, renderer); + + ply_hashtable_remove (manager->renderers, (void *) device_path); + free (key); +-- +2.7.4 + diff --git a/docs-fix-some-typos.patch b/docs-fix-some-typos.patch new file mode 100644 index 0000000..3b2f953 --- /dev/null +++ b/docs-fix-some-typos.patch @@ -0,0 +1,42 @@ +From 179ba1e0d81795c355344a1a1482afdc889aaa21 Mon Sep 17 00:00:00 2001 +From: qiangzhao +Date: Thu, 31 May 2018 15:58:11 +0800 +Subject: [PATCH 032/142] docs: fix some typos + +There are few word spelling errors in the documentation. + +This commit addresses those problems. +--- + docs/plymouth1.xml | 2 +- + docs/plymouthd.xml | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/docs/plymouth1.xml b/docs/plymouth1.xml +index b484599..c63fcc7 100644 +--- a/docs/plymouth1.xml ++++ b/docs/plymouth1.xml +@@ -298,7 +298,7 @@ The following commands are understood: + + + +- Keys to remove sensitivitiy from ++ Keys to remove sensitivity from + + + +diff --git a/docs/plymouthd.xml b/docs/plymouthd.xml +index 4e7e499..1b6e006 100644 +--- a/docs/plymouthd.xml ++++ b/docs/plymouthd.xml +@@ -103,7 +103,7 @@ that control its behaviour. + + + +- TTY to ues instead of default. ++ TTY to use instead of default. + + + +-- +1.8.3.1 + diff --git a/event-loop-fix-leak-in-error-path.patch b/event-loop-fix-leak-in-error-path.patch new file mode 100644 index 0000000..e7bdf2d --- /dev/null +++ b/event-loop-fix-leak-in-error-path.patch @@ -0,0 +1,32 @@ +From 656444ed2606cba8be76b9de8792dc36f72d946c Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 15 Oct 2018 21:07:01 -0400 +Subject: [PATCH 050/142] event-loop: fix leak in error path + +ply_event_loop_new fails to clean itself up if it's unable to +create a pipe for dispatching signals. + +This commit fixes that. +--- + src/libply/ply-event-loop.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/libply/ply-event-loop.c b/src/libply/ply-event-loop.c +index 9736dae..0e8ad7c 100644 +--- a/src/libply/ply-event-loop.c ++++ b/src/libply/ply-event-loop.c +@@ -496,8 +496,10 @@ ply_event_loop_new (void) + + loop->signal_dispatcher = ply_signal_dispatcher_new (); + +- if (loop->signal_dispatcher == NULL) ++ if (loop->signal_dispatcher == NULL) { ++ ply_event_loop_free (loop); + return NULL; ++ } + + ply_event_loop_watch_fd (loop, + ply_signal_dispatcher_receiver_fd, +-- +2.7.4 + diff --git a/key-file-ply_key_file_get_value-returns-duplicated-m.patch b/key-file-ply_key_file_get_value-returns-duplicated-m.patch new file mode 100644 index 0000000..2d518c7 --- /dev/null +++ b/key-file-ply_key_file_get_value-returns-duplicated-m.patch @@ -0,0 +1,90 @@ +From 322a3635fa8eed7c3ee4c849518e3b002cbf089a Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 15 Oct 2018 21:13:58 -0400 +Subject: [PATCH 051/142] key-file: ply_key_file_get_value returns duplicated + memory, don't leak + +For some reason I made the same api misdesign with ply_key_file_t +that I made when writing GKeyFile...it returns duplicated memory for +no good reason. + +This commit sprinkles frees around. +--- + src/main.c | 13 +++++++++---- + src/plugins/splash/two-step/plugin.c | 2 ++ + 2 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/main.c b/src/main.c +index 47157bc..d0d9ce3 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -296,8 +296,8 @@ load_settings (state_t *state, + { + ply_key_file_t *key_file = NULL; + bool settings_loaded = false; +- const char *scale_string; +- const char *splash_string; ++ char *scale_string = NULL; ++ char *splash_string = NULL; + + ply_trace ("Trying to load %s", path); + key_file = ply_key_file_new (path); +@@ -323,24 +323,27 @@ load_settings (state_t *state, + } + + if (isnan (state->splash_delay)) { +- const char *delay_string; ++ char *delay_string; + + delay_string = ply_key_file_get_value (key_file, "Daemon", "ShowDelay"); + + if (delay_string != NULL) { + state->splash_delay = atof (delay_string); + ply_trace ("Splash delay is set to %lf", state->splash_delay); ++ free (delay_string); + } + } + + if (isnan (state->device_timeout)) { +- const char *timeout_string; ++ char *timeout_string; + + timeout_string = ply_key_file_get_value (key_file, "Daemon", "DeviceTimeout"); + + if (timeout_string != NULL) { + state->device_timeout = atof (timeout_string); + ply_trace ("Device timeout is set to %lf", state->device_timeout); ++ ++ free (timeout_string); + } + } + +@@ -348,10 +351,12 @@ load_settings (state_t *state, + + if (scale_string != NULL) { + ply_set_device_scale (strtoul (scale_string, NULL, 0)); ++ free (scale_string); + } + + settings_loaded = true; + out: ++ free (splash_string); + ply_key_file_free (key_file); + + return settings_loaded; +diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c +index 7ae9910..7307e19 100644 +--- a/src/plugins/splash/two-step/plugin.c ++++ b/src/plugins/splash/two-step/plugin.c +@@ -662,6 +662,8 @@ create_plugin (ply_key_file_t *key_file) + ply_trace ("unknown progress function %s, defaulting to linear", progress_function); + plugin->progress_function = PROGRESS_FUNCTION_TYPE_LINEAR; + } ++ ++ free (progress_function); + } + + plugin->views = ply_list_new (); +-- +2.7.4 + diff --git a/keyboard-add-helper-to-get-the-keyboard-s-renderer-i.patch b/keyboard-add-helper-to-get-the-keyboard-s-renderer-i.patch new file mode 100644 index 0000000..4ff115c --- /dev/null +++ b/keyboard-add-helper-to-get-the-keyboard-s-renderer-i.patch @@ -0,0 +1,55 @@ +From b082f42494e8423f08f40addc833d7e9b0192cb6 Mon Sep 17 00:00:00 2001 +From: Mathieu Trudel-Lapierre +Date: Tue, 4 Dec 2018 14:31:13 -0500 +Subject: [PATCH 088/142] keyboard: add helper to get the keyboard's renderer, + if applicable + +Based on an original patch from Gert van de Kraats on Ubuntu's Launchpad: +https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/1794292 + +Signed-off-by: Mathieu Trudel-Lapierre +--- + src/libply-splash-core/ply-keyboard.c | 16 ++++++++++++++++ + src/libply-splash-core/ply-keyboard.h | 1 + + 2 files changed, 17 insertions(+) + +diff --git a/src/libply-splash-core/ply-keyboard.c b/src/libply-splash-core/ply-keyboard.c +index 80f7694..e11c093 100644 +--- a/src/libply-splash-core/ply-keyboard.c ++++ b/src/libply-splash-core/ply-keyboard.c +@@ -587,4 +587,20 @@ ply_keyboard_remove_enter_handler (ply_keyboard_t *keyboard, + } + } + ++ply_renderer_t * ++ply_keyboard_get_renderer (ply_keyboard_t *keyboard) ++{ ++ assert (keyboard != NULL); ++ ++ switch (keyboard->provider_type) { ++ case PLY_KEYBOARD_PROVIDER_TYPE_RENDERER: ++ return keyboard->provider.if_renderer->renderer; ++ ++ default: ++ break; ++ } ++ ++ return NULL; ++} ++ + /* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +diff --git a/src/libply-splash-core/ply-keyboard.h b/src/libply-splash-core/ply-keyboard.h +index 6147cc7..dd428c0 100644 +--- a/src/libply-splash-core/ply-keyboard.h ++++ b/src/libply-splash-core/ply-keyboard.h +@@ -72,6 +72,7 @@ void ply_keyboard_remove_enter_handler (ply_keyboard_t *keyboard, + bool ply_keyboard_watch_for_input (ply_keyboard_t *keyboard); + void ply_keyboard_stop_watching_for_input (ply_keyboard_t *keyboard); + bool ply_keyboard_is_active (ply_keyboard_t *keyboard); ++ply_renderer_t *ply_keyboard_get_renderer (ply_keyboard_t *keyboard); + + #endif + +-- +2.7.4 + diff --git a/libply-Add-ply_strtod-helper.patch b/libply-Add-ply_strtod-helper.patch new file mode 100644 index 0000000..a609281 --- /dev/null +++ b/libply-Add-ply_strtod-helper.patch @@ -0,0 +1,63 @@ +From 2dc81adb0f1a5469b15c62d3dacf53dfbc37c17a Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 19 Dec 2018 10:43:09 +0100 +Subject: [PATCH 091/142] libply: Add ply_strtod helper + +Add a ply_strtod helper which always uses "." as decimal separator +independent of the locale. + +Using this fixes e.g. HorizontalAlignment in the two-step plugin +not working with some locales. + +Signed-off-by: Hans de Goede +--- + src/libply/ply-utils.c | 14 ++++++++++++++ + src/libply/ply-utils.h | 2 ++ + 2 files changed, 16 insertions(+) + +diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c +index c17e0c8..4ff7b1b 100644 +--- a/src/libply/ply-utils.c ++++ b/src/libply/ply-utils.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1109,4 +1110,17 @@ ply_kernel_command_line_override (const char *command_line) + kernel_command_line_is_set = true; + } + ++double ply_strtod(const char *str) ++{ ++ char *old_locale; ++ double ret; ++ ++ /* Ensure strtod uses '.' as decimal separator, as we use this in our cfg files. */ ++ old_locale = setlocale(LC_NUMERIC, "C"); ++ ret = strtod(str, NULL); ++ setlocale(LC_NUMERIC, old_locale); ++ ++ return ret; ++} ++ + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h +index ae4776e..4dd9c09 100644 +--- a/src/libply/ply-utils.h ++++ b/src/libply/ply-utils.h +@@ -132,6 +132,8 @@ const char *ply_kernel_command_line_get_string_after_prefix (const char *prefix) + bool ply_kernel_cmd_line_has_argument (const char *argument); + void ply_kernel_cmd_line_set (const char *cmd_line); + ++double ply_strtod(const char *str); ++ + #endif + + #endif /* PLY_UTILS_H */ +-- +2.7.4 + diff --git a/ply-device-manager-Fix-race-causing-undesired-creati.patch b/ply-device-manager-Fix-race-causing-undesired-creati.patch new file mode 100644 index 0000000..31cb4dc --- /dev/null +++ b/ply-device-manager-Fix-race-causing-undesired-creati.patch @@ -0,0 +1,81 @@ +From 059390ac569798cbf40a958ea714b15f313b46a3 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sat, 10 Nov 2018 16:04:31 +0100 +Subject: [PATCH 062/142] ply-device-manager: Fix race causing undesired + creation of non-gfx devs + +On systems with working drm/kms devices we still sometimes see: +"Creating non-graphical devices, since there's no suitable graphics hardware" +in the logs (and actually create non-gfx devices). + +This is caused by a race where the create_devices_from_udev timeout handler +runs just after the pivot-root, just at the time when the "udev trigger" +from the real root is done. + +This causes create_devices_for_subsystem() to hit the "it's not initialized" +code-path for all drm and fb devices, even though before (from the initrd) +drm-devices where already setup successfully. + +One way of solving this would be to stop the timer as soon as we successfully +enumerate the first drm device. But we need the timer to enumerate fb devices +so on machines where some outputs only have a fbdev driver (corner case) this +would break support for those outputs. + +Instead this commit moves the found_drm_device and found_fb_device to the +global manager state and sets them from create_devices_for_udev_device(). +This way they will be set when we check them from the create_devices_from_udev +timeout handler even if create_devices_for_subsystem skips over the devices +because of the udev trigger race. + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-device-manager.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c +index b637fb8..dcc9859 100644 +--- a/src/libply-splash-core/ply-device-manager.c ++++ b/src/libply-splash-core/ply-device-manager.c +@@ -77,6 +77,8 @@ struct _ply_device_manager + uint32_t serial_consoles_detected : 1; + uint32_t renderers_activated : 1; + uint32_t keyboards_activated : 1; ++ uint32_t found_drm_device : 1; ++ uint32_t found_fb_device : 1; + }; + + static void +@@ -250,6 +252,12 @@ create_devices_for_udev_device (ply_device_manager_t *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; ++ } + } + } + +@@ -799,14 +807,12 @@ create_non_graphical_devices (ply_device_manager_t *manager) + static void + create_devices_from_udev (ply_device_manager_t *manager) + { +- bool found_drm_device, found_fb_device; +- + ply_trace ("Timeout elapsed, looking for devices from udev"); + +- found_drm_device = create_devices_for_subsystem (manager, SUBSYSTEM_DRM); +- found_fb_device = create_devices_for_subsystem (manager, SUBSYSTEM_FRAME_BUFFER); ++ create_devices_for_subsystem (manager, SUBSYSTEM_DRM); ++ create_devices_for_subsystem (manager, SUBSYSTEM_FRAME_BUFFER); + +- if (found_drm_device || found_fb_device) ++ if (manager->found_drm_device || manager->found_fb_device) + return; + + ply_trace ("Creating non-graphical devices, since there's no suitable graphics hardware"); +-- +1.8.3.1 + diff --git a/ply-pixel-buffer-Fix-fill_with_buffer-fastpath-when-.patch b/ply-pixel-buffer-Fix-fill_with_buffer-fastpath-when-.patch new file mode 100644 index 0000000..dc8fdc4 --- /dev/null +++ b/ply-pixel-buffer-Fix-fill_with_buffer-fastpath-when-.patch @@ -0,0 +1,35 @@ +From 986c911e21b41464aa17006fd048dc38d5824325 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 7 Nov 2018 15:49:40 +0100 +Subject: [PATCH 070/142] ply-pixel-buffer: Fix fill_with_buffer fastpath when + device_scale != 1 + +After calling ply_pixel_buffer_crop_area_to_clip_area cropped_area.x/y +are in device coordinates. So when calculating the x/y offset in the +source-buffer due to device-clip areas possible making cropped_area.x/y +larger then just the xoffset/yoffset (in the canvas) we must multiply +the original xoffset/yoffset by device_scale before subtracting. + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-pixel-buffer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c +index de3b107..04aa0d6 100644 +--- a/src/libply-splash-core/ply-pixel-buffer.c ++++ b/src/libply-splash-core/ply-pixel-buffer.c +@@ -868,8 +868,8 @@ ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canv + if (cropped_area.width == 0 || cropped_area.height == 0) + return; + +- x = cropped_area.x - x_offset; +- y = cropped_area.y - y_offset; ++ x = cropped_area.x - x_offset * canvas->device_scale; ++ y = cropped_area.y - y_offset * canvas->device_scale; + + ply_pixel_buffer_copy_area (canvas, source, x, y, &cropped_area); + +-- +2.7.4 + diff --git a/ply-pixel-buffer-Fix-right-and-bottom-edge-rendering.patch b/ply-pixel-buffer-Fix-right-and-bottom-edge-rendering.patch new file mode 100644 index 0000000..dae971f --- /dev/null +++ b/ply-pixel-buffer-Fix-right-and-bottom-edge-rendering.patch @@ -0,0 +1,45 @@ +From 4e1c00b89a710c38ba04206875c4d7c7c1d49c75 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 1 Mar 2019 17:22:30 +0100 +Subject: [PATCH 140/142] ply-pixel-buffer: Fix right and bottom edge rendering + of scaled buffers + +When scaling a buffer 2x and calling ply_pixels_interpolate to interpolate +the last row / column, the extra pixels used for pixels would go out of +bounds and be replaced with a black pixel. This causes a 50% dimming of the +last row / column. + +This 50% dimming leads to an ugly darkline when a theme draws 2 images +which are supposed to be joined together. + +This commit fixes this by clipping the coordinates to the source image +limits instead of using black pixels when interpolating right and bottom +edge pixels. + +Signed-off-by: Hans de Goede +--- + src/libply-splash-core/ply-pixel-buffer.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c +index 3ce6f78..51f9c4d 100644 +--- a/src/libply-splash-core/ply-pixel-buffer.c ++++ b/src/libply-splash-core/ply-pixel-buffer.c +@@ -667,7 +667,13 @@ ply_pixels_interpolate (uint32_t *bytes, + ix = x + offset_x; + iy = y + offset_y; + +- if (ix < 0 || ix >= width || iy < 0 || iy >= height) ++ if (ix >= width) ++ ix = width - 1; ++ ++ if (iy >= height) ++ ix = height - 1; ++ ++ if (ix < 0 || iy < 0) + pixels[offset_y][offset_x] = 0x00000000; + else + pixels[offset_y][offset_x] = bytes[ix + iy * width]; +-- +2.7.4 + diff --git a/plymouth-0.9.3.tar.xz b/plymouth-0.9.3.tar.xz new file mode 100644 index 0000000..97e15ee Binary files /dev/null and b/plymouth-0.9.3.tar.xz differ diff --git a/plymouth-update-initrd b/plymouth-update-initrd new file mode 100644 index 0000000..4ed5709 --- /dev/null +++ b/plymouth-update-initrd @@ -0,0 +1,2 @@ +#!/bin/bash +dracut -f diff --git a/plymouth.spec b/plymouth.spec new file mode 100644 index 0000000..454ad2d --- /dev/null +++ b/plymouth.spec @@ -0,0 +1,286 @@ +%global plymouth_initrd_file /boot/initrd-plymouth.img + +Name: plymouth +Version: 0.9.3 +Release: 16 +License: GPLv2+ +Summary: Graphical Boot Animation and Logger +URL: https://www.freedesktop.org/wiki/Software/Plymouth + +Source0: https://freedesktop.org/software/plymouth/releases/%{name}-%{version}.tar.xz +Source2: charge.plymouth +Source3: plymouth-update-initrd + +# Patches from upstream git for rotated-display support +# https://bugs.freedesktop.org/show_bug.cgi?id=104714 +Patch1: 0001-device-manager-drop-superfluous-create_pixel_display.patch +Patch2: 0002-main-Do-not-update-the-display-on-backspace-when-the.patch +Patch3: 0003-pixel-buffer-Add-the-concept-of-device-rotation.patch +Patch4: 0004-drm-Check-for-panel-orientation-connector-property.patch +Patch5: 0005-drm-Reset-primary-plane-rotation-to-DRM_MODE_ROTATE_.patch +Patch6: 0006-pixel-buffer-switch-device-rotation-to-an-enum.patch +Patch7: 0007-terminal-add-include-for-sysmacros.h.patch +Patch8: 0001-device-manager-skip-graphical-renderer-setup-when-de.patch +Patch9: 0001-device-manager-fall-back-to-text-mode-if-graphical-d.patch +# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +Patch10: 0001-renderer-support-reactivating-renderer-without-closi.patch +Patch11: 0002-main-move-ply_device_manager_deactivate_renderers-in.patch +Patch12: 0003-main-Only-activate-renderers-if-the-splash-uses-pixe.patch +Patch13: 0004-drm-Remove-unnecessary-reset_scan_out_buffer_if_need.patch +Patch14: 0005-main-Show-details-when-ESC-is-pressed-during-splash_.patch +Patch15: 0006-main-Fix-getting-detailed-logs-from-systemd.patch +Patch16: 0007-main-fix-build.patch +# addressing: https://gitlab.freedesktop.org/plymouth/plymouth/issues/68 +Patch17: 0001-main-ensure-tty-is-closed-on-deactivate.patch +Patch18: 0002-libply-Move-kernel-commandline-parsing-functions-to-.patch +Patch19: 0003-drm-Reset-LUT-gamma-table-before-the-first-drmModeSe.patch +Patch20: 0004-drm-Refactor-ply_renderer_connector_get_rotation.patch +Patch21: 0005-drm-Use-preferred-mode-for-outputs-instead-of-curren.patch + +Patch6000: scripts-Use-2-instead-of-dev-stderr.patch +Patch6001: INSTALL-Fix-a-spelling-error-in-the-command-example.patch +Patch6002: x11-don-t-call-gdk_display_get_name-before-gtk_init.patch +Patch6003: client-fix-typo-in-help-text.patch +Patch6004: docs-fix-some-typos.patch +Patch6005: systemd-units-Add-ConditionVirtualization-container.patch +Patch6006: boot-splash-fix-memory-leak-in-error-path.patch +Patch6007: event-loop-fix-leak-in-error-path.patch +Patch6008: key-file-ply_key_file_get_value-returns-duplicated-m.patch +Patch6009: script-fix-various-memory-leaks.patch +Patch6010: boot-server-free-the-argument-and-triggers.patch +Patch6011: systemd-units-Also-add-ConditionVirtualization-conta.patch +Patch6012: ply-device-manager-Fix-race-causing-undesired-creati.patch +Patch6013: two-step-Fix-animation-not-starting-on-later-added-h.patch +Patch6014: two-step-Fix-crash-asking-for-password-with-multiple.patch +Patch6015: ply-pixel-buffer-Fix-fill_with_buffer-fastpath-when-.patch +Patch6016: keyboard-add-helper-to-get-the-keyboard-s-renderer-i.patch +Patch6017: device-manager-free-keyboards-when-deactivating-a-re.patch +Patch6018: libply-Add-ply_strtod-helper.patch +Patch6019: two-step-Use-plymouth_strtod.patch +Patch6020: ply-pixel-buffer-Fix-right-and-bottom-edge-rendering.patch + +BuildRequires: gcc libdrm-devel systemd-devel kernel-headers libpng-devel libxslt docbook-style-xsl +BuildRequires: gtk3-devel pango-devel cairo-devel git + +Requires(post): %{_sbindir}/plymouth-set-default-theme +Requires: system-logos findutils coreutils gzip cpio dracut + +Provides: %{name}-system-theme %{name}-scripts %{name}-plugin-two-step %{name}-graphics-libs %{name}-core-libs %{name}-plugin-fade-throbber %{name}-plugin-throbgress %{name}-plugin-space-flares %{name}-plugin-script %{name}-theme-script %{name}-plugin-label +Obsoletes: %{name}-system-theme %{name}-scripts %{name}-plugin-two-step %{name}-graphics-libs %{name}-core-libs %{name}-plugin-fade-throbber %{name}-plugin-throbgress %{name}-plugin-space-flares %{name}-plugin-script %{name}-theme-script %{name}-plugin-label + +%description +Plymouth provides an attractive graphical boot animation in +place of the text messages that normally get shown. Text +messages are instead redirected to a log file for viewing +after boot. + +%package devel +Summary: Librar ies and headers for writing Plymouth splash plugins +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +This package contains the libply and libplybootsplash libraries +and headers needed to develop 3rd party splash plugins for Plymouth. + +%package theme-fade-in +Summary: Plymouth "Fade-In" theme +Requires: %{name} = %{version}-%{release} + +%description theme-fade-in +This package contains the "Fade-In" boot splash theme for +Plymouth. It features a centered logo that fades in and out +while stars twinkle around the logo during system boot up. + +%package theme-spinfinity +Summary: Plymouth "Spinfinity" theme +Requires: %{name} = %{version}-%{release} + +%description theme-spinfinity +This package contains the "Spinfinity" boot splash theme for +Plymouth. It features a centered logo and animated spinner that +spins in the shape of an infinity sign. + +%package theme-solar +Summary: Plymouth "Solar" theme +Requires: %{name} = %{version}-%{release} + +%description theme-solar +This package contains the "Solar" boot splash theme for +Plymouth. It features a blue flamed sun with animated solar flares. + +%package theme-charge +Summary: Plymouth "Charge" plugin +Requires: %{name} = %{version}-%{release} + +%description theme-charge +This package contains the "charge" boot splash theme for +Plymouth. + +%package theme-spinner +Summary: Plymouth "Spinner" theme +Requires: %{name} = %{version}-%{release} + +%description theme-spinner +This package contains the "spinner" boot splash theme for +Plymouth. It features a small spinner on a dark background. + +%package_help + +%prep +%autosetup -n %{name}-%{version} -p1 -S git + +sed -i -e 's/spinner/charge/g' src/plymouthd.defaults + +%build +%configure --enable-tracing --disable-tests --with-logo=%{_datadir}/pixmaps/system-logo-white.png \ + --with-background-start-color-stop=0x0073B3 --with-background-end-color-stop=0x00457E --with-background-color=0x3391cd \ + --disable-gdm-transition --enable-systemd-integration --without-system-root-install \ + --without-log-viewer --without-rhgb-compat-link --disable-libkms + +make + +%install +%make_install + +rm -rf $RPM_BUILD_ROOT%{_datadir}/plymouth/glow/ +rm -f $RPM_BUILD_ROOT%{_libdir}/plymouth/glow.so + +%delete_la_and_a + +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/plymouth +cp -f $RPM_SOURCE_DIR/plymouth-update-initrd $RPM_BUILD_ROOT%{_libexecdir}/plymouth + +mkdir -p $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/charge +cp %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/charge +cp $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/glow/{box,bullet,entry,lock}.png $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/charge + +%postun +if [ $1 -eq 0 ]; then + rm -f %{_libdir}/plymouth/default.so + rm -f /boot/initrd-plymouth.img +fi + +%ldconfig_scriptlets + +%postun theme-spinfinity +export LIB=%{_lib} +if [ $1 -eq 0 ]; then + if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "spinfinity" ]; then + %{_sbindir}/plymouth-set-default-theme text + fi +fi + +%postun theme-fade-in +export LIB=%{_lib} +if [ $1 -eq 0 ]; then + if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "fade-in" ]; then + %{_sbindir}/plymouth-set-default-theme --reset + fi +fi + +%postun theme-spinner +export LIB=%{_lib} +if [ $1 -eq 0 ]; then + if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "spinner" ]; then + %{_sbindir}/plymouth-set-default-theme --reset + fi +fi + +%postun theme-solar +export LIB=%{_lib} +if [ $1 -eq 0 ]; then + if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "solar" ]; then + %{_sbindir}/plymouth-set-default-theme --reset + fi +fi + +%post theme-charge +export LIB=%{_lib} +if [ $1 -eq 1 ]; then + %{_sbindir}/plymouth-set-default-theme charge +else + if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "solar" ]; then + %{_sbindir}/plymouth-set-default-theme charge + fi +fi + +%postun theme-charge +export LIB=%{_lib} +if [ $1 -eq 0 ]; then + if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "charge" ]; then + %{_sbindir}/plymouth-set-default-theme --reset + fi +fi + +%files +%defattr(-,root,root) +%license COPYING +%doc AUTHORS +%dir %{_libexecdir}/plymouth +%dir %{_libdir}/plymouth/renderers +%config(noreplace) %{_sysconfdir}/plymouth/plymouthd.conf +%{_bindir}/plymouth +%{_sbindir}/plymouth-set-default-theme +%{_sbindir}/plymouthd +%{_libexecdir}/plymouth/plymouth-*-initrd +%{_libdir}/libply-splash-graphics.so.* +%{_libdir}/plymouth/renderers/drm* +%{_libdir}/plymouth/renderers/frame-buffer* +%{_libdir}/plymouth/*.so +%{_libdir}/libply.so.* +%{_libdir}/libply-splash-core.so.* +%{_libdir}/libply-boot-client.so.* +%{_libdir}/plymouth/two-step.so +%{_datadir}/plymouth/themes/details/details.plymouth +%{_datadir}/plymouth/themes/text/text.plymouth +%{_datadir}/plymouth/themes/tribar/tribar.plymouth +%{_datadir}/plymouth/themes/solar/solar.plymouth +%{_datadir}/plymouth/plymouthd.defaults +%{_datadir}/plymouth/themes/script/script.* +%{_localstatedir}/run/plymouth +%{_localstatedir}/spool/plymouth +%ghost %{_localstatedir}/lib/plymouth/boot-duration +%{_prefix}/lib/systemd/system/* +%exclude %{_libdir}/plymouth/two-step.so +%exclude %{_datadir}/plymouth/themes/glow + +%files devel +%defattr(-,root,root) +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%{_libdir}/plymouth/renderers/x11* +%{_includedir}/plymouth-1 + +%files theme-fade-in +%defattr(-,root,root) +%{_datadir}/plymouth/themes/fade-in/fade-in.plymouth + +%files theme-spinner +%defattr(-,root,root) +%{_datadir}/plymouth/themes/spinner/spinner.plymouth + +%files theme-spinfinity +%defattr(-,root,root) +%{_datadir}/plymouth/themes/spinfinity/spinfinity.plymouth + +%files theme-solar +%defattr(-,root,root) +%{_datadir}/plymouth/themes/solar/solar.plymouth + +%files theme-charge +%defattr(-,root,root) +%{_datadir}/plymouth/themes/charge/charge.plymouth + +%files help +%defattr(-,root,root) +%doc README +%{_datadir}/plymouth/themes/*/*.png +%{_mandir}/man?/* + +%changelog +* Fri Dec 20 2019 openEuler Buildteam - 0.9.3-16 +- description change + +* Thu Sep 19 2019 openEuler Buildteam - 0.9.3-15 +- Package init diff --git a/script-fix-various-memory-leaks.patch b/script-fix-various-memory-leaks.patch new file mode 100644 index 0000000..b8a1d11 --- /dev/null +++ b/script-fix-various-memory-leaks.patch @@ -0,0 +1,188 @@ +From 5badb95b8e419266fb69c22aa7e3eacdf6aeaf08 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 15 Oct 2018 21:44:10 -0400 +Subject: [PATCH 052/142] script: fix various memory leaks + +coverity found a few leaks. + +this commit mops them up. +--- + src/plugins/splash/script/script-lib-image.c | 5 ++- + src/plugins/splash/script/script-lib-sprite.c | 4 +- + src/plugins/splash/script/script-parse.c | 61 ++++++++++++++++++++++++--- + 3 files changed, 62 insertions(+), 8 deletions(-) + +diff --git a/src/plugins/splash/script/script-lib-image.c b/src/plugins/splash/script/script-lib-image.c +index a202702..748e6d1 100644 +--- a/src/plugins/splash/script/script-lib-image.c ++++ b/src/plugins/splash/script/script-lib-image.c +@@ -200,7 +200,10 @@ static script_return_t image_text (script_state_t *state, + } + script_obj_unref (align_obj); + +- if (!text) return script_return_obj_null (); ++ if (!text) { ++ free (font); ++ return script_return_obj_null (); ++ } + + label = ply_label_new (); + ply_label_set_text (label, text); +diff --git a/src/plugins/splash/script/script-lib-sprite.c b/src/plugins/splash/script/script-lib-sprite.c +index 206252b..211fe44 100644 +--- a/src/plugins/splash/script/script-lib-sprite.c ++++ b/src/plugins/splash/script/script-lib-sprite.c +@@ -741,12 +741,14 @@ void + script_lib_sprite_refresh (script_lib_sprite_data_t *data) + { + ply_list_node_t *node; +- ply_region_t *region = ply_region_new (); ++ ply_region_t *region; + ply_list_t *rectable_list; + + if (!data) + return; + ++ region = ply_region_new (); ++ + ply_list_sort_stable (data->sprite_list, &sprite_compare_z); + + node = ply_list_get_first_node (data->sprite_list); +diff --git a/src/plugins/splash/script/script-parse.c b/src/plugins/splash/script/script-parse.c +index a4c7656..ea5fdd2 100644 +--- a/src/plugins/splash/script/script-parse.c ++++ b/src/plugins/splash/script/script-parse.c +@@ -54,6 +54,7 @@ static script_op_t *script_parse_op (script_scan_t *scan); + static script_exp_t *script_parse_exp (script_scan_t *scan); + static ply_list_t *script_parse_op_list (script_scan_t *scan); + static void script_parse_op_list_free (ply_list_t *op_list); ++static void script_parse_exp_free (script_exp_t *exp); + + static script_exp_t *script_parse_new_exp (script_exp_type_t type, + script_debug_location_t *location) +@@ -225,10 +226,33 @@ static void script_parse_advance_scan_by_string (script_scan_t *scan, + } + } + ++static void ++free_parameter_list (script_scan_t *scan, ++ ply_list_t *parameter_list) ++{ ++ if (parameter_list != NULL) { ++ ply_list_node_t *node; ++ ++ node = ply_list_get_first_node (parameter_list); ++ while (node != NULL) { ++ ply_list_node_t *next_node; ++ char *parameter; ++ ++ parameter = ply_list_node_get_data (node); ++ next_node = ply_list_get_next_node (parameter_list, node); ++ free (parameter); ++ ply_list_remove_node (parameter_list, node); ++ ++ node = next_node; ++ } ++ } ++} ++ + static script_function_t *script_parse_function_def (script_scan_t *scan) + { + script_scan_token_t *curtoken = script_scan_get_current_token (scan); +- ply_list_t *parameter_list; ++ script_function_t *function = NULL; ++ ply_list_t *parameter_list = NULL; + + if (!script_scan_token_is_symbol_of_value (curtoken, '(')) { + script_parse_error (&curtoken->location, +@@ -243,7 +267,7 @@ static script_function_t *script_parse_function_def (script_scan_t *scan) + if (!script_scan_token_is_identifier (curtoken)) { + script_parse_error (&curtoken->location, + "Function declaration parameters must be valid identifiers"); +- return NULL; ++ goto out; + } + char *parameter = strdup (curtoken->data.string); + ply_list_append_data (parameter_list, parameter); +@@ -254,7 +278,7 @@ static script_function_t *script_parse_function_def (script_scan_t *scan) + if (!script_scan_token_is_symbol_of_value (curtoken, ',')) { + script_parse_error (&curtoken->location, + "Function declaration parameters must separated with ',' and terminated with a ')'"); +- return NULL; ++ goto out; + } + curtoken = script_scan_get_next_token (scan); + } +@@ -263,9 +287,12 @@ static script_function_t *script_parse_function_def (script_scan_t *scan) + + script_op_t *func_op = script_parse_op (scan); + +- script_function_t *function = script_function_script_new (func_op, +- NULL, +- parameter_list); ++ function = script_function_script_new (func_op, ++ NULL, ++ parameter_list); ++ parameter_list = NULL; ++out: ++ free_parameter_list (scan, parameter_list); + return function; + } + +@@ -327,8 +354,18 @@ static script_exp_t *script_parse_exp_tm (script_scan_t *scan) + curtoken = script_scan_get_current_token (scan); + if (script_scan_token_is_symbol_of_value (curtoken, ']')) break; + if (!script_scan_token_is_symbol_of_value (curtoken, ',')) { ++ ply_list_node_t *node; + script_parse_error (&curtoken->location, + "Set parameters should be separated with a ',' and terminated with a ']'"); ++ ++ ++ for (node = ply_list_get_first_node (parameters); ++ node; ++ node = ply_list_get_next_node (parameters, node)) { ++ script_exp_t *sub = ply_list_node_get_data (node); ++ script_parse_exp_free (sub); ++ } ++ ply_list_free (parameters); + return NULL; + } + curtoken = script_scan_get_next_token (scan); +@@ -377,8 +414,18 @@ static script_exp_t *script_parse_exp_pi (script_scan_t *scan) + curtoken = script_scan_get_current_token (scan); + if (script_scan_token_is_symbol_of_value (curtoken, ')')) break; + if (!script_scan_token_is_symbol_of_value (curtoken, ',')) { ++ ply_list_node_t *node; ++ + script_parse_error (&curtoken->location, + "Function parameters should be separated with a ',' and terminated with a ')'"); ++ ++ for (node = ply_list_get_first_node (parameters); ++ node; ++ node = ply_list_get_next_node (parameters, node)) { ++ script_exp_t *sub = ply_list_node_get_data (node); ++ script_parse_exp_free (sub); ++ } ++ ply_list_free (parameters); + return NULL; + } + curtoken = script_scan_get_next_token (scan); +@@ -992,6 +1039,7 @@ script_op_t *script_parse_file (const char *filename) + curtoken = script_scan_get_current_token (scan); + if (curtoken->type != SCRIPT_SCAN_TOKEN_TYPE_EOF) { + script_parse_error (&curtoken->location, "Unparsed characters at end of file"); ++ script_parse_op_list_free (list); + return NULL; + } + script_op_t *op = script_parse_new_op_block (list, &location); +@@ -1015,6 +1063,7 @@ script_op_t *script_parse_string (const char *string, + curtoken = script_scan_get_current_token (scan); + if (curtoken->type != SCRIPT_SCAN_TOKEN_TYPE_EOF) { + script_parse_error (&curtoken->location, "Unparsed characters at end of file"); ++ script_parse_op_list_free (list); + return NULL; + } + script_op_t *op = script_parse_new_op_block (list, &location); +-- +2.7.4 + diff --git a/scripts-Use-2-instead-of-dev-stderr.patch b/scripts-Use-2-instead-of-dev-stderr.patch new file mode 100644 index 0000000..5a1aca9 --- /dev/null +++ b/scripts-Use-2-instead-of-dev-stderr.patch @@ -0,0 +1,155 @@ +From f9425978e19a6b57640553f0a1ef43f1642ca970 Mon Sep 17 00:00:00 2001 +From: Daniel Baumann +Date: Thu, 24 Aug 2017 17:12:37 +0200 +Subject: [PATCH 003/142] scripts: Use >&2 instead of /dev/stderr + +/dev/stderr isn't always available in chroots, so use +>&2 instead. + +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=581649 +https://bugs.freedesktop.org/show_bug.cgi?id=102388 +--- + scripts/plymouth-populate-initrd.in | 10 +++++----- + scripts/plymouth-set-default-theme.in | 34 +++++++++++++++++----------------- + 2 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in +index e3326e9..d0ffc23 100755 +--- a/scripts/plymouth-populate-initrd.in ++++ b/scripts/plymouth-populate-initrd.in +@@ -337,10 +337,10 @@ inst_any() { + } + + function usage() { +- local output="/dev/stdout" ++ local output="/proc/self/fd/1" + local rc=0 + if [ "$1" == "error" ]; then +- output="/dev/stderr" ++ output="/proc/self/fd/2" + rc=1 + fi + +@@ -385,13 +385,13 @@ inst ${PLYMOUTH_POLICYDIR}/plymouthd.defaults $INITRDDIR + inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR + + if [ -z "$PLYMOUTH_THEME_NAME" ]; then +- echo "No default plymouth plugin is set" > /dev/stderr ++ echo "No default plymouth plugin is set" >&2 + exit 1 + fi + + if [ $THEME_OVERRIDE ]; then + conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf +- echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" > /dev/stderr ++ echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2 + # make sure the section and key exist so we can modify them + grep -q "^ *\[Daemon\]" $conf || echo "[Daemon]" >> $conf + grep -q "^ *Theme *=" $conf || echo "Theme=fade-in" >> $conf +@@ -401,7 +401,7 @@ fi + PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//') + + if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then +- echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr ++ echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" >&2 + exit 1 + fi + +diff --git a/scripts/plymouth-set-default-theme.in b/scripts/plymouth-set-default-theme.in +index 68e63d1..ed999e9 100755 +--- a/scripts/plymouth-set-default-theme.in ++++ b/scripts/plymouth-set-default-theme.in +@@ -84,14 +84,14 @@ while [ $# -gt 0 ]; do + + -l|--list) + if [ -n "$THEME_NAME" ]; then +- echo "You can only specify --list or a theme name, not both" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify --list or a theme name, not both" >&2 ++ echo $(usage) >&2 + exit 1 + fi + + if [ $DO_RESET -ne 0 ]; then +- echo "You can only specify --reset or --list, not both" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify --reset or --list, not both" >&2 ++ echo $(usage) >&2 + exit 1 + fi + +@@ -104,14 +104,14 @@ while [ $# -gt 0 ]; do + + -r|--reset|default) + if [ -n "$THEME_NAME" ]; then +- echo "You can only specify --reset or a theme name, not both" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify --reset or a theme name, not both" >&2 ++ echo $(usage) >&2 + exit 1 + fi + + if [ $DO_LIST -ne 0 ]; then +- echo "You can only specify --reset or --list, not both" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify --reset or --list, not both" >&2 ++ echo $(usage) >&2 + exit 1 + fi + +@@ -124,20 +124,20 @@ while [ $# -gt 0 ]; do + + *) + if [ -n "$THEME_NAME" ]; then +- echo "You can only specify one theme at a time" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify one theme at a time" >&2 ++ echo $(usage) >&2 + exit 1 + fi + + if [ $DO_RESET -ne 0 ]; then +- echo "You can only specify --reset or a theme name, not both" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify --reset or a theme name, not both" >&2 ++ echo $(usage) >&2 + exit 1 + fi + + if [ $DO_LIST -ne 0 ]; then +- echo "You can only specify --list or a theme name, not both" > /dev/stderr +- echo $(usage) > /dev/stderr ++ echo "You can only specify --list or a theme name, not both" >&2 ++ echo $(usage) >&2 + exit 1 + fi + +@@ -163,7 +163,7 @@ if [ $DO_RESET -eq 0 ] && [ $DO_INITRD_REBUILD -eq 0 ] && [ -z $THEME_NAME ]; th + fi + + if [ `id -u` -ne 0 ]; then +- echo "This program must be run as root" > /dev/stderr ++ echo "This program must be run as root" >&2 + exit 1 + fi + +@@ -174,14 +174,14 @@ if [ $DO_RESET -ne 0 ]; then + fi + + if [ ! -e ${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth ]; then +- echo "${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth does not exist" > /dev/stderr ++ echo "${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth does not exist" >&2 + exit 1 + fi + + MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth | sed 's/ModuleName *= *//') + + if [ ! -e ${PLYMOUTH_PLUGIN_PATH}${MODULE_NAME}.so ]; then +- echo "${PLYMOUTH_PLUGIN_PATH}${MODULE_NAME}.so does not exist" > /dev/stderr ++ echo "${PLYMOUTH_PLUGIN_PATH}${MODULE_NAME}.so does not exist" >&2 + exit 1 + fi + +-- +2.7.4 + diff --git a/systemd-units-Add-ConditionVirtualization-container.patch b/systemd-units-Add-ConditionVirtualization-container.patch new file mode 100644 index 0000000..c3b0f8d --- /dev/null +++ b/systemd-units-Add-ConditionVirtualization-container.patch @@ -0,0 +1,107 @@ +From 9ed2a0c55be8ee9919953efbacedc079a7428358 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 7 Aug 2018 10:15:56 +0200 +Subject: [PATCH 045/142] systemd-units: Add + "ConditionVirtualization=!container" + +When running in a container with plymouth installed, plymouth is started +unnecessarily and systemd prints warnings: + +[ OK ] Reached target Shutdown. +Sending SIGTERM to remaining processes... +Sending SIGKILL to remaining processes... +Process 253 (plymouthd) has been been marked to be excluded from killing. It is running from the root file system, and thus likely to block re-mounting of the root file system to read-only. Please consider moving it into an initrd file system instead. + +It makes little sense to start plymouth in contains, so add +'ConditionVirtualization=!container' everywhere where +ConditionKernelCommandLine=!plymouth.enable=0 appears to disable plymouth +in containers. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1337611 +Signed-off-by: Hans de Goede + +Closes: https://gitlab.freedesktop.org/plymouth/plymouth/issues/27 +--- + systemd-units/plymouth-halt.service.in | 1 + + systemd-units/plymouth-kexec.service.in | 1 + + systemd-units/plymouth-poweroff.service.in | 1 + + systemd-units/plymouth-reboot.service.in | 1 + + systemd-units/plymouth-start.service.in | 1 + + systemd-units/systemd-ask-password-plymouth.service.in | 1 + + 6 files changed, 6 insertions(+) + +diff --git a/systemd-units/plymouth-halt.service.in b/systemd-units/plymouth-halt.service.in +index 59a1912..38ae98c 100644 +--- a/systemd-units/plymouth-halt.service.in ++++ b/systemd-units/plymouth-halt.service.in +@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service + Before=systemd-halt.service + DefaultDependencies=no + ConditionKernelCommandLine=!plymouth.enable=0 ++ConditionVirtualization=!container + + [Service] + ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session +diff --git a/systemd-units/plymouth-kexec.service.in b/systemd-units/plymouth-kexec.service.in +index 5a39037..bed5eb7 100644 +--- a/systemd-units/plymouth-kexec.service.in ++++ b/systemd-units/plymouth-kexec.service.in +@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service + Before=systemd-kexec.service + DefaultDependencies=no + ConditionKernelCommandLine=!plymouth.enable=0 ++ConditionVirtualization=!container + + [Service] + ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session +diff --git a/systemd-units/plymouth-poweroff.service.in b/systemd-units/plymouth-poweroff.service.in +index 8ebaf76..7891e97 100644 +--- a/systemd-units/plymouth-poweroff.service.in ++++ b/systemd-units/plymouth-poweroff.service.in +@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service + Before=systemd-poweroff.service + DefaultDependencies=no + ConditionKernelCommandLine=!plymouth.enable=0 ++ConditionVirtualization=!container + + [Service] + ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session +diff --git a/systemd-units/plymouth-reboot.service.in b/systemd-units/plymouth-reboot.service.in +index 6d5309f..1d57789 100644 +--- a/systemd-units/plymouth-reboot.service.in ++++ b/systemd-units/plymouth-reboot.service.in +@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service + Before=systemd-reboot.service + DefaultDependencies=no + ConditionKernelCommandLine=!plymouth.enable=0 ++ConditionVirtualization=!container + + [Service] + ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session +diff --git a/systemd-units/plymouth-start.service.in b/systemd-units/plymouth-start.service.in +index ddfb08f..5d88f60 100644 +--- a/systemd-units/plymouth-start.service.in ++++ b/systemd-units/plymouth-start.service.in +@@ -5,6 +5,7 @@ Wants=systemd-ask-password-plymouth.path systemd-vconsole-setup.service + After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service + Before=systemd-ask-password-plymouth.service + ConditionKernelCommandLine=!plymouth.enable=0 ++ConditionVirtualization=!container + + [Service] + ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=boot --pid-file=@plymouthruntimedir@/pid --attach-to-session +diff --git a/systemd-units/systemd-ask-password-plymouth.service.in b/systemd-units/systemd-ask-password-plymouth.service.in +index 0c3acde..242b733 100644 +--- a/systemd-units/systemd-ask-password-plymouth.service.in ++++ b/systemd-units/systemd-ask-password-plymouth.service.in +@@ -6,6 +6,7 @@ Conflicts=shutdown.target + After=plymouth-start.service + Before=shutdown.target + ConditionKernelCommandLine=!plymouth.enable=0 ++ConditionVirtualization=!container + ConditionPathExists=/run/plymouth/pid + + [Service] +-- +2.7.4 + diff --git a/systemd-units-Also-add-ConditionVirtualization-conta.patch b/systemd-units-Also-add-ConditionVirtualization-conta.patch new file mode 100644 index 0000000..86097b9 --- /dev/null +++ b/systemd-units-Also-add-ConditionVirtualization-conta.patch @@ -0,0 +1,26 @@ +From 763c023caa5215070047b07c80208b9d99dc8d8b Mon Sep 17 00:00:00 2001 +From: Laurent Bigonville +Date: Thu, 8 Nov 2018 11:05:05 +0000 +Subject: [PATCH 060/142] systemd-units: Also add + "ConditionVirtualization=!container" in systemd-ask-password-plymouth.path.in + +This completes the fix for #27 +--- + systemd-units/systemd-ask-password-plymouth.path.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/systemd-units/systemd-ask-password-plymouth.path.in b/systemd-units/systemd-ask-password-plymouth.path.in +index c2ee420..826a6b3 100644 +--- a/systemd-units/systemd-ask-password-plymouth.path.in ++++ b/systemd-units/systemd-ask-password-plymouth.path.in +@@ -7,6 +7,7 @@ After=plymouth-start.service + Before=basic.target shutdown.target + ConditionKernelCommandLine=!plymouth.enable=0 + ConditionPathExists=/run/plymouth/pid ++ConditionVirtualization=!container + + [Path] + DirectoryNotEmpty=/run/systemd/ask-password +-- +2.7.4 + diff --git a/two-step-Fix-animation-not-starting-on-later-added-h.patch b/two-step-Fix-animation-not-starting-on-later-added-h.patch new file mode 100644 index 0000000..59372b0 --- /dev/null +++ b/two-step-Fix-animation-not-starting-on-later-added-h.patch @@ -0,0 +1,38 @@ +From 9639ed895331924b24670ff6f814aaa952ad5b02 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 12 Nov 2018 12:50:33 +0100 +Subject: [PATCH 063/142] two-step: Fix animation not starting on later added + heads + +Fix the animation not starting on heads added after show_splash_screen +has been called. Since the core calls show_splash_screen after adding +the first head / pixel_display in practice this fixes the animation not +starting on all monitors other then the first. + +Signed-off-by: Hans de Goede +--- + src/plugins/splash/two-step/plugin.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c +index 7307e19..924207c 100644 +--- a/src/plugins/splash/two-step/plugin.c ++++ b/src/plugins/splash/two-step/plugin.c +@@ -1002,10 +1002,12 @@ add_pixel_display (ply_boot_splash_plugin_t *plugin, + (ply_pixel_display_draw_handler_t) + on_draw, view); + if (plugin->is_visible) { +- if (view_load (view)) ++ if (view_load (view)) { + ply_list_append_data (plugin->views, view); +- else ++ view_start_progress_animation (view); ++ } else { + view_free (view); ++ } + } else { + ply_list_append_data (plugin->views, view); + } +-- +2.7.4 + diff --git a/two-step-Fix-crash-asking-for-password-with-multiple.patch b/two-step-Fix-crash-asking-for-password-with-multiple.patch new file mode 100644 index 0000000..e8e5b3d --- /dev/null +++ b/two-step-Fix-crash-asking-for-password-with-multiple.patch @@ -0,0 +1,43 @@ +From 50adbfd30085715940a22f1517c81584d73d767b Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 27 Nov 2018 08:24:20 +0100 +Subject: [PATCH 065/142] two-step: Fix crash asking for password with multiple + heads + +Commit 9639ed895331 ("two-step: Fix animation not starting on later +added heads") unconditionally calls view_start_progress_animation() when +adding secondary heads, to fix the animation not running on secondary +heads when not asking for a password. + +But we should not start the animation when adding a head after we've +already entered PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY state, otherwise +we end up starting it a second time when the user is done entering his +password, causing plymouth to crash and the boot to hang. + +We already have the is_animating bool to indicate whether animations have +been started or not, use this to decide if we should start the animation +when adding a new head, fixing the crash. + +Fixes: 9639ed895331 ("two-step: Fix animation not starting on ... added heads") +Signed-off-by: Hans de Goede +--- + src/plugins/splash/two-step/plugin.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c +index 924207c..0ceda90 100644 +--- a/src/plugins/splash/two-step/plugin.c ++++ b/src/plugins/splash/two-step/plugin.c +@@ -1004,7 +1004,8 @@ add_pixel_display (ply_boot_splash_plugin_t *plugin, + if (plugin->is_visible) { + if (view_load (view)) { + ply_list_append_data (plugin->views, view); +- view_start_progress_animation (view); ++ if (plugin->is_animating) ++ view_start_progress_animation (view); + } else { + view_free (view); + } +-- +2.7.4 + diff --git a/two-step-Use-plymouth_strtod.patch b/two-step-Use-plymouth_strtod.patch new file mode 100644 index 0000000..fd9fa3e --- /dev/null +++ b/two-step-Use-plymouth_strtod.patch @@ -0,0 +1,77 @@ +From fb6d4b4983de70296ee84d0029e5e7b91202d526 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 19 Dec 2018 10:45:51 +0100 +Subject: [PATCH 092/142] two-step: Use plymouth_strtod + +Use the locale agnostic plymouth_strtod helper which always uses a "." +as decimal seperator. This fixes the various Alignment options not working +with some locales. + +While at it also add a ply_trace to log the size and chosen centering for +the watermark image. + +Signed-off-by: Hans de Goede +--- + src/plugins/splash/two-step/plugin.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c +index 16b8fc8..c1e75a8 100644 +--- a/src/plugins/splash/two-step/plugin.c ++++ b/src/plugins/splash/two-step/plugin.c +@@ -423,6 +423,10 @@ view_load (view_t *view) + view->watermark_area.height = ply_image_get_height (plugin->watermark_image); + view->watermark_area.x = screen_width * plugin->watermark_horizontal_alignment - ply_image_get_width (plugin->watermark_image) * plugin->watermark_horizontal_alignment; + view->watermark_area.y = screen_height * plugin->watermark_vertical_alignment - ply_image_get_height (plugin->watermark_image) * plugin->watermark_vertical_alignment; ++ ply_trace ("using %ldx%ld watermark centered at %ldx%ld for %ldx%ld screen", ++ view->watermark_area.width, view->watermark_area.height, ++ view->watermark_area.x, view->watermark_area.y, ++ screen_width, screen_height); + } + + ply_trace ("loading entry"); +@@ -746,28 +750,28 @@ create_plugin (ply_key_file_t *key_file) + + alignment = ply_key_file_get_value (key_file, "two-step", "HorizontalAlignment"); + if (alignment != NULL) +- plugin->animation_horizontal_alignment = strtod (alignment, NULL); ++ plugin->animation_horizontal_alignment = ply_strtod (alignment); + else + plugin->animation_horizontal_alignment = .5; + free (alignment); + + alignment = ply_key_file_get_value (key_file, "two-step", "VerticalAlignment"); + if (alignment != NULL) +- plugin->animation_vertical_alignment = strtod (alignment, NULL); ++ plugin->animation_vertical_alignment = ply_strtod (alignment); + else + plugin->animation_vertical_alignment = .5; + free (alignment); + + alignment = ply_key_file_get_value (key_file, "two-step", "WatermarkHorizontalAlignment"); + if (alignment != NULL) +- plugin->watermark_horizontal_alignment = strtod (alignment, NULL); ++ plugin->watermark_horizontal_alignment = ply_strtod (alignment); + else + plugin->watermark_horizontal_alignment = 1.0; + free (alignment); + + alignment = ply_key_file_get_value (key_file, "two-step", "WatermarkVerticalAlignment"); + if (alignment != NULL) +- plugin->watermark_vertical_alignment = strtod (alignment, NULL); ++ plugin->watermark_vertical_alignment = ply_strtod (alignment); + else + plugin->watermark_vertical_alignment = .5; + free (alignment); +@@ -786,7 +790,7 @@ create_plugin (ply_key_file_t *key_file) + + transition_duration = ply_key_file_get_value (key_file, "two-step", "TransitionDuration"); + if (transition_duration != NULL) +- plugin->transition_duration = strtod (transition_duration, NULL); ++ plugin->transition_duration = ply_strtod (transition_duration); + else + plugin->transition_duration = 0.0; + free (transition_duration); +-- +2.7.4 + diff --git a/x11-don-t-call-gdk_display_get_name-before-gtk_init.patch b/x11-don-t-call-gdk_display_get_name-before-gtk_init.patch new file mode 100644 index 0000000..bc73caa --- /dev/null +++ b/x11-don-t-call-gdk_display_get_name-before-gtk_init.patch @@ -0,0 +1,49 @@ +From e953e47216b95549ad8f92458e2fd5af5805e5e0 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 11 Dec 2017 10:39:13 -0500 +Subject: [PATCH 007/142] x11: don't call gdk_display_get_name before gtk_init + +The x11 plugin calls gdk_display_get_name at load time +to set the device name state. This no longer works, since +gtk_init_check() happens later at open_device time, and +GTK+ no longer allows gdk_display_get_name before gtk_init. + +This commit moves the gtk_init call earlier, to +create_backend, so gdk_display_get_name works again. + +https://bugzilla.gnome.org/show_bug.cgi?id=104204 +--- + src/plugins/renderers/x11/plugin.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/plugins/renderers/x11/plugin.c b/src/plugins/renderers/x11/plugin.c +index 8948f69..76addda 100644 +--- a/src/plugins/renderers/x11/plugin.c ++++ b/src/plugins/renderers/x11/plugin.c +@@ -105,6 +105,11 @@ create_backend (const char *device_name, + { + ply_renderer_backend_t *backend; + ++ gdk_set_allowed_backends ("x11"); ++ ++ if (!gtk_init_check (0, NULL)) ++ return false; ++ + backend = calloc (1, sizeof(ply_renderer_backend_t)); + + backend->loop = ply_event_loop_get_default (); +@@ -150,11 +155,6 @@ open_device (ply_renderer_backend_t *backend) + Display *display; + int display_fd; + +- gdk_set_allowed_backends ("x11"); +- +- if (!gtk_init_check (0, NULL)) +- return false; +- + /* Force gtk+ to deal in device pixels */ + gdk_x11_display_set_window_scale (gdk_display_get_default (), 1); + +-- +2.7.4 +