render / rpms / edk2

Forked from rpms/edk2 2 months ago
Clone
Blob Blame History Raw
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 25 Feb 2014 18:40:35 +0100
Subject: [PATCH] MdeModulePkg: TerminalDxe: add other text resolutions

When the console output is multiplexed to several devices by
ConSplitterDxe, then ConSplitterDxe builds an intersection of text modes
supported by all console output devices.

Two notable output devices are provided by:
(1) MdeModulePkg/Universal/Console/GraphicsConsoleDxe,
(2) MdeModulePkg/Universal/Console/TerminalDxe.

GraphicsConsoleDxe supports four modes at most -- see
InitializeGraphicsConsoleTextMode():

(1a) 80x25 (required by the UEFI spec as mode 0),
(1b) 80x50 (not necessarily supported, but if it is, then the UEFI spec
     requires the driver to provide it as mode 1),
(1c) 100x31 (corresponding to graphics resolution 800x600, which the UEFI
     spec requires from all plug-in graphics devices),
(1d) "full screen" resolution, derived form the underlying GOP's
     horizontal and vertical resolutions with division by EFI_GLYPH_WIDTH
     (8) and EFI_GLYPH_HEIGHT (19), respectively.

The automatic "full screen resolution" makes GraphicsConsoleDxe's
character console very flexible. However, TerminalDxe (which runs on
serial ports) only provides the following fixed resolutions -- see
InitializeTerminalConsoleTextMode():

(2a) 80x25 (required by the UEFI spec as mode 0),
(2b) 80x50 (since the character resolution of a serial device cannot be
    interrogated easily, this is added unconditionally as mode 1)
(2c) modes 2 and above come from "mTerminalConsoleModeData". This table
     currently only contains one mode, 100x31.

When ConSplitterDxe combines (1) and (2), multiplexing console output to
both video output and serial terminal, the list of commonly supported text
modes (ie. the "intersection") comprises:

(3a) 80x25, unconditionally, from (1a) and (2a),
(3b) 80x50, if the graphics console provides at least 640x950 pixel
     resolution, from (1b) and (2b)
(3c) 100x31, if the graphics device is a plug-in one (because in that case
     800x600 is a mandated pixel resolution), from (1c) and (2c).

Unfortunately, the "full screen resolution" (1d) of the GOP-based text
console is not available in general.

Mitigate this problem by extending "mTerminalConsoleModeData" with a
handful of text resolutions that are derived from widespread maximal pixel
resolutions. This way TerminalDxe won't cause ConSplitterDxe to filter out
the most frequent (1d) values from the intersection, and eg. the MODE
command in the UEFI shell will offer the "best" (ie. full screen)
resolution too.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 .../Universal/Console/TerminalDxe/Terminal.c       | 37 +++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index 3f445f0..2537e27 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -103,7 +103,42 @@ TERMINAL_DEV  mTerminalDevTemplate = {
 };
 
 TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = {
-  {100, 31},
+  {  100,  25 }, // from graphics resolution  800 x  480
+  {  100,  31 }, // from graphics resolution  800 x  600
+  {  104,  32 }, // from graphics resolution  832 x  624
+  {  120,  33 }, // from graphics resolution  960 x  640
+  {  128,  31 }, // from graphics resolution 1024 x  600
+  {  128,  40 }, // from graphics resolution 1024 x  768
+  {  144,  45 }, // from graphics resolution 1152 x  864
+  {  144,  45 }, // from graphics resolution 1152 x  870
+  {  160,  37 }, // from graphics resolution 1280 x  720
+  {  160,  40 }, // from graphics resolution 1280 x  760
+  {  160,  40 }, // from graphics resolution 1280 x  768
+  {  160,  42 }, // from graphics resolution 1280 x  800
+  {  160,  50 }, // from graphics resolution 1280 x  960
+  {  160,  53 }, // from graphics resolution 1280 x 1024
+  {  170,  40 }, // from graphics resolution 1360 x  768
+  {  170,  40 }, // from graphics resolution 1366 x  768
+  {  175,  55 }, // from graphics resolution 1400 x 1050
+  {  180,  47 }, // from graphics resolution 1440 x  900
+  {  200,  47 }, // from graphics resolution 1600 x  900
+  {  200,  63 }, // from graphics resolution 1600 x 1200
+  {  210,  55 }, // from graphics resolution 1680 x 1050
+  {  240,  56 }, // from graphics resolution 1920 x 1080
+  {  240,  63 }, // from graphics resolution 1920 x 1200
+  {  240,  75 }, // from graphics resolution 1920 x 1440
+  {  250, 105 }, // from graphics resolution 2000 x 2000
+  {  256,  80 }, // from graphics resolution 2048 x 1536
+  {  256, 107 }, // from graphics resolution 2048 x 2048
+  {  320,  75 }, // from graphics resolution 2560 x 1440
+  {  320,  84 }, // from graphics resolution 2560 x 1600
+  {  320, 107 }, // from graphics resolution 2560 x 2048
+  {  350, 110 }, // from graphics resolution 2800 x 2100
+  {  400, 126 }, // from graphics resolution 3200 x 2400
+  {  480, 113 }, // from graphics resolution 3840 x 2160
+  {  512, 113 }, // from graphics resolution 4096 x 2160
+  {  960, 227 }, // from graphics resolution 7680 x 4320
+  { 1024, 227 }, // from graphics resolution 8192 x 4320
   //
   // New modes can be added here.
   //