Donald D. Dugger
2006-May-09 19:47 UTC
[Xen-devel] [PATCH] Fix for minor video corruption on a Windows guest
If you change the video resolution on a Windows XP guest 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 diff -r b6c5920e5d99 tools/ioemu/hw/cirrus_vga.c --- a/tools/ioemu/hw/cirrus_vga.c Thu Apr 6 18:58:39 2006 +0100 +++ b/tools/ioemu/hw/cirrus_vga.c Thu May 4 10:59:06 2006 -0600 @@ -1187,6 +1187,17 @@ cirrus_hook_write_sr(CirrusVGAState * s, 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 @@ -3021,10 +3032,6 @@ static void cirrus_init_common(CirrusVGA } 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; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel