Toshaan Bharvani
5 months ago
8 changed files with 1073 additions and 3 deletions
@ -0,0 +1,167 @@
@@ -0,0 +1,167 @@
|
||||
From c42ff26b3dd3afa520946b1e28716055134cab50 Mon Sep 17 00:00:00 2001 |
||||
From: Ray Strode <rstrode@redhat.com> |
||||
Date: Tue, 30 Aug 2022 14:41:36 -0400 |
||||
Subject: [PATCH] details: Don't replay boot buffer on serial consoles |
||||
|
||||
commit 0e59dde8 changed the details plugin to clear the terminal when |
||||
first opening it. This was done to prevent duplicate messages from |
||||
showing up when toggling back and forth between details and graphical |
||||
splashes. |
||||
|
||||
That has the negative side effect of purging serial console output too |
||||
though. Furthermore, it makes little sense to replay the boot buffer |
||||
on serial consoles, since serial consoles don't aggressively purge |
||||
scrollback like VTs do. |
||||
|
||||
This commit adds a check to make sure the terminal is a VT before trying |
||||
to clear and replay the scrollback buffer. |
||||
|
||||
Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/187 |
||||
--- |
||||
src/plugins/splash/details/plugin.c | 38 ++++++++++++++++++++--------- |
||||
1 file changed, 27 insertions(+), 11 deletions(-) |
||||
|
||||
diff --git a/src/plugins/splash/details/plugin.c b/src/plugins/splash/details/plugin.c |
||||
index 254f682b..140fb282 100644 |
||||
--- a/src/plugins/splash/details/plugin.c |
||||
+++ b/src/plugins/splash/details/plugin.c |
||||
@@ -175,109 +175,125 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin) |
||||
detach_from_event_loop, |
||||
plugin); |
||||
detach_from_event_loop (plugin); |
||||
} |
||||
|
||||
free_messages (plugin); |
||||
free_views (plugin); |
||||
|
||||
free (plugin); |
||||
} |
||||
|
||||
static void |
||||
detach_from_event_loop (ply_boot_splash_plugin_t *plugin) |
||||
{ |
||||
plugin->loop = NULL; |
||||
|
||||
ply_trace ("detaching from event loop"); |
||||
} |
||||
|
||||
static void |
||||
view_write (view_t *view, |
||||
const char *text, |
||||
size_t number_of_bytes) |
||||
{ |
||||
ply_terminal_t *terminal; |
||||
|
||||
terminal = ply_text_display_get_terminal (view->display); |
||||
ply_terminal_write (terminal, "%.*s", (int) number_of_bytes, text); |
||||
} |
||||
|
||||
+static void |
||||
+view_write_boot_buffer (view_t *view) |
||||
+{ |
||||
+ ply_boot_splash_plugin_t *plugin; |
||||
+ ply_terminal_t *terminal; |
||||
+ |
||||
+ plugin = view->plugin; |
||||
+ |
||||
+ terminal = ply_text_display_get_terminal (view->display); |
||||
+ |
||||
+ ply_text_display_clear_screen (view->display); |
||||
+ ply_terminal_activate_vt (terminal); |
||||
+ |
||||
+ if (plugin->boot_buffer != NULL) { |
||||
+ size_t size; |
||||
+ const char *bytes; |
||||
+ |
||||
+ size = ply_buffer_get_size (plugin->boot_buffer); |
||||
+ bytes = ply_buffer_get_bytes (plugin->boot_buffer); |
||||
+ view_write (view, bytes, size); |
||||
+ } |
||||
+} |
||||
+ |
||||
static void |
||||
write_on_views (ply_boot_splash_plugin_t *plugin, |
||||
const char *text, |
||||
size_t number_of_bytes) |
||||
{ |
||||
ply_list_node_t *node; |
||||
|
||||
if (number_of_bytes == 0) |
||||
return; |
||||
|
||||
node = ply_list_get_first_node (plugin->views); |
||||
|
||||
while (node != NULL) { |
||||
ply_list_node_t *next_node; |
||||
view_t *view; |
||||
|
||||
view = ply_list_node_get_data (node); |
||||
next_node = ply_list_get_next_node (plugin->views, node); |
||||
|
||||
view_write (view, text, number_of_bytes); |
||||
|
||||
node = next_node; |
||||
} |
||||
} |
||||
|
||||
static void |
||||
add_text_display (ply_boot_splash_plugin_t *plugin, |
||||
ply_text_display_t *display) |
||||
{ |
||||
view_t *view; |
||||
ply_terminal_t *terminal; |
||||
|
||||
view = view_new (plugin, display); |
||||
|
||||
terminal = ply_text_display_get_terminal (view->display); |
||||
- if (ply_terminal_open (terminal)) { |
||||
- ply_text_display_clear_screen (view->display); |
||||
- ply_terminal_activate_vt (terminal); |
||||
- } |
||||
|
||||
- ply_list_append_data (plugin->views, view); |
||||
+ ply_terminal_open (terminal); |
||||
|
||||
- if (plugin->boot_buffer != NULL) { |
||||
- size_t size; |
||||
- const char *bytes; |
||||
+ ply_list_append_data (plugin->views, view); |
||||
|
||||
- size = ply_buffer_get_size (plugin->boot_buffer); |
||||
- bytes = ply_buffer_get_bytes (plugin->boot_buffer); |
||||
- view_write (view, bytes, size); |
||||
+ if (ply_terminal_is_vt (terminal)) { |
||||
+ view_write_boot_buffer (view); |
||||
} |
||||
} |
||||
|
||||
static void |
||||
remove_text_display (ply_boot_splash_plugin_t *plugin, |
||||
ply_text_display_t *display) |
||||
{ |
||||
ply_list_node_t *node; |
||||
|
||||
node = ply_list_get_first_node (plugin->views); |
||||
while (node != NULL) { |
||||
view_t *view; |
||||
ply_list_node_t *next_node; |
||||
|
||||
view = ply_list_node_get_data (node); |
||||
next_node = ply_list_get_next_node (plugin->views, node); |
||||
|
||||
if (view->display == display) { |
||||
ply_list_remove_node (plugin->views, node); |
||||
return; |
||||
} |
||||
|
||||
node = next_node; |
||||
} |
||||
} |
||||
|
||||
static bool |
||||
show_splash_screen (ply_boot_splash_plugin_t *plugin, |
||||
ply_event_loop_t *loop, |
||||
ply_buffer_t *boot_buffer, |
||||
-- |
||||
2.41.0.rc2 |
||||
|
@ -0,0 +1,158 @@
@@ -0,0 +1,158 @@
|
||||
From 58161da08c108243d59d58c6c1f9d3c97bb9a3ad Mon Sep 17 00:00:00 2001 |
||||
From: Hans de Goede <hdegoede@redhat.com> |
||||
Date: Mon, 7 Mar 2022 12:25:56 +0100 |
||||
Subject: [PATCH 1/6] ply-utils: Reintroduce ply_string_has_prefix helper |
||||
|
||||
ply_string_has_prefix was dropped in commit c7965ea19abf ("ply-utils: |
||||
Drop unused ply_string_has_prefix helper"). We have a need for this |
||||
helper again, so reintroduce it. |
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||
--- |
||||
src/libply/ply-utils.c | 9 +++++++++ |
||||
src/libply/ply-utils.h | 1 + |
||||
2 files changed, 10 insertions(+) |
||||
|
||||
diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c |
||||
index f90ac40..f457579 100644 |
||||
--- a/src/libply/ply-utils.c |
||||
+++ b/src/libply/ply-utils.c |
||||
@@ -432,60 +432,69 @@ ply_copy_string_array (const char *const *array) |
||||
int i; |
||||
|
||||
for (i = 0; array[i] != NULL; i++) { |
||||
} |
||||
|
||||
copy = calloc (i + 1, sizeof(char *)); |
||||
|
||||
for (i = 0; array[i] != NULL; i++) { |
||||
copy[i] = strdup (array[i]); |
||||
} |
||||
|
||||
return copy; |
||||
} |
||||
|
||||
void |
||||
ply_free_string_array (char **array) |
||||
{ |
||||
int i; |
||||
|
||||
if (array == NULL) |
||||
return; |
||||
|
||||
for (i = 0; array[i] != NULL; i++) { |
||||
free (array[i]); |
||||
array[i] = NULL; |
||||
} |
||||
|
||||
free (array); |
||||
} |
||||
|
||||
+bool |
||||
+ply_string_has_prefix (const char *str, const char *prefix) |
||||
+{ |
||||
+ if (str == NULL || prefix == NULL) |
||||
+ return false; |
||||
+ |
||||
+ return strncmp (str, prefix, strlen (prefix)) == 0; |
||||
+} |
||||
+ |
||||
double |
||||
ply_get_timestamp (void) |
||||
{ |
||||
const double nanoseconds_per_second = 1000000000.0; |
||||
double timestamp; |
||||
struct timespec now = { 0L, /* zero-filled */ }; |
||||
|
||||
clock_gettime (CLOCK_MONOTONIC, &now); |
||||
timestamp = ((nanoseconds_per_second * now.tv_sec) + now.tv_nsec) / |
||||
nanoseconds_per_second; |
||||
|
||||
return timestamp; |
||||
} |
||||
|
||||
void |
||||
ply_save_errno (void) |
||||
{ |
||||
assert (errno_stack_position < PLY_ERRNO_STACK_SIZE); |
||||
errno_stack[errno_stack_position] = errno; |
||||
errno_stack_position++; |
||||
} |
||||
|
||||
void |
||||
ply_restore_errno (void) |
||||
{ |
||||
assert (errno_stack_position > 0); |
||||
errno_stack_position--; |
||||
errno = errno_stack[errno_stack_position]; |
||||
} |
||||
|
||||
diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h |
||||
index d7b7622..b4565c3 100644 |
||||
--- a/src/libply/ply-utils.h |
||||
+++ b/src/libply/ply-utils.h |
||||
@@ -56,60 +56,61 @@ typedef enum |
||||
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS |
||||
|
||||
#define ply_round_to_multiple(n, m) (((n) + (((m) - 1))) & ~((m) - 1)) |
||||
|
||||
bool ply_open_unidirectional_pipe (int *sender_fd, |
||||
int *receiver_fd); |
||||
int ply_connect_to_unix_socket (const char *path, |
||||
ply_unix_socket_type_t type); |
||||
int ply_listen_to_unix_socket (const char *path, |
||||
ply_unix_socket_type_t type); |
||||
bool ply_get_credentials_from_fd (int fd, |
||||
pid_t *pid, |
||||
uid_t *uid, |
||||
gid_t *gid); |
||||
|
||||
bool ply_write (int fd, |
||||
const void *buffer, |
||||
size_t number_of_bytes); |
||||
bool ply_write_uint32 (int fd, |
||||
uint32_t value); |
||||
bool ply_read (int fd, |
||||
void *buffer, |
||||
size_t number_of_bytes); |
||||
bool ply_read_uint32 (int fd, |
||||
uint32_t *value); |
||||
|
||||
bool ply_fd_has_data (int fd); |
||||
bool ply_set_fd_as_blocking (int fd); |
||||
char **ply_copy_string_array (const char *const *array); |
||||
void ply_free_string_array (char **array); |
||||
+bool ply_string_has_prefix (const char *str, const char *prefix); |
||||
double ply_get_timestamp (void); |
||||
|
||||
void ply_save_errno (void); |
||||
void ply_restore_errno (void); |
||||
|
||||
bool ply_directory_exists (const char *dir); |
||||
bool ply_file_exists (const char *file); |
||||
bool ply_character_device_exists (const char *device); |
||||
|
||||
ply_module_handle_t *ply_open_module (const char *module_path); |
||||
ply_module_handle_t *ply_open_built_in_module (void); |
||||
|
||||
ply_module_function_t ply_module_look_up_function (ply_module_handle_t *handle, |
||||
const char *function_name); |
||||
void ply_close_module (ply_module_handle_t *handle); |
||||
|
||||
bool ply_create_directory (const char *directory); |
||||
bool ply_create_file_link (const char *source, |
||||
const char *destination); |
||||
void ply_show_new_kernel_messages (bool should_show); |
||||
|
||||
ply_daemon_handle_t *ply_create_daemon (void); |
||||
bool ply_detach_daemon (ply_daemon_handle_t *handle, |
||||
int exit_code); |
||||
|
||||
int ply_utf8_character_get_size (const char *string, |
||||
size_t n); |
||||
int ply_utf8_string_get_length (const char *string, |
||||
size_t n); |
||||
|
||||
-- |
||||
2.37.0.rc1 |
||||
|
@ -0,0 +1,159 @@
@@ -0,0 +1,159 @@
|
||||
From ccb1a425efa1a21ba0d6730b8eba030c5f1d4ada Mon Sep 17 00:00:00 2001 |
||||
From: Hans de Goede <hdegoede@redhat.com> |
||||
Date: Mon, 28 Feb 2022 16:07:11 +0100 |
||||
Subject: [PATCH 2/6] ply-device-manager: Treat SimpleDRM drm devices as fbdev |
||||
devices |
||||
|
||||
Simple-framebuffer devices driven by simpledrm lack information |
||||
like panel-rotation info and physical size, causing the splash |
||||
to briefly render on its side / without HiDPI scaling, switching |
||||
to the correct rendering when the native driver loads. |
||||
|
||||
To avoid this treat simpledrm devices as fbdev devices and only |
||||
use them after the timeout. |
||||
|
||||
Also adds 2 exceptions to this: |
||||
|
||||
1. If nomodeset is passed on the kernel commandline then no native |
||||
drivers will load, so in this case it is best to immediately use |
||||
SimpleDRM devices when they are detected. |
||||
|
||||
2. On some devics the firmware leave the panel black at boot. In this |
||||
case it is desirable to show the splash to the user ASAP so that there |
||||
is some visual feedback that the device is booting. Add a support for a |
||||
"plymouth.use-simpledrm" kernel cmdline option to show the splash |
||||
immediately on SimpleDRM devices rather then waiting for the native |
||||
driver to load. |
||||
|
||||
Closes #167 |
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||
--- |
||||
src/libply-splash-core/ply-device-manager.c | 39 +++++++++++++++++++++ |
||||
1 file changed, 39 insertions(+) |
||||
|
||||
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c |
||||
index aed7bac..b2484b4 100644 |
||||
--- a/src/libply-splash-core/ply-device-manager.c |
||||
+++ b/src/libply-splash-core/ply-device-manager.c |
||||
@@ -378,78 +378,117 @@ create_devices_for_subsystem (ply_device_manager_t *manager, |
||||
static void |
||||
on_drm_udev_add_or_change (ply_device_manager_t *manager, |
||||
const char *action, |
||||
const char *device_path, |
||||
struct udev_device *device) |
||||
{ |
||||
ply_renderer_t *renderer; |
||||
bool changed; |
||||
|
||||
renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path); |
||||
if (renderer == NULL) { |
||||
/* We also try to create the renderer again on change events, |
||||
* renderer creation fails when no outputs are connected and |
||||
* this may have changed. |
||||
*/ |
||||
create_devices_for_udev_device (manager, device); |
||||
return; |
||||
} |
||||
|
||||
/* Renderer exists, bail if this is not a change event */ |
||||
if (strcmp (action, "change")) |
||||
return; |
||||
|
||||
changed = ply_renderer_handle_change_event (renderer); |
||||
if (changed) { |
||||
free_displays_for_renderer (manager, renderer); |
||||
create_pixel_displays_for_renderer (manager, renderer); |
||||
} |
||||
} |
||||
|
||||
+static bool |
||||
+verify_drm_device (struct udev_device *device) |
||||
+{ |
||||
+ const char *id_path; |
||||
+ |
||||
+ /* |
||||
+ * Simple-framebuffer devices driven by simpledrm lack information |
||||
+ * like panel-rotation info and physical size, causing the splash |
||||
+ * to briefly render on its side / without HiDPI scaling, switching |
||||
+ * to the correct rendering when the native driver loads. |
||||
+ * To avoid this treat simpledrm devices as fbdev devices and only |
||||
+ * use them after the timeout. |
||||
+ */ |
||||
+ id_path = udev_device_get_property_value (device, "ID_PATH"); |
||||
+ if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer")) |
||||
+ return true; /* Not a SimpleDRM device */ |
||||
+ |
||||
+ /* |
||||
+ * With nomodeset, no native drivers will load, so SimpleDRM devices |
||||
+ * should be used immediately. |
||||
+ */ |
||||
+ if (ply_kernel_command_line_has_argument ("nomodeset")) |
||||
+ return true; |
||||
+ |
||||
+ /* |
||||
+ * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM |
||||
+ * use from the cmdline to show something to the user ASAP. |
||||
+ */ |
||||
+ if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) |
||||
+ return true; |
||||
+ |
||||
+ return false; |
||||
+} |
||||
+ |
||||
static bool |
||||
verify_add_or_change (ply_device_manager_t *manager, |
||||
const char *action, |
||||
const char *device_path, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (action, "add") && strcmp (action, "change")) |
||||
return false; |
||||
|
||||
subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
if (manager->local_console_managed && manager->local_console_is_text) { |
||||
ply_trace ("ignoring since we're already using text splash for local console"); |
||||
return false; |
||||
} |
||||
+ |
||||
+ if (!verify_drm_device (device)) { |
||||
+ ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); |
||||
+ return false; |
||||
+ } |
||||
} else { |
||||
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
static bool |
||||
duplicate_device_path (ply_list_t *events, const char *device_path) |
||||
{ |
||||
struct udev_device *device; |
||||
ply_list_node_t *node; |
||||
|
||||
for (node = ply_list_get_first_node (events); |
||||
node; node = ply_list_get_next_node (events, node)) { |
||||
device = ply_list_node_get_data (node); |
||||
|
||||
if (strcmp (udev_device_get_devnode (device), device_path) == 0) |
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
static void |
||||
process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events) |
||||
{ |
||||
const char *action, *device_path; |
||||
struct udev_device *device; |
||||
-- |
||||
2.37.0.rc1 |
||||
|
@ -0,0 +1,213 @@
@@ -0,0 +1,213 @@
|
||||
From 7fbd59d04e971d327c3aaba417765f25c3168447 Mon Sep 17 00:00:00 2001 |
||||
From: Hans de Goede <hdegoede@redhat.com> |
||||
Date: Wed, 28 Sep 2022 15:14:00 +0200 |
||||
Subject: [PATCH 3/6] ply-device-manager: Move verify_drm_device() higher up in |
||||
the file |
||||
|
||||
Move verify_drm_device() higher up in ply-device-manager.c, this is |
||||
a preparation patch for the next patch in this series. |
||||
|
||||
This is a pure move without any changes to the moved block. |
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||
--- |
||||
src/libply-splash-core/ply-device-manager.c | 68 ++++++++++----------- |
||||
1 file changed, 34 insertions(+), 34 deletions(-) |
||||
|
||||
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c |
||||
index b2484b4..015bd70 100644 |
||||
--- a/src/libply-splash-core/ply-device-manager.c |
||||
+++ b/src/libply-splash-core/ply-device-manager.c |
||||
@@ -236,60 +236,94 @@ fb_device_has_drm_device (ply_device_manager_t *manager, |
||||
ply_trace ("trying to find associated drm node for fb device (path: %s)", id_path); |
||||
|
||||
udev_enumerate_scan_devices (card_matches); |
||||
|
||||
/* there should only ever be at most one match so we don't iterate through |
||||
* the list, but just look at the first entry */ |
||||
card_entry = udev_enumerate_get_list_entry (card_matches); |
||||
|
||||
if (card_entry != NULL) { |
||||
struct udev_device *card_device = NULL; |
||||
const char *card_node; |
||||
const char *card_path; |
||||
|
||||
card_path = udev_list_entry_get_name (card_entry); |
||||
card_device = udev_device_new_from_syspath (manager->udev_context, card_path); |
||||
card_node = udev_device_get_devnode (card_device); |
||||
if (card_node != NULL && drm_device_in_use (manager, card_node)) |
||||
has_drm_device = true; |
||||
else |
||||
ply_trace ("no card node!"); |
||||
|
||||
udev_device_unref (card_device); |
||||
} else { |
||||
ply_trace ("no card entry!"); |
||||
} |
||||
|
||||
udev_enumerate_unref (card_matches); |
||||
return has_drm_device; |
||||
} |
||||
|
||||
+static bool |
||||
+verify_drm_device (struct udev_device *device) |
||||
+{ |
||||
+ const char *id_path; |
||||
+ |
||||
+ /* |
||||
+ * Simple-framebuffer devices driven by simpledrm lack information |
||||
+ * like panel-rotation info and physical size, causing the splash |
||||
+ * to briefly render on its side / without HiDPI scaling, switching |
||||
+ * to the correct rendering when the native driver loads. |
||||
+ * To avoid this treat simpledrm devices as fbdev devices and only |
||||
+ * use them after the timeout. |
||||
+ */ |
||||
+ id_path = udev_device_get_property_value (device, "ID_PATH"); |
||||
+ if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer")) |
||||
+ return true; /* Not a SimpleDRM device */ |
||||
+ |
||||
+ /* |
||||
+ * With nomodeset, no native drivers will load, so SimpleDRM devices |
||||
+ * should be used immediately. |
||||
+ */ |
||||
+ if (ply_kernel_command_line_has_argument ("nomodeset")) |
||||
+ return true; |
||||
+ |
||||
+ /* |
||||
+ * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM |
||||
+ * use from the cmdline to show something to the user ASAP. |
||||
+ */ |
||||
+ if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) |
||||
+ return true; |
||||
+ |
||||
+ return false; |
||||
+} |
||||
+ |
||||
static bool |
||||
create_devices_for_udev_device (ply_device_manager_t *manager, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *device_path; |
||||
bool created = false; |
||||
|
||||
device_path = udev_device_get_devnode (device); |
||||
|
||||
if (device_path != NULL) { |
||||
const char *subsystem; |
||||
ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE; |
||||
|
||||
subsystem = udev_device_get_subsystem (device); |
||||
ply_trace ("device subsystem is %s", subsystem); |
||||
|
||||
if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
ply_trace ("found DRM device %s", device_path); |
||||
renderer_type = PLY_RENDERER_TYPE_DRM; |
||||
} else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) { |
||||
ply_trace ("found frame buffer device %s", device_path); |
||||
if (!fb_device_has_drm_device (manager, device)) |
||||
renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER; |
||||
else |
||||
ply_trace ("ignoring, since there's a DRM device associated with it"); |
||||
} |
||||
|
||||
if (renderer_type != PLY_RENDERER_TYPE_NONE) { |
||||
ply_terminal_t *terminal = NULL; |
||||
|
||||
@@ -378,94 +412,60 @@ create_devices_for_subsystem (ply_device_manager_t *manager, |
||||
static void |
||||
on_drm_udev_add_or_change (ply_device_manager_t *manager, |
||||
const char *action, |
||||
const char *device_path, |
||||
struct udev_device *device) |
||||
{ |
||||
ply_renderer_t *renderer; |
||||
bool changed; |
||||
|
||||
renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path); |
||||
if (renderer == NULL) { |
||||
/* We also try to create the renderer again on change events, |
||||
* renderer creation fails when no outputs are connected and |
||||
* this may have changed. |
||||
*/ |
||||
create_devices_for_udev_device (manager, device); |
||||
return; |
||||
} |
||||
|
||||
/* Renderer exists, bail if this is not a change event */ |
||||
if (strcmp (action, "change")) |
||||
return; |
||||
|
||||
changed = ply_renderer_handle_change_event (renderer); |
||||
if (changed) { |
||||
free_displays_for_renderer (manager, renderer); |
||||
create_pixel_displays_for_renderer (manager, renderer); |
||||
} |
||||
} |
||||
|
||||
-static bool |
||||
-verify_drm_device (struct udev_device *device) |
||||
-{ |
||||
- const char *id_path; |
||||
- |
||||
- /* |
||||
- * Simple-framebuffer devices driven by simpledrm lack information |
||||
- * like panel-rotation info and physical size, causing the splash |
||||
- * to briefly render on its side / without HiDPI scaling, switching |
||||
- * to the correct rendering when the native driver loads. |
||||
- * To avoid this treat simpledrm devices as fbdev devices and only |
||||
- * use them after the timeout. |
||||
- */ |
||||
- id_path = udev_device_get_property_value (device, "ID_PATH"); |
||||
- if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer")) |
||||
- return true; /* Not a SimpleDRM device */ |
||||
- |
||||
- /* |
||||
- * With nomodeset, no native drivers will load, so SimpleDRM devices |
||||
- * should be used immediately. |
||||
- */ |
||||
- if (ply_kernel_command_line_has_argument ("nomodeset")) |
||||
- return true; |
||||
- |
||||
- /* |
||||
- * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM |
||||
- * use from the cmdline to show something to the user ASAP. |
||||
- */ |
||||
- if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) |
||||
- return true; |
||||
- |
||||
- return false; |
||||
-} |
||||
- |
||||
static bool |
||||
verify_add_or_change (ply_device_manager_t *manager, |
||||
const char *action, |
||||
const char *device_path, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (action, "add") && strcmp (action, "change")) |
||||
return false; |
||||
|
||||
subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
if (manager->local_console_managed && manager->local_console_is_text) { |
||||
ply_trace ("ignoring since we're already using text splash for local console"); |
||||
return false; |
||||
} |
||||
|
||||
if (!verify_drm_device (device)) { |
||||
ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); |
||||
return false; |
||||
} |
||||
} else { |
||||
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
-- |
||||
2.37.0.rc1 |
||||
|
@ -0,0 +1,88 @@
@@ -0,0 +1,88 @@
|
||||
From 5a493ef808b769f4ccc4f3acc1ecf048b8e3efdc Mon Sep 17 00:00:00 2001 |
||||
From: Hans de Goede <hdegoede@redhat.com> |
||||
Date: Mon, 28 Feb 2022 16:20:43 +0100 |
||||
Subject: [PATCH 4/6] ply-device-manager: Remove unnecessary subsystem != NULL |
||||
check |
||||
|
||||
The ply-device-manager.c already assumes that the return value of |
||||
udev_device_get_subsystem () is never NULL in many places, including |
||||
in the condition of the "else if" just below the check which is |
||||
being removed. |
||||
|
||||
Remove the one lonely check for it being NULL for consistency. |
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||
--- |
||||
src/libply-splash-core/ply-device-manager.c | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c |
||||
index 015bd70..6b7ccd6 100644 |
||||
--- a/src/libply-splash-core/ply-device-manager.c |
||||
+++ b/src/libply-splash-core/ply-device-manager.c |
||||
@@ -286,61 +286,61 @@ verify_drm_device (struct udev_device *device) |
||||
*/ |
||||
if (ply_kernel_command_line_has_argument ("nomodeset")) |
||||
return true; |
||||
|
||||
/* |
||||
* Some firmwares leave the panel black at boot. Allow enabling SimpleDRM |
||||
* use from the cmdline to show something to the user ASAP. |
||||
*/ |
||||
if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) |
||||
return true; |
||||
|
||||
return false; |
||||
} |
||||
|
||||
static bool |
||||
create_devices_for_udev_device (ply_device_manager_t *manager, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *device_path; |
||||
bool created = false; |
||||
|
||||
device_path = udev_device_get_devnode (device); |
||||
|
||||
if (device_path != NULL) { |
||||
const char *subsystem; |
||||
ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE; |
||||
|
||||
subsystem = udev_device_get_subsystem (device); |
||||
ply_trace ("device subsystem is %s", subsystem); |
||||
|
||||
- if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
+ if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
ply_trace ("found DRM device %s", device_path); |
||||
renderer_type = PLY_RENDERER_TYPE_DRM; |
||||
} else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) { |
||||
ply_trace ("found frame buffer device %s", device_path); |
||||
if (!fb_device_has_drm_device (manager, device)) |
||||
renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER; |
||||
else |
||||
ply_trace ("ignoring, since there's a DRM device associated with it"); |
||||
} |
||||
|
||||
if (renderer_type != PLY_RENDERER_TYPE_NONE) { |
||||
ply_terminal_t *terminal = NULL; |
||||
|
||||
if (!manager->local_console_managed) { |
||||
terminal = manager->local_console_terminal; |
||||
} |
||||
|
||||
created = create_devices_for_terminal_and_renderer_type (manager, |
||||
device_path, |
||||
terminal, |
||||
renderer_type); |
||||
if (created) { |
||||
if (renderer_type == PLY_RENDERER_TYPE_DRM) |
||||
manager->found_drm_device = 1; |
||||
if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER) |
||||
manager->found_fb_device = 1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
-- |
||||
2.37.0.rc1 |
||||
|
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
From 406376fbe89078678d68392ea76151ecb4f0e30a Mon Sep 17 00:00:00 2001 |
||||
From: Hans de Goede <hdegoede@redhat.com> |
||||
Date: Mon, 28 Feb 2022 16:36:58 +0100 |
||||
Subject: [PATCH 5/6] ply-device-manager: verify_add_or_change(): Move |
||||
local_console_is_text check |
||||
|
||||
Move the local_console_is_text check outside of the |
||||
"if (subsytem == SUBSYSTEM_DRM)" block. |
||||
|
||||
This check is equally relevant for SUBSYSTEM_FRAME_BUFFER. |
||||
|
||||
Note by itself this is a no-op since verify_add_or_change() *always* |
||||
returns false for SUBSYSTEM_FRAME_BUFFER devices. |
||||
|
||||
This is a preparation patch for making verify_add_or_change() not |
||||
return false when manager->device_timeout_elapsed is set. |
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||
--- |
||||
src/libply-splash-core/ply-device-manager.c | 10 +++++----- |
||||
1 file changed, 5 insertions(+), 5 deletions(-) |
||||
|
||||
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c |
||||
index 6b7ccd6..bff4982 100644 |
||||
--- a/src/libply-splash-core/ply-device-manager.c |
||||
+++ b/src/libply-splash-core/ply-device-manager.c |
||||
@@ -423,68 +423,68 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, |
||||
/* We also try to create the renderer again on change events, |
||||
* renderer creation fails when no outputs are connected and |
||||
* this may have changed. |
||||
*/ |
||||
create_devices_for_udev_device (manager, device); |
||||
return; |
||||
} |
||||
|
||||
/* Renderer exists, bail if this is not a change event */ |
||||
if (strcmp (action, "change")) |
||||
return; |
||||
|
||||
changed = ply_renderer_handle_change_event (renderer); |
||||
if (changed) { |
||||
free_displays_for_renderer (manager, renderer); |
||||
create_pixel_displays_for_renderer (manager, renderer); |
||||
} |
||||
} |
||||
|
||||
static bool |
||||
verify_add_or_change (ply_device_manager_t *manager, |
||||
const char *action, |
||||
const char *device_path, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (action, "add") && strcmp (action, "change")) |
||||
return false; |
||||
|
||||
+ if (manager->local_console_managed && manager->local_console_is_text) { |
||||
+ ply_trace ("ignoring since we're already using text splash for local console"); |
||||
+ return false; |
||||
+ } |
||||
+ |
||||
subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
- if (manager->local_console_managed && manager->local_console_is_text) { |
||||
- ply_trace ("ignoring since we're already using text splash for local console"); |
||||
- return false; |
||||
- } |
||||
- |
||||
if (!verify_drm_device (device)) { |
||||
ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); |
||||
return false; |
||||
} |
||||
} else { |
||||
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
static bool |
||||
duplicate_device_path (ply_list_t *events, const char *device_path) |
||||
{ |
||||
struct udev_device *device; |
||||
ply_list_node_t *node; |
||||
|
||||
for (node = ply_list_get_first_node (events); |
||||
node; node = ply_list_get_next_node (events, node)) { |
||||
device = ply_list_node_get_data (node); |
||||
|
||||
if (strcmp (udev_device_get_devnode (device), device_path) == 0) |
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
static void |
||||
-- |
||||
2.37.0.rc1 |
||||
|
@ -0,0 +1,162 @@
@@ -0,0 +1,162 @@
|
||||
From eb40956898e35121525e253305f6d40b45cfbf23 Mon Sep 17 00:00:00 2001 |
||||
From: Hans de Goede <hdegoede@redhat.com> |
||||
Date: Mon, 28 Feb 2022 16:36:58 +0100 |
||||
Subject: [PATCH 6/6] ply-device-manager: verify_add_or_change(): Move |
||||
local_console_is_text check |
||||
|
||||
Move the local_console_is_text check outside of the |
||||
"if (subsytem == SUBSYSTEM_DRM)" block. |
||||
|
||||
This check is equally relevant for SUBSYSTEM_FRAME_BUFFER. |
||||
|
||||
Note by itself this is a no-op since verify_add_or_change() *always* |
||||
returns false for SUBSYSTEM_FRAME_BUFFER devices. |
||||
|
||||
This is a preparation patch for making verify_add_or_change() not |
||||
return false when manager->device_timeout_elapsed is set. |
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
||||
--- |
||||
src/libply-splash-core/ply-device-manager.c | 11 +++++------ |
||||
1 file changed, 5 insertions(+), 6 deletions(-) |
||||
|
||||
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c |
||||
index bff4982..29b26fc 100644 |
||||
--- a/src/libply-splash-core/ply-device-manager.c |
||||
+++ b/src/libply-splash-core/ply-device-manager.c |
||||
@@ -287,60 +287,64 @@ verify_drm_device (struct udev_device *device) |
||||
if (ply_kernel_command_line_has_argument ("nomodeset")) |
||||
return true; |
||||
|
||||
/* |
||||
* Some firmwares leave the panel black at boot. Allow enabling SimpleDRM |
||||
* use from the cmdline to show something to the user ASAP. |
||||
*/ |
||||
if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) |
||||
return true; |
||||
|
||||
return false; |
||||
} |
||||
|
||||
static bool |
||||
create_devices_for_udev_device (ply_device_manager_t *manager, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *device_path; |
||||
bool created = false; |
||||
|
||||
device_path = udev_device_get_devnode (device); |
||||
|
||||
if (device_path != NULL) { |
||||
const char *subsystem; |
||||
ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE; |
||||
|
||||
subsystem = udev_device_get_subsystem (device); |
||||
ply_trace ("device subsystem is %s", subsystem); |
||||
|
||||
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
+ if (!manager->device_timeout_elapsed && !verify_drm_device (device)) { |
||||
+ ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); |
||||
+ return false; |
||||
+ } |
||||
ply_trace ("found DRM device %s", device_path); |
||||
renderer_type = PLY_RENDERER_TYPE_DRM; |
||||
} else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) { |
||||
ply_trace ("found frame buffer device %s", device_path); |
||||
if (!fb_device_has_drm_device (manager, device)) |
||||
renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER; |
||||
else |
||||
ply_trace ("ignoring, since there's a DRM device associated with it"); |
||||
} |
||||
|
||||
if (renderer_type != PLY_RENDERER_TYPE_NONE) { |
||||
ply_terminal_t *terminal = NULL; |
||||
|
||||
if (!manager->local_console_managed) { |
||||
terminal = manager->local_console_terminal; |
||||
} |
||||
|
||||
created = create_devices_for_terminal_and_renderer_type (manager, |
||||
device_path, |
||||
terminal, |
||||
renderer_type); |
||||
if (created) { |
||||
if (renderer_type == PLY_RENDERER_TYPE_DRM) |
||||
manager->found_drm_device = 1; |
||||
if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER) |
||||
manager->found_fb_device = 1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@@ -430,66 +434,61 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, |
||||
|
||||
/* Renderer exists, bail if this is not a change event */ |
||||
if (strcmp (action, "change")) |
||||
return; |
||||
|
||||
changed = ply_renderer_handle_change_event (renderer); |
||||
if (changed) { |
||||
free_displays_for_renderer (manager, renderer); |
||||
create_pixel_displays_for_renderer (manager, renderer); |
||||
} |
||||
} |
||||
|
||||
static bool |
||||
verify_add_or_change (ply_device_manager_t *manager, |
||||
const char *action, |
||||
const char *device_path, |
||||
struct udev_device *device) |
||||
{ |
||||
const char *subsystem = udev_device_get_subsystem (device); |
||||
|
||||
if (strcmp (action, "add") && strcmp (action, "change")) |
||||
return false; |
||||
|
||||
if (manager->local_console_managed && manager->local_console_is_text) { |
||||
ply_trace ("ignoring since we're already using text splash for local console"); |
||||
return false; |
||||
} |
||||
|
||||
subsystem = udev_device_get_subsystem (device); |
||||
|
||||
- if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) { |
||||
- if (!verify_drm_device (device)) { |
||||
- ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); |
||||
- return false; |
||||
- } |
||||
- } else { |
||||
+ if (strcmp (subsystem, SUBSYSTEM_DRM)) { |
||||
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
static bool |
||||
duplicate_device_path (ply_list_t *events, const char *device_path) |
||||
{ |
||||
struct udev_device *device; |
||||
ply_list_node_t *node; |
||||
|
||||
for (node = ply_list_get_first_node (events); |
||||
node; node = ply_list_get_next_node (events, node)) { |
||||
device = ply_list_node_get_data (node); |
||||
|
||||
if (strcmp (udev_device_get_devnode (device), device_path) == 0) |
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
static void |
||||
process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events) |
||||
{ |
||||
const char *action, *device_path; |
||||
struct udev_device *device; |
||||
ply_list_node_t *node; |
||||
-- |
||||
2.37.0.rc1 |
||||
|
Loading…
Reference in new issue