Fix for bochs vbe issues
I found a way to fix the bochs VBE issues in Windows 2000. It looks really good in 16+ bit color. The changes in this patch are:
- Use linear (chain-4) mode for all VBE_DISPI_ENABLED modes
- Add ff80 and ff81 as valid ioport registers (these are the old ports, still used by the driver)
Some of the issues with the patch:
- There are black lines that appear on the screen at what appear to be lines that span a display bank. This only seems to happen in 8- or 24-bit. Puzzling!
- The shutdown screen in windows 2000 is corrupted.
A better patch might tweak some of the sequence controller and bank select registers to set the chain-4 mode, but I haven't tried that yet.
../qemu-0.5.4/hw/vga.c 2004-04-27 21:46:20.828796000 -0600 renamed from hw/vga.c 2004-04-26 15:17:28.000000000 -0600 +20 -2
@@ -678,7 +678,10 @@ break; } - if (s->sr[4] & 0x08) { + if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { + /* VBE mode : simplest access */ + ret = s->vram_ptr[addr]; + } else if (s->sr[4] & 0x08) { /* chain 4 mode : simplest access */ ret = s->vram_ptr[addr]; } else if (s->gr[5] & 0x10) {
@@ -756,7 +759,17 @@ break; } - if (s->sr[4] & 0x08) { + if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { + /* VBE mode : simplest access */ + plane = (s->gr[4] & 2) | (addr & 1); + if (s->sr[2] & (1 << plane)) { + s->vram_ptr[addr] = val; +#ifdef DEBUG_VGA_MEM + printf("vga: VBE: [0x%x]\n", addr); +#endif + cpu_physical_memory_set_dirty(s->vram_offset + addr); + } + } else if (s->sr[4] & 0x08) { /* chain 4 mode : simplest access */ plane = addr & 3; if (s->sr[2] & (1 << plane)) {
@@ -1768,6 +1781,11 @@ register_ioport_write(0x1ce, 1, 2, vbe_ioport_write, s); register_ioport_write(0x1cf, 1, 2, vbe_ioport_write, s); + register_ioport_read(0xff80, 1, 2, vbe_ioport_read, s); + register_ioport_read(0xff81, 1, 2, vbe_ioport_read, s); + + register_ioport_write(0xff80, 1, 2, vbe_ioport_write, s); + register_ioport_write(0xff81, 1, 2, vbe_ioport_write, s);
#endif
vga_io_memory = cpu_register_io_memory(0, vga_mem_read, vga_mem_write);
begin:vcard
fn:Matthew Mastracci
n:Mastracci;Matthew
org:aclaro Softworks, inc.
adr:;;1900 a - 11 St. SE;Calgary;Alberta;T2H 3G2;Canada email;internet:[email protected]
title:Software Developer
tel;work:(403) 299-6612
x-mozilla-html:FALSE
url:http://www.aclaro.com
version:2.1
end:vcard
Hi,
I just commited a slightly different patch. Tell me if it works.
Fabrice
Quoted 68 lines · Matthew Mastracci
I found a way to fix the bochs VBE issues in Windows 2000. It looks really good in 16+ bit color. The changes in this patch are:
- Use linear (chain-4) mode for all
VBE_DISPI_ENABLEDmodes
- Add ff80 and ff81 as valid ioport registers (these are the old ports, still used by the driver)Some of the issues with the patch:
- There are black lines that appear on the screen at what appear to be lines that span a display bank. This only seems to happen in 8- or 24-bit. Puzzling!
- The shutdown screen in windows 2000 is corrupted.A better patch might tweak some of the sequence controller and bank select registers to set the chain-4 mode, but I haven't tried that yet.
diff -u -r
./hw/vga.c../../qemu-0.5.4/hw/vga.c../qemu-0.5.4/hw/vga.c 2004-04-27 21:46:20.828796000 -0600 renamed from hw/vga.c 2004-04-26 15:17:28.000000000 -0600 +20
-3@@ -678,7 +678,10 @@ break; } - if (s->sr[4] & 0x08) { + if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { + /* VBE mode : simplest access */ + ret = s->vram_ptr[addr]; + } else if (s->sr[4] & 0x08) { /* chain 4 mode : simplest access */ ret = s->vram_ptr[addr]; } else if (s->gr[5] & 0x10) {@@ -756,7 +759,17 @@ break; } - if (s->sr[4] & 0x08) { + if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { + /* VBE mode : simplest access */ + plane = (s->gr[4] & 2) | (addr & 1); + if (s->sr[2] & (1 << plane)) { + s->vram_ptr[addr] = val; +#ifdef DEBUG_VGA_MEM + printf("vga: VBE: [0x%x]\n", addr); +#endif + cpu_physical_memory_set_dirty(s->vram_offset + addr); + } + } else if (s->sr[4] & 0x08) { /* chain 4 mode : simplest access */ plane = addr & 3; if (s->sr[2] & (1 << plane)) {@@ -1768,6 +1781,11 @@ register_ioport_write(0x1ce, 1, 2, vbe_ioport_write, s); register_ioport_write(0x1cf, 1, 2, vbe_ioport_write, s); + register_ioport_read(0xff80, 1, 2, vbe_ioport_read, s); + register_ioport_read(0xff81, 1, 2, vbe_ioport_read, s); + + register_ioport_write(0xff80, 1, 2, vbe_ioport_write, s); + register_ioport_write(0xff81, 1, 2, vbe_ioport_write, s); #endif vga_io_memory = cpu_register_io_memory(0, vga_mem_read, vga_mem_write); ------------------------------------------------------------------------_______________________________________________
Qemu-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemu-devel
Looks good. The shutdown screen is still corrupted in Windows, but that's not a huge issue. I think that it's expecting to be back in latched mode, but isn't setting it itself.
One last thing to add - we need to ensure that the chain-4 mask is set when we start up VBE mode. This will ensure that all of the planes are written (inserted right after your chain-4 mode change):
sr[2] |= 0x0f;
Signature · 1 line
Matthew Mastracci <[email protected]>
And right after I sent this message, I discovered why the shutdown screen is corrupted:
The VBE_DISPI_ENABLED flag wasn't getting cleared internally when VBE was disabled by the driver, causing some issues in other parts of the code that check it:
} else {
/* XXX: the bios should do that */
s->bank_offset = -0xa0000;
+ s->vbe_regs[s->vbe_index] = val;
}The above makes the shutdown screen appear as expected.
Matt.
Quoted 9 lines · Matthew Mastracci
Looks good. The shutdown screen is still corrupted in Windows, but that's not a huge issue. I think that it's expecting to be back in latched mode, but isn't setting it itself.
One last thing to add - we need to ensure that the chain-4 mask is set when we start up VBE mode. This will ensure that all of the planes are written (inserted right after your chain-4 mode change):
sr[2] |=
0x0f;
Signature · 1 line
Matthew Mastracci <[email protected]>
Quoted 3 lines · Fabrice Bellard
Hi,
I just commited a slightly different patch. Tell me if it works.
I updated from CVS this morning, but unfortunately it doens't completely work. The screen looks all garbled. The interesting thing is that if I install VNC server, the exported screen is all garbled also.
Attached is a screenshot.
It could be the whole install is scrambled. Or I have the wrong driver.
Michael
Quoted 83 lines
Fabrice
Quoted 67 lines · Matthew Mastracci
I found a way to fix the bochs VBE issues in Windows 2000. It looks really good in 16+ bit color. The changes in this patch are:
- Use linear (chain-4) mode for all
VBE_DISPI_ENABLEDmodes
- Add ff80 and ff81 as valid ioport registers (these are the old ports, still used by the driver)Some of the issues with the patch:
- There are black lines that appear on the screen at what appear to be lines that span a display bank. This only seems to happen in 8- or 24-bit. Puzzling!
- The shutdown screen in windows 2000 is corrupted.A better patch might tweak some of the sequence controller and bank select registers to set the chain-4 mode, but I haven't tried that yet.
diff -u -r
./hw/vga.c../../qemu-0.5.4/hw/vga.c../qemu-0.5.4/hw/vga.c 2004-04-27 21:46:20.828796000 -0600 renamed from hw/vga.c 2004-04-26 15:17:28.000000000 -0600 +20
-3@@ -678,7 +678,10 @@ break; } - if (s->sr[4] & 0x08) { + if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { + /* VBE mode : simplest access */ + ret = s->vram_ptr[addr]; + } else if (s->sr[4] & 0x08) { /* chain 4 mode : simplest access */ ret = s->vram_ptr[addr]; } else if (s->gr[5] & 0x10) {@@ -756,7 +759,17 @@ break; } - if (s->sr[4] & 0x08) { + if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { + /* VBE mode : simplest access */ + plane = (s->gr[4] & 2) | (addr & 1); + if (s->sr[2] & (1 << plane)) { + s->vram_ptr[addr] = val; +#ifdef DEBUG_VGA_MEM + printf("vga: VBE: [0x%x]\n", addr); +#endif + cpu_physical_memory_set_dirty(s->vram_offset + addr); + } + } else if (s->sr[4] & 0x08) { /* chain 4 mode : simplest access */ plane = addr & 3; if (s->sr[2] & (1 << plane)) {@@ -1768,6 +1781,11 @@ register_ioport_write(0x1ce, 1, 2, vbe_ioport_write, s); register_ioport_write(0x1cf, 1, 2, vbe_ioport_write, s); + register_ioport_read(0xff80, 1, 2, vbe_ioport_read, s); + register_ioport_read(0xff81, 1, 2, vbe_ioport_read, s); + + register_ioport_write(0xff80, 1, 2, vbe_ioport_write, s); + register_ioport_write(0xff81, 1, 2, vbe_ioport_write, s); #endif vga_io_memory = cpu_register_io_memory(0, vga_mem_read, vga_mem_write); ------------------------------------------------------------------------Quoted 4 lines
_______________________________________________
Qemu-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemu-devel_______________________________________________
Qemu-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemu-devel
Signature · 1 line
Michael L Torrie <[email protected]>
Quoted 11 lines
I updated from CVS this morning, but unfortunately it doens't completely work. The screen looks all garbled. The interesting thing is that if I install VNC server, the exported screen is all garbled also.
Attached is a screenshot.
It could be the whole install is scrambled. Or I have the wrong driver.
You have the right driver, but you'll need to grab the latest CVS stuff for it all to work. I noticed that Fabrice just recently committed the other two fixes remaining.
Matt.
begin:vcard
fn:Matthew Mastracci
n:Mastracci;Matthew
org:aclaro Softworks, inc.
adr:;;1900 a - 11 St. SE;Calgary;Alberta;T2H 3G2;Canada email;internet:[email protected]
title:Software Developer
tel;work:(403) 299-6612
x-mozilla-html:FALSE
url:http://www.aclaro.com
version:2.1
end:vcard
Quoted 3 lines
You have the right driver, but you'll need to grab the latest CVS stuff for it all to work. I noticed that Fabrice just recently committed the other two fixes remaining.
Well, just tried with the latest CVS and I still have the 'black horizontal bars' in 32 bpp mode (but not the disappearing Red color as before)..
But, more problematic, is a nice crash when switching to 16 bpp mode (segmentation fault).
Lionel
Signature · 1 line
Lionel Ulmer - http://www.bbrox.org/
Quoted 4 lines · Lionel Ulmer
Well, just tried with the latest CVS and I still have the 'black horizontal bars' in 32 bpp mode (but not the disappearing Red color as before)..
I've found that the horizontal bars will disappear if you use 1024x768x16bpp or 1024x768x32bpp. I'm not certain what the problem is that causes the bars.
Matt.
begin:vcard
fn:Matthew Mastracci
n:Mastracci;Matthew
org:aclaro Softworks, inc.
adr:;;1900 a - 11 St. SE;Calgary;Alberta;T2H 3G2;Canada email;internet:[email protected]
title:Software Developer
tel;work:(403) 299-6612
x-mozilla-html:FALSE
url:http://www.aclaro.com
version:2.1
end:vcard
Quoted 2 lines · Lionel Ulmer
Well, just tried with the latest CVS and I still have the 'black horizontal bars' in 32 bpp mode (but not the disappearing Red color as before)..
I remember reading on the Bochs mailing list that the VBE drivers did not support 32 but 24 bits. Can you try 24 bits depth? Just a guess. Cheers, Jean-Michel