This patch adds support for persistent console history, surviving
console switches. It allocates new scrollback buffer only when
user switches console for the first time.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: linux-fbdev-devel@lists.sourceforge.net
---
drivers/video/console/Kconfig | 11 ++++++
drivers/video/console/vgacon.c | 75 +++++++++++++++++++++++++++++++++++++--
2 files changed, 82 insertions(+), 4 deletions(-)
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 06f87b0..9efb885 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -43,6 +43,17 @@ config VGACON_SOFT_SCROLLBACK_SIZE
buffer. Each 64KB will give you approximately 16 80x25
screenfuls of scrollback buffer
+config VGACON_REMEMBER_SCROLLBACK
+ bool "Remember scrollback buffer on console switch"
+ depends on VGACON_SOFT_SCROLLBACK
+ default y
+ help
+ Say 'Y' here if you want the scrollback buffer to be remembered
+ on console switch and restored when you switch back.
+
+ Note: every VGA console will use its own buffer, but it will be
+ allocated only when you switch to this console for the first time.
+
config VIDEO_SELECT
bool "Video mode selection support"
depends on X86 && VGA_CONSOLE
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index a785f99..94ce971 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -174,9 +174,11 @@ static int vgacon_scrollback_cur;
static int vgacon_scrollback_save;
static int vgacon_scrollback_restore;
+#define SCROLLBACK_SIZE (CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024)
+
static void vgacon_scrollback_init(int pitch)
{
- int rows = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024/pitch;
+ int rows = SCROLLBACK_SIZE / pitch;
if (vgacon_scrollback) {
vgacon_scrollback_cnt = 0;
@@ -187,15 +189,76 @@ static void vgacon_scrollback_init(int pitch)
}
}
...