From 475ff0fcba57f19b5713500ced58bbeef11bb4c2 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 May 2019 17:54:05 +0200 Subject: [PATCH 1/5] drm: Fix tiled mode detection The TILE property is present on all connectors which are DisplayPort MST (Multi-Stream) outputs, independent if they are connected to a tiled display are not. Starting with the 5.2 kernel, it is actually present on almost all outputs. Rather then just checking if the property is present, check that if it is present it has a valid (non zero) blob-id assigned to it, this fixes us mis-identifying DP MST outputs as always being tiled. Which in turn fixes us failing to pick the preferred mode on these outputs. Signed-off-by: Hans de Goede --- src/plugins/renderers/drm/plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 88c9d97..7ddd9c5 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -459,7 +459,8 @@ ply_renderer_connector_get_rotation_and_tiled (ply_renderer_backend_t *back output->rotation = connector_orientation_prop_to_rotation (prop, connector->prop_values[i]); if ((prop->flags & DRM_MODE_PROP_BLOB) && - strcmp (prop->name, "TILE") == 0) + strcmp (prop->name, "TILE") == 0 && + connector->prop_values[i] != 0) output->tiled = true; if ((prop->flags & DRM_MODE_PROP_ENUM) && -- 2.21.0 From cd4a6010942c6765f5659a2eb88686121db4ccd8 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 25 Mar 2019 09:39:24 +0000 Subject: [PATCH 2/5] Add a new firmware-upgrade mode for use by fwupd This allows us to have accurate localised text, and also to use the vendor BIOS logo when applying firmware updates. --- src/client/plymouth.c | 6 ++++++ src/libply-splash-core/ply-boot-splash-plugin.h | 3 ++- src/main.c | 7 +++++++ src/plugins/splash/script/script-lib-plymouth.c | 3 +++ src/plugins/splash/throbgress/plugin.c | 6 ++++-- src/plugins/splash/two-step/plugin.c | 8 ++++++-- themes/bgrt/bgrt.plymouth.in | 8 ++++++++ themes/spinner/spinner.plymouth.in | 8 ++++++++ 8 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/client/plymouth.c b/src/client/plymouth.c index a11753a..be74ae7 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -787,6 +787,7 @@ on_change_mode_request (state_t *state, bool reboot = false; bool updates = false; bool system_upgrade = false; + bool firmware_upgrade = false; const char *mode = NULL; ply_command_parser_get_command_options (state->command_parser, @@ -796,6 +797,7 @@ on_change_mode_request (state_t *state, "reboot", &reboot, "updates", &updates, "system-upgrade", &system_upgrade, + "firmware-upgrade", &firmware_upgrade, NULL); if (boot_up) @@ -808,6 +810,8 @@ on_change_mode_request (state_t *state, mode = "updates"; else if (system_upgrade) mode = "system-upgrade"; + else if (firmware_upgrade) + mode = "firmware-upgrade"; if (mode) { ply_boot_client_change_mode (state->client, mode, @@ -901,6 +905,8 @@ main (int argc, PLY_COMMAND_OPTION_TYPE_FLAG, "system-upgrade", "Upgrading the OS to a new version", PLY_COMMAND_OPTION_TYPE_FLAG, + "firmware-upgrade", "Upgrading firmware to a new version", + PLY_COMMAND_OPTION_TYPE_FLAG, NULL); ply_command_parser_add_command (state.command_parser, diff --git a/src/libply-splash-core/ply-boot-splash-plugin.h b/src/libply-splash-core/ply-boot-splash-plugin.h index 3fa56ce..227147f 100644 --- a/src/libply-splash-core/ply-boot-splash-plugin.h +++ b/src/libply-splash-core/ply-boot-splash-plugin.h @@ -41,8 +41,9 @@ typedef enum PLY_BOOT_SPLASH_MODE_REBOOT, PLY_BOOT_SPLASH_MODE_UPDATES, PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE, + PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE, PLY_BOOT_SPLASH_MODE_INVALID, - PLY_BOOT_SPLASH_MODE_COUNT = PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE + 1, + PLY_BOOT_SPLASH_MODE_COUNT = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE + 1, } ply_boot_splash_mode_t; typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t; diff --git a/src/main.c b/src/main.c index a6f0b01..2f04e11 100644 --- a/src/main.c +++ b/src/main.c @@ -206,6 +206,8 @@ on_change_mode (state_t *state, state->mode = PLY_BOOT_SPLASH_MODE_UPDATES; else if (strcmp (mode, "system-upgrade") == 0) state->mode = PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE; + else if (strcmp (mode, "firmware-upgrade") == 0) + state->mode = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE; else return; @@ -675,6 +677,7 @@ get_cache_file_for_mode (ply_boot_splash_mode_t mode) break; case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: filename = NULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -704,6 +707,7 @@ get_log_file_for_state (state_t *state) case PLY_BOOT_SPLASH_MODE_REBOOT: case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: filename = _PATH_DEVNULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -730,6 +734,7 @@ get_log_spool_file_for_mode (ply_boot_splash_mode_t mode) case PLY_BOOT_SPLASH_MODE_REBOOT: case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: filename = NULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -2149,6 +2154,8 @@ main (int argc, state.mode = PLY_BOOT_SPLASH_MODE_UPDATES; else if (strcmp (mode_string, "system-upgrade") == 0) state.mode = PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE; + else if (strcmp (mode_string, "firmware-upgrade") == 0) + state.mode = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE; else state.mode = PLY_BOOT_SPLASH_MODE_BOOT_UP; diff --git a/src/plugins/splash/script/script-lib-plymouth.c b/src/plugins/splash/script/script-lib-plymouth.c index ca7ad77..d578223 100644 --- a/src/plugins/splash/script/script-lib-plymouth.c +++ b/src/plugins/splash/script/script-lib-plymouth.c @@ -79,6 +79,9 @@ static script_return_t plymouth_get_mode (script_state_t *state, case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: obj = script_obj_new_string ("system-upgrade"); break; + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: + obj = script_obj_new_string ("firmware-upgrade"); + break; case PLY_BOOT_SPLASH_MODE_INVALID: default: obj = script_obj_new_string ("unknown"); diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c index 3982821..86be064 100644 --- a/src/plugins/splash/throbgress/plugin.c +++ b/src/plugins/splash/throbgress/plugin.c @@ -723,7 +723,8 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin, double total_duration; if (plugin->mode == PLY_BOOT_SPLASH_MODE_UPDATES || - plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE || + plugin->mode == PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; total_duration = duration / percent_done; @@ -935,7 +936,8 @@ system_update (ply_boot_splash_plugin_t *plugin, ply_list_node_t *node; if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES && - plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE && + plugin->mode != PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; node = ply_list_get_first_node (plugin->views); diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index e8b91ec..caf03fc 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -253,6 +253,7 @@ view_load_end_animation (view_t *view) case PLY_BOOT_SPLASH_MODE_BOOT_UP: case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: animation_prefix = "startup-animation-"; break; case PLY_BOOT_SPLASH_MODE_SHUTDOWN: @@ -1006,6 +1007,7 @@ create_plugin (ply_key_file_t *key_file) load_mode_settings (plugin, key_file, "reboot", PLY_BOOT_SPLASH_MODE_REBOOT); load_mode_settings (plugin, key_file, "updates", PLY_BOOT_SPLASH_MODE_UPDATES); load_mode_settings (plugin, key_file, "system-upgrade", PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE); + load_mode_settings (plugin, key_file, "firmware-upgrade", PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE); if (plugin->use_firmware_background) plugin->background_bgrt_image = ply_image_new ("/sys/firmware/acpi/bgrt/image"); @@ -1583,7 +1585,8 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin, double percent_done) { if (plugin->mode == PLY_BOOT_SPLASH_MODE_UPDATES || - plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE || + plugin->mode == PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL) @@ -1791,7 +1794,8 @@ system_update (ply_boot_splash_plugin_t *plugin, char buf[64]; if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES && - plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE && + plugin->mode != PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; node = ply_list_get_first_node (plugin->views); diff --git a/themes/bgrt/bgrt.plymouth.in b/themes/bgrt/bgrt.plymouth.in index 39bfdc5..ac07bc9 100644 --- a/themes/bgrt/bgrt.plymouth.in +++ b/themes/bgrt/bgrt.plymouth.in @@ -46,3 +46,11 @@ ProgressBarShowPercentComplete=true UseProgressBar=true _Title=Upgrading System... _SubTitle=Do not turn off your computer + +[firmware-upgrade] +SuppressMessages=true +ProgressBarShowPercentComplete=true +UseProgressBar=true +UseFirmwareBackground=true +_Title=Upgrading Firmware... +_SubTitle=Do not turn off your computer diff --git a/themes/spinner/spinner.plymouth.in b/themes/spinner/spinner.plymouth.in index 5c0b297..5e5078e 100644 --- a/themes/spinner/spinner.plymouth.in +++ b/themes/spinner/spinner.plymouth.in @@ -36,3 +36,11 @@ ProgressBarShowPercentComplete=true UseProgressBar=true _Title=Upgrading System... _SubTitle=Do not turn off your computer + +[firmware-upgrade] +SuppressMessages=true +ProgressBarShowPercentComplete=true +UseProgressBar=true +UseFirmwareBackground=true +_Title=Upgrading Firmware... +_SubTitle=Do not turn off your computer -- 2.21.0 From 97a3d7b422c88fb0e874331b7948daa332d7e78d Mon Sep 17 00:00:00 2001 From: ZhaoQiang Date: Sun, 2 Jun 2019 19:52:58 +0000 Subject: [PATCH 3/5] ply-text-display.c: Correct vi format line make vi can directly edit this file without errors and make it use 8 space tabs etc. --- src/libply-splash-core/ply-text-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libply-splash-core/ply-text-display.c b/src/libply-splash-core/ply-text-display.c index 83bf602..7bf6e06 100644 --- a/src/libply-splash-core/ply-text-display.c +++ b/src/libply-splash-core/ply-text-display.c @@ -333,4 +333,4 @@ ply_text_display_get_terminal (ply_text_display_t *display) return display->terminal; } -/* vim: set ts= 4 sw= 4 et ai ci cino= {.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ -- 2.21.0 From 88f6bac356fdc6df130516fe30537a8fecba0c90 Mon Sep 17 00:00:00 2001 From: ZhaoQiang Date: Wed, 5 Jun 2019 10:42:24 +0000 Subject: [PATCH 4/5] Unify all code's vi format control. Update several file's vi format control line to make it easy to maintain. --- src/libply-splash-core/ply-keyboard.c | 2 +- src/libply-splash-core/ply-keyboard.h | 3 ++- src/libply-splash-core/ply-pixel-buffer.c | 2 +- src/libply-splash-core/ply-pixel-display.c | 2 +- src/libply-splash-core/ply-pixel-display.h | 3 ++- src/libply-splash-core/ply-terminal.c | 2 +- src/libply-splash-core/ply-terminal.h | 3 ++- src/libply-splash-core/ply-text-display.h | 3 ++- src/main.c | 2 +- src/plugins/renderers/drm/plugin.c | 3 ++- src/plugins/renderers/frame-buffer/plugin.c | 3 ++- src/plugins/renderers/x11/plugin.c | 2 +- src/plugins/splash/two-step/plugin.c | 2 +- 13 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/libply-splash-core/ply-keyboard.c b/src/libply-splash-core/ply-keyboard.c index 27395e0..b174261 100644 --- a/src/libply-splash-core/ply-keyboard.c +++ b/src/libply-splash-core/ply-keyboard.c @@ -603,4 +603,4 @@ ply_keyboard_get_renderer (ply_keyboard_t *keyboard) 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 */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-keyboard.h b/src/libply-splash-core/ply-keyboard.h index dd428c0..008a804 100644 --- a/src/libply-splash-core/ply-keyboard.h +++ b/src/libply-splash-core/ply-keyboard.h @@ -77,4 +77,5 @@ ply_renderer_t *ply_keyboard_get_renderer (ply_keyboard_t *keyboard); #endif #endif /* PLY_KEYBOARD_H */ -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ + +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c index 51f9c4d..aa4b344 100644 --- a/src/libply-splash-core/ply-pixel-buffer.c +++ b/src/libply-splash-core/ply-pixel-buffer.c @@ -1140,4 +1140,4 @@ ply_pixel_buffer_rotate_upright (ply_pixel_buffer_t *old_buffer) return buffer; } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-pixel-display.c b/src/libply-splash-core/ply-pixel-display.c index dc088bb..8ef93b1 100644 --- a/src/libply-splash-core/ply-pixel-display.c +++ b/src/libply-splash-core/ply-pixel-display.c @@ -189,4 +189,4 @@ ply_pixel_display_set_draw_handler (ply_pixel_display_t *display, display->draw_handler_user_data = user_data; } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-pixel-display.h b/src/libply-splash-core/ply-pixel-display.h index a57b9a9..a5cfd88 100644 --- a/src/libply-splash-core/ply-pixel-display.h +++ b/src/libply-splash-core/ply-pixel-display.h @@ -69,4 +69,5 @@ void ply_pixel_display_unpause_updates (ply_pixel_display_t *display); #endif #endif /* PLY_PIXEL_DISPLAY_H */ -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ + +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c index f3b32fe..0190f9e 100644 --- a/src/libply-splash-core/ply-terminal.c +++ b/src/libply-splash-core/ply-terminal.c @@ -1049,4 +1049,4 @@ ply_terminal_stop_watching_for_input (ply_terminal_t *terminal, } } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-terminal.h b/src/libply-splash-core/ply-terminal.h index 7cfcc59..620ee9e 100644 --- a/src/libply-splash-core/ply-terminal.h +++ b/src/libply-splash-core/ply-terminal.h @@ -117,4 +117,5 @@ void ply_terminal_stop_watching_for_input (ply_terminal_t *terminal #endif #endif /* PLY_TERMINAL_H */ -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ + +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply-splash-core/ply-text-display.h b/src/libply-splash-core/ply-text-display.h index 4a56aba..774dd4d 100644 --- a/src/libply-splash-core/ply-text-display.h +++ b/src/libply-splash-core/ply-text-display.h @@ -86,4 +86,5 @@ void ply_text_display_unpause_updates (ply_text_display_t *display); #endif #endif /* PLY_TEXT_DISPLAY_H */ -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ + +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/main.c b/src/main.c index 2f04e11..6fceb20 100644 --- a/src/main.c +++ b/src/main.c @@ -2308,4 +2308,4 @@ main (int argc, return exit_code; } -/* vim: set sts=4 ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +/* vim: set ts=4 ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 7ddd9c5..d9d5c37 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -1824,4 +1824,5 @@ ply_renderer_backend_get_interface (void) return &plugin_interface; } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ + +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/plugins/renderers/frame-buffer/plugin.c b/src/plugins/renderers/frame-buffer/plugin.c index b4050c5..065e484 100644 --- a/src/plugins/renderers/frame-buffer/plugin.c +++ b/src/plugins/renderers/frame-buffer/plugin.c @@ -744,4 +744,5 @@ ply_renderer_backend_get_interface (void) return &plugin_interface; } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ + +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/plugins/renderers/x11/plugin.c b/src/plugins/renderers/x11/plugin.c index 76addda..7d2a730 100644 --- a/src/plugins/renderers/x11/plugin.c +++ b/src/plugins/renderers/x11/plugin.c @@ -552,4 +552,4 @@ ply_renderer_backend_get_interface (void) return &plugin_interface; } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index caf03fc..434bcf2 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -1892,4 +1892,4 @@ ply_boot_splash_plugin_get_interface (void) return &plugin_interface; } -/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */ +/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ -- 2.21.0 From 2449ea52006238f6d0e61bae2f0630e02bedc5e6 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 24 May 2019 22:49:15 +0200 Subject: [PATCH 5/5] two-step: Add support for firmware-splashes with rotation status bits set Before the ACPI 6.2 specification, the BGRT table did not contain any rotation information, so to make sure that the firmware-splash showed the right way up the firmware would contain a pre-rotated image and our BGRT / firmware-splash loading code assumed this is alwast true. Starting with ACPI 6.2 tge bgrt status fields has 2 bits to tell the firmware the image needs to be rotated before being displayed. If these bits are set then the firmwares-splash is not pre-rotated and we must handle it differently. This commit adds support for reading the new rotation bits from the sysfs bgrt/status file and adds handling for the case where the bits indicate that the image is not pre-rotated. Signed-off-by: Hans de Goede --- src/plugins/splash/two-step/plugin.c | 84 ++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 434bcf2..795bded 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -73,6 +73,12 @@ #define PROGRESS_BAR_WIDTH 400 #define PROGRESS_BAR_HEIGHT 5 +#define BGRT_STATUS_ORIENTATION_OFFSET_0 (0 << 1) +#define BGRT_STATUS_ORIENTATION_OFFSET_90 (1 << 1) +#define BGRT_STATUS_ORIENTATION_OFFSET_180 (2 << 1) +#define BGRT_STATUS_ORIENTATION_OFFSET_270 (3 << 1) +#define BGRT_STATUS_ORIENTATION_OFFSET_MASK (3 << 1) + typedef enum { PLY_BOOT_SPLASH_DISPLAY_NORMAL, @@ -298,12 +304,41 @@ view_load_end_animation (view_t *view) } static bool -get_bgrt_sysfs_offsets(int *x_offset, int *y_offset) +get_bgrt_sysfs_info(int *x_offset, int *y_offset, + ply_pixel_buffer_rotation_t *rotation) { bool ret = false; char buf[64]; + int status; FILE *f; + f = fopen("/sys/firmware/acpi/bgrt/status", "r"); + if (!f) + return false; + + if (!fgets(buf, sizeof(buf), f)) + goto out; + + if (sscanf(buf, "%d", &status) != 1) + goto out; + + fclose(f); + + switch (status & BGRT_STATUS_ORIENTATION_OFFSET_MASK) { + case BGRT_STATUS_ORIENTATION_OFFSET_0: + *rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; + break; + case BGRT_STATUS_ORIENTATION_OFFSET_90: + *rotation = PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE; + break; + case BGRT_STATUS_ORIENTATION_OFFSET_180: + *rotation = PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN; + break; + case BGRT_STATUS_ORIENTATION_OFFSET_270: + *rotation = PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE; + break; + } + f = fopen("/sys/firmware/acpi/bgrt/xoffset", "r"); if (!f) return false; @@ -347,23 +382,61 @@ static void view_set_bgrt_background (view_t *view) { ply_pixel_buffer_rotation_t panel_rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; + ply_pixel_buffer_rotation_t bgrt_rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; int x_offset, y_offset, sysfs_x_offset, sysfs_y_offset, width, height; int panel_width = 0, panel_height = 0, panel_scale = 1; int screen_width, screen_height, screen_scale; ply_pixel_buffer_t *bgrt_buffer; + bool have_panel_props; if (!view->plugin->background_bgrt_image) return; + if (!get_bgrt_sysfs_info(&sysfs_x_offset, &sysfs_y_offset, + &bgrt_rotation)) { + ply_trace ("get bgrt sysfs info failed"); + return; + } + screen_width = ply_pixel_display_get_width (view->display); screen_height = ply_pixel_display_get_height (view->display); screen_scale = ply_pixel_display_get_device_scale (view->display); bgrt_buffer = ply_image_get_buffer (view->plugin->background_bgrt_image); - if (ply_renderer_get_panel_properties (ply_pixel_display_get_renderer (view->display), - &panel_width, &panel_height, - &panel_rotation, &panel_scale)) { + have_panel_props = ply_renderer_get_panel_properties (ply_pixel_display_get_renderer (view->display), + &panel_width, &panel_height, + &panel_rotation, &panel_scale); + + /* + * Before the ACPI 6.2 specification, the BGRT table did not contain + * any rotation information, so to make sure that the firmware-splash + * showed the right way up the firmware would contain a pre-rotated + * image. Starting with ACPI 6.2 the bgrt status fields has 2 bits + * to tell the firmware the image needs to be rotated before being + * displayed. + * If these bits are set then the firmwares-splash is not pre-rotated, + * in this case we must not rotate it when rendering and when doing + * comparisons with the panel-size we must use the post rotation + * panel-size. + */ + if (bgrt_rotation != PLY_PIXEL_BUFFER_ROTATE_UPRIGHT) { + if (bgrt_rotation != panel_rotation) { + ply_trace ("bgrt orientation mismatch, bgrt_rot %d panel_rot %d", (int)bgrt_rotation, (int)panel_rotation); + return; + } + + /* Set panel properties to their post-rotations values */ + if (panel_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE || + panel_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) { + int temp = panel_width; + panel_width = panel_height; + panel_height = temp; + } + panel_rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT; + } + + if (have_panel_props) { /* Upside-down panels are fixed up in HW by the GOP, so the * bgrt image is not rotated in this case. */ @@ -396,8 +469,7 @@ view_set_bgrt_background (view_t *view) * panel's native resolution and then we correct for any difference * between the (external) screen's and the panel's resolution. */ - if (panel_width != 0 && panel_height != 0 && - get_bgrt_sysfs_offsets(&sysfs_x_offset, &sysfs_y_offset) && + if (have_panel_props && (panel_width - view->plugin->background_bgrt_raw_width) / 2 == sysfs_x_offset) { if (panel_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE || panel_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) { -- 2.21.0 From aac0f839ec120fdd4dadd198709216f313bb0ac0 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 18 Jul 2019 17:51:54 +0200 Subject: [PATCH] two-step: Deal with buggy firmware which does not pre-rotate the bgrt image Some buggy Lenovo 2-in-1s with a 90 degree rotated panel, behave as if the panel is mounted up-right / not rotated at all. These devices have a buggy efifb size (landscape resolution instead of the actual portrait resolution of the panel), this gets fixed-up by the kernel. These buggy devices also do not pre-rotate the bgrt_image nor do they set the ACPI-6.2 rotation status-bits. We can detect this by checking that the bgrt_image is perfectly centered horizontally when we use the panel's height as the width. This commit uses this check to override the bgrt-rotation read from the ACPI-6.2 rotation status-bits, fixing us displaying the bgrt image with the wrong rotation. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1730783 Signed-off-by: Hans de Goede --- src/plugins/splash/two-step/plugin.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 795bded..2e596d5 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -408,6 +408,23 @@ view_set_bgrt_background (view_t *view) &panel_width, &panel_height, &panel_rotation, &panel_scale); + /* + * Some buggy Lenovo 2-in-1s with a 90 degree rotated panel, behave as + * if the panel is mounted up-right / not rotated at all. These devices + * have a buggy efifb size (landscape resolution instead of the actual + * portrait resolution of the panel), this gets fixed-up by the kernel. + * These buggy devices also do not pre-rotate the bgrt_image nor do + * they set the ACPI-6.2 rotation status-bits. We can detect this by + * checking that the bgrt_image is perfectly centered horizontally + * when we use the panel's height as the width. + */ + if (have_panel_props && + (panel_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE || + panel_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) && + (panel_width - view->plugin->background_bgrt_raw_width) / 2 != sysfs_x_offset && + (panel_height - view->plugin->background_bgrt_raw_width) / 2 == sysfs_x_offset) + bgrt_rotation = panel_rotation; + /* * Before the ACPI 6.2 specification, the BGRT table did not contain * any rotation information, so to make sure that the firmware-splash -- 2.21.0 From 4b3be154867ddfc3315a39e57d23a374142c7d2f Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 25 Aug 2019 18:01:59 +0200 Subject: [PATCH 1/3] two-step: bgrt: Add workaround for desktops which do not use the golden ratio On desktops (no panel) we normally do not use the BGRT provided xoffset and yoffset because the resolution they are intended for may be differtent then the resolution of the current display. On some desktops (no panel) the image gets centered not only horizontally, but also vertically. In this case our default of using the golden ratio for the vertical position causes the BGRT image to jump. To avoid this this commits adds an extra check to see if the provided xoffset and yoffset perfectly center the image and in that case uses them. An example of a system needing this workaround is the Minix Neo Z83-4. Signed-off-by: Hans de Goede --- src/plugins/splash/two-step/plugin.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 2e596d5..b5ef926 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -506,6 +506,24 @@ view_set_bgrt_background (view_t *view) } } + /* + * On desktops (no panel) we normally do not use the BGRT provided + * xoffset and yoffset because the resolution they are intended for + * may be differtent then the resolution of the current display. + * + * On some desktops (no panel) the image gets centered not only + * horizontally, but also vertically. In this case our default of using + * the golden ratio for the vertical position causes the BGRT image + * to jump. To avoid this we check here if the provided xoffset and + * yoffset perfectly center the image and in that case we use them. + */ + if (!have_panel_props && screen_scale == 1 && + (screen_width - width ) / 2 == sysfs_x_offset && + (screen_height - height) / 2 == sysfs_y_offset) { + x_offset = sysfs_x_offset; + y_offset = sysfs_y_offset; + } + ply_trace ("using %dx%d bgrt image centered at %dx%d for %dx%d screen", width, height, x_offset, y_offset, screen_width, screen_height); -- 2.23.0 From 7bd45c782eb7a76005ab7f92de4b51fc2ecb8068 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Sep 2019 17:21:45 +0200 Subject: [PATCH 2/3] ply-device-manager: De-activate and close renderer on device hot unplug When a device gets hot unplugged, we should de-activate and close the renderer before freeing it. Speficially this fixes a problem where plymout's display "freezes" when used with AMD GPUs which can be handled by both the radeon or the amdgpu kms driver and the user has added kernel commandline options to prefer the amdgpu driver. In this case the following happens: 1) radeon driver gets loaded, creates /dev/dri/card0 generating a udev "add /dev/dri/card0" event. 2) radeon driver's "load" method checks if it should bind, comes to the conclusion it should not, causing the probe of the device to be aborted and /dev/dri/card0 to be unregistered generating a udev "remove /dev/dri/card0" event 3) amdgpu driver loads, creates /dev/dri/card0 generating another udev "add /dev/dri/card0" event. 4) plymouth loads while udev is still catching up with kernel events, plymouth sees the first "add" event opens /dev/dri/card0 (which is already managed by amdgpu at this time) finds outputs, shows splash 5) plymouth gets the "remove" events tears down the renderer, but since deactivate and close were not called before this commit, plymouth keeps the master rights attached to the old-fd which is leaked at this point 6) plymouth gets the second "add" event brings everything back up, but it cannot get master rights, since there can only be 1 master and the leaked fd is the master. This leads to lots of: "Couldn't set scan out buffer" errors and plymouth appears frozen because of this, this is esp. bad with the disk encryption unlock screen 7) When gdm starts, it deactivates plymouth, but does not yet tell it to quit to avoid flickering. The deactivate makes plymouth drop its master rights, but this happens on the new broken fd which never got the master rights. This also makes it impossible for gdm to get master rights, also breaking gdm, with the following error in the logs: "(EE) wl_drm@4: error 0: authenicate failed" Note in theory calling ply_renderer_close() on teardown (from ply_device_manager_free()) should be fine too, but for some reason this causes the framebuffer to be all messed up (looks like wrong pitch / tiling) when this is done after gdm has taken over the framebuffer. Where as just exiting without calling drmModeRmFB, letting the kernel clean up behind us, does not trigger this. This feels like it is a kernel bug bug and I will file a bug for this. But for now we should not call ply_renderer_close() on teardown to avoid this issue (which would be a regression). BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490 Signed-off-by: Hans de Goede --- src/libply-splash-core/ply-device-manager.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c index e2a9eae..160b8cb 100644 --- a/src/libply-splash-core/ply-device-manager.c +++ b/src/libply-splash-core/ply-device-manager.c @@ -169,7 +169,8 @@ free_keyboards_for_renderer (ply_device_manager_t *manager, static void free_devices_from_device_path (ply_device_manager_t *manager, - const char *device_path) + const char *device_path, + bool close) { void *key = NULL; void *renderer = NULL; @@ -187,6 +188,13 @@ free_devices_from_device_path (ply_device_manager_t *manager, ply_hashtable_remove (manager->renderers, (void *) device_path); free (key); + + if (manager->renderers_activated) + ply_renderer_deactivate (renderer); + + if (close) + ply_renderer_close (renderer); + ply_renderer_free (renderer); } @@ -309,7 +317,7 @@ free_devices_for_udev_device (ply_device_manager_t *manager, device_path = udev_device_get_devnode (device); if (device_path != NULL) - free_devices_from_device_path (manager, device_path); + free_devices_from_device_path (manager, device_path, true); } static bool @@ -557,7 +565,7 @@ free_renderer (char *device_path, ply_renderer_t *renderer, ply_device_manager_t *manager) { - free_devices_from_device_path (manager, device_path); + free_devices_from_device_path (manager, device_path, false); } static void -- 2.23.0 From 443415375a58f2f58af9991a55a8f4aaff83a7c9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Sep 2019 17:40:06 +0200 Subject: [PATCH 3/3] plymouthd.defaults: Bump default DeviceTimeout to 8 seconds The amdgpu driver needs up to 5 seconds to initialize / boot some AMD GPUs, which makes our 5 second timeout much too close to the actual needed time, leading to systems where sometimes the boot is fine and the next boot we fallback to a text based splash because we won the race from the GPU probe code. This commit bumps the default DeviceTimeout to 8 seconds giving us a decent marging here without making it overly long. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1737221 Signed-off-by: Hans de Goede --- src/plymouthd.defaults | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plymouthd.defaults b/src/plymouthd.defaults index 9e3a342..7f247fd 100644 --- a/src/plymouthd.defaults +++ b/src/plymouthd.defaults @@ -3,4 +3,4 @@ [Daemon] Theme=spinner ShowDelay=0 -DeviceTimeout=5 +DeviceTimeout=8 -- 2.23.0