From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JqQfN-0002gL-9E for qemu-devel@nongnu.org; Mon, 28 Apr 2008 06:33:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JqQfI-0002ev-DT for qemu-devel@nongnu.org; Mon, 28 Apr 2008 06:32:57 -0400 Received: from [199.232.76.173] (port=51888 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JqQfH-0002eV-Nt for qemu-devel@nongnu.org; Mon, 28 Apr 2008 06:32:56 -0400 Received: from smtp.ctxuk.citrix.com ([62.200.22.115] helo=SMTP.EU.CITRIX.COM) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JqQfH-0001VR-3q for qemu-devel@nongnu.org; Mon, 28 Apr 2008 06:32:55 -0400 Received: from samy by implementation.famille.thibault.fr with local (Exim 4.69) (envelope-from ) id 1JqQfG-0001Yb-4O for qemu-devel@nongnu.org; Mon, 28 Apr 2008 12:32:54 +0200 Date: Mon, 28 Apr 2008 11:32:49 +0100 From: Samuel Thibault Message-ID: <20080428103248.GE4537@implementation.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] Fix spurious VGA 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 Hello, VGA used to use bwidth = width * 4; to detect how much memory it should check for dirtyness for each line to be updated. This is however only valid in 32bit modes. The patch below fixes that by using the exact number of bytes. Index: hw/vga.c =================================================================== --- hw/vga.c (révision 4276) +++ hw/vga.c (copie de travail) @@ -1418,7 +1418,7 @@ static void vga_draw_graphic(VGAState *s, int full_update) { int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask; - int width, height, shift_control, line_offset, page0, page1, bwidth; + int width, height, shift_control, line_offset, page0, page1, bwidth, bits; int disp_width, multi_scan, multi_run; uint8_t *d; uint32_t v, addr1, addr; @@ -1451,16 +1451,20 @@ if (s->sr[0x01] & 8) { v = VGA_DRAW_LINE4D2; disp_width <<= 1; + bits = 2; } else { v = VGA_DRAW_LINE4; + bits = 4; } } else if (shift_control == 1) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { v = VGA_DRAW_LINE2D2; disp_width <<= 1; + bits = 2; } else { v = VGA_DRAW_LINE2; + bits = 4; } } else { switch(s->get_bpp(s)) { @@ -1468,22 +1472,28 @@ case 0: full_update |= update_palette256(s); v = VGA_DRAW_LINE8D2; + bits = 4; break; case 8: full_update |= update_palette256(s); v = VGA_DRAW_LINE8; + bits = 8; break; case 15: v = VGA_DRAW_LINE15; + bits = 16; break; case 16: v = VGA_DRAW_LINE16; + bits = 16; break; case 24: v = VGA_DRAW_LINE24; + bits = 24; break; case 32: v = VGA_DRAW_LINE32; + bits = 32; break; } } @@ -1507,7 +1517,7 @@ width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); #endif addr1 = (s->start_addr * 4); - bwidth = width * 4; + bwidth = (width * bits + 7) / 8; y_start = -1; page_min = 0x7fffffff; page_max = -1;