summaryrefslogtreecommitdiff
path: root/drivers/video/console
diff options
context:
space:
mode:
authorManuel Schölling <manuel.schoelling@gmx.de>2017-01-13 21:07:56 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-25 11:54:02 +0100
commitbcd375f7f71f7106c97516bf5395149954ef8810 (patch)
treed3622fbb8a88f55aa8223c343e6dcb9b81d6740c /drivers/video/console
parent66da39eb91b42ab70dd49ef0b9ac5f4cfa76c9c3 (diff)
console: Add callback to flush scrollback buffer to consw struct
This new callback is in preparation for persistent scrollback buffer support for VGA consoles. With a single scrollback buffer for all consoles, we could flush the buffer just by invocating consw->con_switch(). But when each VGA console has its own scrollback buffer, we need a new callback to tell the video console driver which buffer to flush. Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de> Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/vgacon.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 48b97648d4af..9a7c2bbc5326 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -173,6 +173,16 @@ static struct vgacon_scrollback_info {
int restore;
} vgacon_scrollback;
+static void vgacon_scrollback_reset(size_t reset_size)
+{
+ if (vgacon_scrollback.data && reset_size > 0)
+ memset(vgacon_scrollback.data, 0, reset_size);
+
+ vgacon_scrollback.cnt = 0;
+ vgacon_scrollback.tail = 0;
+ vgacon_scrollback.cur = 0;
+}
+
static void vgacon_scrollback_init(int pitch)
{
int rows = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024/pitch;
@@ -305,6 +315,14 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)
} else
vgacon_cursor(c, CM_MOVE);
}
+
+static void vgacon_flush_scrollback(struct vc_data *c)
+{
+ size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
+
+ if (c->vc_num == fg_console)
+ vgacon_scrollback_reset(size);
+}
#else
#define vgacon_scrollback_startup(...) do { } while (0)
#define vgacon_scrollback_init(...) do { } while (0)
@@ -322,6 +340,10 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)
vga_vram_size);
vga_set_mem_top(c);
}
+
+static void vgacon_flush_scrollback(struct vc_data *c)
+{
+}
#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */
static const char *vgacon_startup(void)
@@ -1329,7 +1351,6 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
return true;
}
-
/*
* The console `switch' structure for the VGA based console
*/
@@ -1362,6 +1383,7 @@ const struct consw vga_con = {
.con_save_screen = vgacon_save_screen,
.con_build_attr = vgacon_build_attr,
.con_invert_region = vgacon_invert_region,
+ .con_flush_scrollback = vgacon_flush_scrollback,
};
EXPORT_SYMBOL(vga_con);