Hi,
animefreak1233 wrote:
Thanks. I never thought I'd get these many answers. Guess I've got no other choice but to implement VESA... (still, it sucks)
VESA/VBE doesn't suck - it's far worse than that!
The problem is that for most video cards VBE doesn't care if the monitor supports a video mode or not; so you can set a video mode that is completely useless without knowing it. To guard against this you need to compare the video mode timing for each mode to the video mode timings that the monitor says it supports (via.
EDID).
The problem with that is VBE doesn't tell you the video mode timing for each video mode. For example, there are an almost infinite number of possible 800*600 video mode timings (each with different sync pulse polarities, sync pulse widths, front/back porch times, frame rates, etc); and about 5 relatively common 800*600 video mode timings (with different frame rates - 60 Hz, 75 Hz,80 Hz, ...); and a monitor might support some 800*600 video mode timings and not others; and VBE will just tell you "800*600".
Basically; to ensure that you're setting a video mode that the monitor supports you need information that VBE doesn't provide, and to work around that your only option is to use an ugly heuristical approach to estimate the probability that a video mode might work. For example, for an 800*600 mode you might see how many of the common 800*600 timings the monitor supports, and determine how many are within the monitor's frequency limits, and if the monitor supports (GTF/CVT) "variable timings"; and calculate a "probability that this unknown video mode timing is something the monitor supports" based on that.
Note that for VBE 3.0 they added the ability for software to provide a "CRTC info block" structure when setting a video mode, and by using this you can force the video card to use a specific video mode timing that you know the monitor does support. You can also use this to make more video modes. For example, if the video card says it supports "800*600 with unknown timing" you can use "CRTC info block" to create 800*600@60Hz, 800*600@75Hz, 800*600@80Hz, etc; and (with pixel/line doubling) also create 400*300, 400*600 and 800*300 variations; and end up with maybe 12 different variations (where each one uses a timing that the monitor says it supports). Of course this assumes that the video card's support for "CRTC info block" structure isn't buggy; so in reality you just end up with a lot more video modes where the "probability the video mode works" is based on how buggy you think the video card's "CRTC info block" support is (instead of how likely it is that the monitor supports the video mode timing).
Cheers,
Brendan