aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/video
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-03-17 14:10:43 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-03-17 14:10:43 +0000
commitae695978a69783a9aff38604daf3322e6709b379 (patch)
treeac2c4dd12d441f5ec7b639b71de356a6d4789459 /xen/drivers/video
parent5e827c9822dafd58156437977a12bd3d82f1f490 (diff)
downloadxen-ae695978a69783a9aff38604daf3322e6709b379.tar.gz
xen-ae695978a69783a9aff38604daf3322e6709b379.tar.bz2
xen-ae695978a69783a9aff38604daf3322e6709b379.zip
Improve graphical console performance
As it is pretty pointless to clear unused parts of a line over and over again, keep track of how much of a line was actually written to and avoid clearing parts of the screen that are known to already be clear. With this, scrolling speed becomes comparable to that of Linux' VESA console. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/drivers/video')
-rw-r--r--xen/drivers/video/vesa.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/xen/drivers/video/vesa.c b/xen/drivers/video/vesa.c
index bace5c625d..aa31d9b891 100644
--- a/xen/drivers/video/vesa.c
+++ b/xen/drivers/video/vesa.c
@@ -21,6 +21,7 @@ static void vesa_redraw_puts(const char *s);
static void vesa_scroll_puts(const char *s);
static unsigned char *lfb, *lbuf, *text_buf;
+static unsigned int *__initdata line_len;
static const struct font_desc *font;
static bool_t vga_compat;
static unsigned int pixel_on;
@@ -96,6 +97,10 @@ void __init vesa_init(void)
if ( !text_buf )
goto fail;
+ line_len = xmalloc_array(unsigned int, text_columns);
+ if ( !line_len )
+ goto fail;
+
if ( map_pages_to_xen(IOREMAP_VIRT_START,
vlfb_info.lfb_base >> PAGE_SHIFT,
vram_remap >> PAGE_SHIFT,
@@ -104,6 +109,7 @@ void __init vesa_init(void)
lfb = memset((void *)IOREMAP_VIRT_START, 0, vram_remap);
memset(text_buf, 0, text_columns * text_rows);
+ memset(line_len, 0, text_columns * sizeof(*line_len));
vga_puts = vesa_redraw_puts;
@@ -144,6 +150,7 @@ void __init vesa_init(void)
fail:
xfree(lbuf);
xfree(text_buf);
+ xfree(line_len);
}
void __init vesa_endboot(bool_t keep)
@@ -160,6 +167,8 @@ void __init vesa_endboot(bool_t keep)
memset(lfb + i * vlfb_info.bytes_per_line, 0,
vlfb_info.width * bpp);
}
+
+ xfree(line_len);
}
#if defined(CONFIG_X86)
@@ -212,7 +221,8 @@ static void lfb_flush(void)
static void vesa_show_line(
const unsigned char *text_line,
unsigned char *video_line,
- unsigned int nr_chars)
+ unsigned int nr_chars,
+ unsigned int nr_cells)
{
unsigned int i, j, b, bpp, pixel;
@@ -236,13 +246,13 @@ static void vesa_show_line(
}
memset(ptr, 0, (vlfb_info.width - nr_chars * font->width) * bpp);
- memcpy(video_line, lbuf, vlfb_info.width * bpp);
+ memcpy(video_line, lbuf, nr_cells * font->width * bpp);
video_line += vlfb_info.bytes_per_line;
}
}
/* Fast mode which redraws all modified parts of a 2D text buffer. */
-static void vesa_redraw_puts(const char *s)
+static void __init vesa_redraw_puts(const char *s)
{
unsigned int i, min_redraw_y = ypos;
char c;
@@ -269,9 +279,18 @@ static void vesa_redraw_puts(const char *s)
/* Render modified section of text buffer to VESA linear framebuffer. */
for ( i = min_redraw_y; i <= ypos; i++ )
- vesa_show_line(text_buf + i * text_columns,
+ {
+ const unsigned char *line = text_buf + i * text_columns;
+ unsigned int width;
+
+ for ( width = text_columns; width; --width )
+ if ( line[width - 1] )
+ break;
+ vesa_show_line(line,
lfb + i * font->height * vlfb_info.bytes_per_line,
- text_columns);
+ width, max(line_len[i], width));
+ line_len[i] = width;
+ }
lfb_flush();
}
@@ -303,7 +322,7 @@ static void vesa_scroll_puts(const char *s)
vesa_show_line(
text_buf,
lfb + (text_rows-1) * font->height * vlfb_info.bytes_per_line,
- xpos);
+ xpos, text_columns);
xpos = 0;
}