plymouth/plymouth-more-updates.patch
2019-07-19 11:48:32 +02:00

673 lines
30 KiB
Diff

From 475ff0fcba57f19b5713500ced58bbeef11bb4c2 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
---
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 <richard@hughsie.com>
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 <zhaoqiangx@gmail.com>
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 <zhaoqiangx@gmail.com>
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 <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
---
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 <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
---
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