Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FdYKH-0000OW-1v for qemu-devel@nongnu.org; Tue, 09 May 2006 15:56:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FdYKG-0000OD-44 for qemu-devel@nongnu.org; Tue, 09 May 2006 15:56:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FdYKF-0000Nz-WE for qemu-devel@nongnu.org; Tue, 09 May 2006 15:56:56 -0400 Received: from [134.134.136.20] (helo=orsmga101-1.jf.intel.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FdYLN-0003nP-8J for qemu-devel@nongnu.org; Tue, 09 May 2006 15:58:05 -0400 Date: Tue, 9 May 2006 12:56:39 -0700 From: "Donald D. Dugger" Message-ID: <20060509195639.GB25376@los-vmm.sc.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH]Fix for minor video corruption under Windows 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 If you change the video resolution while running a Windows XP image such that it uses fewer bytes of VRAM (either by using fewer bytes per pixel or by lowering the resolution) then some window backgrounds will become corrupted. This happens because the Windows XP Cirrus Logic driver assumes that VRAM is initialized to 0xff whenever the video mode switches between VGA and SVGA. This patch fixes this problem by resetting VRAM whenever a VGA/SVGA mode switch occurs. Signed-off-by: Donald.D.Dugger@intel.com -- Don Dugger "Censeo Toto nos in Kansa esse decisse." - D. Gale Donald.D.Dugger@intel.com Ph: (303)440-1368 --- qemu-0.8.0-/hw/cirrus_vga.c 2005-12-19 15:51:53.000000000 -0700 +++ qemu-0.8.0/hw/cirrus_vga.c 2006-05-04 10:14:28.000000000 -0600 @@ -1185,6 +1185,17 @@ s->hw_cursor_y = (reg_value << 3) | (reg_index >> 5); break; case 0x07: // Extended Sequencer Mode + /* Win2K seems to assume that the VRAM is set to 0xff + * whenever VGA/SVGA mode changes + */ + if ((s->sr[0x07] ^ reg_value) & CIRRUS_SR7_BPP_SVGA) + memset(s->vram_ptr, 0xff, s->real_vram_size); + s->sr[0x07] = reg_value; +#ifdef DEBUG_CIRRUS + printf("cirrus: handled outport sr_index %02x, sr_value %02x\n", + reg_index, reg_value); +#endif + break; case 0x08: // EEPROM Control case 0x09: // Scratch Register 0 case 0x0a: // Scratch Register 1 @@ -2993,10 +3004,6 @@ } s->cr[0x27] = device_id; - /* Win2K seems to assume that the pattern buffer is at 0xff - initially ! */ - memset(s->vram_ptr, 0xff, s->real_vram_size); - s->cirrus_hidden_dac_lockindex = 5; s->cirrus_hidden_dac_data = 0;