All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH 4/4] EFI: Do not set text-mode until we actually need it
Date: Fri, 6 Apr 2018 13:44:01 +0200	[thread overview]
Message-ID: <20180406114401.GX26100@olila.local.net-space.pl> (raw)
In-Reply-To: <c378ec5a-9ff7-179d-a8e6-2661dbde96f2@redhat.com>

On Thu, Apr 05, 2018 at 08:05:47PM +0200, Hans de Goede wrote:
> Hi,
>
> On 05-04-18 14:34, Daniel Kiper wrote:
> >On Wed, Mar 28, 2018 at 04:50:28PM +0200, Hans de Goede wrote:
> >>If we're running with a hidden menu we may never need text mode, so do not
> >>change the video-mode to text until we actually need it.
> >>
> >>Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >>---
> >>  grub-core/term/efi/console.c | 72 +++++++++++++++++++++++-------------
> >>  1 file changed, 47 insertions(+), 25 deletions(-)
> >>
> >>diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
> >>index 02f64ea74..d9fd7cf48 100644
> >>--- a/grub-core/term/efi/console.c
> >>+++ b/grub-core/term/efi/console.c
> >>@@ -24,6 +24,11 @@
> >>  #include <grub/efi/api.h>
> >>  #include <grub/efi/console.h>
> >>
> >>+static grub_err_t grub_prepare_for_text_output(struct grub_term_output *term);
> >
> >Please drop this forward declaration and put the function definition before the callers.
>
> I did not do that initially because that requires also moving
> grub_console_setcolorstate() and grub_console_setcursor() to
> higher in the file (or do a forward declaration for those).
>
> I'll add a preparation patch to v2 of the series moving just
> those 2 up to higher in the file.

Great!

> >>+static int text_mode_available = -1;
> >
> >Could you use bool type here? If yes please define grub_bool_t as stdbool.h
> >does (grub/bool.h?) and replace its usage in grub-core/term/tparm.c as separate
> >patch. If not bool please use enum here.
>
> There are 3 states, so a bool is not going to work I will
> switch to an enum for v2.

Perfect!

> >>+static int text_colorstate = -1;
>
> There already is a grub_term_color_state enum for this, which
> defines values 0-2, I want to know if setcolorstate has been
> called and text_colorstate contains a valid value, so I made
> this an int and use -1 to mean not set / invalid.
>
> I can see a number of solutions here:
>
> 1) Leave as is
> 2) Use:
>
> static grub_term_color_state text_colorstate = -1;
>
> Assuming the compiler will not warn about putting -1 in there.
>
> 3) Extend the grub_term_color_state like this:
>
> typedef enum
>   {
>     /* Used for uninitialized grub_term_color_state variables */
>     GRUB_TERM_COLOR_UNDEFINED = -1,
>     /* The color used to display all text that does not use the
>        user defined colors below.  */
>     GRUB_TERM_COLOR_STANDARD = 0,
>     /* The user defined colors for normal text.  */
>     GRUB_TERM_COLOR_NORMAL,
>     /* The user defined colors for highlighted text.  */
>     GRUB_TERM_COLOR_HIGHLIGHT
>   }
> grub_term_color_state;
>
> Which solution would you prefer?

3rd, enum please.

Thanks,

Daniel


  reply	other threads:[~2018-04-06 11:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 14:50 [PATCH 0/4] Make hidden menu really hidden Hans de Goede
2018-03-28 14:50 ` [PATCH 1/4] Add new "version" command Hans de Goede
2018-03-29  7:53   ` Olaf Hering
2018-03-29  8:37     ` Thomas Schmitt
2018-03-29 14:57     ` Hans de Goede
2018-03-29 15:02       ` Olaf Hering
2018-04-05 11:41   ` Daniel Kiper
2018-03-28 14:50 ` [PATCH 2/4] Accept Both ESC and F8 as user interrupt keys Hans de Goede
2018-03-28 14:56   ` Lennart Sorensen
2018-03-28 15:06     ` Hans de Goede
2018-03-28 15:11       ` Lennart Sorensen
2018-03-28 15:58         ` Hans de Goede
2018-04-05 11:47           ` Daniel Kiper
2018-03-28 14:50 ` [PATCH 3/4] Optionally print less messages at boot Hans de Goede
2018-04-05 12:12   ` Daniel Kiper
2018-04-05 17:53     ` Hans de Goede
2018-04-06 11:41       ` Daniel Kiper
2018-03-28 14:50 ` [PATCH 4/4] EFI: Do not set text-mode until we actually need it Hans de Goede
2018-04-05 12:34   ` Daniel Kiper
2018-04-05 18:05     ` Hans de Goede
2018-04-06 11:44       ` Daniel Kiper [this message]
2018-03-28 15:04 ` [PATCH 0/4] Make hidden menu really hidden Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180406114401.GX26100@olila.local.net-space.pl \
    --to=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=hdegoede@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.