From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nEbfK-00020q-MP for mharc-grub-devel@gnu.org; Mon, 31 Jan 2022 13:44:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEbfB-0001xM-CA for grub-devel@gnu.org; Mon, 31 Jan 2022 13:44:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEbf8-0005yN-1H for grub-devel@gnu.org; Mon, 31 Jan 2022 13:44:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643654664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9HH++4D/R1tBmvGlEDLnUb6VVtFO91YvImgjH7yBBKg=; b=BPRD0/qJQCzyJtwQMpLHgU+cyYOnmTURQLslorEkiP53BlTCHAqVtbJ0JkNsTSP7ESRgco l++BFyC46afF1F8vFMS4niXdMTtMfF2s8VyEp0m/5bqPfJWiZs3ImcdC11iAd/3tTGJ8I3 3qEx1iYl/NtXpKjoF9iUbQ6rac3rwNY= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-SChQMPeiMDWlMzx4OFyUvg-1; Mon, 31 Jan 2022 13:44:22 -0500 X-MC-Unique: SChQMPeiMDWlMzx4OFyUvg-1 Received: by mail-qt1-f197.google.com with SMTP id 4-20020ac85744000000b002b2f329efc2so11025030qtx.12 for ; Mon, 31 Jan 2022 10:44:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=9HH++4D/R1tBmvGlEDLnUb6VVtFO91YvImgjH7yBBKg=; b=FOerOHB634dDtYXspStZSVGzbmcM97u63qf+OJbkXaFIRy+Q8U+b+gv1SmQGWUBk0o SUxBrCgTypSfm0lX6XCoV2NHoOQBjqZHX+KOZe4JLj1Nuqq6AJy6pAm2PNLj+gkjra3N LVREomch/WLvfQmXeGqGE8zW47B7WfY1EasUZdRGPz4D9EQRaYyvNP/2eUBDDzKC9eBw Ii8rF2BY/5EwqxW/2qGKd1uegHx0EpUdoZZ9StN9gdTpuIApC0j0QN8/gNYajgShui9a U9/FbLVwvZKXEmUFUGmUSv5EnBZpjejddc6Szyqe5Sw+9Jzh6rxIA0SafIqedDY4l/Xw jCNQ== X-Gm-Message-State: AOAM532BjInpEEoQuWF75y/QvY0KSOSOg/RIb6niqbszP4v0FV1zCtG5 xhN+4XSFRPL6LC9FhbZQySWtFvim4dDgL/GX1WAZdZ4eZP2DwWTSzhuiGqkYpPGGgtnBh5nSdFC d/5tdLQeYcLc= X-Received: by 2002:ac8:7619:: with SMTP id t25mr16023108qtq.456.1643654661628; Mon, 31 Jan 2022 10:44:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZ91B84qtUaCo7YGXCPP2ySGhd727c9wUHr2+DlQ8PDXIeAMyQcLXdFatm+Zy9iPQnmPEZ1Q== X-Received: by 2002:ac8:7619:: with SMTP id t25mr16023057qtq.456.1643654661039; Mon, 31 Jan 2022 10:44:21 -0800 (PST) Received: from localhost ([2601:184:4181:74c0:862e:5809:ed9e:e10e]) by smtp.gmail.com with ESMTPSA id a8sm8431891qti.71.2022.01.31.10.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 10:44:20 -0800 (PST) From: Robbie Harwood To: Javier Martinez Canillas , Hans de Goede , grub-devel@gnu.org Subject: Re: [PATCH 1/2] EFI: console: Do not set colorstate until the first text output In-Reply-To: <72311e14-916c-82d3-588e-ae62c91998e4@redhat.com> References: <20220128114349.87480-1-hdegoede@redhat.com> <72311e14-916c-82d3-588e-ae62c91998e4@redhat.com> Date: Mon, 31 Jan 2022 13:44:19 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=170.10.133.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.088, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2022 18:44:34 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Javier Martinez Canillas writes: > Hello Hans, > > Thanks for the patch. > > On 1/28/22 12:43, Hans de Goede wrote: >> GRUB_MOD_INIT(normal) does an unconditional: >>=20 >> grub_env_set ("color_normal", "light-gray/black"); >>=20 >> which triggers a grub_term_setcolorstate() call. The original version >> of the "efi/console: Do not set text-mode until we actually need it" pat= ch: >> https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00125.html >>=20 >> 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/consol= e.c >> file the code to cache the color-state + bail early was accidentally >> dropped. >>=20 >> Restore the cache the color-state + bail early behavior from the origina= l. >>=20 >> Cc: Javier Martinez Canillas >> Fixes: 2d7c3abd871f ("efi/console: Do not set text-mode until we actuall= y need it") >> Signed-off-by: Hans de Goede >> --- >> grub-core/term/efi/console.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >>=20 >> 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; >>=20=20 >> + if (grub_efi_is_finished || text_mode !=3D GRUB_TEXT_MODE_AVAILABLE) >> + { >> + /* >> + * Cache colorstate changes before the first text-output, this av= oids >> + * "color_normal" environment writes causing a switch to textmode. >> + */ >> + text_colorstate =3D state; >> + return; >> + } >> + >> if (grub_efi_is_finished) >> return; >> > > Indeed, sorry for messing this when addressing the concerns raised by > Daniel in your original patch. The fix looks good to me. > > Reviewed-by: Javier Martinez Canillas Reviewed-by: Robbie Harwood Be well, =2D-Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAmH4LgMUHHJoYXJ3b29k QHJlZGhhdC5jb20ACgkQJTL5F2qVpEL3Sg//SxFz93ZOqsDB3EFewTxf3CcPkJWP acXOgDXReWSl7bbAYUCZGZmIL+Kn3WV/C+RTEX6iJZUzgU0Ay+Er0kdqjdZcJxb2 bXK+Jj1lZYAMGbEgByARbk86yX9hlaIqnYe3F98/2JqMVCDJv/1jVTr9QxLau0H2 AglYKJK1aDVv8eD5tEsCqZp11U95io29+kAYWd/1WxfT9SfLjIKuawO5ao0Af3Yl jEzRzTNSBWkussV4i6AUbO4BLORNSgJ9PLb3/dWzLy1B9CPLRGyvu34aVYO1YI5s gXtAMu9RAdEvoqGU8DylSATLwvBfyOrY/wQ6k8xB5gUTrcLzoSlZkKhBTNBiR++h +bgUV+ZIoVS/7ai1WuQKV1fTVgY8OVElbzDNvBSqlD+p+IvoWXEJvicHuEbxmhpO T8k/Uw1VyTLsppCT1lqvdlxnsCCJisS7LvecmAf9sXhBmhLJKaPLJZBezLNljjcy i4V6qp0bw2hCy0Hhx1p8og2GktkgaB2H170Y/cNiNa2hVrn4zFiSwQ+6fFgHvFM/ M03a8StyGkV/QCDEgsZQxNtOS+gom5k/WekFrwy9hxeU93tcx76eQIxonsBmEP2q mbjltZB9/wbZvXE1Ynau0LRlHcSRVLzyoJjEflnYsDdV9m6UC6a0fhv/0XEVtluY VdPX3ArEeRhkXWk= =nxL7 -----END PGP SIGNATURE----- --=-=-=--