On 25/10/2010 21:33, Peter Stuge wrote:
Mark Marshall wrote:
Improving VBE support seems like a good goal though.
Also having a libpayload OGD1 framebuffer driver.
http://www.coreboot.org/Libpayload
I have to say that coreboot was extremely useful in getting the BIOS to
work at all, so a big thank you to the coreboot guys for a very nice
development tool.
If I was to start working on VBE support, I think my first steps would
be with DOS or coreboot. DOS might be workable by making a special
build of the BIOS that could be re-loaded (probably at a different
address) so that changes could be made and tests run without having to
reboot. Once that showed signs of working, coreboot would be another
good target, as you can get a lot of debug output from it. You also
have the posibilty of running the BIOS either native or interpreted, and
this lets you catch silly bugs earlier (jumping into data and such
things get trapped, sometimes).
I have to confess though (it was a long time since I looked at any of
this) that there were a few really anoying problems that I couldn't see
a solution to without changing hardware. You end up needing to write to
PCI config space and to memory outside the first 1Meg, and these things
are very hard to do reliably in code that can be run in all contexts.
The VGA BIOS initialisation should be run in Big-Real mode, but only for
PCI 3.0+ BIOS's. I'm not sure that you can rely on this happening
(coreboot doesn't use big-real mode I think - I did have a patch at one
point, but I think I've lost that now). You really have to assume real
mode, and not test that assumption too much.
The int 10h calls can happen in real mode, V86 mode, big-real mode and
some can happen in some forms of protected mode. I don't think it's
easy to get from all of these modes to a mode where you can access the
PCI BAR's. There are BIOS calls to copy memory that can access the
first 16Meg (or maybe more), but the don't ensure that the accesses are
32-bit writes (which we need for registers, 4 8-bit writes will not work).
We have a config space window into the upper BARs, but accessing config
space is _very_ slow. I can't now remeber the details, but even config
space access seemed hard from all situations (you have to rely on the
BIOS call for this, I think, and this is why it's slow - certainly
direct access to ports 0xCF8 won't make many OSes happy).
The protected mode interface to the VBE is a bit of a mess as well, as
I'm not sure what other external services you can call, and I'm also not
sure if you can access the BAR's directly. I'd really like to look at a
disassembly of a real BIOS, but that would be cheating (and break the
"clean-room" rules that I've been sticking to until now).
Other parts seemed OK. You would need to write a special HQ program to
have windowed access to the frame buffer (to convert memory accesses in
the range 0xa0000 - 0xbffff into frame buffer accesses), but the linear
framebuffer code is probably more useful and easier.
I think that you can assume that once a VBE mode is started we no longer
need to support the legacy IO ports (maybe some programs check the
retrace status register for timing, but they shouldn't) so it's quite
easy to swap in a new HQ program at this time, and swap it out again
once we switch back to a standard VGA mode.
Anyway, theres some ideas on VBE. If anyone looks into these things
further then try to keep me (and everyone else) updated.
MM
PS.
It should be possible to do 8, 15, 16 and 24 bits modes by writing HQ
code to do the conversion - this is left as an exercise for the user.
PPS.
Actually, proper 8-bit modes are hard because we don't have enough RAM
on the HQ for the full palette, and re-reading it from the S3 into HQ is
slow. I think it would be nice to have the S3 be able to do the palette
look-up itself, and possibly also support these other bit depths.
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)