All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] EFI: console: Do not set colorstate until the first text output
@ 2022-01-28 11:43 Hans de Goede
  2022-01-28 11:43 ` [PATCH 2/2] EFI: console: Do not set cursor " Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Hans de Goede @ 2022-01-28 11:43 UTC (permalink / raw)
  To: grub-devel; +Cc: Robbie Harwood, Hans de Goede, Javier Martinez Canillas

GRUB_MOD_INIT(normal) does an unconditional:

grub_env_set ("color_normal", "light-gray/black");

which triggers a grub_term_setcolorstate() call. The original version
of the "efi/console: Do not set text-mode until we actually need it" patch:
https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00125.html

Protected against this by caching the requested state in
grub_console_setcolorstate () and then only applying it when the first
text output actually happens. During refactoring to move the
grub_console_setcolorstate () up higher in the grub-core/term/efi/console.c
file the code to cache the color-state + bail early was accidentally
dropped.

Restore the cache the color-state + bail early behavior from the original.

Cc: Javier Martinez Canillas <javierm@redhat.com>
Fixes: 2d7c3abd871f ("efi/console: Do not set text-mode until we actually need it")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 grub-core/term/efi/console.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
index 2f1ae85ba..c44b2ac31 100644
--- a/grub-core/term/efi/console.c
+++ b/grub-core/term/efi/console.c
@@ -82,6 +82,16 @@ grub_console_setcolorstate (struct grub_term_output *term
 {
   grub_efi_simple_text_output_interface_t *o;
 
+  if (grub_efi_is_finished || text_mode != GRUB_TEXT_MODE_AVAILABLE)
+    {
+      /*
+       * Cache colorstate changes before the first text-output, this avoids
+       * "color_normal" environment writes causing a switch to textmode.
+       */
+      text_colorstate = state;
+      return;
+    }
+
   if (grub_efi_is_finished)
     return;
 
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-03-22 15:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 11:43 [PATCH 1/2] EFI: console: Do not set colorstate until the first text output Hans de Goede
2022-01-28 11:43 ` [PATCH 2/2] EFI: console: Do not set cursor " Hans de Goede
2022-01-30 13:35   ` Javier Martinez Canillas
2022-01-31 18:44     ` Robbie Harwood
2022-01-30 13:33 ` [PATCH 1/2] EFI: console: Do not set colorstate " Javier Martinez Canillas
2022-01-31 18:44   ` Robbie Harwood
2022-03-04 10:30 ` Hans de Goede
2022-03-04 20:08   ` Daniel Kiper
2022-03-17 21:42   ` Daniel Kiper
2022-03-22 15:48   ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.