diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-21 03:02:52 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-21 03:02:52 +0000 |
commit | 14778c2064166a8d1d07b22f0af9eee4fa490e60 (patch) | |
tree | 49df9fefcd3ceaf5e1ffa78737e88b286d4907c6 /console.c | |
parent | 6e60065f882d0e552bab1920402780b000a63700 (diff) | |
download | qemu-14778c2064166a8d1d07b22f0af9eee4fa490e60.tar.gz qemu-14778c2064166a8d1d07b22f0af9eee4fa490e60.tar.bz2 qemu-14778c2064166a8d1d07b22f0af9eee4fa490e60.zip |
Coalesce virtual console screen updates.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6374 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'console.c')
-rw-r--r-- | console.c | 40 |
1 files changed, 33 insertions, 7 deletions
@@ -139,6 +139,11 @@ struct TextConsole { TextCell *cells; int text_x[2], text_y[2], cursor_invalidate; + int update_x0; + int update_y0; + int update_x1; + int update_y1; + enum TTYState state; int esc_params[MAX_ESC_PARAMS]; int nb_esc_params; @@ -537,6 +542,18 @@ static inline void text_update_xy(TextConsole *s, int x, int y) s->text_y[1] = MAX(s->text_y[1], y); } +static void invalidate_xy(TextConsole *s, int x, int y) +{ + if (s->update_x0 > x * FONT_WIDTH) + s->update_x0 = x * FONT_WIDTH; + if (s->update_y0 > y * FONT_HEIGHT) + s->update_y0 = y * FONT_HEIGHT; + if (s->update_x1 < (x + 1) * FONT_WIDTH) + s->update_x1 = (x + 1) * FONT_WIDTH; + if (s->update_y1 < (y + 1) * FONT_HEIGHT) + s->update_y1 = (y + 1) * FONT_HEIGHT; +} + static void update_xy(TextConsole *s, int x, int y) { TextCell *c; @@ -556,8 +573,7 @@ static void update_xy(TextConsole *s, int x, int y) c = &s->cells[y1 * s->width + x]; vga_putcharxy(s->ds, x, y2, c->ch, &(c->t_attrib)); - dpy_update(s->ds, x * FONT_WIDTH, y2 * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); + invalidate_xy(s, x, y2); } } } @@ -591,8 +607,7 @@ static void console_show_cursor(TextConsole *s, int show) } else { vga_putcharxy(s->ds, x, y, c->ch, &(c->t_attrib)); } - dpy_update(s->ds, x * FONT_WIDTH, y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); + invalidate_xy(s, x, y); } } } @@ -626,8 +641,8 @@ static void console_refresh(TextConsole *s) if (++y1 == s->total_height) y1 = 0; } - dpy_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds)); console_show_cursor(s, 1); + dpy_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds)); } static void console_scroll(int ydelta) @@ -703,8 +718,10 @@ static void console_put_lf(TextConsole *s) vga_fill_rect(s->ds, 0, (s->height - 1) * FONT_HEIGHT, s->width * FONT_WIDTH, FONT_HEIGHT, color_table[0][s->t_attrib_default.bgcol]); - dpy_update(s->ds, 0, 0, - s->width * FONT_WIDTH, s->height * FONT_HEIGHT); + s->update_x0 = 0; + s->update_y0 = 0; + s->update_x1 = s->width * FONT_WIDTH; + s->update_y1 = s->height * FONT_HEIGHT; } } } @@ -1062,11 +1079,20 @@ static int console_puts(CharDriverState *chr, const uint8_t *buf, int len) TextConsole *s = chr->opaque; int i; + s->update_x0 = s->width * FONT_WIDTH; + s->update_y0 = s->height * FONT_HEIGHT; + s->update_x1 = 0; + s->update_y1 = 0; console_show_cursor(s, 0); for(i = 0; i < len; i++) { console_putchar(s, buf[i]); } console_show_cursor(s, 1); + if (ds_get_bits_per_pixel(s->ds) && s->update_x0 < s->update_x1) { + dpy_update(s->ds, s->update_x0, s->update_y0, + s->update_x1 - s->update_x0, + s->update_y1 - s->update_y0); + } return len; } |