]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/GraphicsConsoleDxe: Initialize the output mode
authorZhichao Gao <zhichao.gao@intel.com>
Tue, 30 Apr 2019 06:51:34 +0000 (14:51 +0800)
committerHao A Wu <hao.a.wu@intel.com>
Thu, 13 Jun 2019 06:53:40 +0000 (14:53 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1412

Original logic:
Connect the graphics device -> connect it as graphics consoles
and initialize its parameters(Mode = -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*)

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*).

Also remove the section of SetMode for debug version.

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".

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf

index 26ea19f300aab95788a89efce198f53bcdf92fb6..c042451a9b5234baf309d7626c5a41755355fb8e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This is the main routine for initializing the Graphics Console support routines.\r
 \r
 /** @file\r
   This is the main routine for initializing the Graphics Console support routines.\r
 \r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -384,6 +384,12 @@ GraphicsConsoleControllerDriverStart (
   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE    *Mode;\r
   UINTN                                SizeOfInfo;\r
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE    *Mode;\r
   UINTN                                SizeOfInfo;\r
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
+  INT32                                PreferMode;\r
+  INT32                                Index;\r
+  UINTN                                Column;\r
+  UINTN                                Row;\r
+  UINTN                                DefaultColumn;\r
+  UINTN                                DefaultRow;\r
 \r
   ModeNumber = 0;\r
 \r
 \r
   ModeNumber = 0;\r
 \r
@@ -567,16 +573,32 @@ GraphicsConsoleControllerDriverStart (
   //\r
   Private->SimpleTextOutputMode.MaxMode = (INT32) MaxMode;\r
 \r
   //\r
   Private->SimpleTextOutputMode.MaxMode = (INT32) MaxMode;\r
 \r
-  DEBUG_CODE_BEGIN ();\r
-    Status = GraphicsConsoleConOutSetMode (&Private->SimpleTextOutput, 0);\r
-    if (EFI_ERROR (Status)) {\r
-      goto Error;\r
-    }\r
-    Status = GraphicsConsoleConOutOutputString (&Private->SimpleTextOutput, (CHAR16 *)L"Graphics Console Started\n\r");\r
-    if (EFI_ERROR (Status)) {\r
-      goto Error;\r
+  //\r
+  // Initialize the Mode of graphics console devices\r
+  //\r
+  PreferMode = -1;\r
+  DefaultColumn = PcdGet32 (PcdConOutColumn);\r
+  DefaultRow = PcdGet32 (PcdConOutRow);\r
+  Column = 0;\r
+  Row = 0;\r
+  for (Index = 0; Index < (INT32)MaxMode; Index++) {\r
+    if (DefaultColumn != 0 && DefaultRow != 0) {\r
+      if ((Private->ModeData[Index].Columns == DefaultColumn) &&\r
+          (Private->ModeData[Index].Rows == DefaultRow)) {\r
+        PreferMode = Index;\r
+        break;\r
+      }\r
+    } else {\r
+      if ((Private->ModeData[Index].Columns > Column) &&\r
+          (Private->ModeData[Index].Rows > Row)) {\r
+        Column = Private->ModeData[Index].Columns;\r
+        Row = Private->ModeData[Index].Rows;\r
+        PreferMode = Index;\r
+      }\r
     }\r
     }\r
-  DEBUG_CODE_END ();\r
+  }\r
+  Private->SimpleTextOutput.Mode->Mode = (INT32)PreferMode;\r
+  DEBUG ((DEBUG_INFO, "Graphics Console Started, Mode: %d\n", PreferMode));\r
 \r
   //\r
   // Install protocol interfaces for the Graphics Console device.\r
 \r
   //\r
   // Install protocol interfaces for the Graphics Console device.\r
index f7caa65aa9d9078eb4e145ca6beb8b21af406783..bcfd306eee138ff9ed98bb70e05549609ef2f4cf 100644 (file)
@@ -65,6 +65,8 @@
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution   ## SOMETIMES_CONSUMES\r
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution   ## SOMETIMES_CONSUMES\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow                 ## SOMETIMES_CONSUMES\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn              ## SOMETIMES_CONSUMES\r
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   GraphicsConsoleDxeExtra.uni\r
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   GraphicsConsoleDxeExtra.uni\r