From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: hao.a.wu@intel.com) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Sun, 26 May 2019 18:51:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 May 2019 18:51:14 -0700 X-ExtLoop1: 1 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 26 May 2019 18:51:15 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 26 May 2019 18:51:13 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 26 May 2019 18:51:13 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by shsmsx102.ccr.corp.intel.com ([169.254.2.249]) with mapi id 14.03.0415.000; Mon, 27 May 2019 09:51:11 +0800 From: "Wu, Hao A" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Ni, Ray" , "Zeng, Star" , "Gao, Liming" , Sean Brogan , Michael Turner , Bret Barkelew , Laszlo Ersek Subject: Re: [PATCH V4 2/2] MdeModulePkg/GraphicsConsoleDxe: Initialize the output mode Thread-Topic: [PATCH V4 2/2] MdeModulePkg/GraphicsConsoleDxe: Initialize the output mode Thread-Index: AQHVEdofaPpv8u9jcka2Esh3PRY6gqZ+OXQA Date: Mon, 27 May 2019 01:51:10 +0000 Message-ID: References: <20190524024009.31600-1-zhichao.gao@intel.com> <20190524024009.31600-3-zhichao.gao@intel.com> In-Reply-To: <20190524024009.31600-3-zhichao.gao@intel.com> 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 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Gao, Zhichao > Sent: Friday, May 24, 2019 10:40 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Gao, Liming; Sean Broga= n; > Michael Turner; Bret Barkelew; Laszlo Ersek > Subject: [PATCH V4 2/2] MdeModulePkg/GraphicsConsoleDxe: Initialize the > output mode >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1412 >=20 > Original logic: > Connect the graphics device -> connect it as graphics consoles > and initialize its parameters(Mode =3D -1, invalid) -> connect it > as console spliter and add the device to the list(use SetMode to > set mode to the user defined mode or the best mode the devices > supported if the mode is invalid. *clear the screen at this phase*) >=20 > Changed logic: > Connect the graphics device -> connect it as graphics consoles > and initialize its parameters(initialize the mode to the user > defined mode or the best mode. *directly set the mode value without > using SetMode, that would not clear the screen) -> connect it as > console spliter and add the device to the list(use SetMode to set > mode to the user defined mode or the best mode the devices supported > if the mode is invalid. *now the mode is already set, so it would > not clear the screen*). >=20 > Also remove the section of SetMode for debug version. >=20 > Impact: as the text mode may not be an invalid value, the SetMode > may have no chance to be called during reconnect the graphics device. > That means the screen may not be cleaned after finishing reconnect > operation. There is one common condition: shell command "recoonect -r". >=20 > Cc: Jian J Wang > Cc: Hao Wu > Cc: Ray Ni > Cc: Star Zeng > Cc: Liming Gao > Cc: Sean Brogan > Cc: Michael Turner > Cc: Bret Barkelew > Cc: Laszlo Ersek > Signed-off-by: Zhichao Gao > --- > .../GraphicsConsoleDxe/GraphicsConsole.c | 42 ++++++++++++++----- > .../GraphicsConsoleDxe/GraphicsConsoleDxe.inf | 2 + > 2 files changed, 34 insertions(+), 10 deletions(-) >=20 > diff --git > a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole > .c > b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsol > e.c > index 26ea19f300..c042451a9b 100644 > --- > a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole > .c > +++ > b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsol > e.c > @@ -1,7 +1,7 @@ > /** @file > This is the main routine for initializing the Graphics Console support= routines. >=20 > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -384,6 +384,12 @@ GraphicsConsoleControllerDriverStart ( > EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; > UINTN SizeOfInfo; > EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; > + INT32 PreferMode; > + INT32 Index; > + UINTN Column; > + UINTN Row; > + UINTN DefaultColumn; > + UINTN DefaultRow; >=20 > ModeNumber =3D 0; >=20 > @@ -567,16 +573,32 @@ GraphicsConsoleControllerDriverStart ( > // > Private->SimpleTextOutputMode.MaxMode =3D (INT32) MaxMode; >=20 > - DEBUG_CODE_BEGIN (); > - Status =3D GraphicsConsoleConOutSetMode (&Private->SimpleTextOutput, > 0); > - if (EFI_ERROR (Status)) { > - goto Error; > - } > - Status =3D GraphicsConsoleConOutOutputString (&Private- > >SimpleTextOutput, (CHAR16 *)L"Graphics Console Started\n\r"); > - if (EFI_ERROR (Status)) { > - goto Error; > + // > + // Initialize the Mode of graphics console devices > + // > + PreferMode =3D -1; > + DefaultColumn =3D PcdGet32 (PcdConOutColumn); > + DefaultRow =3D PcdGet32 (PcdConOutRow); > + Column =3D 0; > + Row =3D 0; > + for (Index =3D 0; Index < (INT32)MaxMode; Index++) { > + if (DefaultColumn !=3D 0 && DefaultRow !=3D 0) { > + if ((Private->ModeData[Index].Columns =3D=3D DefaultColumn) && > + (Private->ModeData[Index].Rows =3D=3D DefaultRow)) { > + PreferMode =3D Index; > + break; > + } > + } else { > + if ((Private->ModeData[Index].Columns > Column) && > + (Private->ModeData[Index].Rows > Row)) { > + Column =3D Private->ModeData[Index].Columns; > + Row =3D Private->ModeData[Index].Rows; > + PreferMode =3D Index; > + } > } > - DEBUG_CODE_END (); > + } > + Private->SimpleTextOutput.Mode->Mode =3D (INT32)PreferMode; > + DEBUG ((DEBUG_INFO, "Graphics Console Started, Mode: %d\n", > PreferMode)); The change looks good to me, Reviewed-by: Hao A Wu Best Regards, Hao Wu >=20 > // > // Install protocol interfaces for the Graphics Console device. > diff --git > a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole > Dxe.inf > b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsol > eDxe.inf > index f7caa65aa9..bcfd306eee 100644 > --- > a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole > Dxe.inf > +++ > b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsol > eDxe.inf > @@ -65,6 +65,8 @@ > [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## > SOMETIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## > SOMETIMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## > SOMETIMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## > SOMETIMES_CONSUMES >=20 > [UserExtensions.TianoCore."ExtraFiles"] > GraphicsConsoleDxeExtra.uni > -- > 2.21.0.windows.1