render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

Blame SOURCES/0007-MdeModulePkg-TerminalDxe-set-xterm-resolution-on-mod.patch

7fdf80
From cfccb98d13e955beb0b93b4a75a973f30c273ffc Mon Sep 17 00:00:00 2001
7fdf80
From: Laszlo Ersek <lersek@redhat.com>
7fdf80
Date: Tue, 25 Feb 2014 22:40:01 +0100
7fdf80
Subject: MdeModulePkg: TerminalDxe: set xterm resolution on mode change (RH
7fdf80
 only)
7fdf80
7fdf80
Notes about the RHEL-8.0/20180508-ee3198e672e2 ->
7fdf80
RHEL-8.1/20190308-89910a39dcfd rebase:
7fdf80
7fdf80
- no change
7fdf80
7fdf80
Notes about the RHEL-7.6/ovmf-20180508-2.gitee3198e672e2.el7 ->
7fdf80
RHEL-8.0/20180508-ee3198e672e2 rebase:
7fdf80
7fdf80
- reorder the rebase changelog in the commit message so that it reads like
7fdf80
  a blog: place more recent entries near the top
7fdf80
- no changes to the patch body
7fdf80
7fdf80
Notes about the 20171011-92d07e48907f -> 20180508-ee3198e672e2 rebase:
7fdf80
7fdf80
- no change
7fdf80
7fdf80
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
7fdf80
7fdf80
- Refresh downstream-only commit 2909e025db68 against "MdeModulePkg.dec"
7fdf80
  context change from upstream commits e043f7895b83 ("MdeModulePkg: Add
7fdf80
  PCD PcdPteMemoryEncryptionAddressOrMask", 2017-02-27) and 76081dfcc5b2
7fdf80
  ("MdeModulePkg: Add PROMPT&HELP string of pcd to UNI file", 2017-03-03).
7fdf80
7fdf80
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
7fdf80
7fdf80
- refresh commit 519b9751573e against various context changes
7fdf80
7fdf80
The
7fdf80
7fdf80
  CSI Ps ; Ps ; Ps t
7fdf80
7fdf80
escape sequence serves for window manipulation. We can use the
7fdf80
7fdf80
  CSI 8 ; <rows> ; <columns> t
7fdf80
7fdf80
sequence to adapt eg. the xterm window size to the selected console mode.
7fdf80
7fdf80
Reference: <http://rtfm.etla.org/xterm/ctlseq.html>
7fdf80
Contributed-under: TianoCore Contribution Agreement 1.0
7fdf80
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
7fdf80
(cherry picked from commit 2909e025db6878723b49644a8a0cf160d07e6444)
7fdf80
(cherry picked from commit b9c5c901f25e48d68eef6e78a4abca00e153f574)
7fdf80
(cherry picked from commit b7f6115b745de8cbc5214b6ede33c9a8558beb90)
7fdf80
(cherry picked from commit 67415982afdc77922aa37496c981adeb4351acdb)
7fdf80
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
7fdf80
---
7fdf80
 MdeModulePkg/MdeModulePkg.dec                 |  4 +++
7fdf80
 .../Console/TerminalDxe/TerminalConOut.c      | 30 +++++++++++++++++++
7fdf80
 .../Console/TerminalDxe/TerminalDxe.inf       |  2 ++
7fdf80
 3 files changed, 36 insertions(+)
7fdf80
7fdf80
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
7fdf80
index a2130bc439..dcd118ba62 100644
7fdf80
--- a/MdeModulePkg/MdeModulePkg.dec
7fdf80
+++ b/MdeModulePkg/MdeModulePkg.dec
7fdf80
@@ -1968,6 +1968,10 @@
7fdf80
   # @Prompt The address mask when memory encryption is enabled.
7fdf80
   gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0|UINT64|0x30001047
7fdf80
 
7fdf80
+  ## Controls whether TerminalDxe outputs an XTerm resize sequence on terminal
7fdf80
+  #  mode change.
7fdf80
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080
7fdf80
+
7fdf80
 [PcdsPatchableInModule]
7fdf80
   ## Specify memory size with page number for PEI code when
7fdf80
   #  Loading Module at Fixed Address feature is enabled.
7fdf80
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
7fdf80
index 4d7218e415..295e7641a5 100644
7fdf80
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
7fdf80
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
7fdf80
@@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
7fdf80
 
7fdf80
 **/
7fdf80
 
7fdf80
+#include <Library/PrintLib.h>
7fdf80
+
7fdf80
 #include "Terminal.h"
7fdf80
 
7fdf80
 //
7fdf80
@@ -86,6 +88,16 @@ CHAR16 mSetCursorPositionString[]  = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0
7fdf80
 CHAR16 mCursorForwardString[]      = { ESC, '[', '0', '0', 'C', 0 };
7fdf80
 CHAR16 mCursorBackwardString[]     = { ESC, '[', '0', '0', 'D', 0 };
7fdf80
 
7fdf80
+//
7fdf80
+// Note that this is an ASCII format string, taking two INT32 arguments:
7fdf80
+// rows, columns.
7fdf80
+//
7fdf80
+// A %d (INT32) format specification can expand to at most 11 characters.
7fdf80
+//
7fdf80
+CHAR8 mResizeTextAreaFormatString[] = "\x1B[8;%d;%dt";
7fdf80
+#define RESIZE_SEQ_SIZE (sizeof mResizeTextAreaFormatString + 2 * (11 - 2))
7fdf80
+
7fdf80
+
7fdf80
 //
7fdf80
 // Body of the ConOut functions
7fdf80
 //
7fdf80
@@ -508,6 +520,24 @@ TerminalConOutSetMode (
7fdf80
     return EFI_DEVICE_ERROR;
7fdf80
   }
7fdf80
 
7fdf80
+  if (PcdGetBool (PcdResizeXterm)) {
7fdf80
+    CHAR16 ResizeSequence[RESIZE_SEQ_SIZE];
7fdf80
+
7fdf80
+    UnicodeSPrintAsciiFormat (
7fdf80
+      ResizeSequence,
7fdf80
+      sizeof ResizeSequence,
7fdf80
+      mResizeTextAreaFormatString,
7fdf80
+      (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows,
7fdf80
+      (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns
7fdf80
+      );
7fdf80
+    TerminalDevice->OutputEscChar = TRUE;
7fdf80
+    Status                        = This->OutputString (This, ResizeSequence);
7fdf80
+    TerminalDevice->OutputEscChar = FALSE;
7fdf80
+    if (EFI_ERROR (Status)) {
7fdf80
+      return EFI_DEVICE_ERROR;
7fdf80
+    }
7fdf80
+  }
7fdf80
+
7fdf80
   This->Mode->Mode  = (INT32) ModeNumber;
7fdf80
 
7fdf80
   Status            = This->ClearScreen (This);
7fdf80
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
7fdf80
index 15b4ac1c33..a704bc17e5 100644
7fdf80
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
7fdf80
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
7fdf80
@@ -60,6 +60,7 @@
7fdf80
   DebugLib
7fdf80
   PcdLib
7fdf80
   BaseLib
7fdf80
+  PrintLib
7fdf80
 
7fdf80
 [Guids]
7fdf80
   ## SOMETIMES_PRODUCES ## Variable:L"ConInDev"
7fdf80
@@ -88,6 +89,7 @@
7fdf80
 [Pcd]
7fdf80
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType           ## SOMETIMES_CONSUMES
7fdf80
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable    ## CONSUMES
7fdf80
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm             ## CONSUMES
7fdf80
 
7fdf80
 # [Event]
7fdf80
 # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds input timeout.
7fdf80
-- 
7fdf80
2.18.1
7fdf80