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.129.124]) by mx.groups.io with SMTP id smtpd.web12.26125.1661216586064100113 for ; Mon, 22 Aug 2022 18:03:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GoCy+b7D; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: ppolawsk@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661216585; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nTzb6RJdwuO9GlpDWgCKd0WMhbT6ZDenpFOTO4XDTKg=; b=GoCy+b7D5HGwJSC58GPBR9rgeBEqz1IFTgMtVroYsvaReGfp4eHBkJRJRHIi9bG8yrjzkw OSsR+/XXj4VNCifYiJwTpwKUnrW4s2M3SaK17mssE2DoJwdeCCZ6wy/thU2C1rAzbBgYku sGH5YdW+yEO/y9gptqyCpXXEPo6NJuc= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-551-Y1P6YLyUOF2dy201dy_ttA-1; Mon, 22 Aug 2022 21:03:04 -0400 X-MC-Unique: Y1P6YLyUOF2dy201dy_ttA-1 Received: by mail-lf1-f69.google.com with SMTP id dt8-20020a0565122a8800b00492f7025810so132814lfb.3 for ; Mon, 22 Aug 2022 18:03:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=0z40MdM9WJwuZ5ppA71aA3Y8+W6TVKNzxpocAt/DJyk=; b=C7oZnDkHLAThEV9bYvtvsYZqdVhwuouUR8Wj5c8/Ryuo9SPKR5Xr3cObwl2dj4xzCL qr0ozpdhE2hoC9kHgh7ohy9aXUGrI5L/Iw0SdmP6MLeLyibBwnzDoowxsJMjnWH14zXx yWinBp454UpCmjON6IEN2S0bCPNrnPjh/APO60XTd8YU6JiTy0wRjH2gRHdwgRLniwT6 jfmR0MAyo+WkP74MEGo9EmnzqZX06NncD+MH6iN/lpiZ7z12XBSf0T+KZz4DgbdvnSkc LlON8JxWY5Hq6KoEtcscedw5nhpu3PFrOY43jHVB3ZCv1lRHlMODCcy6XHY9agKX3bOz oNFw== X-Gm-Message-State: ACgBeo07fyLy8BjYI00r+O8mgghAO6H/9ASaoDMh9zdZeWENYr0nONlU zOqky5xfFjEfgLdWeyTfxMB1gwT2DXfzcbc4WnLfmqq1sXpZC4ZuXT2I4Ir5BI3C2K1dfzh/JZy lJQXVuHiNl7xYLcVlDQZ8pi74N2J+09bZyesrXCRyW5RqOOojM7wBl1lTj1EEKKwMtw== X-Received: by 2002:a05:6512:1155:b0:48a:fb9a:32d8 with SMTP id m21-20020a056512115500b0048afb9a32d8mr8035716lfg.672.1661216582186; Mon, 22 Aug 2022 18:03:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wKWV/ESAIIT+4DMG6gN53blVP3yl9XI8GioNANVf1eritZIz2UOITOrXZhX8kMRZzV4LbKg== X-Received: by 2002:a05:6512:1155:b0:48a:fb9a:32d8 with SMTP id m21-20020a056512115500b0048afb9a32d8mr8035703lfg.672.1661216581826; Mon, 22 Aug 2022 18:03:01 -0700 (PDT) Return-Path: Received: from czapka.. ([93.177.91.185]) by smtp.gmail.com with ESMTPSA id q23-20020a056512211700b0048b045a5c3asm2197406lfr.201.2022.08.22.18.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 18:03:01 -0700 (PDT) From: =?UTF-8?B?UGF3ZcWCIFBvxYJhd3NraQ==?= To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao Subject: [[edk2-devel] PATH v1 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change Date: Tue, 23 Aug 2022 03:02:37 +0200 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Laszlo Ersek Reference: Signed-off-by: Laszlo Ersek Pawel: 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 | 30 +++++++++= +++++++++++ 3 files changed, 36 insertions(+) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 7d989108324a..45d793f3fddc 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2098,6 +2098,10 @@ # @Prompt The shared bit mask when Intel Tdx is enabled.=0D gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x10000025= =0D =20=0D + ## Controls whether TerminalDxe outputs an XTerm resize sequence on term= inal=0D + # mode change.=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080= =0D +=0D [PcdsPatchableInModule]=0D ## Specify memory size with page number for PEI code when=0D # Loading Module at Fixed Address feature is enabled.=0D 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 @@ DebugLib=0D PcdLib=0D BaseLib=0D + PrintLib=0D =20=0D [Guids]=0D ## SOMETIMES_PRODUCES ## Variable:L"ConInDev"=0D @@ -87,6 +88,7 @@ [Pcd]=0D gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType ## SOMETIMES_C= ONSUMES=0D gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm ## CONSUMES=0D =20=0D # [Event]=0D # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 second= s input timeout.=0D diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/= MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c index 7809869e7d49..0ce931d6442b 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 =20=0D **/=0D =20=0D +#include =0D +=0D #include "Terminal.h"=0D =20=0D //=0D @@ -80,6 +82,16 @@ CHAR16 mSetCursorPositionString[] =3D { ESC, '[', '0', = '0', ';', '0', '0', 'H', 0 CHAR16 mCursorForwardString[] =3D { ESC, '[', '0', '0', 'C', 0 };=0D CHAR16 mCursorBackwardString[] =3D { ESC, '[', '0', '0', 'D', 0 };=0D =20=0D +//=0D +// Note that this is an ASCII format string, taking two INT32 arguments:= =0D +// rows, columns.=0D +//=0D +// A %d (INT32) format specification can expand to at most 11 characters.= =0D +//=0D +CHAR8 mResizeTextAreaFormatString[] =3D "\x1B[8;%d;%dt";=0D +#define RESIZE_SEQ_SIZE (sizeof mResizeTextAreaFormatString + 2 * (11 - 2)= )=0D +=0D +=0D //=0D // Body of the ConOut functions=0D //=0D @@ -498,6 +510,24 @@ TerminalConOutSetMode ( return EFI_DEVICE_ERROR;=0D }=0D =20=0D + if (PcdGetBool (PcdResizeXterm)) {=0D + CHAR16 ResizeSequence[RESIZE_SEQ_SIZE];=0D +=0D + UnicodeSPrintAsciiFormat (=0D + ResizeSequence,=0D + sizeof ResizeSequence,=0D + mResizeTextAreaFormatString,=0D + (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows,=0D + (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns= =0D + );=0D + TerminalDevice->OutputEscChar =3D TRUE;=0D + Status =3D This->OutputString (This, ResizeSequ= ence);=0D + TerminalDevice->OutputEscChar =3D FALSE;=0D + if (EFI_ERROR (Status)) {=0D + return EFI_DEVICE_ERROR;=0D + }=0D + }=0D +=0D This->Mode->Mode =3D (INT32)ModeNumber;=0D =20=0D Status =3D This->ClearScreen (This);=0D --=20 2.37.2