From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPTMm-0002sU-8r for qemu-devel@nongnu.org; Tue, 20 Jan 2009 22:02:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPTMl-0002sI-AC for qemu-devel@nongnu.org; Tue, 20 Jan 2009 22:02:55 -0500 Received: from [199.232.76.173] (port=54739 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPTMl-0002sF-5s for qemu-devel@nongnu.org; Tue, 20 Jan 2009 22:02:55 -0500 Received: from savannah.gnu.org ([199.232.41.3]:43547 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LPTMk-00082C-JV for qemu-devel@nongnu.org; Tue, 20 Jan 2009 22:02:54 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LPTMj-0003yU-Rb for qemu-devel@nongnu.org; Wed, 21 Jan 2009 03:02:53 +0000 Received: from pbrook by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LPTMj-0003yQ-Fh for qemu-devel@nongnu.org; Wed, 21 Jan 2009 03:02:53 +0000 MIME-Version: 1.0 Errors-To: pbrook Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Paul Brook Message-Id: Date: Wed, 21 Jan 2009 03:02:53 +0000 Subject: [Qemu-devel] [6374] Coalesce virtual console screen updates. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6374 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6374 Author: pbrook Date: 2009-01-21 03:02:52 +0000 (Wed, 21 Jan 2009) Log Message: ----------- Coalesce virtual console screen updates. Modified Paths: -------------- trunk/console.c Modified: trunk/console.c =================================================================== --- trunk/console.c 2009-01-21 01:50:17 UTC (rev 6373) +++ trunk/console.c 2009-01-21 03:02:52 UTC (rev 6374) @@ -139,6 +139,11 @@ 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 @@ 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 @@ 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 @@ } 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 @@ if (++y1 == s->total_height) y1 = 0; } + console_show_cursor(s, 1); dpy_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds)); - console_show_cursor(s, 1); } static void console_scroll(int ydelta) @@ -703,8 +718,10 @@ 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 @@ 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; }