From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 49D981A1DE9 for ; Wed, 26 Oct 2016 22:06:55 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 26 Oct 2016 22:06:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,404,1473145200"; d="scan'208";a="1076441204" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 26 Oct 2016 22:06:56 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 22:06:54 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 22:06:54 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.104]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.209]) with mapi id 14.03.0248.002; Thu, 27 Oct 2016 13:06:52 +0800 From: "Tian, Feng" To: "Kinney, Michael D" , "Brian J. Johnson" , "edk2-devel@lists.01.org" CC: "Zeng, Star" , "Tian, Feng" Thread-Topic: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion Thread-Index: AQHSIKqwwrAyFr7zqU6F7N4dkvD516C7N6KAgACbH0A= Date: Thu, 27 Oct 2016 05:06:50 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE566E39766@SHSMSX101.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] 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 05:06:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Mike, You are right, the VS2015x64 IA32 build would fail. With your fix, the code could pass build. If there is no objection, I will help to push this fix tomorrow after addin= g EDKII commit log with your Sign-off and my Review-by. Thanks Feng -----Original Message----- From: Kinney, Michael D=20 Sent: Thursday, October 27, 2016 11:10 AM To: Brian J. Johnson ; edk2-devel@lists.01.org; Kinney, M= ichael D Cc: Tian, Feng ; Zeng, Star Subject: RE: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm = cursor motion Tian Feng, Unfortunately, this patch that was pushed to edk2/master today breaks on IA= 32 VS2015x86 builds with a signed/unsigned mismatch on 3 lines. I think th= e right fix might be: diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.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' + ((Colum= n - Mode->CursorColumn) / 10)); mCursorForwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' + ((Colum= n - Mode->CursorColumn) % 10)); String =3D mCursorForwardString; Please see if you can reproduce this issue. Thanks, Mike > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Brian J. Johnson > Sent: Friday, October 7, 2016 7:54 AM > To: edk2-devel@lists.01.org > Cc: Brian J. Johnson ; Tian, Feng=20 > ; Zeng, Star > Subject: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm=20 > cursor motion >=20 > For TtyTerm terminals, output a shorter escape sequence when possible=20 > to move the cursor within the current line, and don't print any escape=20 > sequence if the cursor is already at the correct position. This=20 > removes extra cursor motion activity at the EFI shell prompt,=20 > improving performance. It also makes it possible in many cases to=20 > successfully use a terminal window which is taller than the driver's=20 > mode setting (eg. 80x25.) >=20 > 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=20 > +++++++++++++++++++--- > 2 files changed, 33 insertions(+), 5 deletions(-) >=20 > 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. >=20 > Copyright (c) 2006 - 2014, Intel Corporation. All rights=20 > reserved.
> +Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
> This program and the accompanying materials are licensed and made=20 > available under the terms and conditions of the BSD License which=20 > accompanies this distribution. The full text of the license may be=20 > found at @@ -157,6 +158,7 @@ typedef union { #define=20 > BACKGROUND_CONTROL_OFFSET 11 > #define ROW_OFFSET 2 > #define COLUMN_OFFSET 5 > +#define FW_BACK_OFFSET 2 >=20 > typedef struct { > UINT16 Unicode; > diff --git=20 > a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.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',=20 > '0', 'H', 0 }; > +CHAR16 mCursorForwardString[] =3D { ESC, '[', '0', '0', 'C', 0 }; > +CHAR16 mCursorBackwardString[] =3D { ESC, '[', '0', '0', 'D', 0 }; >=20 > // > // Body of the ConOut functions > @@ -755,6 +757,7 @@ TerminalConOutSetCursorPosition ( > UINTN MaxRow; > EFI_STATUS Status; > TERMINAL_DEV *TerminalDevice; > + CHAR16 *String; >=20 > TerminalDevice =3D TERMINAL_CON_OUT_DEV_FROM_THIS (This); >=20 > @@ -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' +=20 > ((Column + 1) / 10)); > - mSetCursorPositionString[COLUMN_OFFSET + 1] =3D (CHAR16) ('0' +=20 > ((Column + 1) % 10)); > + // Optimize cursor motion control sequences for TtyTerm. Move //=20 > + within the current line if possible, and don't output anyting if //=20 > + 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' +=20 > + ((Mode->CursorColumn > - Column) / 10)); > + mCursorBackwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' +=20 > + ((Mode->CursorColumn > - Column) % 10)); > + String =3D mCursorBackwardString; > + } > + else if (Column > Mode->CursorColumn) { > + mCursorForwardString[FW_BACK_OFFSET + 0] =3D (CHAR16) ('0' +=20 > + ((Column - Mode- > >CursorColumn) / 10)); > + mCursorForwardString[FW_BACK_OFFSET + 1] =3D (CHAR16) ('0' +=20 > + ((Column - Mode- > >CursorColumn) % 10)); > + String =3D mCursorForwardString; > + } > + else { > + String =3D L""; // No cursor motion necessary > + } > + } > + else { > + mSetCursorPositionString[ROW_OFFSET + 0] =3D (CHAR16) ('0' + ((Ro= w + 1) / 10)); > + mSetCursorPositionString[ROW_OFFSET + 1] =3D (CHAR16) ('0' + ((Ro= w + 1) % 10)); > + mSetCursorPositionString[COLUMN_OFFSET + 0] =3D (CHAR16) ('0' +=20 > + ((Column + 1) / > 10)); > + mSetCursorPositionString[COLUMN_OFFSET + 1] =3D (CHAR16) ('0' +=20 > + ((Column + 1) % > 10)); > + String =3D mSetCursorPositionString; } >=20 > TerminalDevice->OutputEscChar =3D TRUE; > - Status =3D This->OutputString (This, mSetCursorPositionString); > + Status =3D This->OutputString (This, String); > TerminalDevice->OutputEscChar =3D FALSE; >=20 > if (EFI_ERROR (Status)) { > -- > 2.7.4 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel