From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7C2A41A1E28 for ; Thu, 27 Oct 2016 11:32:36 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 27 Oct 2016 11:32:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,553,1473145200"; d="scan'208";a="24458162" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga006.fm.intel.com with ESMTP; 27 Oct 2016 11:32:35 -0700 Received: from orsmsx111.amr.corp.intel.com (10.22.240.12) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 27 Oct 2016 11:32:35 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.50]) by ORSMSX111.amr.corp.intel.com ([10.22.240.12]) with mapi id 14.03.0248.002; Thu, 27 Oct 2016 11:32:35 -0700 From: "Kinney, Michael D" To: "Brian J. Johnson" , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: "Tian, Feng" , "Zeng, Star" Thread-Topic: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion Thread-Index: AQHSIKqtsE2qF9I1+UWTcJeIS2yat6C7vQpQgAFwmYD//4y8cIAABRbA Date: Thu, 27 Oct 2016 18:32:34 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDliYTY0MDgtMWQ4Ni00ZmFmLTg1MTktYWI2NzliY2VmYTczIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InVFMEg3eHc3NVZrVFNJbkdzWk1FUTlWdW5WRTVRSHFIWEF3QkQwRnJod2c9In0= x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Subject: Re: [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 18:32:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Committed at https://github.com/tianocore/edk2/commit/d1b757e2cd034e32676c5cc2d542f785e7= 4f8c5d Mike > -----Original Message----- > From: Kinney, Michael D > Sent: Thursday, October 27, 2016 11:14 AM > To: Brian J. Johnson ; edk2-devel@lists.01.org; Kinney,= Michael D > > Cc: Tian, Feng ; Zeng, Star > Subject: RE: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTer= m cursor > motion >=20 > Brian, >=20 > Thanks. I will do the commit with your rb. >=20 > Mike >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of = Brian J. > Johnson > > Sent: Thursday, October 27, 2016 11:06 AM > > To: Kinney, Michael D ; edk2-devel@lists.01= .org > > Cc: Tian, Feng ; Zeng, Star > > Subject: Re: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyT= erm cursor > > motion > > > > On 10/26/2016 10:09 PM, Kinney, Michael D wrote: > > > Tian Feng, > > > > > > Unfortunately, this patch that was pushed to edk2/master today > > > breaks on IA32 VS2015x86 builds with a signed/unsigned mismatch > > > on 3 lines. I think the right fix might be: > > > > > > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOu= t.c > > b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > > > index e9b5ed0..9625f4d 100644 > > > --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > > > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > > > @@ -790,13 +790,13 @@ TerminalConOutSetCursorPosition ( > > > // it isn't necessary. > > > // > > > if (TerminalDevice->TerminalType =3D=3D TTYTERMTYPE && > > > - Mode->CursorRow =3D=3D Row) { > > > - if (Mode->CursorColumn > Column) { > > > + (UINTN)Mode->CursorRow =3D=3D Row) { > > > + if ((UINTN)Mode->CursorColumn > Column) { > > > mCursorBackwardString[FW_BACK_OFFSET + 0] =3D (CHAR16) ('0' + = ((Mode- > > >CursorColumn - Column) / 10)); > > > mCursorBackwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' + = ((Mode- > > >CursorColumn - Column) % 10)); > > > String =3D mCursorBackwardString; > > > } > > > - else if (Column > Mode->CursorColumn) { > > > + else if (Column > (UINTN)Mode->CursorColumn) { > > > mCursorForwardString[FW_BACK_OFFSET + 0] =3D (CHAR16) ('0' + (= (Column - Mode- > > >CursorColumn) / 10)); > > > mCursorForwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' + (= (Column - Mode- > > >CursorColumn) % 10)); > > > String =3D mCursorForwardString; > > > > > > Please see if you can reproduce this issue. > > > > > > Thanks, > > > > > > Mike > > > > The changes look fine to me. Unfortunately, I don't have that compiler > > to test with. > > > > If it's needed, > > Reviewed-by: Brian Johnson > > > > > > > >> -----Original Message----- > > >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf = Of Brian J. > > Johnson > > >> Sent: Friday, October 7, 2016 7:54 AM > > >> To: edk2-devel@lists.01.org > > >> Cc: Brian J. Johnson ; Tian, Feng ; Zeng, > > Star > > >> > > >> Subject: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTe= rm cursor > motion > > >> > > >> For TtyTerm terminals, output a shorter escape sequence when possibl= e > > >> to move the cursor within the current line, and don't print any esca= pe > > >> sequence if the cursor is already at the correct position. This > > >> removes extra cursor motion activity at the EFI shell prompt, > > >> improving performance. It also makes it possible in many cases to > > >> successfully use a terminal window which is taller than the driver's > > >> mode setting (eg. 80x25.) > > >> > > >> Contributed-under: TianoCore Contribution Agreement 1.0 > > >> Signed-off-by: Brian Johnson > > >> Cc: Feng Tian > > >> Cc: Star Zeng > > >> --- > > >> .../Universal/Console/TerminalDxe/Terminal.h | 2 ++ > > >> .../Universal/Console/TerminalDxe/TerminalConOut.c | 36 +++++++++++= ++++++++--- > > >> 2 files changed, 33 insertions(+), 5 deletions(-) > > >> > > >> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > > >> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > > >> index 269d2ae..3ee3969 100644 > > >> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > > >> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > > >> @@ -2,6 +2,7 @@ > > >> Header file for Terminal driver. > > >> > > >> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<= BR> > > >> +Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
> > >> This program and the accompanying materials > > >> are licensed and made available under the terms and conditions of t= he BSD License > > >> which accompanies this distribution. The full text of the license = may be found > at > > >> @@ -157,6 +158,7 @@ typedef union { > > >> #define BACKGROUND_CONTROL_OFFSET 11 > > >> #define ROW_OFFSET 2 > > >> #define COLUMN_OFFSET 5 > > >> +#define FW_BACK_OFFSET 2 > > >> > > >> typedef struct { > > >> UINT16 Unicode; > > >> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConO= ut.c > > >> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > > >> index b11e83f..e9b5ed0 100644 > > >> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > > >> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > > >> @@ -83,6 +83,8 @@ CHAR16 mSetModeString[] =3D { ESC, '[',= '=3D', '3', 'h', > 0 > > }; > > >> CHAR16 mSetAttributeString[] =3D { ESC, '[', '0', 'm', ESC, '= [', '4', '0', > 'm', > > >> ESC, '[', '4', '0', 'm', 0 }; > > >> CHAR16 mClearScreenString[] =3D { ESC, '[', '2', 'J', 0 }; > > >> 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= }; > > >> > > >> // > > >> // Body of the ConOut functions > > >> @@ -755,6 +757,7 @@ TerminalConOutSetCursorPosition ( > > >> UINTN MaxRow; > > >> EFI_STATUS Status; > > >> TERMINAL_DEV *TerminalDevice; > > >> + CHAR16 *String; > > >> > > >> TerminalDevice =3D TERMINAL_CON_OUT_DEV_FROM_THIS (This); > > >> > > >> @@ -782,13 +785,36 @@ TerminalConOutSetCursorPosition ( > > >> // > > >> // control sequence to move the cursor > > >> // > > >> - mSetCursorPositionString[ROW_OFFSET + 0] =3D (CHAR16) ('0' + (= (Row + 1) / > 10)); > > >> - mSetCursorPositionString[ROW_OFFSET + 1] =3D (CHAR16) ('0' + (= (Row + 1) % > 10)); > > >> - mSetCursorPositionString[COLUMN_OFFSET + 0] =3D (CHAR16) ('0' + (= (Column + 1) / > > 10)); > > >> - mSetCursorPositionString[COLUMN_OFFSET + 1] =3D (CHAR16) ('0' + (= (Column + 1) % > > 10)); > > >> + // Optimize cursor motion control sequences for TtyTerm. Move > > >> + // within the current line if possible, and don't output anyting = if > > >> + // it isn't necessary. > > >> + // > > >> + if (TerminalDevice->TerminalType =3D=3D TTYTERMTYPE && > > >> + Mode->CursorRow =3D=3D Row) { > > >> + if (Mode->CursorColumn > Column) { > > >> + mCursorBackwardString[FW_BACK_OFFSET + 0] =3D (CHAR16) ('0' += ((Mode- > > >CursorColumn > > >> - Column) / 10)); > > >> + mCursorBackwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' += ((Mode- > > >CursorColumn > > >> - Column) % 10)); > > >> + String =3D mCursorBackwardString; > > >> + } > > >> + else if (Column > Mode->CursorColumn) { > > >> + mCursorForwardString[FW_BACK_OFFSET + 0] =3D (CHAR16) ('0' + = ((Column - Mode- > > >>> CursorColumn) / 10)); > > >> + mCursorForwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' + = ((Column - Mode- > > >>> CursorColumn) % 10)); > > >> + String =3D mCursorForwardString; > > >> + } > > >> + else { > > >> + String =3D L""; // No cursor motion necessary > > >> + } > > >> + } > > >> + else { > > >> + mSetCursorPositionString[ROW_OFFSET + 0] =3D (CHAR16) ('0' += ((Row + 1) / > > 10)); > > >> + mSetCursorPositionString[ROW_OFFSET + 1] =3D (CHAR16) ('0' += ((Row + 1) % > > 10)); > > >> + mSetCursorPositionString[COLUMN_OFFSET + 0] =3D (CHAR16) ('0' += ((Column + 1) / > > >> 10)); > > >> + mSetCursorPositionString[COLUMN_OFFSET + 1] =3D (CHAR16) ('0' += ((Column + 1) % > > >> 10)); > > >> + String =3D mSetCursorPositionString; > > >> + } > > >> > > >> TerminalDevice->OutputEscChar =3D TRUE; > > >> - Status =3D This->OutputString (This, mSetCursorPositionString); > > >> + Status =3D This->OutputString (This, String); > > >> TerminalDevice->OutputEscChar =3D FALSE; > > >> > > >> if (EFI_ERROR (Status)) { > > >> -- > > >> 2.7.4 > > >> > > >> _______________________________________________ > > >> edk2-devel mailing list > > >> edk2-devel@lists.01.org > > >> https://lists.01.org/mailman/listinfo/edk2-devel > > > > > > -- > > > > Brian > > > > -------------------------------------------------------------------- > > > > "I have discovered that all human evil comes from this, man's being > > unable to sit still in a room." > > -- Blaise Pascal > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel