Received: from list by lists.gnu.org with archive (Exim 4.71) id 1f49Gm-0004lU-6s for mharc-grub-devel@gnu.org; Thu, 05 Apr 2018 14:05:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f49Gk-0004lD-0h for grub-devel@gnu.org; Thu, 05 Apr 2018 14:05:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f49Gg-0000Bz-Lx for grub-devel@gnu.org; Thu, 05 Apr 2018 14:05:53 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:54931) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f49Gg-0000AH-FG for grub-devel@gnu.org; Thu, 05 Apr 2018 14:05:50 -0400 Received: by mail-wm0-f66.google.com with SMTP id r191so7907763wmg.4 for ; Thu, 05 Apr 2018 11:05:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HRJ+hQJQH+dhEiBF/jHr9/cVK5chpgmFdRx6Ua0Taa0=; b=GbjmrLXQgmfKd9d25DcS2Ksjcj0/wNytrsT/bCeNU7/CtiJI7e7/GR/Y6v5xQOOqH+ 2niGC7FWJY+MCHhdWDTmOrJ3HRQQREqI7JuKqij6j9MLDRNj1UBOPHEii/L+LFG1lUfk VvSSKW0SCgOoltivuFkOyWrMhxYAxRjOpvlIHA594VqA1wsZkqj0541wlxnUMIMNjZ4s cWHpspmwB8huXYxaVxLxN48IZWVbl/oTuH5UHkpf3jfF7TDzY8C8vOf2ANm0JeanMkFw KAWbmqwaLOGnWIfv/TKGBbmQnYxh8dvfLC4Wiiq71JWf9uNgothLf0+ScBEClnoxkX5v R7cw== X-Gm-Message-State: ALQs6tARo4cf/arb3PWpabI2yt4xEnP2JTZygH1a/iind8JNj17/UWKQ 8aaL8f90t6Q1FARY9AZpoiPpsvaq5OU= X-Google-Smtp-Source: AIpwx4/sdbTP7/aNdgH46mwzkEOMPWhvcf4aeuRAQfI1bAPcd8Gbyt20Jhl9PA7UTdtnVU7NcVszLg== X-Received: by 10.80.190.66 with SMTP id b2mr3664510edi.161.1522951548988; Thu, 05 Apr 2018 11:05:48 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id g55sm5219544eda.15.2018.04.05.11.05.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 11:05:48 -0700 (PDT) Subject: Re: [PATCH 4/4] EFI: Do not set text-mode until we actually need it To: Daniel Kiper Cc: grub-devel@gnu.org References: <20180328145028.21555-1-hdegoede@redhat.com> <20180328145028.21555-5-hdegoede@redhat.com> <20180405123401.GU26100@olila.local.net-space.pl> From: Hans de Goede Message-ID: Date: Thu, 5 Apr 2018 20:05:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180405123401.GU26100@olila.local.net-space.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.66 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 18:05:55 -0000 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 >> --- >> 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 >> #include >> >> +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. >> +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. >> +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? Regards, Hans