From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.13302.1678193243839753823 for ; Tue, 07 Mar 2023 04:47:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W9A3XUed; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: ppolawsk@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678193243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/rD1OfnynMEtWixY6MqYNhujOFitcVO+fGqvjy9NXYM=; b=W9A3XUed4dX5LL9hS8tXdmlrSKIeRrVy5i21jLKFj6zlTwimoIQC+D7GS88WCjF2wNL+pI 0Q/SQCCxW8NnV8ICeL+J81vgED8084EJw8ZYsOwca7NSiq4wB28IxyOJNww39A4FvtyPT6 ZcBcryDuCsXy6ZzwAZPRewRItmbFj/c= Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com [209.85.222.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-UahAScQwN4CA-eLodwvQIA-1; Tue, 07 Mar 2023 07:47:21 -0500 X-MC-Unique: UahAScQwN4CA-eLodwvQIA-1 Received: by mail-ua1-f71.google.com with SMTP id c19-20020ab06ed3000000b0068b9f3e0a2dso6246123uav.6 for ; Tue, 07 Mar 2023 04:47:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678193241; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/rD1OfnynMEtWixY6MqYNhujOFitcVO+fGqvjy9NXYM=; b=FnGlq4+wqh84dvIAdvr4KanpGDg5ci0UU7cr6MHF37lmd4/bhxQAIV/9T6exoClWka fBngaD8CAYsreYiDciGXe7p6Zru9H2tXlOGBRGhNxN6lX9rOBJXeTIPMxwTi2r1IieTe 8h74kF4+Z98HdttMTufSE2tHojwBgw8oiNzH4WtHjXxQLB7l+Dhp56X9hOYyVQG4jNJc ellsCNpsWzjd0Vrw0uVFRyGqlm8pMKP7ErQwtjSlicfqKwPCm6IbaYDWBwvoUlTlhFhb D7GMQmZnacRmrmlZk7pOQFJmHvwQab7xYNpEWI6RrV3YJzQ3VYmF183RxpU598xtyehB DAOg== X-Gm-Message-State: AO0yUKV5VLV0ayo/PIqgk/0QL1qL+eDd8iVZv2g5CLDwLjxp4gJz7fpn V2P2wKhSaQEYjwFd0Xo8BPQeFOAfH8lhE324cDAgm6zWaSgC6hC1bsQH2xZKl4EXy25pHoSiRYo +awzImsSRsyiuwZr2/gATPb1XsS3zacZumQEJ8w== X-Received: by 2002:a1f:2dcb:0:b0:401:42e5:6d2e with SMTP id t194-20020a1f2dcb000000b0040142e56d2emr8835556vkt.1.1678193240552; Tue, 07 Mar 2023 04:47:20 -0800 (PST) X-Google-Smtp-Source: AK7set89/SeK1tjp8ZGoBt9UjEIT9qgtDzp39ubcAlI7uipVCSa9kMQa6BGo2aNE1Tov1cL50tcpPcm6r/vlanEdVdQ= X-Received: by 2002:a1f:2dcb:0:b0:401:42e5:6d2e with SMTP id t194-20020a1f2dcb000000b0040142e56d2emr8835546vkt.1.1678193240242; Tue, 07 Mar 2023 04:47:20 -0800 (PST) MIME-Version: 1.0 References: <17449E3B102C52E2.23192@groups.io> In-Reply-To: <17449E3B102C52E2.23192@groups.io> From: =?UTF-8?B?UGF3ZcWCIFBvxYJhd3NraQ==?= Date: Tue, 7 Mar 2023 13:47:09 +0100 Message-ID: Subject: Re: [edk2-devel] PATCH v3 1/3 MdeModulePkg: TerminalDxe: set xterm resolution on mode change To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000f30ff905f64ecfe7" --000000000000f30ff905f64ecfe7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, As a new stable version has been released recently and the freeze is over, if there is a chance for review of this set of patches? They have been already reviewed in the past and the last request was to make commit messages more meaningful for the end user. Best regards, Pawel On Fri, Feb 17, 2023 at 2:02=E2=80=AFPM Pawe=C5=82 Po=C5=82awski wrote: > From: Laszlo Ersek > > TerminalDxe driver can send xterm control sequences. > Reference: > > This way it can trigger client window resize (xterm, > gnome-terminal etc.) accordingly, to a specified number > of rows and columns. It improves user experience > when handling text mode based operations. > > New PcdResizeXterm config switch has been added to enable > or disable this behaviour. > > Signed-off-by: Laszlo Ersek > > Pawel Polawski: Updated commit message for re-submission > > Cc: Jian J Wang > Cc: Liming Gao > > Signed-off-by: Pawe=C5=82 Po=C5=82awski > --- > MdeModulePkg/MdeModulePkg.dec | 4 +++ > MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf | 2 ++ > MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c | 29 > ++++++++++++++++++++ > 3 files changed, 35 insertions(+) > > diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.de= c > index 9605c617b7a8..76007e0af42a 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -2107,6 +2107,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, > PcdsDynamic, PcdsDynamicEx] > # @Prompt The shared bit mask when Intel Tdx is enabled. > gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x100000= 25 > > + ## Controls whether TerminalDxe outputs an XTerm resize sequence on > terminal > + # mode change. > + gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080 > + > [PcdsPatchableInModule] > ## Specify memory size with page number for PEI code when > # Loading Module at Fixed Address feature is enabled. > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf > b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf > index b2a8aeba8510..eff625346539 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf > @@ -55,6 +55,7 @@ [LibraryClasses] > DebugLib > PcdLib > BaseLib > + PrintLib > > [Guids] > ## SOMETIMES_PRODUCES ## Variable:L"ConInDev" > @@ -87,6 +88,7 @@ [Protocols] > [Pcd] > gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType ## > SOMETIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm ## CONSUMES > > # [Event] > # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 > seconds input timeout. > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > index 7809869e7d49..496849458db4 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > @@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > > +#include > + > #include "Terminal.h" > > // > @@ -80,6 +82,15 @@ CHAR16 mSetCursorPositionString[] =3D { ESC, '[', '0'= , > '0', ';', '0', '0', 'H', 0 > CHAR16 mCursorForwardString[] =3D { ESC, '[', '0', '0', 'C', 0 }; > CHAR16 mCursorBackwardString[] =3D { ESC, '[', '0', '0', 'D', 0 }; > > +// > +// Note that this is an ASCII format string, taking two INT32 arguments: > +// rows, columns. > +// > +// A %d (INT32) format specification can expand to at most 11 characters= . > +// > +CHAR8 mResizeTextAreaFormatString[] =3D "\x1B[8;%d;%dt"; > +#define RESIZE_SEQ_SIZE (sizeof mResizeTextAreaFormatString + 2 * (11 - > 2)) > + > // > // Body of the ConOut functions > // > @@ -498,6 +509,24 @@ TerminalConOutSetMode ( > return EFI_DEVICE_ERROR; > } > > + if (PcdGetBool (PcdResizeXterm)) { > + CHAR16 ResizeSequence[RESIZE_SEQ_SIZE]; > + > + UnicodeSPrintAsciiFormat ( > + ResizeSequence, > + sizeof ResizeSequence, > + mResizeTextAreaFormatString, > + (INT32)TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows, > + (INT32)TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns > + ); > + TerminalDevice->OutputEscChar =3D TRUE; > + Status =3D This->OutputString (This, > ResizeSequence); > + TerminalDevice->OutputEscChar =3D FALSE; > + if (EFI_ERROR (Status)) { > + return EFI_DEVICE_ERROR; > + } > + } > + > This->Mode->Mode =3D (INT32)ModeNumber; > > Status =3D This->ClearScreen (This); > -- > 2.39.1 > > > >=20 > > > --=20 Pawe=C5=82 Po=C5=82awski Red Hat Virtualization ppolawsk@redhat.com @RedHat Red Hat Red Hat --000000000000f30ff905f64ecfe7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

As a new stable vers= ion has been released recently and the freeze is over,
if there i= s a chance for review of this set of patches?

They= have been already reviewed in the past and the last request was to make co= mmit
messages more meaningful for the end user.

Best regards,
Pawel

On Fri, Feb 17, 2023 at 2:02= =E2=80=AFPM Pawe=C5=82 Po=C5=82awski <ppolawsk@redhat.com> wrote:
From: Laszlo Ersek <lersek@redhat.com>

TerminalDxe driver can send xterm control sequences.
Reference: <http://rtfm.etla.org/xterm/ctlseq.html><= br>
This way it can trigger client window resize (xterm,
gnome-terminal etc.) accordingly, to a specified number
of rows and columns. It improves user experience
when handling text mode based operations.

New PcdResizeXterm config switch has been added to enable
or disable this behaviour.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Pawel Polawski: Updated commit message for re-submission

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Pawe=C5=82 Po=C5=82awski <ppolawsk@redhat.com>
---
=C2=A0MdeModulePkg/MdeModulePkg.dec=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 4 +++
=C2=A0MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=C2=A0 |=C2= =A0 2 ++
=C2=A0MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c | 29 ++++= ++++++++++++++++
=C2=A03 files changed, 35 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec<= br> index 9605c617b7a8..76007e0af42a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2107,6 +2107,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynami= c, PcdsDynamicEx]
=C2=A0 =C2=A0# @Prompt The shared bit mask when Intel Tdx is enabled.
=C2=A0 =C2=A0gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|= 0x10000025

+=C2=A0 ## Controls whether TerminalDxe outputs an XTerm resize sequence on= terminal
+=C2=A0 #=C2=A0 mode change.
+=C2=A0 gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010= 080
+
=C2=A0[PcdsPatchableInModule]
=C2=A0 =C2=A0## Specify memory size with page number for PEI code when
=C2=A0 =C2=A0#=C2=A0 Loading Module at Fixed Address feature is enabled. diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/M= deModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
index b2a8aeba8510..eff625346539 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@@ -55,6 +55,7 @@ [LibraryClasses]
=C2=A0 =C2=A0DebugLib
=C2=A0 =C2=A0PcdLib
=C2=A0 =C2=A0BaseLib
+=C2=A0 PrintLib

=C2=A0[Guids]
=C2=A0 =C2=A0## SOMETIMES_PRODUCES ## Variable:L"ConInDev"
@@ -87,6 +88,7 @@ [Protocols]
=C2=A0[Pcd]
=C2=A0 =C2=A0gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0## SOMETIMES_CONSUMES
=C2=A0 =C2=A0gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable=C2=A0 = =C2=A0 ## CONSUMES
+=C2=A0 gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0## CONSUMES

=C2=A0# [Event]
=C2=A0# # Relative timer event set by UnicodeToEfiKey(), used to be one 2 s= econds input timeout.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/= MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
index 7809869e7d49..496849458db4 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
@@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

=C2=A0**/

+#include <Library/PrintLib.h>
+
=C2=A0#include "Terminal.h"

=C2=A0//
@@ -80,6 +82,15 @@ CHAR16=C2=A0 mSetCursorPositionString[] =3D { ESC, '= [', '0', '0', ';', '0', '0', &#= 39;H', 0
=C2=A0CHAR16=C2=A0 mCursorForwardString[]=C2=A0 =C2=A0 =C2=A0=3D { ESC, = 9;[', '0', '0', 'C', 0 };
=C2=A0CHAR16=C2=A0 mCursorBackwardString[]=C2=A0 =C2=A0 =3D { ESC, '[&#= 39;, '0', '0', 'D', 0 };

+//
+// Note that this is an ASCII format string, taking two INT32 arguments: +// rows, columns.
+//
+// A %d (INT32) format specification can expand to at most 11 characters.<= br> +//
+CHAR8=C2=A0 mResizeTextAreaFormatString[] =3D "\x1B[8;%d;%dt"; +#define RESIZE_SEQ_SIZE=C2=A0 (sizeof mResizeTextAreaFormatString + 2 * (1= 1 - 2))
+
=C2=A0//
=C2=A0// Body of the ConOut functions
=C2=A0//
@@ -498,6 +509,24 @@ TerminalConOutSetMode (
=C2=A0 =C2=A0 =C2=A0return EFI_DEVICE_ERROR;
=C2=A0 =C2=A0}

+=C2=A0 if (PcdGetBool (PcdResizeXterm)) {
+=C2=A0 =C2=A0 CHAR16=C2=A0 ResizeSequence[RESIZE_SEQ_SIZE];
+
+=C2=A0 =C2=A0 UnicodeSPrintAsciiFormat (
+=C2=A0 =C2=A0 =C2=A0 ResizeSequence,
+=C2=A0 =C2=A0 =C2=A0 sizeof ResizeSequence,
+=C2=A0 =C2=A0 =C2=A0 mResizeTextAreaFormatString,
+=C2=A0 =C2=A0 =C2=A0 (INT32)TerminalDevice->TerminalConsoleModeData[Mod= eNumber].Rows,
+=C2=A0 =C2=A0 =C2=A0 (INT32)TerminalDevice->TerminalConsoleModeData[Mod= eNumber].Columns
+=C2=A0 =C2=A0 =C2=A0 );
+=C2=A0 =C2=A0 TerminalDevice->OutputEscChar =3D TRUE;
+=C2=A0 =C2=A0 Status=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D This->OutputString (This, ResizeSequ= ence);
+=C2=A0 =C2=A0 TerminalDevice->OutputEscChar =3D FALSE;
+=C2=A0 =C2=A0 if (EFI_ERROR (Status)) {
+=C2=A0 =C2=A0 =C2=A0 return EFI_DEVICE_ERROR;
+=C2=A0 =C2=A0 }
+=C2=A0 }
+
=C2=A0 =C2=A0This->Mode->Mode =3D (INT32)ModeNumber;

=C2=A0 =C2=A0Status =3D This->ClearScreen (This);
--
2.39.1








--

<= span>Pawe=C5=82 Po=C5=82awski

Red Hat Virtualization

ppolawsk@= redhat.com=C2=A0 =C2=A0

@RedHat=C2=A0=C2=A0=C2=A0Red Hat=C2=A0=C2=A0Red Hat
=
--000000000000f30ff905f64ecfe7--