diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c index bb548ef8..82b89f35 100644 --- a/src/libply-splash-core/ply-device-manager.c +++ b/src/libply-splash-core/ply-device-manager.c @@ -405,6 +405,40 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, } } +static bool +verify_drm_device (struct udev_device *device) +{ + const char *id_path; + + /* + * Simple-framebuffer devices driven by simpledrm lack information + * like panel-rotation info and physical size, causing the splash + * to briefly render on its side / without HiDPI scaling, switching + * to the correct rendering when the native driver loads. + * To avoid this treat simpledrm devices as fbdev devices and only + * use them after the timeout. + */ + id_path = udev_device_get_property_value (device, "ID_PATH"); + if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer")) + return true; /* Not a SimpleDRM device */ + + /* + * With nomodeset, no native drivers will load, so SimpleDRM devices + * should be used immediately. + */ + if (ply_kernel_command_line_has_argument ("nomodeset")) + return true; + + /* + * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM + * use from the cmdline to show something to the user ASAP. + */ + if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm")) + return true; + + return false; +} + static bool verify_add_or_change (ply_device_manager_t *manager, const char *action, @@ -423,6 +457,11 @@ verify_add_or_change (ply_device_manager_t *manager, ply_trace ("ignoring since we're already using text splash for local console"); return false; } + + if (!verify_drm_device (device)) { + ply_trace ("ignoring since we only handle SimpleDRM devices after timeout"); + return false; + } } else { ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem); return false; diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c index f90ac40a..f457579c 100644 --- a/src/libply/ply-utils.c +++ b/src/libply/ply-utils.c @@ -459,6 +459,15 @@ ply_free_string_array (char **array) 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) { diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h index 47bb3f24..7572cca2 100644 --- a/src/libply/ply-utils.h +++ b/src/libply/ply-utils.h @@ -85,6 +85,7 @@ 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);